summaryrefslogtreecommitdiff
path: root/language/typingtex/email.dir/email-fr.fix
blob: 656d1077a36bb6d775a9adfcc5cbcc450f951f81 (plain)
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
 %%%% email-fr.fix
  %%% Error correction utility for email-fr.sty (same postings)
  %%% Laurent Siebenmann, October 1993 
  %%% Master Posting in 1993: anonymous  ftp matups.matups.fr 
  %%%    (perhaps) in directory TypingTeX.dir
  %%% Support: lcs@matups.matups.fr 
  %%% Documentation: after \endinput 
 
 \catcode`\@=11
 \def\wlog#1{\relax}

  %%% \SIN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
   %% Answer in \ifIN@
   %% Further if true, then \Initialtoks@  \Terminaltoks@
   %% contain the parts before and after.
   %% while \Initialtoks@{#2}%
 \newif\ifIN@
 \newtoks\Initialtoks@  \newtoks\Terminaltoks@
 \def\m@rker{\m@@rker}%
 \long\def\DeleteMarker@ #1@@#2\m@rker{\Terminaltoks@{#1}}%
 \def\SIN@{\expandafter\SINN@\expandafter}%
  \long\def\SINN@0#1@#2@{%
    \long\def\NI@##1#1##2##3\ENDNI@
     {\ifx\m@rker##2\IN@false\Initialtoks@\expandafter{#2}%
      \else
        \IN@true
        \Initialtoks@{##1}\DeleteMarker@##2##3%
      \fi}%
    \expandafter\NI@#2@@#1\m@rker\ENDNI@}

 \def\END{\output{\shipout\box255}\end{document}}

 \catcode`\!=12\catcode`\;=12\catcode`\:=12\catcode`\?=12
 \catcode`\'=12 \catcode`\/=12 \catcode`\>=12 \catcode`\"=12
 \catcode`\_=12 \catcode9=4

 \newread\emailFile@ 
 \newwrite\emailNFile@
 \def\ms@g{\immediate\write16}%

 \def\iWrite#1#2{\toks0\expandafter{#2}%
     \immediate\write#1{\the\toks0}}

 \def\iWr@#1{\iWrite\emailNFile@{#1}}

 \begingroup\lccode`_=32\lccode`C=`C\lccode`C=`C
  \lccode`S=`S\lccode`T=`T\lccode`E=`E
  \catcode`\^=12%
  \lowercase{\endgroup
 \gdef\FirstScreen@{\ms@g{}%
 \ms@g{_***********************************************}%
 \ms@g{_**************__email-fr.fix__*****************}%
 \ms@g{_*******__Correcteur_pour__email-fr.sty__*******}%
 \ms@g{_**_Sert_`a_assurer_que__/__est_employ'e_pour_<apostrophe>}%
 \ms@g{_**_`a_la_place_de___'___l`a_o`u_il_convient}%
 \ms@g{_**_d/'eviter_une_confusion_'eventuelle_avec_<accute>.}%
 \ms@g{_***********************************************}%
 \ms@g{_****_Taper_le_nom_du_fichier_`a_corriger,_se_trouvant}%
 \ms@g{_****_dans_le_m^eme_directory_que__email-fr.fix.}%
 \ms@g{_****_Ensuite_taper__<return>__(=_retour_de_chariot).}%
 \ms@g{_*******_Le_nom_par__d'efaut_est__corr.in.}%
 \ms@g{_**********_Taper__x__et__<return>__pour_avorter.}%
 \ms@g{_***********************************************}%
 \let\FirstScreen@\relax}}

 \gdef\ConfigScreen@{\ms@g{}%
 \ms@g{ ***********************************************}%
 \ms@g{ ** Les tabs sont interdits dans le fichier d'entr'ee.}%
 \ms@g{ ** Le nom du fichier de sortie sera  corr.out.}%
 \ms@g{ ** Le traitement co^ute quelques secondes par page.}%
 \ms@g{ ** La documentation se trouve apr`es \space\string\endinput.}%
 \ms@g{ ***********************************************}% 
 \ms@g{ ** Tapez <return> pour les choix par d'efaut.}%
 \ms@g{ ** (ie. "automatique" et "dialogue")}%
 \ms@g{ ** Tapez \space o \space et <return> pour d'autres options.}%
   \let\ConfigScreen@\relax}%

 \gdef\OptionsScreen@{\ms@g{}%
 \ms@g{ ***********************************************} 
 \ms@g{ ** \space a \space pour "mode intelligence automatique"} 
 \ms@g{ ** \space d \space pour "mode dialogue"} 
 \ms@g{ ** \space f \space pour "mode flag" (avertisseurs dans la sortie).} 
 \ms@g{ ** \space p \space pour "protection par espaces" des modifications.} 
 \ms@g{ ** \space i \space pour "ignore protection" `a l/entr'ee.} 
 \ms@g{ ** \space m \space pour l'insertion d'un espace `a la marge.} 
 \ms@g{ ** \space '' \space pour *ne pas* convertir 
       \space l''etat \space en \space l/'etat \space etc.} 
 \ms@g{ *** --- toute combinaison et order, puis <return>.} 
   }

  %\ms@g{ ** \space e \space ent^ete autonome de macros email-fr.} 


 \gdef\DialogScreen@{\ms@g{}%
 \ms@g{ *** Frappe douteuse >>> \DialogWord@}%
 \ifHomonym@ 
   \ms@g{ *** In the line : }%
   \ms@g{ \emailLine@}%% guarantees enough context
   \Homonym@false
 \fi
 \DialogSubScreen@
   }

 \def\DialogSubScreen@{\ms@g{ *** Taper <retour> pour confirmer; \space n \space d/abord sinon; }%
   \ms@g{ *** et \space f \space pour flag (avertisseur dans la sortie). }%
      }

  \let\EX@=\expandafter

  \newif\ifDialogs@ %% not dialog
  \newif\ifSmart@ %%
  \newif\ifSpProtect@ %%
  \newif\ifFFlag@

 {\catcode32=12\relax\gdef\OtherSp@{ }}
 \edef\dOtherSp@{\OtherSp@\OtherSp@\OtherSp@}%


\gdef\Preamble@{\FirstScreen@
 \read16 to \YourChoice@
 \def\Temp{\let\emailFileSpec@\YourChoice@ }
 \def\temp{\par}
 \ifx\YourChoice@\temp
   \def\Temp{\def\emailFileSpec@{corr.in }}
 \fi
 \def\temp{x }
 \ifx\YourChoice@\temp
   \def\Temp{\end{document}}
 \fi
 \Temp
  %
  %\show\emailFileSpec@
  \openin\emailFile@\emailFileSpec@
  \immediate\openout\emailNFile@ corr.out 
    \relax  %necessary to prevent precocious expansion of \ifeof?
   \ifeof\emailFile@ 
     \ms@g{}%
     \ms@g{ !!! FILE NOT FOUND !!!}\show\Perseverence
     \EX@\END
   \fi
 \ConfigScreen@
 \read16 to \YourChoice@ %\show\YourChoice@
     \SIN@0o@\YourChoice@ @%
     \ifIN@ 
       \OptionsScreen@
       \read16 to \YourChoice@ %\show\YourChoice@
     \else 
       \def\YourChoice@{ad }%
     \fi
     \SIN@0a@\YourChoice@ @%
     \ifIN@ 
       \Smart@true
       \let\AutoAccCalc@\AutoAccCalc@Full
     \else 
       \Smart@false
       \let\AutoAccCalc@\AutoAccCalc@Nul
     \fi
     \SIN@0d@\YourChoice@ @%
     \ifIN@  
       \Dialogs@true 
       \ifSmart@
         \let\Acc@Dialog\Acc@Dialog@Option
       \else
         \let\Acc@Dialog\Acc@Dialog@Full
       \fi
     \else
       \let\Acc@Dialog\Acc@Dialog@Nul
       \Dialogs@false
     \fi
     \SendOutputSyntaxHeader@
     \SIN@0f@\YourChoice@ @%\show\YourChoice@
     \ifIN@  %\message{ *** f is IN!}%
       \edef\Flag@{\XXXX }%\show\Flag@
       \SendOutputBatchHeader@
     \else
         \edef\Flag@{}
     \fi
     \SIN@0p@\YourChoice@ @%
     \ifIN@  
       \SpProtect@true
       \edef\Flag@{\OtherSp@\Flag@}%
     \fi
     \SIN@0m@\YourChoice@ @%
     \ifIN@  
       \let\Mspace@\OtherSp@
     \else
       \let\Mspace@\empty
     \fi
     \SIN@0i@\YourChoice@ @%
     \ifIN@  
       \def\IgnorePD@test{\SIN@0\dOtherSp@\@@z@zg @\Spacy@\@@z@zg @
              %%\@@z@zg "unique"!
              \ifIN@\DoubleSp@true\else\DoubleSp@false\fi}
     \else
       \let\IgnorePD@test\relax\DoubleSp@false
     \fi
     \SIN@0''@\YourChoice@ @%
     \ifIN@  
       \let\AigAigFix@\relax
     \fi
   }

 \let\XXXX\relax

 \begingroup 
 %%\catcode`*`=12 %%troublesome; by hand
 \catcode`\%=12 \catcode`\<=12 \catcode`\>=12
 \catcode`\^=12 \catcode`\_=12 \catcode`\#=12 
 \catcode`\'=12 \catcode`\"=12 \catcode`\~=12
 \catcode`\*=0 *catcode`*\=12 
 *gdef*SendOutputSyntaxHeader@{
 *iWr@{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
 *iWr@{ %% La frappe des accents fran_cais pour email-fr.sty :}
 *iWr@{ %%  / sert comme <apostrophe>, du moins devant  e  et  E }
 *iWr@{ %% ' ` ^ _ pour \' \` \^ \c  respectivement; \" est inchang'e}
 *iWr@{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
 *iWr@{ %% Commandes utiles `a l/'epreuvage : }
 *iWr@{ %\input email-fr.sty %% master posting ftp matups.matups.fr}
 *iWr@{ %% in directory TeX/TypingTeX.dir}
 *iWr@{ %\frenchemail }
 *iWr@{ %\BlockNonASCII }
 *iWr@{ %\SmartQuotes %\noSmartQuotes %\flexcat! }
 *iWr@{}
 *gdef*SendOutputSyntaxHeader@{}}
 *gdef*SendOutputBatchHeader@{
 *iWr@{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
 *iWr@{ %% Dans le texte modifi'e suivant construit par email-fr.fix,}
 *iWr@{ %% \XXXX  marque les les sites d'erreurs 'eventuelles, par }
 *iWr@{ %% confusion entre / <apostrophe> et ' <accute>.}
 *iWr@{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
 *iWr@{ %% Apr`es avoir apport'e les corrections, il convient de}
 *iWr@{ %% supprimer tous les  \XXXX (faites-le automatiquement}
 *iWr@{ %% si possible).  Ensuite, transportez le} 
 *iWr@{ %% texte corrig'e dans son fichier d'origine.}
 *iWr@{ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
 *gdef*SendOutputBatchHeader@{}}
 *endgroup

 %%% Will use tripply (or more) nested loops:
 %%
 \def\Loop@#1\Repeat@{%
    \def\Iterate@{#1\expandafter\Iterate@\fi}%
    \Iterate@} 
 
 \def\Loop@@#1\Repeat@@{%
    \def\Iterate@@{#1\expandafter\Iterate@@\fi}%
    \Iterate@@} 
 
 \def\Loop@@@#1\Repeat@@@{%
    \def\Iterate@@@{#1\expandafter\Iterate@@@\fi}%
    \Iterate@@@} 
 
 \def\Loop@@@@#1\Repeat@@@@{%
    \def\Iterate@@@@{#1\expandafter\Iterate@@@@\fi}%
    \Iterate@@@@} 

 %{\catcode 9=13\relax \global\let ^^09\OtherSp@}

 \newcount \aux@count

  \def\HighASCIIOther@{% 
     \count@=128\relax \aux@count=256
     \loop
        \catcode\count@=12
        \advance\count@ by \@ne
     \ifnum\count@ < \aux@count %
     \repeat}
 
 \def\Transfer@{\let\OptionScreen@\relax\begingroup
     \HighASCIIOther@
     \endlinechar=-1 for above two lines
     \catcode9=15 %% invalid because tabs spoil fix
     \relax\catcode`\%=12 \catcode`\#=12 \catcode`\_=12 
     \catcode`\^=12 %\showthe\catcode`\^%
     \catcode`\-=12 \catcode`\{=12 \catcode`\}=12
     \catcode`\  =12 \catcode`\'=12 \catcode`\\=12
     \Loop@   %\message{ * }%
       \ifeof\emailFile@ 
       \else
         \read\emailFile@ to \emailLine@
         %\edef\emailLine@{\emailLine@}
         \TreatLine@
         %\let\emailNLine@\emailLine@
         \iWrite\emailNFile@{\emailNLine@}%
       \Repeat@
     \closein\emailFile@ 
     \immediate\closeout\emailNFile@ 
     \ClosingDialog
     \endgroup}

  \def\ClosingDialog{%
    \ms@g{ *** FINI! :  }%
    \ms@g{ *** Voir \space corr.out \space 
                     `a c^ot'e du fichier d'entr'ee.}%
    \ms@g{ *** Taper <return> pout sortir. }%
    \read16 to \byebye 
    \aftergroup\stopp}

  \def\stopp{\end{document}}
 
 \newtoks\Remaindertoks@
 \newtoks\emailNLinetoks@
 \newif\ifLMargin@

 \def\TreatLine@{%\message{**TreatLine@}%
  \LMargin@true
  \Remaindertoks@\expandafter{\emailLine@}
  \let\Remainder@\emailLine@
  \emailNLinetoks@\EX@{\Mspace@}%
  \let\emailNLine@\Mspace@
  %%
  \Loop@@
   %\message{**TreatLine@loop}%
   %\show\Remainder@
   %\showthe\Remaindertoks@
   \ifx\empty\Remainder@
   \else
    \LopLine@
    \Repeat@@
    \relax
    %\show\emailNLine@
    }
   
  \newif\ifDanger@
  \newtoks\BeforeAcc@etoks

  \def\acc@e{'e}%
  %\def\AutoAcc@{/e}\def\AltAcc@{'e}%
  %\def\ChosenAcc@{/e}%

  %%% \SetQWord@ gets \QWord@ for machine
 \def\SetQWord@{%\show\Remainder@ 
  \SIN@0\OtherSp@ @\Remainder@ @%% defines \Initialtoks@
     %% no need revise remainder
     \edef\QWord@{\space\the\Dangeroustoks@ ?e\the\Initialtoks@\space}%
     %\show\QWord@ %% space?
   }

  %%% \SetDialogWord@ gets \DialogWord@ for man
   %% also
 \def\SetDialogWord@{%
  \SIN@0\OtherSp@ @\Remainder@ @%% defines \Initialtoks@
    \edef\DialogWord@{\the\Dangeroustoks@\AutoAcc@\the\Initialtoks@}%
   }

 \newcount\uc@cnt
 \def\Cest@{C/est}

 %%% Nibble@#1\endNibble@\endNibble@
  %% gives \Nibblet@ (first token of #1) and \Butt@ rest (or empty)
  %% If no token in #1 then \Butt@ is xequal \endNibble@
  %% Spaces are omitted for \Nibblet@; not for \Butt@

  \def\Nibble@#1\endNibble@{%
     \expandafter\Nibble@@#1\endNibble@\endNibble@}
  \def\endNibble@{\Term@}\let\Term@\relax
  \def\Nibble@@#1#2\endNibble@{%
     \def\Nibblet@{#1}\edef\Butt@{#2}%
     %\show\Nibblet@\show\Butt@
     }

 \newif\ifHomonym@

  %%% \Acc@Dialog@Option that is the question
   %%
   \def\Acc@Dialog@Option{%
      \Nibble@\DialogWord@\endNibble@
      \EX@\count@\EX@`\Nibblet@
      \uc@cnt=\uccode\count@
      \ifnum \uc@cnt=\count@ \relax
        %\show\Cest@\show\DialogWord@ 
        \SIN@0\EX@\relax\Cest@ @\EX@\relax\DialogWord@ @%
        \ifIN@
           \EX@\Acc@Dialog@Nul
        \else
           \EX@\Acc@Dialog@Full
        \fi
      \else %\show\DialogWord@
        \SIN@0\DialogWord@\relax @ n'es\relax n/es\relax @%
        \ifIN@
          \Homonym@true
          %\edef\BeforeDangerous@{\emailNLine@\Spacy@}%
          \edef\DialogWord@{%
            \the\Dangeroustoks@\AutoAcc@\the\Remaindertoks@}%
          \EX@\Acc@Dialog@Full
        \else
          \EX@\Acc@Dialog@Nul
        \fi
      \fi}


  %%% \AutoAccCalc@ : fn \acc@e and context
   %% gives \AutoAcc@ and \AltAcc@ 

  %%% \Acc@Dialog@Full : fn \AutoAcc@ and USER input give \ChosenAcc@
     \def\Acc@Dialog@Full{\DialogScreen@
     \catcode"D=5\read16 to \YourChoice@\catcode"D=14
     %%must not break above line! 5=endline; 14=comment
     \ifx\par\YourChoice@
       \let\ChosenAcc@=\AutoAcc@
     \else
       \EX@\OtherDialogActions@
     \fi
      }

 \def\OtherDialogActions@{%
     \SIN@0n@\YourChoice@  @%
     \ifIN@ %\message{** n IN**}%
       \let\ChosenAcc@=\AltAcc@ %\show\ChosenAcc@
     \else
       \let\ChosenAcc@=\AutoAcc@
     \fi
     \OtherDialogActions@@}

 \def\FFlag@{}
 \def\FFlag@@{\XXXX}
 \let\FFlag@reset\relax

 \def\OtherDialogActions@@{%
     \SIN@0f@\YourChoice@ @%
     \ifIN@ %\message{** f IN**}%
       \ifx\Flag@\empty
         \let\FFlag@\FFlag@@
         \def\FFlag@reset{\let\FFlag@\empty}%
       \else
         \let\FFlag@\empty
       \fi
     \fi
     \SIN@0F@\YourChoice@ @%
     \ifIN@ %\message{** F IN**}%
       \ifx\Flag@\empty
         \def\FFlag@reset{}%
         \let\OtherDialogActions@@\relax
         \def\DialogSubScreen@{\ms@g{ *** Taper <retour> pour confirmer;
                                     d'abord \space n \space sinon.}}
       \fi
     \fi
     }

  %%% \Acc@Dialog@Nul : fn \AutoAcc@ and USER input give \ChosenAcc@
  \def \Acc@Dialog@Nul{\let\ChosenAcc@\AutoAcc@}


\def \LopLine@{%   \message{**LopLine@}%
  \SIN@0\acc@e @\Remainder@ @%
  \ifIN@ %\show\ifIN@ %\message{**IN}%
    \edef\BeforeAcc@e{\the\Initialtoks@}%
    \BeforeAcc@etoks=\Initialtoks@
    \Remaindertoks@=\Terminaltoks@
    \edef\Remainder@{\the\Remaindertoks@}% maybe need later
    \DangerTest@ %% result in ifDanger@
        %% Spacy , Danger splitting
    %\LMargin@false
    \ifDanger@\message{*}%
       \SetQWord@\relax%\show\QWord@
       \AutoAccCalc@\relax%\show\AutoAccCalc@
       \SetDialogWord@
       \Acc@Dialog       
       \edef\emailNLine@{\the\emailNLinetoks@
         \the\Spacytoks@\Flag@\FFlag@\the\Dangeroustoks@\ChosenAcc@}%
       \FFlag@reset
       \emailNLinetoks@\expandafter{\emailNLine@}%
    \else
       \edef\emailNLine@{\the\emailNLinetoks@
             \the\BeforeAcc@etoks\acc@e}%
       \emailNLinetoks@\expandafter{\emailNLine@}%
    \fi
  \else 
     \edef\emailNLine@{\the\emailNLinetoks@\the\Remaindertoks@}%
     \emailNLinetoks@\expandafter{\emailNLine@}%
     \Remaindertoks@{}\let\Remainder@\empty
  \fi  
  %
   %\show\emailNLine@
   %\show\Remainder@
  }



  %%% New splitting of \BeforeAcc@e
  %% into abutting initial
  %\Spacy@
  \newtoks\Spacytoks@
  %% and terminal (no spaces)
  %\Dangerous@
  \newtoks\Dangeroustoks@

  \def\DPrefixes@{ c d j l m n s t qu C D J L M N S T Qu QU }

  \def\DangerTest@{%
    \FindLastSpace@ %% last space in \BeforeAcc@e
       %% Spacy, Dangerous : is splitting
    \AigAigFix@
    \ParenFix@
    \SIN@0\Dangerous@ @\DPrefixes@ @%
    \ifIN@
      \Danger@true%
    \else
      \Danger@false
    \fi
    \ifx\Dangerous@\empty\Danger@false\fi%% correction
    \ifx\Spacy@\empty
      \ifLMargin@%\message{***Lmargin}%
        \ifSpProtect@
          \let\Spacy@\OtherSp@%
          \Spacytoks@\expandafter{\Spacy@}%
          %\LMargin@false
        \fi
      \else
        \Danger@false
      \fi
    %\else \LMargin@false
    \fi%% correction
    \ifDoubleSp@\Danger@false\fi%% correction
    \ifDanger@  %\message{ !!!!DANGER!!! }%
    \else%\message{ ***No Danger*** }%
    \fi
    \LMargin@false}

 \def\AigAigFix@{%% Following for l''ecart ==> l/'ecart
     %% "not Dangerous" no dialog etc???
    \SIN@0'\relax @\Dangerous@\relax @%% Is ' at end??
    \ifIN@\message{*}%
      \edef\Dangerous@{\Flag@\the\Initialtoks@ /}%
      \Dangeroustoks@\EX@{\Dangerous@}%
      \edef\BeforeAcc@e{\the\Spacytoks@\the\Dangeroustoks@}%
      \BeforeAcc@etoks\EX@{\BeforeAcc@e}%
      %\show\BeforeAcc@e
    \fi}

 \edef\Parens@{\string`\string"([\string{}
  %\show\Panens@

 \def\ParenFix@{%
    \Loop@@@@
    \Nibble@\Dangerous@ \endNibble@%\show\Nibblet@
    \SIN@0\Nibblet@ @\Parens@ @% 
       %% Does \Dangerous@ begin with one of `"([{??
    \ifIN@ % \message{ ***IN*** }
      \let\Dangerous@\Butt@\Dangeroustoks@\EX@{\Dangerous@}%
      %\show\Dangerous@\showthe\Dangeroustoks@
      \edef\Spacy@{\Spacy@\Nibblet@}\Spacytoks@\EX@{\Spacy@}%
    \Repeat@@@@
    %\show\Dangerous@
    }

 \newif\ifDoubleSp@ 

 \def\FindLastSpace@{%gives possibly degen splitting
   \Dangeroustoks@\expandafter{\BeforeAcc@e}%
   \edef\Dangerous@{\the\Dangeroustoks@}%
   \let\Spacy@\empty\Spacytoks@{}%
   \Loop@@@
     \SIN@0\OtherSp@ @\Dangerous@ @%
     \ifIN@
        \edef\Spacy@{\the\Spacytoks@\the\Initialtoks@\OtherSp@}%
        \Spacytoks@\expandafter{\Spacy@}%
        \Dangeroustoks@=\Terminaltoks@
        \edef\Dangerous@{\the\Dangeroustoks@}%
    \Repeat@@@
    \IgnorePD@test %% always gives false unless ignore option on
    %\show\Spacy@
    %\show\Dangerous@
    %\ifDoubleSp@\message{ ***DoubleSp@*** }\fi
   }
 

 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%% Syllable Counting macros


 %\let\CountPause\relax

  %% Conserve count registers by local use.
 \countdef\TY@cnt=190
 \dimendef\TY@hsize=200
 \dimendef\TY@everypar=201 

 %%%% \PrepCounts@ 
 \def\PrepCounts@{%
 %%% Impose a suitable language
  %% Check for and call language \l@emailFR
  \ifSmart@
    \ifx\undefined\l@emailFR
     \ms@g{}%
     \ms@g{ !!! Pardon, le mode "automatique" est disponible seulement avec}%
     \ms@g{ !!! le language artificiel "emailFR" (fourni par email-fr.dmp).}%
     \show\Perseverence
       \def\empty{\END}
     \fi
  \fi\empty
  \language\l@emailFR
 %%% Exotic convention /  hyphen character 
  %% (for display and to enable some hyphenation)
  \hyphenchar\font=`\/
 %%% Exotic convention '?-  are letters for hyphenation
  \lccode`\'=`\' %
  \lccode`\?=`\? %
  \lccode`\-=`\- %
    %% prevents extraneous hyphenation at hyphen!
  \lccode 32=32 %% just in case
 %%% Clearly:
  \lefthyphenmin=0
  \righthyphenmin=0
 %%% Horizontal changes
 \SetTY@everypar
 \SetTY@hsize
 \hbadness=10000
 \hfuzz=\maxdimen
 %\pretolerance=100000 %% Alas no effect!
 %%% Vertical changes
 \topskip=0pt plus \vsize  
 \baselineskip=\vsize\relax
 %%% Output changes
 \maxdeadcycles=2000000000 %% two billion words at most!
 \csname output\endcsname{\global\setbox255=\box\voidb@x}%
 %%% use a standard font
  \font\ft=cmr10 \ft 
 }

 %%%% Gen@Count: the main macro.
   %% will always be surrounded by grouping
 \def\Gen@Count{%
  \vfil\par\break
  \let\Gen@Count\undefined 
  \let\endGen@Count\endGen@@Count
  \deadcycles=0}

 \def\endGen@@Count{%% defined \endGen@Count in time
  \vfil\par\break
  \errorcontextlines=0
  \global\TY@cnt=\deadcycles
  %\message{*}%
  %\immediate\write16{\space
  %  *** \Count@Mode\space= \the\TY@cnt\space\TY@Msg}%
  %\CountPause\CountPause %% gives pause
  \deadcycles=0}
  
 %%% Some defaults
 \def\TY@Msg{(starting at input line \the\inputlineno) ***}%
 \def\SetTY@hsize{\hsize=\z@\relax
                    \let\hsize\TY@hsize} %% uproot!
 \def\SetTY@everypar{\everypar\expandafter{\the\everypar\ }
    %% "\ " is glue allowing hyphenation of 1st word
    \let\everypar\TY@everypar %% uproot!
    }

 %%% \SyllableCount: Simple!
 \def\Count@Mode{SyllableCount}
 \def\SyllableCount{\begingroup
      \Gen@Count} %% language variation OK!?
 \def\endSyllableCount{\endGen@Count\endgroup}
 
 %%%%% End Syllable Counting macros
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 %%% \AutoAccCalc@Full  
  %% uses \QWord@
  %% will define \AutoAcc@ \AltAcc@ 
  \def\AutoAccCalc@Full{%\show\Remainder@\show\QWord@ 
    \SyllableCount \QWord@ \endSyllableCount 
    \ifnum\TY@cnt>1
       \def\AutoAcc@{/e}\def\AltAcc@{'e}%
    \else
       \def\AutoAcc@{'e}\def\AltAcc@{/e}%
    \fi}

 %%% \AutoAccCalc@Nul  
  %% must define \AutoAcc@ \AltAcc@ 
  \def\AutoAccCalc@Nul{\def\AutoAcc@{'e}\def\AltAcc@{/e}}

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%% The action!

  \Preamble@
  \PrepCounts@ 
  \Transfer@
 
 \END

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%% Documentation for email-fr.fix
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


 Apology to French readers:  This documentation is in English
to facilitate construction of similar programs for other languages.
However the user interface is in French.


 *** Motivation ***

    In typing French according to the email-fr rules, there
is one unfortunate change of standard typing habits that
one must cope with. An apostrophe followed by  e or  E  should
be typed as a slash  /  and not as  ' .  This is unambiguous
and visually acceptable --- at least more so than a
backslash in the middle of a word.  The problem is that few
typists are able to avoid reverting several times per page
to  '  for apostrophe, which may produce <eaccute> or
<Eaccute> in TeX.  One can, of course, correct the errors
after typesetting; however this is inefficient to the point
of nearly cancelling the time gain over Knuth's 
rather clumsy typing system.

      A portable but tiresome solution consists in 
searching for and examining all occurrences of 'e or 'E. 

      An effective but elitist solution is to use a good text
editor to search for the quadruple <space><letter>'<e or E>
and replace it where appropriate by /e (or /E).  As <letter>
is one of many   c d j l m n s t   (not counting
capitalisation and occurrences of  qu) it should be treated
as a wildcard or multiple choice; but only a sophisticated
text editor operated by a sophisticated user can do that.  

      Thus a portable and preferably automatic typing
correction tool should be made available to every  TeX user
wherever he may be.  It is provided by the present ".tex"
utility called  email-fr.fix  in conjunction with
email-fe.dmp.  Both are distributed with  email-fr.sty.  

      Alternative utilities to accomplish the same tasks
as email-fr.fix could be be based on on programmable word
processors such as  emacs  or on a spelling checker that has
the means to read email-fr typing.  However TeX has proved a
quite appropriate tool for this job because the tiresome part
is rather trivial for TeX's hyphenation mechanism. 
Clearly, no alternative could be quite so portable. 
      

 **** Use of email-fr.fix ****

      If you have many pages of typing to correct, you will want
a format containing the special language "emailFR", for only
with this language present is the action of  email-fr.fix
essentially automatic --- use default or the the "a" option. 
For just a few pages of typing, the "d" or "dialog mode" of
operation is adequate on its own without language "emailFR".
  
      Any French format built with the mechanism "format-dumper" in
1994 or later will contain the (tiny) language emailFR (the master
posting of format-dumper is on matups.matups.fr in 1993-1994).  If
your format does not have this language, you can quickly build one
that does with the help of email-fr.dmp and initex.  Note that the
format for email-fr.fix need not be the one that composes your ".tex"
typescript.
      
      Here is how to start using  email-fr.fix. Save your email-fr 
typescript under the name  corr.in  along side of email-fr.fix. Then
"compose"  email-fr.fix  (not  corr.in!)  under a TeX format
containing (if possible) the language emailFR. Do so just as though
email-fr.fix  were a typescript.  Instructions are given
interactively. Ultimately the corrected typescript will apear in
corr.out along side of corr.in.
  
  
KEY TO OPTIONS
  
     The full gammut of options is only offered only if a default choice
has been declined. 
      
     Each option is commanded  by a one-letter key; one types any
(unordered) subset of the keys listed  below and then hits return. 
For example :
 
          ad <Carriage Return>
 
commands "Automatic" and "Dialog"; this is the default choice. 

 ********************************
 
 m --- Margin space :  add a space at the beginning of every line
that does not already begin with one.  Lines that do not begin
with a space are occasionally subject to corruption 
in the email network.
 
 f --- Flag All:  always insert a "flag"  \XXXX  before the spot
where where a possible error is detected. (Compare  d.)  If you
wish to examine absolutely every change introduced (or even
contemplated) by email-fr.fix this is the one and only way to do
it.  The dialog option below will reveal only changes that risk
being wrong.

 i --- Space ignore : ignore potential errors that are preceeded
by at least three spaces.
 
 p --- Space protect : "protect" all errors corrected  
by inserting three preceeding spaces in the output.
 
 a --- Automatic mode : use the hyphenation patterns of the
special language emailFR to make (or propose) corrections.  Here
lies the power of email-fr.fix --- use it!  An asterisk is printed
to the screen each time a significant automatic decision is made.

 '' --- leave  l''etat (etc.) as is.  By default, there is
otherwise an automatic conversion to l/'etat (etc.), which seems
noticeably mode readable to me.
 
 d --- Dialog mode :  In this mode of action the user is 
asked to choose between  /  and  '  whenever  email-fr.fix
cannot decide.  Let us spell out what this means.

    In case Smart mode is on at the same time, dialog is rare : it
is skipped as unnecessary, unless a capital letter begins the
possible error.  In this case a proper name with non-French
spelling may be involved and so dialog serves a purpose. The
program proposes for the user's approval a correction by the
automatic mechanism.  
   In case Smart mode is off, dialog always occurs and it just
proposes what was found in corr.in.  
   In either case, the user has several choices
 
    <Carriage Return>  to  approve the dialog proposal
 
The other choices are provided by preceeding the <Carriage Return>
with one or more of the following letters in any order:
 
    n     to decide the opposite of the proposal
    f     to flag this possible error in the output
    F     to impose f for all remaining dialogs
 
A flag may be vital to permit later correction of a nonstandard
error that you spot.
 
 
 
 ****** Leftovers and Extensions ****** 

 1)   n<eaccute>s   and   n<apostrophe>es   are both legitimate
in French.  This is one of the extremely rare occasions 
when the change 

       <eaccute>  <--->  <apostrophe>e

preserves French.  It is treated as an exception,
via dialog if possible.

 2)  Remember that one can suppress all action  of
email-fr.fix at a given spot by insertion of three or more
preceeding spaces, and then always using the "p" option above.
For example the sentence of documentation:

    Pour 'eviter l/erreur  : `` Freud et   l'ego''

would be left intact --- as we clearly want.
     When it is not possible to protect in this way, insertion
of {}  (although visually disturbing) should do the job ---
indeed without calling on  the "p" option:

    Pour 'eviter l/erreur  : Freud et ``{}l'ego''

 3)  Some  'e  occurring in mathematics may be wrongly converted
into /e  by  email-fr.fix.  This is statistically extremely
rare. Furthermore,  email-fr.sty (not .fix!) has been
programmed to stop and warn the reader whenever it meets /e in
math mode. (The user is then asked to insert a space to prevent
recurrence of the confusion.) Thus, such rare errors will be
mechanically caught before they get into print.

 4)  The case of  'E  in place of  'e  is not treated by
email-fr.fix although it could be.  The reason is that such
problems are rare and in any case risk involving a proper name.
Direct search for  'E  seems a perfectly adequate correction
procedure.  For example

     La vie d'Egas, architecte espagnol, 1455-1534.

would be maintained by  email-fr.fix  *if* e and E were treated alike,
whereas only d/Egas is correct.  The matter is complicated by
frequent omission of accents on capitals.

 5)  Proper names especially those of non-French origin, will
be a small but inexhaustible source of failure of the
automatic choices offered by email-fr.fix. For example,
email-fr.fix changes

    l'ego    ==>   l/ego

But what of the  S'ego  lily of the American Indians (which
would surely have an accute accent in Cajun French of
Louisiana). As first  based on existing French dictionaries,
email-fr.fix wrongly proposed S/ego, and the user had to
respond by switching back to S'ego.  Progressively such
exceptions (and others below) are handled by
augmenting the tables in email-fr.dmp.  Thus, dialog may
gradually become superfluous.

 6)  Bits of English used in French (often illigimately) will
also be an inexhaustable supply of exceptions. Computer science
is a big contributor because the spelling of English is usually
retained and lower case is usual.  Here here sample patterns from
email-fr.dmp that handle such exceptions:

        ?3email  ?3emacs 

Here ? stands for a  '  that may or may not become a  /.


NB.  Users are kindly requested to report exceptions as well as
true bugs.


Laurent Siebenmann <lcs@matups.matups.fr>



 **** Appendix :

 %%%%%%%%%%%%%%%%%%%%
 A test file:  corr.in

 ``c'est bon''    

 "c'est bon"    

 (c'est bon)    

 [c'est bon]    

 {{}c'est bon}    

Donc, tu n'es pas n'e hier; et vous autres 
vous n'^etes pas n'es hier non plus.

 %%%%%%%%%%%%%%%%%%%%
 corr.out :


 ``c/est bon''

 "c/est bon"

 (c/est bon)

 [c/est bon]

 {{}c'est bon}

Donc, tu n/es pas n'e hier; et vous autres
vous n'^etes pas n'es hier non plus.