-
Notifications
You must be signed in to change notification settings - Fork 0
/
kemacs-2.1k_patch1.unofficial
5664 lines (5384 loc) · 147 KB
/
kemacs-2.1k_patch1.unofficial
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
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -ruN kemacs-2.1k.orig/.kemacsrc.tmpl kemacs-2.1k/.kemacsrc.tmpl
--- kemacs-2.1k.orig/.kemacsrc.tmpl 1970-01-01 09:00:00.000000000 +0900
+++ kemacs-2.1k/.kemacsrc.tmpl 2012-11-25 00:37:11.000000000 +0900
@@ -0,0 +1,299 @@
+;;sample .kemacsrc file
+
+;;if you can't use ^S and ^Q because of flow control...
+;bind-to-key search-forward ^\
+;bind-to-key save-file ^X^\
+;bind-to-key incremental-search ^X\
+;bind-to-key quote-character ^XQ
+
+;;some private binds
+;bind-to-key exit-recursive-edit ^^
+;bind-to-key insert-space ^C
+;bind-to-key insert-file ^XI
+;bind-to-key set-mark ^@
+;bind-to-key entab-line ^XT
+
+;set $fcode UJIS
+;set $bcode UJIS
+;set $cperiod 0
+
+set %term &env "TERM"
+!if &or &seq %term "xterm" &or &seq %term "sun" &seq %term "linux"
+ set $kanji FALSE
+!endif
+
+; ESC Tでチュートリアル
+40 store-macro
+ find-file "_PREFIX_/lib/kemacs/emacs.tut"
+ set $cbufname Tutorial
+ set $cfname /dev/null
+*loop0
+ ; /^[ \t]*>>/で始まっているところを探す
+ ; ^Sの探索リストに残らぬようsearch-forwardを使わず探す
+ !if &gre $curline 40
+ ; 40行以内になければ中止
+ beginning-of-file
+ !return
+ !endif
+ set %tmp $curline
+ set %line #Tutorial
+ !if &equ %tmp $curline
+ ; 最後まで探し終わった。無限ループ回避
+ beginning-of-file
+ !return
+ !endif
+*loop0sub
+ !if &les &len %line 2
+ !goto loop0
+ !endif
+ set %chr &lef %line 2
+ !if &seq %chr ">>"
+ !goto loop0fin
+ !endif
+ set %chr &lef %line 1
+ set %line &rig %line 2
+ !if &or &seq %chr " " &seq %chr "~t"
+ !goto loop0sub
+ !endif
+ !goto loop0
+*loop0fin
+ previous-line
+ beginning-of-line
+ ; 見つかった行にカーソルがある
+
+ set %addsp &sub &sub $cwinlen $curline 4
+ ; %addsp行ほど空ける
+ set %tmp %addsp
+*loop
+ !if ¬ &gre %tmp 0
+ !goto loopfin
+ !endif
+ open-line
+ set %tmp &sub %tmp 1
+ !goto loop
+*loopfin
+
+ ; %addspが3より大きいなら中ほどにメッセージ
+ !if &gre %addsp 3
+ set %tmp &div %addsp 2
+ *loop2
+ !if ¬ &gre %tmp 1
+ !goto loop2fin
+ !endif
+ next-line
+ set %tmp &sub %tmp 1
+ !goto loop2
+ *loop2fin
+ !if $kanji
+ insert-string "~t(ここはわざと空けてあります。"
+ insert-string "続きの内容は画面下方にあります。)"
+ !else
+ insert-string "~t(This space is left blank on purpose."
+ insert-string " Text continues below.)"
+ !endif
+ !endif
+
+ ; 変更フラグを落として終了
+ unmark-buffer
+ beginning-of-file
+!endm
+bind-to-key execute-macro-40 M-T
+
+;; ESC Eでコンパイル&実行(単一ソースファイルのCプログラムに限る) (廃止)
+;39 store-macro
+; set %args @"Args: "
+; save-file
+; !if ¬ &seq "" %args
+; write-message &cat "~nArgs: " %args
+; !endif
+; write-message "~nCompiling...~r~n"
+; set %args &cat " " %args
+; set %args &cat $cfname %args
+; shell-command &cat "exec _PREFIX_/lib/kemacs/ccg " %args
+;!endm
+;bind-to-key execute-macro-39 M-E
+
+; 指定バッファ(デフォルトでカレント)の削除 これを改めて^XKにバインド
+39 store-macro
+ !if $kanji
+ set %tmp @"削除するバッファ名: "
+ !else
+ set %tmp @"Kill buffer: "
+ !endif
+ !if &seq %tmp "" ; 入力が空なら現バッファ名に
+ set %tmp $cbufname
+ !endif
+
+ set %tmpi $cwinid ; 現ウィンドウのID
+*kbwinloop
+ !if &seq %tmp $cbufname ; 消そうとしているバッファが表示中なら
+ !force next-buffer ; 他のバッファに切り替え
+ !endif
+ next-window ; 以上を、表示中の各ウィンドウに対して実施
+ !if ¬ &equ %tmpi $cwinid
+ !goto kbwinloop
+ !endif
+
+ !force delete-buffer %tmp
+ !if ¬ $status
+ !if $kanji
+ write-message "唯一のバッファは削除できません"
+ !else
+ write-message "Buffer is the last one"
+ !endif
+ !endif
+!endm
+bind-to-key execute-macro-39 ^XK
+
+; AWKモードもどき
+; CMODEにしておいて"#"のバインドだけ変える。CMODEでは"#"は自動的に行頭へ
+; 戻ってしまう(変更不能)ので、単に自分をinsertだけするマクロをわざわざ
+; 作って"#"にバインド。このとき、ファイル名末尾が「.[ch]」だと本来の"#"の
+; 働きを1回エミュレートした上で"#"へのバインドを解除し、またファイル名
+; 末尾がそれら以外なら単に"#"へのバインドを解除
+38 store-macro
+ insert-string "#"
+ ; CMODEでないなら普通のバインドに戻して終わり
+ !if ¬ &bmode "CMODE"
+ !goto unbind
+ !endif
+
+ ; ファイル名末尾が「.awk」ならそのまま終了
+ !if &les 3 &len $cfname
+ !if &seq ".awk" &rig $cfname &sub &len $cfname 3
+ !return
+ !endif
+ !endif
+
+ ; 通常のCMODE。「#」の働きを1回エミュレートの上普通のバインドに戻す
+ set %tmpx $curcol
+ backward-character ; 「#」1個分バック
+*searchloop
+ !if &equ $curcol 1
+ !goto topofline
+ !endif
+ backward-character
+ !if ¬ &or &equ $curchar 32 &equ $curchar 9
+ *normspcloop
+ !if ¬ &equ %tmpx $curcol
+ forward-character
+ !goto normspcloop
+ !endif
+ !goto unbind
+ !endif
+ !goto searchloop
+*topofline
+ !if ¬ &equ $curchar 35
+ delete-next-character
+ !goto topofline
+ !endif
+ forward-character
+*unbind
+ set %prvdiscmd $discmd
+ set $discmd FALSE
+ unbind-key "#"
+ set $discmd %prvdiscmd
+!endm
+auto-mode-for-file CMODE "\.awk$"
+bind-to-key execute-macro-38 "#"
+
+;「ESC [ …」というシーケンスを吐くいくつかのファンクションキーを取り扱う
+37 store-macro
+ set %tmpseq >key
+ !if &seq %tmpseq "[" ; ESC [ [ ○
+ set %tmpseq &cat %tmpseq >key
+ !goto gotseq
+ !endif
+ !if &or &sle %tmpseq "0" &sle "9" %tmpseq ; ESC [ ○
+ !goto gotseq
+ !endif
+*getseqloop
+ ; ESC [ 数 ~ 「~」は "~~" と書かねばならないことに注意
+ set %tmpc >key
+ set %tmpseq &cat %tmpseq %tmpc
+ !if &seq %tmpc "~~"
+ !goto gotseq
+ !endif
+ !if &or &sle %tmpc "0" &sle "9" %tmpc
+ !goto unsup
+ !endif
+ !goto getseqloop
+*gotseq
+ !if &seq %tmpseq "5~~" ; PgUp
+ previous-page
+ !return
+ !endif
+ !if &seq %tmpseq "6~~" ; PgDn
+ next-page
+ !return
+ !endif
+ !if &seq %tmpseq "1~~" ; Home
+ beginning-of-file
+ !return
+ !endif
+ !if &seq %tmpseq "4~~" ; End
+ end-of-file
+ !return
+ !endif
+ !if &seq %tmpseq "2~~" ; Ins
+ !if &bmode "OVER"
+ delete-mode "OVER"
+ !else
+ add-mode "OVER"
+ !endif
+ !return
+ !endif
+ !if &seq %tmpseq "3~~" ; Del
+ delete-previous-character
+ !return
+ !endif
+ !if &seq %tmpseq "A" ; Up
+ previous-line
+ !return
+ !endif
+ !if &seq %tmpseq "B" ; Down
+ next-line
+ !return
+ !endif
+ !if &seq %tmpseq "D" ; Left
+ backward-character
+ !return
+ !endif
+ !if &seq %tmpseq "C" ; Right
+ forward-character
+ !return
+ !endif
+*unsup
+ !if $kanji
+ write-message "[未定義ファンクションキー]"
+ !else
+ write-message "[Function key not bound]"
+ !endif
+!endm
+bind-to-key execute-macro-37 M-[
+
+; 10-key numerics etc.
+36 store-macro
+ insert-string &chr &mod $lastkey 64
+!endm
+bind-to-key execute-macro-36 M-FNw
+bind-to-key execute-macro-36 M-FNx
+bind-to-key execute-macro-36 M-FNy
+bind-to-key execute-macro-36 M-FNt
+bind-to-key execute-macro-36 M-FNu
+bind-to-key execute-macro-36 M-FNv
+bind-to-key execute-macro-36 M-FNq
+bind-to-key execute-macro-36 M-FNr
+bind-to-key execute-macro-36 M-FNs
+bind-to-key execute-macro-36 M-FNp
+bind-to-key execute-macro-36 M-FNj
+bind-to-key execute-macro-36 M-FNk
+bind-to-key execute-macro-36 M-FNm
+bind-to-key execute-macro-36 M-FNn
+bind-to-key execute-macro-36 M-FNo
+bind-to-key newline M-FNM
+bind-to-key beginning-of-file M-FN^@ ; Home
+bind-to-key beginning-of-file M-FNH ; Home
+bind-to-key end-of-file M-FNX ; End
+bind-to-key end-of-file M-FNe ; End
+bind-to-key end-of-file M-FNF ; End
diff -ruN kemacs-2.1k.orig/Cstrings/Cfromc.c kemacs-2.1k/Cstrings/Cfromc.c
--- kemacs-2.1k.orig/Cstrings/Cfromc.c 1990-09-19 17:43:37.000000000 +0900
+++ kemacs-2.1k/Cstrings/Cfromc.c 2012-11-25 02:05:04.000000000 +0900
@@ -2,18 +2,25 @@
#include "kanji.h"
#include "Cstrings.h"
+#include "../econfig.h"
+#if BSD_LEGACY
+# include <strings.h>
+#else
+# include <string.h>
+#endif
+
struct KS {
char *p;
};
+static int copen(), cclose(), cget();
+
Char *
Cfromc(c)
register char *c;
{
- char *malloc();
register Char *C;
int len;
- int copen(), cclose(), cget();
register KSTREAM *ksp;
struct KS ks;
static int blen = 0;
@@ -32,7 +39,7 @@
}
/* the length of C is no longer than that of c */
ks.p = c;
- if ((ksp = kalloc((caddr_t)&ks, copen, cclose, cget, (int (*)())NULL, 0)) == NULL)
+ if ((ksp = kalloc((caddr_t)&ks, copen, cclose, cget, (int (*)())NULL, KS_BINMODE)) == NULL)
return NULL;
for (C = buf; (*C = kgetc(ksp)) != EOF; C++) ;
*C = '\0';
diff -ruN kemacs-2.1k.orig/Cstrings/Makefile.Cstr kemacs-2.1k/Cstrings/Makefile.Cstr
--- kemacs-2.1k.orig/Cstrings/Makefile.Cstr 1993-07-07 09:44:36.000000000 +0900
+++ kemacs-2.1k/Cstrings/Makefile.Cstr 2012-11-25 00:37:11.000000000 +0900
@@ -28,13 +28,13 @@
LIBRARY = Cstrings.a
CCFLAGS = -O
-CFLAGS = $(CCFLAGS) -I../kanji
+CFLAGS = $(CCFLAGS) -I../kanji $(EINCL)
all: $(LIBRARY)
$(LIBRARY): $(OBJS)
ar cru $(LIBRARY) $(OBJS)
- @-ranlib $(LIBRARY) || echo If you use systemV, no probrem.
+ @-ranlib $(LIBRARY) || echo If you use systemV, no problem.
clean:; @rm -f $(OBJS)
diff -ruN kemacs-2.1k.orig/Cstrings/cfromC_.c kemacs-2.1k/Cstrings/cfromC_.c
--- kemacs-2.1k.orig/Cstrings/cfromC_.c 1990-09-19 17:43:38.000000000 +0900
+++ kemacs-2.1k/Cstrings/cfromC_.c 2012-11-25 02:05:11.000000000 +0900
@@ -2,19 +2,26 @@
#include "kanji.h"
#include "Cstrings.h"
+#include "../econfig.h"
+#if BSD_LEGACY
+# include <strings.h>
+#else
+# include <string.h>
+#endif
+
struct KS {
char *buf;
int ptr;
int len;
};
+static int copen(), cclose(), cput();
+
char *
cfromC(C)
register Char *C;
{
- char *malloc();
int len;
- int copen(), cclose(), cput();
register KSTREAM *ksp;
struct KS ks;
static int blen = 0;
@@ -35,7 +42,7 @@
ks.buf = buf;
ks.ptr = 0;
ks.len = blen;
- if (!(ksp = kalloc((caddr_t)&ks, copen, cclose, (int(*)())NULL, cput, 0)))
+ if (!(ksp = kalloc((caddr_t)&ks, copen, cclose, (int(*)())NULL, cput, KS_BINMODE)))
return NULL;
while (*C) (void)kputc(*C++, ksp);
(void)kputc(' ', ksp); /* reset state of stream */
@@ -68,8 +75,6 @@
char *buf;
int len;
{
- char *realloc();
-
while (id->ptr+len >= id->len)
id->buf = realloc(id->buf, (unsigned)(id->len += 256));
(void)strncpy(&id->buf[id->ptr], buf, len);
diff -ruN kemacs-2.1k.orig/Makefile kemacs-2.1k/Makefile
--- kemacs-2.1k.orig/Makefile 1993-07-07 09:46:21.000000000 +0900
+++ kemacs-2.1k/Makefile 2012-11-25 00:37:11.000000000 +0900
@@ -3,11 +3,18 @@
#
SHELL=/bin/sh
+# CC=clang -Wno-comment # with LLVM Clang
+CC=cc
+# This value of $(CC) is used ONLY when tailoring makefile.
+# If you want to change the compiler for making kemacs itself,
+# modify mf.c instead.
MAKEFILE=make.file
CONFIG=econfig.h
-MAKE=exec "make" $(MFLAGS)
+MAKE="make" $(MFLAGS)
+
+SED=LANG=C sed
all \
install \
@@ -29,8 +36,14 @@
@ echo "## Instead, modify mf.c and type" >>$@
@ echo "## make $(MAKEFILE)" >>$@
@ echo "" >>$@
- @ cc -E mf.c | sed -e '/^#/d' -e '/^[. ]*$$/d' >>$@
- @ cat mf.dep >>$@
+
+ if (echo ': # \'; echo exit 1) | $(CC) -E - | sh; then \
+ $(CC) -E mf.c; \
+ else \
+ $(CC) -E -P mf.c; \
+ fi | $(SED) -e '/^#/d' -e '/^[. ]*$$/d' \
+ -e 's/^ / /' >>$@
+ cat mf.dep >>$@
FORCE:
diff -ruN kemacs-2.1k.orig/Tech kemacs-2.1k/Tech
--- kemacs-2.1k.orig/Tech 1990-09-21 21:51:50.000000000 +0900
+++ kemacs-2.1k/Tech 2012-11-25 00:37:11.000000000 +0900
@@ -31,3 +31,4 @@
,command
$B>-Mh$N%P!<%8%g%s$G$O!"$3$l$i$N@)Ls$O<h$j=|$+$l$kM=Dj$G$9!#(J
+ ($B?7=PCm(J: $B$3$N@)Ls$OHs8x<0%Q%C%ABh(J5$BHG$G<h$j=|$-$^$7$?(J)
diff -ruN kemacs-2.1k.orig/WhatsNew kemacs-2.1k/WhatsNew
--- kemacs-2.1k.orig/WhatsNew 1990-09-21 21:51:51.000000000 +0900
+++ kemacs-2.1k/WhatsNew 2012-11-25 00:37:11.000000000 +0900
@@ -154,7 +154,7 @@
"ROMAJI"$B!"(J"BOGUS" $B$N$$$:$l$+$G$"$k!#%;%C%H$9$k(J
$B>l9g$O!"3F!9$NJ8;zNs$O!":G=i$N0lJ8;z$N$_$GG'<1(J
$B$5$l$k!#(JJIS $B$N>l9g!"%O%$%U%s0J9_$O>JN,$G$-$k!#(J
- $tcode (S) $BC<Kv$N4A;z%3!<%I!#CM$O(J $focde $B$HF1$87A<0$r;}$D!#(J
+ $tcode (S) $BC<Kv$N4A;z%3!<%I!#CM$O(J $fcode $B$HF1$87A<0$r;}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k$?$a(J)$B!#(J
+ $B$^$?!"%U%!%$%k$KBP$7$F$O9TKv%3!<%I$N;XDj$*$h$S<+F0H=Dj$b9T$($k(J($B%?!<(J
+$B%_%J%k$KBP$7$F$O$G$-$J$$(J)$B!#>e=R$7$?JQ?t(J$bcode$B$d(J$fcode$B$K$*$$$F!"9TKv(J
+$B%3!<%I$N;XDj$O0J2<$N$h$&$K9T$&!#4A;z%3!<%I7O$N;XDjJ8;zNs$NA0$K(J
+
+ LF/
+ CR/
+ CRLF/
+
+$B$N$$$:$l$+$rIU2C$9$k(J($B$=$l$>$l(JL/, C/, CL/$B$HN,$7$F$b$h$$(J)$B$+!"$^$?$O2?$b(J
+$BIU2C$7$J$$(J($B$3$N>l9g$O9TKv%3!<%I$O(JLF$B$H2r<a$5$l$k(J)$B!#Nc$($P(J$bcode$B$K(J
+$B!V(JCL/J-N-A$B!W$rBeF~$9$k$H!"4A;z%3!<%I$O(JJIS-NEW-ASCII$B!"9TKv%3!<%I$O(JCRLF
+$B$H$J$k!#(J
+
$B#1#3!%!!%b!<%I%i%$%s$N%+%9%?%`2=(J
diff -ruN kemacs-2.1k.orig/basic.C_ kemacs-2.1k/basic.C_
--- kemacs-2.1k.orig/basic.C_ 1990-09-21 21:51:53.000000000 +0900
+++ kemacs-2.1k/basic.C_ 2012-11-25 10:44:59.000000000 +0900
@@ -8,6 +8,9 @@
#include "ecomm.h"
#include "estruct.h"
#include "edef.h"
+#if HAVE_SELECT
+#include <sys/time.h>
+#endif
/*
* Move the cursor to the
@@ -452,3 +455,37 @@
curwp->w_flag |= WFMOVE;
return (TRUE);
}
+
+millisleep(f, n) /* sleep for some milliseconds (Added by N.Nide) */
+{
+ register int status; /* status return */
+ Char arg[NSTRING]; /* buffer to hold argument */
+#if HAVE_SELECT
+ struct timeval tm;
+#endif
+
+ if(f == FALSE){
+ if(TRUE != (status = mlreply(
+#if KMSGS
+ kterminal? CSTR("$BDd;_;~4V(J($B%_%jIC(J): "):
+#endif
+ CSTR("Milliseconds to sleep: "),
+ arg, NSTRING-1))){
+ mlwrite(
+#if KMSGS
+ kterminal? CSTR("[$BCf;_$5$l$^$7$?(J]"):
+#endif
+ CSTR("[Aborted]"));
+ return(status);
+ }
+ n = stoi(arg);
+ }
+#if HAVE_SELECT
+ tm.tv_sec = n/1000;
+ tm.tv_usec = (n%1000)*1000;
+ select(0, NULL, NULL, NULL, &tm);
+#else
+ sleep(0 < n && n <= 1000 ? 1 : n/1000);
+#endif
+ return TRUE;
+}
diff -ruN kemacs-2.1k.orig/bind.C_ kemacs-2.1k/bind.C_
--- kemacs-2.1k.orig/bind.C_ 1990-09-21 21:51:55.000000000 +0900
+++ kemacs-2.1k/bind.C_ 2012-11-25 00:50:06.000000000 +0900
@@ -9,7 +9,8 @@
#include "edef.h"
#include "epath.h"
-extern int meta(), cex(), unarg(), ctrlg(); /* dummy prefix binding functions */
+extern int meta_pfx(), cex(), unarg(), ctrlg(); /* dummy prefix binding functions */
+static int unbindchar();
/*ARGSUSED*/
deskey(f, n) /* describe the command for a certain key */
@@ -88,7 +89,7 @@
}
/* apply control sequence if needed */
- if (c & CTRL) {
+ if (c & CTLFLG) {
*ptr++ = '^';
}
@@ -237,7 +238,7 @@
}
/* get the command sequence to bind */
- c = getckey((kfunc == meta) || (kfunc == cex) ||
+ c = getckey((kfunc == meta_pfx) || (kfunc == cex) ||
(kfunc == unarg) || (kfunc == ctrlg));
/* change it to something we can print as well */
@@ -251,7 +252,7 @@
}
/* if the function is a prefix key */
- if (kfunc == meta || kfunc == cex ||
+ if (kfunc == meta_pfx || kfunc == cex ||
kfunc == unarg || kfunc == ctrlg) {
/* search for an existing binding for the prefix key */
@@ -264,7 +265,7 @@
}
/* reset the appropriate global prefix variable */
- if (kfunc == meta)
+ if (kfunc == meta_pfx)
metac = c;
if (kfunc == cex)
ctlxc = c;
@@ -292,7 +293,7 @@
if (ktp >= &keytab[NBINDS]) {
mlwrite(
#if KMSGS
- kterminal? CSTR("$BDj5AI=$,$$$C$Q$$$G$9!*(J"):
+ kterminal? CSTR("$BDj5AI=$,$$$C$Q$$$G$9(J!"):
#endif
CSTR("Binding table FULL!"));
return(FALSE);
@@ -700,12 +701,12 @@
/* a control char? */
if (*s == '^' && *(s+1) != 0) {
- c |= CTRL;
+ c |= CTLFLG;
++s;
}
/* make sure we are not lower case */
- c |= (c & CTRL && islower(*s))? CHCASE(*s): *s;
+ c |= (c & CTLFLG && isLower(*s))? CHCASE(*s): *s;
return(c);
}
diff -ruN kemacs-2.1k.orig/ccg kemacs-2.1k/ccg
--- kemacs-2.1k.orig/ccg 1970-01-01 09:00:00.000000000 +0900
+++ kemacs-2.1k/ccg 2012-11-25 00:37:11.000000000 +0900
@@ -0,0 +1,41 @@
+#!/bin/sh
+# kemacs internal use (deprecated)
+# Usage: ccg [-n] filename.c [arg...]
+CCDEFAULT=cc
+
+NONEXE=false
+if [ "$1" = -n ]; then
+ NONEXE=true
+ shift
+fi
+if [ 0 -eq $# ]; then
+ echo 'Usage: ccg [-n] filename.c [arg...]' 1>&2
+ exit 255
+fi
+
+SRC="$1"; shift
+OBJ=`expr "$SRC" : '\(..*\)\.c'`
+if [ -z "$OBJ" ]; then
+ echo 'Not a C source file'. 1>&2
+ exit 255
+fi
+
+#make "$OBJ"
+case "`ls -drt \"$SRC\" \"$OBJ\" 2>/dev/null`" in
+*.c|"")
+ "${KEMACS_CC:-${CC:-$CCDEFAULT}}" "$SRC" -o "$OBJ" -lm
+ if [ 0 -ne $? ]; then
+ exit 255
+ fi
+ ;;
+*)
+ echo 'Executable file is newer, compile not performed' 1>&2
+ echo '' 1>&2
+ ;;
+esac
+if [ $NONEXE != true ]; then
+ if [ 0 -eq `expr X"$OBJ" : X/` ]; then
+ OBJ=./"$OBJ"
+ fi
+ "$OBJ" "$@"
+fi
diff -ruN kemacs-2.1k.orig/display.C_ kemacs-2.1k/display.C_
--- kemacs-2.1k.orig/display.C_ 1993-07-07 10:08:09.000000000 +0900
+++ kemacs-2.1k/display.C_ 2012-11-25 10:37:01.000000000 +0900
@@ -10,14 +10,28 @@
#include "estruct.h"
#include "edef.h"
+#if HAVE_STDARG
+ /* 2005/1/30 by NIDE, N. Very old cc does not know #elif (??) */
+# define HANDLE_VARIABLE_ARGS
+#else
+#if HAVE_VARARGS
+# define HANDLE_VARIABLE_ARGS
+#endif
+#endif
+
#if CLOCK
# include <signal.h>
#endif
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
-# include <varargs.h>
+#ifdef HANDLE_VARIABLE_ARGS
+# if HAVE_STDARG
+# include <stdarg.h>
+# else
+# include <varargs.h>
+# endif
#endif
static Char *dummy = CSTR("");
+static updateline();
typedef struct VIDEO {
int v_flag; /* Flags */
@@ -58,7 +72,6 @@
{
register int i;
register VIDEO *vp;
- char *malloc();
TTopen(); /* open the screen */
TTkopen(); /* open the keyboard */
@@ -100,10 +113,10 @@
*/
vttidy()
{
- TTkclose();
mlerase();
movecursor(term.t_nrow, 0);
TTflush();
+ TTkclose(); /* moved from above mlerase() by N.Nide. */
TTclose();
}
@@ -228,12 +241,12 @@
/* block ALRM while updating screen */
f = signal(SIGALRM, SIG_IGN);
t = alarm((unsigned)0);
- doupdate(force);
+ do_update(force);
(void)signal(SIGALRM, f);
(void)alarm(t);
}
-doupdate(force)
+do_update(force)
int force;
{
#endif /*CLOCK*/
@@ -595,7 +608,7 @@
* character sequences; we are using VT52 functionality. Update the physical
* row and column variables. It does try an exploit erase to end of line.
*/
-updateline(row, vp1, vp2)
+static updateline(row, vp1, vp2)
int row; /* row of screen to update */
struct VIDEO *vp1; /* virtual screen image */
struct VIDEO *vp2; /* physical screen image */
@@ -956,8 +969,12 @@
* stack grows down; this assumption is made by the "++" in the argument scan
* loop. Set the "message line" flag TRUE.
*/
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
+# if HAVE_STDARG
+mlwrite(Char *fmt, ...)
+# else
mlwrite(va_alist) va_dcl
+# endif
#else
/*VARARGS1*/
mlwrite(fmt, arg)
@@ -965,9 +982,13 @@
#endif
{
register Char c;
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
+# if HAVE_STDARG
+ va_list vl;
+# else
va_list vl;
Char *fmt;
+# endif
#else
register char *ap; /* really a void pointer... */
#endif
@@ -989,9 +1010,13 @@
}
movecursor(term.t_nrow, 0);
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
+# if HAVE_STDARG
+ va_start(vl, fmt);
+# else
va_start(vl);
fmt = va_arg(vl, Char *);
+# endif
#else
ap = (char *)&arg;
#endif
@@ -1006,7 +1031,7 @@
c = *fmt++;
switch (c) {
case 'd':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputi(va_arg(vl, int), 10);
#else
mlputi(*(int *)ap, 10);
@@ -1015,7 +1040,7 @@
break;
case 'o':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputi(va_arg(vl, int), 8);
#else
mlputi(*(int *)ap, 8);
@@ -1024,7 +1049,7 @@
break;
case 'x':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputi(va_arg(vl, int), 16);
#else
mlputi(*(int *)ap, 16);
@@ -1033,7 +1058,7 @@
break;
case 'D':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputli(va_arg(vl, long), 10);
#else
mlputli(*(long *)ap, 10);
@@ -1042,7 +1067,7 @@
break;
case 's':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputs(va_arg(vl, Char *));
#else
mlputs(*(Char **)ap);
@@ -1051,7 +1076,7 @@
break;
case 'f':
-#if HAVE_VARARGS /* 1993/7/6 by NIDE, N. */
+#ifdef HANDLE_VARIABLE_ARGS
mlputf(va_arg(vl, int));
#else
mlputf(*(int *)ap);
@@ -1068,7 +1093,7 @@
}
}
}
-#if HAVE_VARARGS /* 1993/7/6 by sanewo */
+#ifdef HANDLE_VARIABLE_ARGS /* 1993/7/6 by sanewo */
va_end(vl);
#endif
/* if we can, erase to the end-of-line */
diff -ruN kemacs-2.1k.orig/ebind.H_ kemacs-2.1k/ebind.H_
--- kemacs-2.1k.orig/ebind.H_ 1990-09-21 21:52:00.000000000 +0900
+++ kemacs-2.1k/ebind.H_ 2012-11-25 00:37:11.000000000 +0900
@@ -2,6 +2,8 @@
MicroEMACS 3.7
*/
+#include <signal.h> /* to see whether SIGTSTP is defined */
+
/*
* Command table.
* This table is *roughly* in ASCII order, left to right across the
@@ -9,55 +11,55 @@
* control-X commands.
*/
KEYTAB keytab[NBINDS] = {
- {CTRL|'A', gotobol},
- {CTRL|'B', backchar},
- {CTRL|'C', exitrecedit},
- {CTRL|'D', forwdel},
- {CTRL|'E', gotoeol},
- {CTRL|'F', forwchar},
- {CTRL|'H', backdel},
- {CTRL|'I', tab},
- {CTRL|'J', indent},
- {CTRL|'K', killtext},
- {CTRL|'L', refresh},
- {CTRL|'M', newline},
- {CTRL|'N', forwline},
- {CTRL|'O', openline},
- {CTRL|'P', backline},
- {CTRL|'Q', quote},
- {CTRL|'R', backsearch},
- {CTRL|'S', forwsearch},
- {CTRL|'T', twiddle},
- {CTRL|'U', unarg},
- {CTRL|'V', forwpage},
- {CTRL|'W', killregion},
- {CTRL|'X', cex},
- {CTRL|'Y', yank},
- {CTRL|'Z', backpage},
- {CTRL|'[', meta},
- {CTLX|CTRL|'B', listbuffers},
- {CTLX|CTRL|'C', quit}, /* Hard quit. */
+ {CTLFLG|'A', gotobol},
+ {CTLFLG|'B', backchar},
+ {CTLFLG|'C', exitrecedit},
+ {CTLFLG|'D', forwdel},
+ {CTLFLG|'E', gotoeol},
+ {CTLFLG|'F', forwchar},
+ {CTLFLG|'H', backdel},
+ {CTLFLG|'I', tab},
+ {CTLFLG|'J', indent},
+ {CTLFLG|'K', killtext},
+ {CTLFLG|'L', refreshscr},
+ {CTLFLG|'M', newline},
+ {CTLFLG|'N', forwline},
+ {CTLFLG|'O', openline},
+ {CTLFLG|'P', backline},
+ {CTLFLG|'Q', quote},
+ {CTLFLG|'R', backsearch},
+ {CTLFLG|'S', forwsearch},
+ {CTLFLG|'T', twiddle},
+ {CTLFLG|'U', unarg},
+ {CTLFLG|'V', forwpage},
+ {CTLFLG|'W', killregion},
+ {CTLFLG|'X', cex},
+ {CTLFLG|'Y', yank},
+ {CTLFLG|'Z', backpage},
+ {CTLFLG|'[', meta_pfx},
+ {CTLX|CTLFLG|'B', listbuffers},
+ {CTLX|CTLFLG|'C', quit}, /* Hard quit. */
#if AEDIT
- {CTLX|CTRL|'D', detab},
- {CTLX|CTRL|'E', entab},
+ {CTLX|CTLFLG|'D', detab},
+ {CTLX|CTLFLG|'E', entab},
#endif
- {CTLX|CTRL|'F', filefind},
- {CTLX|CTRL|'I', insfile},
- {CTLX|CTRL|'L', lowerregion},
- {CTLX|CTRL|'M', delmode},
- {CTLX|CTRL|'N', mvdnwind},
- {CTLX|CTRL|'O', deblank},
- {CTLX|CTRL|'P', mvupwind},
- {CTLX|CTRL|'R', fileread},
- {CTLX|CTRL|'S', filesave},
+ {CTLX|CTLFLG|'F', filefind},
+ {CTLX|CTLFLG|'I', insfile},
+ {CTLX|CTLFLG|'L', lowerregion},
+ {CTLX|CTLFLG|'M', delmode},
+ {CTLX|CTLFLG|'N', mvdnwind},
+ {CTLX|CTLFLG|'O', deblank},
+ {CTLX|CTLFLG|'P', mvupwind},
+ {CTLX|CTLFLG|'R', fileread},
+ {CTLX|CTLFLG|'S', filesave},
#if AEDIT
- {CTLX|CTRL|'T', trim},
+ {CTLX|CTLFLG|'T', trim},
#endif
- {CTLX|CTRL|'U', upperregion},
- {CTLX|CTRL|'V', viewfile},
- {CTLX|CTRL|'W', filewrite},
- {CTLX|CTRL|'X', swapmark},
- {CTLX|CTRL|'Z', shrinkwind},
+ {CTLX|CTLFLG|'U', upperregion},
+ {CTLX|CTLFLG|'V', viewfile},
+ {CTLX|CTLFLG|'W', filewrite},
+ {CTLX|CTLFLG|'X', swapmark},
+ {CTLX|CTLFLG|'Z', shrinkwind},
{CTLX|'?', deskey},
{CTLX|'!', spawn},