1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24\writestatus{loading}{ConTeXt Multilingual Macros Helpers}
25
26\registerctxluafile{multaux}{}
27
28\unprotect
29
30\immutable\cdef\??empty{\tocharacter25} \immutable\letvalue{\tocharacter25}\empty
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\lettonothing\m_mult_interfaces_namespace
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\def\mult_interfaces_get_parameters#1[#S#2]
271 {\cdef\m_mult_interfaces_namespace{#1}
272 \mult_interfaces_get_parameters_item#2\ignorearguments\ignorearguments}
273
274
275
276
277
278
279
280
281\def\mult_interfaces_get_parameters_item#*#S#1,
282 {\ifarguments
283 \expandafter\gobbleoneargument
284 \else
285 \mult_interfaces_get_parameters_item_okay#1,\ignorearguments
286 \fi
287 \mult_interfaces_get_parameters_item}
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309\tolerant\def\mult_interfaces_get_parameters_item_okay#1=#S#2,
310 {\ifarguments
311
312 \or
313 \mult_interfaces_get_parameters_item_error{#1}
314 \or
315 \defcsname
316 \m_mult_interfaces_namespace
317 \ifcsname\k!prefix!#1\endcsname\lastnamedcs\else#1\fi
318 \endcsname{#2}
319 \fi}
320
321\def\mult_interfaces_get_parameters_item_error#1
322 {\if,#1\else\mult_interfaces_get_parameters_error_indeed\m_mult_interfaces_namespace{#1}\fi}
323
324\startinterface english
325
326 \def\mult_interfaces_get_parameters_item_okay#1=#S#2,
327 {\ifarguments
328
329 \or
330 \mult_interfaces_get_parameters_item_error{#1}
331
332
333 \else
334 \defcsname\m_mult_interfaces_namespace#1\endcsname{#2}
335 \fi}
336
337
338
339
340
341
342
343 \def\mult_interfaces_get_parameters_item_error#1
344 {\if,#1\else\mult_interfaces_get_parameters_error_indeed\m_mult_interfaces_namespace{#1}\fi}
345
346
347
348
349
350
351\stopinterface
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366\def\mult_aux_no_assignment_indeed#1=#2]{\ifcase\ifarguments\plusone\or\zerocount\else\plusone\fi}
367\def\mult_aux_no_assignment#1]{\mult_aux_no_assignment_indeed#1\ignorearguments\relax}
368
369
370
371
372
373
374
375
376 \protected\def\mult_interfaces_let #1#2{\letcsname#1#2\endcsname}
377 \protected\def\mult_interfaces_lete#1#2{\letcsname#1#2\endcsname\empty}
378 \protected\def\mult_interfaces_def #1#2{\defcsname#1#2\endcsname}
379 \protected\def\mult_interfaces_edef#1#2{\edefcsname#1#2\endcsname}
380 \protected\def\mult_interfaces_gdef#1#2{\gdefcsname#1#2\endcsname}
381 \protected\def\mult_interfaces_xdef#1#2{\xdefcsname#1#2\endcsname}
382
383
384
385
386\protected\def\mult_interfaces_adef#1#2{\defcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
387
388
389\startinterface english
390 \protected\def\mult_interfaces_adef#1#2{\defcsname#1#2\endcsname}
391\stopinterface
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\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9
421 {\frozen\def#3##1{\csname\ifcsname#1#2:##1\endcsname\csnamestring\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}
422 \frozen\def#4##1##2{\ifcsname##1:##2\endcsname\csnamestring\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
423 \frozen\edef#5##1##2{\noexpand\ifrelax##1\??empty\noexpand\else\noexpand#4##1{##2}\noexpand\fi}
424 \frozen\def#6##1##2{\csname\ifcsname#1##1:##2\endcsname\csnamestring\else\expandafter#5\csname#1##1:\s!parent\endcsname{##2}\fi\endcsname}
425
426 \frozen\def#7##1{\expandafter\detokened\csname#1#2:##1\endcsname}
427 \frozen\def#8##1{\begincsname#1#2:##1\endcsname}
428
429 \frozen\def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname\csnamestring\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}}
430
431\permanent\protected\def\installparameterhandler#1#2
432 {\mutable\constant\letcsname current#2\endcsname\empty
433 \normalexpanded
434 {\mult_interfaces_install_parameter_handler
435 {\noexpand#1}
436 \expandafter\noexpand\csname current#2\endcsname
437 \expandafter\noexpand\csname #2parameter\endcsname
438 \expandafter\noexpand\csname do#2parameter\endcsname
439 \expandafter\noexpand\csname do#2parentparameter\endcsname
440 \expandafter\noexpand\csname named#2parameter\endcsname
441 \expandafter\noexpand\csname detokenized#2parameter\endcsname
442 \expandafter\noexpand\csname direct#2parameter\endcsname
443 \expandafter\noexpand\csname letfrom#2parameter\endcsname}}
444
445\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3
446
447 {\frozen\def#2##1{\expandafter\detokened\csname#1:##1\endcsname}
448 \frozen\def#3##1{\begincsname#1:##1\endcsname}}
449
450\permanent\protected\def\installrootparameterhandler#1#2
451 {\normalexpanded
452 {\mult_interfaces_install_root_parameter_handler
453 {\noexpand#1}
454 \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname
455 \expandafter\noexpand\csname root#2parameter\endcsname}}
456
457\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9
458 {\frozen\def#3##1{#1#4{#1#2}{##1}:}
459 \frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
460 \frozen\def#5##1##2{\ifrelax##1\else#4##1{##2}\fi}
461 \frozen\def#6{#1#2:}
462 \frozen\def#7##1{#1##1:}
463
464
465 \frozen\def#8{\ifempty#2\orelse\ifcsname#1#2:\s!parent\endcsname\else\letcsname#1#2:\s!parent\endcsname#1\fi}
466 \frozen\protected\def#9##1{\edefcsname#1##1:\s!parent\endcsname{#1#2}}}
467
468\permanent\protected\def\installparameterhashhandler#1#2
469 {\mutable\letcsname current#2\endcsname\empty
470 \immutable\letcsname#2namespace\endcsname#1
471 \normalexpanded
472 {\mult_interfaces_install_parameter_hash_handler
473 {\noexpand#1}
474 \expandafter\noexpand\csname current#2\endcsname
475 \expandafter\noexpand\csname #2parameterhash\endcsname
476 \expandafter\noexpand\csname do#2parameterhash\endcsname
477 \expandafter\noexpand\csname do#2parentparameterhash\endcsname
478 \expandafter\noexpand\csname current#2hash\endcsname
479 \expandafter\noexpand\csname named#2hash\endcsname
480 \expandafter\noexpand\csname check#2parent\endcsname
481 \expandafter\noexpand\csname chaintocurrent#2\endcsname}}
482
483
484
485
486
487
488 \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6
489 {\frozen\protected\def#3##1{\defcsname#1#2:##1\endcsname}
490 \frozen\protected\def#4##1{\edefcsname#1#2:##1\endcsname}
491 \frozen\protected\def#5##1{\letcsname#1#2:##1\endcsname}
492 \frozen\protected\def#6##1{\letcsname#1#2:##1\endcsname\empty}}
493
494
495\permanent\protected\def\installparametersethandler#1#2
496 {\mutable\letcsname current#2\endcsname\empty
497 \normalexpanded
498 {\mult_interfaces_install_parameter_set_handler
499 {\noexpand#1}
500 \expandafter\noexpand\csname current#2\endcsname
501 \expandafter\noexpand\csname set#2parameter\endcsname
502 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
503 \expandafter\noexpand\csname let#2parameter\endcsname
504 \expandafter\noexpand\csname reset#2parameter\endcsname}}
505
506\mutable\let\dousecurrentstyleparameter\relax
507\mutable\let\dousecurrentcolorparameter\relax
508
509\mutable\lettonothing\currentstyleparameter
510\mutable\lettonothing\currentcolorparameter
511
512
513
514\protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4
515 {\frozen\protected\def#2##1##2
516 {\cdef\currentstyleparameter{#1{##1}}
517 \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi
518 \cdef\currentcolorparameter{#1{##2}}
519 \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}
520 \frozen\protected\def#3##1
521 {\cdef\currentstyleparameter{#1{##1}}
522 \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi}
523 \frozen\protected\def#4##1
524 {\cdef\currentcolorparameter{#1{##1}}
525 \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}}
526
527\permanent\protected\def\installstyleandcolorhandler#1#2
528 {\normalexpanded
529 {\mult_interfaces_install_style_and_color_handler
530 \expandafter\noexpand\csname #2parameter\endcsname
531 \expandafter\noexpand\csname use#2styleandcolor\endcsname
532 \expandafter\noexpand\csname use#2styleparameter\endcsname
533 \expandafter\noexpand\csname use#2colorparameter\endcsname}}
534
535\def\mult_check_for_parent#1#2#3#4
536 {\ifcsname#1#4:\s!parent\endcsname\orelse\ifx#4\empty\else
537 \writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}
538 \cdefcsname#1#4:\s!parent\endcsname{#2}
539 \fi}
540
541 \def\mult_interfaces_chain#1#2{\ifcsname#1#2:\s!chain\endcsname\lastnamedcs\space\fi}
542\permanent\def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname}
543\permanent\def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname}
544
545
546
547
548
549\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8
550 {\newtoks#5
551 \newtoks#6
552 \frozen\tolerant\protected\def#2[##1]##*[##S##2]##*[##S##3]
553 {\let#8#4
554
555 \ifarguments
556 \lettonothing#4
557 \expand#5
558 \lettonothing#7
559 \letcsname#1#4:\s!chain\endcsname\empty
560 \cdefcsname#1#4:\s!parent\endcsname{#3}
561 \or
562 \cdef#4{##1}
563 \expand#5
564 \lettonothing#7
565 \cdefcsname#1#4:\s!chain\endcsname{##1}
566 \cdefcsname#1#4:\s!parent\endcsname{#3}
567 \or
568 \cdef#4{##1}
569 \expand#5
570 \relax
571 \ifhastok={##2}
572 \lettonothing#7
573 \cdefcsname#1#4:\s!chain\endcsname{##1}
574 \cdefcsname#1#4:\s!parent\endcsname{#3}
575 \mult_interfaces_get_parameters{#1#4:}[##2]
576 \else
577 \cdef#7{##2}
578 \ifempty#7
579 \cdefcsname#1#4:\s!chain\endcsname{##1}
580 \cdefcsname#1#4:\s!parent\endcsname{#3}
581 \else
582 \mult_check_for_parent{#1}{#3}#4#7
583 \cdefcsname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
584 \cdefcsname#1#4:\s!parent\endcsname{#1##2}
585 \fi
586 \fi
587 \or
588 \cdef#4{##1}
589 \expand#5
590 \cdef#7{##2}
591 \mult_check_for_parent{#1}{#3}#4#7
592 \cdefcsname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
593 \cdefcsname#1#4:\s!parent\endcsname{#1##2}
594 \mult_interfaces_get_parameters{#1#4:}[##3]
595 \fi
596 \expand#6
597 \let#4#8}}
598
599\permanent\protected\def\installdefinehandler#1#2#3
600 {\mutable\letcsname current#2\endcsname\empty
601 \mutable\letcsname current#2parent\endcsname\empty
602 \normalexpanded
603 {\mult_interfaces_install_define_handler
604 {\noexpand#1}
605 \expandafter\noexpand\csname define#2\endcsname
606 {\noexpand#3}
607 \expandafter\noexpand\csname current#2\endcsname
608 \expandafter\noexpand\csname everypreset#2\endcsname
609 \expandafter\noexpand\csname everydefine#2\endcsname
610 \expandafter\noexpand\csname current#2parent\endcsname
611 \expandafter\noexpand\csname saveddefined#2\endcsname}}
612
613\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8
614 {\newtoks#4
615 \newtoks#7
616 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
617 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]
618 {\let#6#3
619 \ifnum\lastarguments=\plustwo
620 \def#8####1
621 {\cdef#3{####1}
622 \mult_interfaces_get_parameters{#1#3:}[##2]
623 \expand#4}
624 \processcommalist[##1]#8
625 \else
626 \lettonothing#3
627 \mult_interfaces_get_parameters{#1:}[##1]
628 \expand#4
629 \fi
630 \let#3#6
631 \expand#7}}
632
633\permanent\protected\def\installsetuphandler#1#2
634 {\mutable\letcsname current#2\endcsname\empty
635 \normalexpanded
636 {\mult_interfaces_install_setup_handler
637 {\noexpand#1}
638 \expandafter\noexpand\csname setup#2\endcsname
639 \expandafter\noexpand\csname current#2\endcsname
640 \expandafter\noexpand\csname everysetup#2\endcsname
641 \expandafter\noexpand\csname setupcurrent#2\endcsname
642 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
643 \expandafter\noexpand\csname everysetup#2root\endcsname
644 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
645
646\aliased\let\doingrootsetupnamed\plusone
647\aliased\let\doingrootsetuproot \plustwo
648\aliased\let\doingrootsetnamed \plusthree
649\aliased\let\doingrootsetroot \plusfour
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\protected\def\mult_interfaces_install_switch_setup_handler#1#2#3#4#5#6#7#8#9#A
728 {\newtoks#5
729 \newconstant#2
730 \newtoks#8
731 \newtoks#9
732 \frozen\tolerant\protected\def#4[##S##1]##*[##S##2]
733 {\ifarguments
734
735 \let#6#3
736 \lettonothing#3
737 #2\doingrootsetroot
738 \expand#5
739 \expand#8
740 \or
741 \ifhastok={##1}
742
743 \let#7#3
744 \let#6#3
745 \lettonothing#3
746 #2\doingrootsetuproot
747 \mult_interfaces_get_parameters{#1:}[##1]
748 \expand#5
749 \expand#8
750 \let#3#7
751 \else
752
753 \let#6#3
754 \cdef#3{##1}
755 \ifempty#3
756 \let#7#6
757 #2\doingrootsetuproot
758 \expand#5
759 \expand#8
760 \let#3#7
761 \else
762 #2\doingrootsetnamed
763 \expand#5
764 \expand#8
765 \fi
766 \fi
767 \or
768
769 \let#7#3
770 \let#6#3
771 \cdef#3{##1}
772 #2\doingrootsetupnamed
773 \mult_interfaces_get_parameters{#1#3:}[##2]
774 \expand#5
775 \ifx#3#6\expand#8\fi
776 \let#3#7
777 \fi
778 #2\zerocount
779 \expand#9}
780 \frozen\protected\def#A{\mult_interfaces_get_parameters{#1#3:}}}
781
782\permanent\protected\def\installswitchsetuphandler#1#2
783 {\mutable\letcsname current#2\endcsname\empty
784 \mutable\letcsname previous#2\endcsname\empty
785 \normalexpanded
786 {\mult_interfaces_install_switch_setup_handler
787 {\noexpand#1}
788 \expandafter\noexpand\csname #2setupmode\endcsname
789 \expandafter\noexpand\csname current#2\endcsname
790 \expandafter\noexpand\csname setup#2\endcsname
791 \expandafter\noexpand\csname everysetup#2\endcsname
792 \expandafter\noexpand\csname previous#2\endcsname
793 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
794 \expandafter\noexpand\csname everyswitch#2\endcsname
795 \expandafter\noexpand\csname everysetup#2root\endcsname
796 \expandafter\noexpand\csname setupcurrent#2\endcsname}}
797
798
799\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8
800 {\newtoks#4
801 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
802 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]##*[##S##3]
803 {\let#7#3
804 \ifarguments
805 \lettonothing#3
806 \expand#4
807 \or
808 \lettonothing#3
809 \mult_interfaces_get_parameters{#1:}[##1]
810 \expand#4
811 \or
812 \def#8####1
813 {\cdef#3{####1}
814 #6
815 \mult_interfaces_get_parameters{#1#3:}[##2]
816 \expand#4}
817 \processcommalist[##1]#8
818 \or
819 \def#8####1
820 {\cdef#3{####1}
821 \cdefcsname#1#3:\s!parent\endcsname{#1##2}
822 \mult_interfaces_get_parameters{#1#3:}[##3]
823 \expand#4}
824 \processcommalist[##1]#8
825 \fi
826 \let#3#7}}
827
828\permanent\protected\def\installautosetuphandler#1#2
829 {\mutable\letcsname current#2\endcsname\empty
830 \normalexpanded
831 {\mult_interfaces_install_auto_setup_handler
832 {\noexpand#1}
833 \expandafter\noexpand\csname setup#2\endcsname
834 \expandafter\noexpand\csname current#2\endcsname
835 \expandafter\noexpand\csname everysetup#2\endcsname
836 \expandafter\noexpand\csname setupcurrent#2\endcsname
837 \expandafter\noexpand\csname check#2parent\endcsname
838 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
839 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
840
841\permanent\protected\def\installbasicparameterhandler#1#2
842 {\installparameterhandler {#1}{#2}
843 \installparameterhashhandler{#1}{#2}
844 \installparametersethandler {#1}{#2}
845 \installrootparameterhandler{#1}{#2}}
846
847\permanent\protected\def\installbasicautosetuphandler#1#2
848 {\installbasicparameterhandler{#1}{#2}
849 \installautosetuphandler {#1}{#2}}
850
851\permanent\protected\def\installstylisticautosetuphandler#1#2
852 {\installbasicparameterhandler{#1}{#2}
853 \installautosetuphandler {#1}{#2}
854 \installstyleandcolorhandler {#1}{#2}}
855
856\permanent\protected\def\installcommandhandler#1#2#3
857 {\installbasicparameterhandler{#1}{#2}
858 \installdefinehandler {#1}{#2}{#3}
859 \installsetuphandler {#1}{#2}
860 \installstyleandcolorhandler {#1}{#2}}
861
862\permanent\protected\def\installswitchcommandhandler#1#2#3
863 {\installbasicparameterhandler{#1}{#2}
864 \installdefinehandler {#1}{#2}{#3}
865 \installswitchsetuphandler {#1}{#2}
866 \installstyleandcolorhandler {#1}{#2}}
867
868\permanent\protected\def\installautocommandhandler#1#2#3
869 {\installbasicparameterhandler{#1}{#2}
870 \installdefinehandler {#1}{#2}{#3}
871 \installautosetuphandler {#1}{#2}
872 \installstyleandcolorhandler {#1}{#2}}
873
874\permanent\protected\def\installsimplecommandhandler#1#2#3
875 {\installbasicparameterhandler{#1}{#2}
876 \installsetuphandler {#1}{#2}
877 \installstyleandcolorhandler {#1}{#2}}
878
879
880
881
882
883
884
885
886
887
888
889
890\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5
891 {\frozen\def#3##1{\begincsname#1##1\endcsname}
892
893 \frozen\def#4##1{\expandafter\detokened\csname#1##1\endcsname}
894 \frozen\def#5##1{\begincsname#1##1\endcsname}}
895
896\permanent\protected\def\installdirectparameterhandler#1#2
897 {\mutable\letcsname current#2\endcsname\empty
898 \normalexpanded
899 {\mult_interfaces_install_direct_parameter_handler
900 {\noexpand#1}
901 \expandafter\noexpand\csname current#2\endcsname
902 \expandafter\noexpand\csname #2parameter\endcsname
903 \expandafter\noexpand\csname detokenized#2parameter\endcsname
904 \expandafter\noexpand\csname direct#2parameter\endcsname}}
905
906\protected\def\mult_interfaces_install_direct_setup_handler#1#2#3#4
907 {\newtoks#4
908 \frozen\tolerant\protected\def#2[##S##1]{\mult_interfaces_get_parameters#1[##1]\expand#4}
909 \frozen\protected\def#3{\mult_interfaces_get_parameters#1}}
910
911\permanent\protected\def\installdirectsetuphandler#1#2
912 {\normalexpanded
913 {\mult_interfaces_install_direct_setup_handler
914 {\noexpand#1}
915 \expandafter\noexpand\csname setup#2\endcsname
916 \expandafter\noexpand\csname setupcurrent#2\endcsname
917 \expandafter\noexpand\csname everysetup#2\endcsname}}
918
919
920 \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5
921 {\frozen\protected\def#2##1{\defcsname#1##1\endcsname}
922 \frozen\protected\def#3##1{\edefcsname#1##1\endcsname}
923 \frozen\protected\def#4##1{\letcsname#1##1\endcsname}
924 \frozen\protected\def#5##1{\letcsname#1##1\endcsname\empty}}
925
926
927\permanent\protected\def\installdirectparametersethandler#1#2
928 {\normalexpanded
929 {\mult_interfaces_install_direct_parameter_set_handler
930 {\noexpand#1}
931 \expandafter\noexpand\csname set#2parameter\endcsname
932 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
933 \expandafter\noexpand\csname let#2parameter\endcsname
934 \expandafter\noexpand\csname reset#2parameter\endcsname}}
935
936\aliased\let\installdirectstyleandcolorhandler\installstyleandcolorhandler
937
938\permanent\protected\def\installdirectcommandhandler#1#2
939 {\installdirectparameterhandler {#1}{#2}
940 \installdirectsetuphandler {#1}{#2}
941 \installdirectparametersethandler {#1}{#2}
942 \installdirectstyleandcolorhandler{#1}{#2}}
943
944\permanent\protected\def\installsetuponlycommandhandler#1#2
945 {\installdirectparameterhandler {#1}{#2}
946 \installdirectsetuphandler {#1}{#2}
947 \installdirectparametersethandler{#1}{#2}}
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\permanent\protected\def\relateparameterhandlers#1#2#3#4
973 {\immutable\edefcsname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}}
974
975\permanent\protected\def\relateparameterhandlersbyns#1#2#3#4
976 {\cdefcsname#1#2:\s!parent\endcsname{#3#4}}
977
978
979
980\protected\def\mult_interfaces_install_action_handler#1#2#3
981 {\frozen\tolerant\protected\defcsname#1\endcsname[##S##1]##*[##S##2]
982 {\begingroup
983 \ifarguments
984 \lettonothing#2
985 \or
986
987
988
989
990
991
992
993 \ifhastok={##1}
994 \lettonothing#2
995 #3[##1]
996 \else
997 \cdef#2{##1}
998 \fi
999 \or
1000 \cdef#2{##1}
1001 #3[##2]
1002 \fi
1003 \directsetup{handler:action:#1}
1004 \endgroup}}
1005
1006\permanent\protected\def\installactionhandler#1
1007 {\mutable\letcsname current#1\endcsname\empty
1008 \normalexpanded
1009 {\mult_interfaces_install_action_handler
1010 {#1}
1011 \expandafter\noexpand\csname current#1\endcsname
1012 \expandafter\noexpand\csname setupcurrent#1\endcsname}}
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039\newinteger\c_mult_interfaces_n_of_namespaces
1040
1041\def\v_interfaces_prefix_template{\the\c_mult_interfaces_n_of_namespaces>}
1042
1043\permanent\protected\def\installnamespace#1
1044 {\ifcsname ????#1\endcsname
1045 \writestatus\m!system{duplicate user namespace #1}\wait
1046 \else
1047 \global\advanceby\c_mult_interfaces_n_of_namespaces\plusone
1048 \global\immutable\cdefcsname ????#1\endcsname{\v_interfaces_prefix_template}
1049 \fi}
1050
1051\permanent\protected\def\installcorenamespace#1
1052 {\ifcsname ??#1\endcsname
1053 \writestatus\m!system{duplicate core namespace #1}\wait
1054 \else
1055 \global\advanceby\c_mult_interfaces_n_of_namespaces\plusone
1056 \global\immutable\cdefcsname ??#1\endcsname{\v_interfaces_prefix_template}
1057 \clf_registernamespace\c_mult_interfaces_n_of_namespaces{#1}
1058 \fi}
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078\def\mult_interfaces_get_parameters_error_indeed#1#2
1079 {\clf_showassignerror{#1}{#2}\inputlineno}
1080
1081
1082
1083
1084\installcorenamespace{fontinstanceready}
1085\installcorenamespace{fontinstancebasic}
1086\installcorenamespace{fontinstanceclass}
1087
1088
1089
1090\installcorenamespace{dummy}
1091
1092\letvalue\??dummy\empty
1093
1094\permanent \def\dummyparameter #1{\begincsname\??dummy#1\endcsname}
1095\permanent \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname}
1096\permanent\protected\def\setdummyparameter #1{\defcsname\??dummy#1\endcsname}
1097\permanent\protected\def\setexpandeddummyparameter#1{\edefcsname\??dummy#1\endcsname}
1098\permanent\protected\def\letdummyparameter #1{\letcsname\??dummy#1\endcsname}
1099\permanent\protected\def\resetdummyparameter #1{\letcsname\??dummy#1\endcsname\empty}
1100
1101\edef\mult_interfaces_dummy{\??dummy}
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115\permanent\protected\def\getdummyparameters[#S#1]
1116 {\let\m_mult_interfaces_namespace\mult_interfaces_dummy
1117 \mult_interfaces_get_parameters_item#1\ignorearguments\ignorearguments}
1118
1119\mult_interfaces_install_style_and_color_handler
1120 \directdummyparameter
1121 \usedummystyleandcolor
1122 \usedummystyleparameter
1123 \usedummycolorparameter
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166\permanent\tolerant\protected\def\definenamespace[#1]#*[#2]
1167 {\clf_definenamespace{#1}{#2}}
1168
1169\permanent\protected\def\listnamespaces
1170 {\clf_listnamespaces}
1171
1172
1173
1174
1175
1176
1177
1178\permanent\protected\def\showparentchain#1#2
1179 {\writestatus\m!system{chain: [ \mult_interfaces_show_parent_chain{#1#2}]}}
1180
1181\def\mult_interfaces_show_parent_chain#1
1182 {#1 =>
1183 \ifcsname#1:\s!parent\endcsname
1184 \expandafter\mult_interfaces_show_parent_chain\lastnamedcs
1185 \fi}
1186
1187
1188
1189\permanent\protected\def\doifelsecommandhandler#1#2
1190 {\ifcsname#1#2:\s!parent\endcsname
1191 \expandafter\firstoftwoarguments
1192 \else
1193 \expandafter\secondoftwoarguments
1194 \fi}
1195
1196\aliased\let\doifcommandhandlerelse\doifelsecommandhandler
1197
1198\permanent\protected\def\doifcommandhandler#1#2
1199 {\ifcsname#1#2:\s!parent\endcsname
1200 \expandafter\firstofoneargument
1201 \else
1202 \expandafter\gobbleoneargument
1203 \fi}
1204
1205\permanent\protected\def\doifnotcommandhandler#1#2
1206 {\ifcsname#1#2:\s!parent\endcsname
1207 \expandafter\gobbleoneargument
1208 \else
1209 \expandafter\firstofoneargument
1210 \fi}
1211
1212\permanent\def\ifcommandhandler#1#2
1213 {\ifcsname#1#2:\s!parent\endcsname}
1214
1215
1216
1217\permanent\def\expandnamespaceparameter#1#2#3
1218 {\csname#1\ifcsname#1\expandafter\expandafter\expandafter\mult_aux_expand_namespace_parameter#2#3}
1219
1220\def\mult_aux_expand_namespace_parameter#1#2
1221 {#1\endcsname#1\else#2\fi\endcsname}
1222
1223\permanent\def\expandnamespacemacro#1#2#3
1224 {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname}
1225
1226\permanent\def\expandnamespacevalue#1#2
1227 {\csname#1\ifcsname#1\normalexpanded{\noexpand\syst_helpers_expand_checked_value{#2}}}
1228
1229\def\syst_helpers_expand_checked_value#1#2
1230 {#1\endcsname#1\else#2\fi\endcsname}
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252\mutable\let\c_mult_set\relax
1253
1254\protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7
1255 {\newinteger#3
1256 \lettonothing#6
1257 \protected\def#2
1258 {\expandafter\let\expandafter\c_mult_set\csname #1t#6\endcsname
1259 \ifrelax\c_mult_set
1260 \expandafter\newtoks\c_mult_set
1261 \letcsname#1t#6\endcsname\c_mult_set
1262 \fi}
1263 \frozen\protected\def#4##1
1264 {\pushmacro#6
1265 \advanceby#3\plusone
1266 \cdef#6{##1}
1267 \unprotect}
1268 \frozen\protected\def#5
1269 {\protect
1270 \advanceby#3\minusone
1271 \popmacro#6}
1272 \frozen\protected\def#7##1
1273 {\cdef#6{##1}
1274 #2
1275 \the\c_mult_set\relax}}
1276
1277\permanent\protected\def\installdefinitionset#1#2
1278 {\normalexpanded
1279 {\mult_interfaces_install_definition_set
1280 {\noexpand#1}
1281 \expandafter\noexpand\csname set#2toks\endcsname
1282 \expandafter\noexpand\csname #2nestingdepth\endcsname
1283 \expandafter\noexpand\csname push#2\endcsname
1284 \expandafter\noexpand\csname pop#2\endcsname
1285 \expandafter\noexpand\csname current#2\endcsname
1286 \expandafter\noexpand\csname use#2\endcsname}}
1287
1288\protected\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9
1289 {\let#5#2
1290 \frozen\protected\def#2
1291 {\ifcase#4\relax\expandafter#5\else\expandafter#6\fi}
1292 \tolerant\protected\def#6[##S##1]##*[##S##2]
1293 {\ifarguments\or
1294 #3\toksapp\c_mult_set{#7[##1]}
1295 \or
1296 #3\toksapp\c_mult_set{#8[##1][##2]}
1297 \fi}}
1298
1299\permanent\protected\def\installdefinitionsetmember#1#2#3#4
1300 {\normalexpanded
1301 {\mult_interfaces_install_definition_set_member
1302 {\noexpand#3}
1303 \expandafter\noexpand\csname setup#4\endcsname
1304 \expandafter\noexpand\csname set#2toks\endcsname
1305 \expandafter\noexpand\csname #2nestingdepth\endcsname
1306 \expandafter\noexpand\csname normalsetup#4\endcsname
1307 \expandafter\noexpand\csname delayedsetup#4\endcsname
1308 \expandafter\noexpand\csname setup#4\s!single\endcsname
1309 \expandafter\noexpand\csname setup#4\s!double\endcsname}}
1310
1311
1312
1313\protected\def\mult_interfaces_install_parent_injector#1#2#3#4
1314 {\frozen\protected\def#4##1
1315 {\ifempty#3
1316 \cdefcsname#1#2:\s!parent\endcsname{#1##1}
1317 \fi}}
1318
1319\permanent\protected\def\installparentinjector#1#2
1320 {\normalexpanded{\mult_interfaces_install_parent_injector
1321 {\noexpand#1}
1322 \expandafter\noexpand\csname current#2\endcsname
1323 \expandafter\noexpand\csname current#2parent\endcsname
1324 \expandafter\noexpand\csname inject#2parent\endcsname}}
1325
1326
1327
1328\permanent\protected\def\mult_interfaces_install_local_current_injector#1#2#3#4#5
1329 {\lettonothing#4
1330 \protected\def#5##1
1331 {\advanceby#2\plusone
1332 \cdef#3{##1:\the#2}
1333 \cdef#4{##1}
1334 \cdefcsname#1#3:\s!parent\endcsname{#1##1}}}
1335
1336\permanent\protected\def\installlocalcurrenthandler#1#2
1337 {\expandafter\newinteger\csname#1:\s!counter\endcsname
1338 \normalexpanded{\mult_interfaces_install_local_current_injector
1339 {\noexpand#1}
1340 \expandafter\noexpand\csname #1:\s!counter\endcsname
1341 \expandafter\noexpand\csname current#2\endcsname
1342 \expandafter\noexpand\csname currentglobal#2\endcsname
1343 \expandafter\noexpand\csname setlocal#2current\endcsname}}
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403\installcorenamespace{commalistprocessor}
1404\installcorenamespace{commalistprocessoraction}
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425\permanent\protected\def\installcommalistprocessor#1#2
1426 {\tolerant\protected\edefcsname\??commalistprocessor#1\endcsname[##S##1]
1427 {\csname\??commalistprocessoraction#1\endcsname##1\ignorearguments\ignorearguments}
1428 \tolerant\protected\edefcsname\??commalistprocessoraction#1\endcsname##S##1,
1429 {\noexpand\ifarguments\noexpand\or
1430 \noexpand#2{##1}
1431 \noexpand\expandafter\csname\??commalistprocessoraction#1\endcsname
1432 \noexpand\fi}}
1433
1434\permanent\protected\def\installcommalistprocessorcommand#1#2
1435 {\cdef\p_name{\csstring#2}
1436 \installcommalistprocessor\p_name{#2}
1437 \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname}
1438
1439\permanent\protected\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname}
1440
1441
1442
1443
1444\startinterface english
1445 \let\mult_interfaces_install_native_auto_setup_handler\mult_interfaces_install_auto_setup_handler
1446 \aliased\let\installbasicnativeautosetuphandler\installbasicsetuphandler
1447\stopinterface
1448
1449\ifdefined\installnativebasicsetuphandler \else
1450
1451 \let\mult_interfaces_adef_yes\mult_interfaces_adef
1452 \protected\def\mult_interfaces_adef_nop#1#2{\defcsname#1#2\endcsname}
1453
1454 \protected\def\mult_interfaces_install_native_auto_setup_handler#1#2#3#4#5#6#7#8
1455 {\newtoks#4
1456 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
1457 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]##*[##S##3]
1458 {\let#7#3
1459 \ifarguments
1460 \lettonothing#3
1461 \expand#4
1462 \or
1463 \lettonothing#3
1464 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1465 \mult_interfaces_get_parameters{#1:}[##1]
1466 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1467 \expand#4
1468 \or
1469 \def#8####1
1470 {\cdef#3{####1}
1471 #6
1472 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1473 \mult_interfaces_get_parameters{#1#3:}[##2]
1474 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1475 \expand#4}
1476 \processcommalist[##1]#8
1477 \or
1478 \def#8####1
1479 {\cdef#3{####1}
1480 \cdefcsname#1#3:\s!parent\endcsname{#1##2}
1481 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1482 \mult_interfaces_get_parameters{#1#3:}[##3]
1483 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1484 \expand#4}
1485 \processcommalist[##1]#8
1486 \fi
1487 \let#3#7}}
1488
1489 \permanent\protected\def\installnativeautosetuphandler#1#2
1490 {\mutable\letcsname current#2\endcsname\empty
1491 \normalexpanded
1492 {\mult_interfaces_install_native_auto_setup_handler
1493 {\noexpand#1}
1494 \expandafter\noexpand\csname setup#2\endcsname
1495 \expandafter\noexpand\csname current#2\endcsname
1496 \expandafter\noexpand\csname everysetup#2\endcsname
1497 \expandafter\noexpand\csname setupcurrent#2\endcsname
1498 \expandafter\noexpand\csname check#2parent\endcsname
1499 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
1500 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
1501
1502 \permanent\protected\def\installbasicnativeautosetuphandler#1#2
1503 {\installbasicparameterhandler {#1}{#2}
1504 \installnativeautosetuphandler{#1}{#2}}
1505
1506\fi
1507
1508\protect \endinput
1509 |