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\startinterface english
389 \protected\def\mult_interfaces_adef#1#2{\defcsname#1#2\endcsname}
390\stopinterface
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9
409 {\frozen\def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}
410 \frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
411 \frozen\edef#5##1##2{\noexpand\ifrelax##1\??empty\noexpand\else\noexpand#4##1{##2}\noexpand\fi}
412 \frozen\def#6##1##2{\csname\ifcsname#1##1:##2\endcsname#1##1:##2\else\expandafter#5\csname#1##1:\s!parent\endcsname{##2}\fi\endcsname}
413
414 \frozen\def#7##1{\expandafter\detokened\csname#1#2:##1\endcsname}
415 \frozen\def#8##1{\begincsname#1#2:##1\endcsname}
416
417 \frozen\def#9##1##2{\expandafter\let\expandafter##1\csname\ifcsname#1#2:##2\endcsname#1#2:##2\else\expandafter#5\csname#1#2:\s!parent\endcsname{##2}\fi\endcsname}}
418
419\permanent\protected\def\installparameterhandler#1#2
420 {\mutable\constant\letcsname current#2\endcsname\empty
421 \normalexpanded
422 {\mult_interfaces_install_parameter_handler
423 {\noexpand#1}
424 \expandafter\noexpand\csname current#2\endcsname
425 \expandafter\noexpand\csname #2parameter\endcsname
426 \expandafter\noexpand\csname do#2parameter\endcsname
427 \expandafter\noexpand\csname do#2parentparameter\endcsname
428 \expandafter\noexpand\csname named#2parameter\endcsname
429 \expandafter\noexpand\csname detokenized#2parameter\endcsname
430 \expandafter\noexpand\csname direct#2parameter\endcsname
431 \expandafter\noexpand\csname letfrom#2parameter\endcsname}}
432
433\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3
434
435 {\frozen\def#2##1{\expandafter\detokened\csname#1:##1\endcsname}
436 \frozen\def#3##1{\begincsname#1:##1\endcsname}}
437
438\permanent\protected\def\installrootparameterhandler#1#2
439 {\normalexpanded
440 {\mult_interfaces_install_root_parameter_handler
441 {\noexpand#1}
442 \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname
443 \expandafter\noexpand\csname root#2parameter\endcsname}}
444
445\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9
446 {\frozen\def#3##1{#1#4{#1#2}{##1}:}
447 \frozen\def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
448 \frozen\def#5##1##2{\ifrelax##1\else#4##1{##2}\fi}
449 \frozen\def#6{#1#2:}
450 \frozen\def#7##1{#1##1:}
451 \frozen\def#8{\ifempty#2\orelse\ifcsname#1#2:\s!parent\endcsname\else\letcsname#1#2:\s!parent\endcsname#1\fi}
452 \frozen\protected\def#9##1{\edefcsname#1##1:\s!parent\endcsname{#1#2}}}
453
454\permanent\protected\def\installparameterhashhandler#1#2
455 {\mutable\letcsname current#2\endcsname\empty
456 \immutable\letcsname#2namespace\endcsname#1
457 \normalexpanded
458 {\mult_interfaces_install_parameter_hash_handler
459 {\noexpand#1}
460 \expandafter\noexpand\csname current#2\endcsname
461 \expandafter\noexpand\csname #2parameterhash\endcsname
462 \expandafter\noexpand\csname do#2parameterhash\endcsname
463 \expandafter\noexpand\csname do#2parentparameterhash\endcsname
464 \expandafter\noexpand\csname current#2hash\endcsname
465 \expandafter\noexpand\csname named#2hash\endcsname
466 \expandafter\noexpand\csname check#2parent\endcsname
467 \expandafter\noexpand\csname chaintocurrent#2\endcsname}}
468
469
470
471
472
473
474 \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6
475 {\frozen\protected\def#3##1{\defcsname#1#2:##1\endcsname}
476 \frozen\protected\def#4##1{\edefcsname#1#2:##1\endcsname}
477 \frozen\protected\def#5##1{\letcsname#1#2:##1\endcsname}
478 \frozen\protected\def#6##1{\letcsname#1#2:##1\endcsname\empty}}
479
480
481\permanent\protected\def\installparametersethandler#1#2
482 {\mutable\letcsname current#2\endcsname\empty
483 \normalexpanded
484 {\mult_interfaces_install_parameter_set_handler
485 {\noexpand#1}
486 \expandafter\noexpand\csname current#2\endcsname
487 \expandafter\noexpand\csname set#2parameter\endcsname
488 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
489 \expandafter\noexpand\csname let#2parameter\endcsname
490 \expandafter\noexpand\csname reset#2parameter\endcsname}}
491
492\mutable\let\dousecurrentstyleparameter\relax
493\mutable\let\dousecurrentcolorparameter\relax
494
495\mutable\lettonothing\currentstyleparameter
496\mutable\lettonothing\currentcolorparameter
497
498
499
500\protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4
501 {\frozen\protected\def#2##1##2
502 {\cdef\currentstyleparameter{#1{##1}}
503 \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi
504 \cdef\currentcolorparameter{#1{##2}}
505 \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}
506 \frozen\protected\def#3##1
507 {\cdef\currentstyleparameter{#1{##1}}
508 \ifempty\currentstyleparameter\else\dousecurrentstyleparameter\fi}
509 \frozen\protected\def#4##1
510 {\cdef\currentcolorparameter{#1{##1}}
511 \ifempty\currentcolorparameter\else\dousecurrentcolorparameter\fi}}
512
513\permanent\protected\def\installstyleandcolorhandler#1#2
514 {\normalexpanded
515 {\mult_interfaces_install_style_and_color_handler
516 \expandafter\noexpand\csname #2parameter\endcsname
517 \expandafter\noexpand\csname use#2styleandcolor\endcsname
518 \expandafter\noexpand\csname use#2styleparameter\endcsname
519 \expandafter\noexpand\csname use#2colorparameter\endcsname}}
520
521\def\mult_check_for_parent#1#2#3#4
522 {\ifcsname#1#4:\s!parent\endcsname\orelse\ifx#4\empty\else
523 \writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}
524 \cdefcsname#1#4:\s!parent\endcsname{#2}
525 \fi}
526
527 \def\mult_interfaces_chain#1#2{\ifcsname#1#2:\s!chain\endcsname\lastnamedcs\space\fi}
528\permanent\def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname}
529\permanent\def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname}
530
531
532
533
534
535\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8
536 {\newtoks#5
537 \newtoks#6
538 \frozen\tolerant\protected\def#2[##1]##*[##S##2]##*[##S##3]
539 {\let#8#4
540
541 \ifarguments
542 \lettonothing#4
543 \expand#5
544 \lettonothing#7
545 \letcsname#1#4:\s!chain\endcsname\empty
546 \cdefcsname#1#4:\s!parent\endcsname{#3}
547 \or
548 \cdef#4{##1}
549 \expand#5
550 \lettonothing#7
551 \cdefcsname#1#4:\s!chain\endcsname{##1}
552 \cdefcsname#1#4:\s!parent\endcsname{#3}
553 \or
554 \cdef#4{##1}
555 \expand#5
556 \relax
557 \ifhastok={##2}
558 \lettonothing#7
559 \cdefcsname#1#4:\s!chain\endcsname{##1}
560 \cdefcsname#1#4:\s!parent\endcsname{#3}
561 \mult_interfaces_get_parameters{#1#4:}[##2]
562 \else
563 \cdef#7{##2}
564 \ifempty#7
565 \cdefcsname#1#4:\s!chain\endcsname{##1}
566 \cdefcsname#1#4:\s!parent\endcsname{#3}
567 \else
568 \mult_check_for_parent{#1}{#3}#4#7
569 \cdefcsname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
570 \cdefcsname#1#4:\s!parent\endcsname{#1##2}
571 \fi
572 \fi
573 \or
574 \cdef#4{##1}
575 \expand#5
576 \cdef#7{##2}
577 \mult_check_for_parent{#1}{#3}#4#7
578 \cdefcsname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
579 \cdefcsname#1#4:\s!parent\endcsname{#1##2}
580 \mult_interfaces_get_parameters{#1#4:}[##3]
581 \fi
582 \expand#6
583 \let#4#8}}
584
585\permanent\protected\def\installdefinehandler#1#2#3
586 {\mutable\letcsname current#2\endcsname\empty
587 \mutable\letcsname current#2parent\endcsname\empty
588 \normalexpanded
589 {\mult_interfaces_install_define_handler
590 {\noexpand#1}
591 \expandafter\noexpand\csname define#2\endcsname
592 {\noexpand#3}
593 \expandafter\noexpand\csname current#2\endcsname
594 \expandafter\noexpand\csname everypreset#2\endcsname
595 \expandafter\noexpand\csname everydefine#2\endcsname
596 \expandafter\noexpand\csname current#2parent\endcsname
597 \expandafter\noexpand\csname saveddefined#2\endcsname}}
598
599\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8
600 {\newtoks#4
601 \newtoks#7
602 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
603 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]
604 {\let#6#3
605 \ifnum\lastarguments=\plustwo
606 \def#8####1
607 {\cdef#3{####1}
608 \mult_interfaces_get_parameters{#1#3:}[##2]
609 \expand#4}
610 \processcommalist[##1]#8
611 \else
612 \lettonothing#3
613 \mult_interfaces_get_parameters{#1:}[##1]
614 \expand#4
615 \fi
616 \let#3#6
617 \expand#7}}
618
619\permanent\protected\def\installsetuphandler#1#2
620 {\mutable\letcsname current#2\endcsname\empty
621 \normalexpanded
622 {\mult_interfaces_install_setup_handler
623 {\noexpand#1}
624 \expandafter\noexpand\csname setup#2\endcsname
625 \expandafter\noexpand\csname current#2\endcsname
626 \expandafter\noexpand\csname everysetup#2\endcsname
627 \expandafter\noexpand\csname setupcurrent#2\endcsname
628 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
629 \expandafter\noexpand\csname everysetup#2root\endcsname
630 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
631
632\aliased\let\doingrootsetupnamed\plusone
633\aliased\let\doingrootsetuproot \plustwo
634\aliased\let\doingrootsetnamed \plusthree
635\aliased\let\doingrootsetroot \plusfour
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\protected\def\mult_interfaces_install_switch_setup_handler#1#2#3#4#5#6#7#8#9#A
714 {\newtoks#5
715 \newconstant#2
716 \newtoks#8
717 \newtoks#9
718 \frozen\tolerant\protected\def#4[##S##1]##*[##S##2]
719 {\ifarguments
720
721 \let#6#3
722 \lettonothing#3
723 #2\doingrootsetroot
724 \expand#5
725 \expand#8
726 \or
727 \ifhastok={##1}
728
729 \let#7#3
730 \let#6#3
731 \lettonothing#3
732 #2\doingrootsetuproot
733 \mult_interfaces_get_parameters{#1:}[##1]
734 \expand#5
735 \expand#8
736 \let#3#7
737 \else
738
739 \let#6#3
740 \cdef#3{##1}
741 \ifempty#3
742 \let#7#6
743 #2\doingrootsetuproot
744 \expand#5
745 \expand#8
746 \let#3#7
747 \else
748 #2\doingrootsetnamed
749 \expand#5
750 \expand#8
751 \fi
752 \fi
753 \or
754
755 \let#7#3
756 \let#6#3
757 \cdef#3{##1}
758 #2\doingrootsetupnamed
759 \mult_interfaces_get_parameters{#1#3:}[##2]
760 \expand#5
761 \ifx#3#6\expand#8\fi
762 \let#3#7
763 \fi
764 #2\zerocount
765 \expand#9}
766 \frozen\protected\def#A{\mult_interfaces_get_parameters{#1#3:}}}
767
768\permanent\protected\def\installswitchsetuphandler#1#2
769 {\mutable\letcsname current#2\endcsname\empty
770 \mutable\letcsname previous#2\endcsname\empty
771 \normalexpanded
772 {\mult_interfaces_install_switch_setup_handler
773 {\noexpand#1}
774 \expandafter\noexpand\csname #2setupmode\endcsname
775 \expandafter\noexpand\csname current#2\endcsname
776 \expandafter\noexpand\csname setup#2\endcsname
777 \expandafter\noexpand\csname everysetup#2\endcsname
778 \expandafter\noexpand\csname previous#2\endcsname
779 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
780 \expandafter\noexpand\csname everyswitch#2\endcsname
781 \expandafter\noexpand\csname everysetup#2root\endcsname
782 \expandafter\noexpand\csname setupcurrent#2\endcsname}}
783
784
785\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8
786 {\newtoks#4
787 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
788 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]##*[##S##3]
789 {\let#7#3
790 \ifarguments
791 \lettonothing#3
792 \expand#4
793 \or
794 \lettonothing#3
795 \mult_interfaces_get_parameters{#1:}[##1]
796 \expand#4
797 \or
798 \def#8####1
799 {\cdef#3{####1}
800 #6
801 \mult_interfaces_get_parameters{#1#3:}[##2]
802 \expand#4}
803 \processcommalist[##1]#8
804 \or
805 \def#8####1
806 {\cdef#3{####1}
807 \cdefcsname#1#3:\s!parent\endcsname{#1##2}
808 \mult_interfaces_get_parameters{#1#3:}[##3]
809 \expand#4}
810 \processcommalist[##1]#8
811 \fi
812 \let#3#7}}
813
814\permanent\protected\def\installautosetuphandler#1#2
815 {\mutable\letcsname current#2\endcsname\empty
816 \normalexpanded
817 {\mult_interfaces_install_auto_setup_handler
818 {\noexpand#1}
819 \expandafter\noexpand\csname setup#2\endcsname
820 \expandafter\noexpand\csname current#2\endcsname
821 \expandafter\noexpand\csname everysetup#2\endcsname
822 \expandafter\noexpand\csname setupcurrent#2\endcsname
823 \expandafter\noexpand\csname check#2parent\endcsname
824 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
825 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
826
827\permanent\protected\def\installbasicparameterhandler#1#2
828 {\installparameterhandler {#1}{#2}
829 \installparameterhashhandler{#1}{#2}
830 \installparametersethandler {#1}{#2}
831 \installrootparameterhandler{#1}{#2}}
832
833\permanent\protected\def\installbasicautosetuphandler#1#2
834 {\installbasicparameterhandler{#1}{#2}
835 \installautosetuphandler {#1}{#2}}
836
837\permanent\protected\def\installstylisticautosetuphandler#1#2
838 {\installbasicparameterhandler{#1}{#2}
839 \installautosetuphandler {#1}{#2}
840 \installstyleandcolorhandler {#1}{#2}}
841
842\permanent\protected\def\installcommandhandler#1#2#3
843 {\installbasicparameterhandler{#1}{#2}
844 \installdefinehandler {#1}{#2}{#3}
845 \installsetuphandler {#1}{#2}
846 \installstyleandcolorhandler {#1}{#2}}
847
848\permanent\protected\def\installswitchcommandhandler#1#2#3
849 {\installbasicparameterhandler{#1}{#2}
850 \installdefinehandler {#1}{#2}{#3}
851 \installswitchsetuphandler {#1}{#2}
852 \installstyleandcolorhandler {#1}{#2}}
853
854\permanent\protected\def\installautocommandhandler#1#2#3
855 {\installbasicparameterhandler{#1}{#2}
856 \installdefinehandler {#1}{#2}{#3}
857 \installautosetuphandler {#1}{#2}
858 \installstyleandcolorhandler {#1}{#2}}
859
860\permanent\protected\def\installsimplecommandhandler#1#2#3
861 {\installbasicparameterhandler{#1}{#2}
862 \installsetuphandler {#1}{#2}
863 \installstyleandcolorhandler {#1}{#2}}
864
865
866
867
868
869
870
871
872
873
874
875
876\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5
877 {\frozen\def#3##1{\begincsname#1##1\endcsname}
878
879 \frozen\def#4##1{\expandafter\detokened\csname#1##1\endcsname}
880 \frozen\def#5##1{\begincsname#1##1\endcsname}}
881
882\permanent\protected\def\installdirectparameterhandler#1#2
883 {\mutable\letcsname current#2\endcsname\empty
884 \normalexpanded
885 {\mult_interfaces_install_direct_parameter_handler
886 {\noexpand#1}
887 \expandafter\noexpand\csname current#2\endcsname
888 \expandafter\noexpand\csname #2parameter\endcsname
889 \expandafter\noexpand\csname detokenized#2parameter\endcsname
890 \expandafter\noexpand\csname direct#2parameter\endcsname}}
891
892\protected\def\mult_interfaces_install_direct_setup_handler#1#2#3#4
893 {\newtoks#4
894 \frozen\tolerant\protected\def#2[##S##1]{\mult_interfaces_get_parameters#1[##1]\expand#4}
895 \frozen\protected\def#3{\mult_interfaces_get_parameters#1}}
896
897\permanent\protected\def\installdirectsetuphandler#1#2
898 {\normalexpanded
899 {\mult_interfaces_install_direct_setup_handler
900 {\noexpand#1}
901 \expandafter\noexpand\csname setup#2\endcsname
902 \expandafter\noexpand\csname setupcurrent#2\endcsname
903 \expandafter\noexpand\csname everysetup#2\endcsname}}
904
905
906 \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5
907 {\frozen\protected\def#2##1{\defcsname#1##1\endcsname}
908 \frozen\protected\def#3##1{\edefcsname#1##1\endcsname}
909 \frozen\protected\def#4##1{\letcsname#1##1\endcsname}
910 \frozen\protected\def#5##1{\letcsname#1##1\endcsname\empty}}
911
912
913\permanent\protected\def\installdirectparametersethandler#1#2
914 {\normalexpanded
915 {\mult_interfaces_install_direct_parameter_set_handler
916 {\noexpand#1}
917 \expandafter\noexpand\csname set#2parameter\endcsname
918 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
919 \expandafter\noexpand\csname let#2parameter\endcsname
920 \expandafter\noexpand\csname reset#2parameter\endcsname}}
921
922\aliased\let\installdirectstyleandcolorhandler\installstyleandcolorhandler
923
924\permanent\protected\def\installdirectcommandhandler#1#2
925 {\installdirectparameterhandler {#1}{#2}
926 \installdirectsetuphandler {#1}{#2}
927 \installdirectparametersethandler {#1}{#2}
928 \installdirectstyleandcolorhandler{#1}{#2}}
929
930\permanent\protected\def\installsetuponlycommandhandler#1#2
931 {\installdirectparameterhandler {#1}{#2}
932 \installdirectsetuphandler {#1}{#2}
933 \installdirectparametersethandler{#1}{#2}}
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\permanent\protected\def\relateparameterhandlers#1#2#3#4
959 {\immutable\edefcsname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}}
960
961\permanent\protected\def\relateparameterhandlersbyns#1#2#3#4
962 {\cdefcsname#1#2:\s!parent\endcsname{#3#4}}
963
964
965
966\protected\def\mult_interfaces_install_action_handler#1#2#3
967 {\frozen\tolerant\protected\defcsname#1\endcsname[##S##1]##*[##S##2]
968 {\begingroup
969 \ifarguments
970 \lettonothing#2
971 \or
972
973
974
975
976
977
978
979 \ifhastok={##1}
980 \lettonothing#2
981 #3[##1]
982 \else
983 \cdef#2{##1}
984 \fi
985 \or
986 \cdef#2{##1}
987 #3[##2]
988 \fi
989 \directsetup{handler:action:#1}
990 \endgroup}}
991
992\permanent\protected\def\installactionhandler#1
993 {\mutable\letcsname current#1\endcsname\empty
994 \normalexpanded
995 {\mult_interfaces_install_action_handler
996 {#1}
997 \expandafter\noexpand\csname current#1\endcsname
998 \expandafter\noexpand\csname setupcurrent#1\endcsname}}
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025\newinteger\c_mult_interfaces_n_of_namespaces
1026
1027
1028
1029
1030\def\v_interfaces_prefix_template
1031 {\tohexadecimal\c_mult_interfaces_n_of_namespaces>}
1032
1033\permanent\protected\def\installnamespace#1
1034 {\ifcsname ????#1\endcsname
1035 \writestatus\m!system{duplicate user namespace #1}\wait
1036 \else
1037 \global\advanceby\c_mult_interfaces_n_of_namespaces\plusone
1038 \global\immutable\cdefcsname ????#1\endcsname{\v_interfaces_prefix_template}
1039 \fi}
1040
1041\permanent\protected\def\installcorenamespace#1
1042 {\ifcsname ??#1\endcsname
1043 \writestatus\m!system{duplicate core namespace #1}\wait
1044 \else
1045 \global\advanceby\c_mult_interfaces_n_of_namespaces\plusone
1046 \global\immutable\cdefcsname ??#1\endcsname{\v_interfaces_prefix_template}
1047 \clf_registernamespace\c_mult_interfaces_n_of_namespaces{#1}
1048 \fi}
1049
1050\def\mult_interfaces_get_parameters_error_indeed#1#2
1051 {\clf_showassignerror{#1}{#2}\inputlineno}
1052
1053
1054
1055
1056\installcorenamespace{fontinstanceready}
1057\installcorenamespace{fontinstancebasic}
1058\installcorenamespace{fontinstanceclass}
1059
1060
1061
1062\installcorenamespace{dummy}
1063
1064\letvalue\??dummy\empty
1065
1066\permanent \def\dummyparameter #1{\begincsname\??dummy#1\endcsname}
1067\permanent \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname}
1068\permanent\protected\def\setdummyparameter #1{\defcsname\??dummy#1\endcsname}
1069\permanent\protected\def\setexpandeddummyparameter#1{\edefcsname\??dummy#1\endcsname}
1070\permanent\protected\def\letdummyparameter #1{\letcsname\??dummy#1\endcsname}
1071\permanent\protected\def\resetdummyparameter #1{\letcsname\??dummy#1\endcsname\empty}
1072
1073\edef\mult_interfaces_dummy{\??dummy}
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087\permanent\protected\def\getdummyparameters[#S#1]
1088 {\let\m_mult_interfaces_namespace\mult_interfaces_dummy
1089 \mult_interfaces_get_parameters_item#1\ignorearguments\ignorearguments}
1090
1091\mult_interfaces_install_style_and_color_handler
1092 \directdummyparameter
1093 \usedummystyleandcolor
1094 \usedummystyleparameter
1095 \usedummycolorparameter
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138\permanent\tolerant\protected\def\definenamespace[#1]#*[#2]
1139 {\clf_definenamespace{#1}{#2}}
1140
1141\permanent\protected\def\listnamespaces
1142 {\clf_listnamespaces}
1143
1144
1145
1146
1147
1148
1149
1150\permanent\protected\def\showparentchain#1#2
1151 {\writestatus\m!system{chain: [ \mult_interfaces_show_parent_chain{#1#2}]}}
1152
1153\def\mult_interfaces_show_parent_chain#1
1154 {#1 =>
1155 \ifcsname#1:\s!parent\endcsname
1156 \expandafter\mult_interfaces_show_parent_chain\lastnamedcs
1157 \fi}
1158
1159
1160
1161\permanent\protected\def\doifelsecommandhandler#1#2
1162 {\ifcsname#1#2:\s!parent\endcsname
1163 \expandafter\firstoftwoarguments
1164 \else
1165 \expandafter\secondoftwoarguments
1166 \fi}
1167
1168\aliased\let\doifcommandhandlerelse\doifelsecommandhandler
1169
1170\permanent\protected\def\doifcommandhandler#1#2
1171 {\ifcsname#1#2:\s!parent\endcsname
1172 \expandafter\firstofoneargument
1173 \else
1174 \expandafter\gobbleoneargument
1175 \fi}
1176
1177\permanent\protected\def\doifnotcommandhandler#1#2
1178 {\ifcsname#1#2:\s!parent\endcsname
1179 \expandafter\gobbleoneargument
1180 \else
1181 \expandafter\firstofoneargument
1182 \fi}
1183
1184\permanent\def\ifcommandhandler#1#2
1185 {\ifcsname#1#2:\s!parent\endcsname}
1186
1187
1188
1189\permanent\def\expandnamespaceparameter#1#2#3
1190 {\csname#1\ifcsname#1\expandafter\expandafter\expandafter\mult_aux_expand_namespace_parameter#2#3}
1191
1192\def\mult_aux_expand_namespace_parameter#1#2
1193 {#1\endcsname#1\else#2\fi\endcsname}
1194
1195\permanent\def\expandnamespacemacro#1#2#3
1196 {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname}
1197
1198\permanent\def\expandnamespacevalue#1#2
1199 {\csname#1\ifcsname#1\normalexpanded{\noexpand\syst_helpers_expand_checked_value{#2}}}
1200
1201\def\syst_helpers_expand_checked_value#1#2
1202 {#1\endcsname#1\else#2\fi\endcsname}
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224\mutable\let\c_mult_set\relax
1225
1226\protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7
1227 {\newinteger#3
1228 \lettonothing#6
1229 \protected\def#2
1230 {\expandafter\let\expandafter\c_mult_set\csname #1t#6\endcsname
1231 \ifrelax\c_mult_set
1232 \expandafter\newtoks\c_mult_set
1233 \letcsname#1t#6\endcsname\c_mult_set
1234 \fi}
1235 \frozen\protected\def#4##1
1236 {\pushmacro#6
1237 \advanceby#3\plusone
1238 \cdef#6{##1}
1239 \unprotect}
1240 \frozen\protected\def#5
1241 {\protect
1242 \advanceby#3\minusone
1243 \popmacro#6}
1244 \frozen\protected\def#7##1
1245 {\cdef#6{##1}
1246 #2
1247 \the\c_mult_set\relax}}
1248
1249\permanent\protected\def\installdefinitionset#1#2
1250 {\normalexpanded
1251 {\mult_interfaces_install_definition_set
1252 {\noexpand#1}
1253 \expandafter\noexpand\csname set#2toks\endcsname
1254 \expandafter\noexpand\csname #2nestingdepth\endcsname
1255 \expandafter\noexpand\csname push#2\endcsname
1256 \expandafter\noexpand\csname pop#2\endcsname
1257 \expandafter\noexpand\csname current#2\endcsname
1258 \expandafter\noexpand\csname use#2\endcsname}}
1259
1260\protected\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9
1261 {\let#5#2
1262 \frozen\protected\def#2
1263 {\ifcase#4\relax\expandafter#5\else\expandafter#6\fi}
1264 \tolerant\protected\def#6[##S##1]##*[##S##2]
1265 {\ifarguments\or
1266 #3\toksapp\c_mult_set{#7[##1]}
1267 \or
1268 #3\toksapp\c_mult_set{#8[##1][##2]}
1269 \fi}}
1270
1271\permanent\protected\def\installdefinitionsetmember#1#2#3#4
1272 {\normalexpanded
1273 {\mult_interfaces_install_definition_set_member
1274 {\noexpand#3}
1275 \expandafter\noexpand\csname setup#4\endcsname
1276 \expandafter\noexpand\csname set#2toks\endcsname
1277 \expandafter\noexpand\csname #2nestingdepth\endcsname
1278 \expandafter\noexpand\csname normalsetup#4\endcsname
1279 \expandafter\noexpand\csname delayedsetup#4\endcsname
1280 \expandafter\noexpand\csname setup#4\s!single\endcsname
1281 \expandafter\noexpand\csname setup#4\s!double\endcsname}}
1282
1283
1284
1285\protected\def\mult_interfaces_install_parent_injector#1#2#3#4
1286 {\frozen\protected\def#4##1
1287 {\ifempty#3
1288 \cdefcsname#1#2:\s!parent\endcsname{#1##1}
1289 \fi}}
1290
1291\permanent\protected\def\installparentinjector#1#2
1292 {\normalexpanded{\mult_interfaces_install_parent_injector
1293 {\noexpand#1}
1294 \expandafter\noexpand\csname current#2\endcsname
1295 \expandafter\noexpand\csname current#2parent\endcsname
1296 \expandafter\noexpand\csname inject#2parent\endcsname}}
1297
1298
1299
1300\permanent\protected\def\mult_interfaces_install_local_current_injector#1#2#3#4
1301 {\protected\def#4##1
1302 {\advanceby#2\plusone
1303 \cdef#3{##1:\the#2}
1304 \cdefcsname#1#3:\s!parent\endcsname{#1##1}}}
1305
1306\permanent\protected\def\installlocalcurrenthandler#1#2
1307 {\expandafter\newinteger\csname#1:\s!counter\endcsname
1308 \normalexpanded{\mult_interfaces_install_local_current_injector
1309 {\noexpand#1}
1310 \expandafter\noexpand\csname #1:\s!counter\endcsname
1311 \expandafter\noexpand\csname current#2\endcsname
1312 \expandafter\noexpand\csname setlocal#2current\endcsname}}
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
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\installcorenamespace{commalistprocessor}
1373\installcorenamespace{commalistprocessoraction}
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394\permanent\protected\def\installcommalistprocessor#1#2
1395 {\tolerant\protected\edefcsname\??commalistprocessor#1\endcsname[##S##1]
1396 {\csname\??commalistprocessoraction#1\endcsname##1\ignorearguments\ignorearguments}
1397 \tolerant\protected\edefcsname\??commalistprocessoraction#1\endcsname##S##1,
1398 {\noexpand\ifarguments\noexpand\or
1399 \noexpand#2{##1}
1400 \noexpand\expandafter\csname\??commalistprocessoraction#1\endcsname
1401 \noexpand\fi}}
1402
1403\permanent\protected\def\installcommalistprocessorcommand#1#2
1404 {\cdef\p_name{\csstring#2}
1405 \installcommalistprocessor\p_name{#2}
1406 \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname}
1407
1408\permanent\protected\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname}
1409
1410
1411
1412
1413\startinterface english
1414 \let\mult_interfaces_install_native_auto_setup_handler\mult_interfaces_install_auto_setup_handler
1415 \aliased\let\installbasicnativeautosetuphandler\installbasicsetuphandler
1416\stopinterface
1417
1418\ifdefined\installnativebasicsetuphandler \else
1419
1420 \let\mult_interfaces_adef_yes\mult_interfaces_adef
1421 \protected\def\mult_interfaces_adef_nop#1#2{\defcsname#1#2\endcsname}
1422
1423 \protected\def\mult_interfaces_install_native_auto_setup_handler#1#2#3#4#5#6#7#8
1424 {\newtoks#4
1425 \frozen\protected\def#5{\mult_interfaces_get_parameters{#1#3:}}
1426 \frozen\tolerant\protected\def#2[##S##1]##*[##S##2]##*[##S##3]
1427 {\let#7#3
1428 \ifarguments
1429 \lettonothing#3
1430 \expand#4
1431 \or
1432 \lettonothing#3
1433 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1434 \mult_interfaces_get_parameters{#1:}[##1]
1435 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1436 \expand#4
1437 \or
1438 \def#8####1
1439 {\cdef#3{####1}
1440 #6
1441 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1442 \mult_interfaces_get_parameters{#1#3:}[##2]
1443 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1444 \expand#4}
1445 \processcommalist[##1]#8
1446 \or
1447 \def#8####1
1448 {\cdef#3{####1}
1449 \cdefcsname#1#3:\s!parent\endcsname{#1##2}
1450 \let\mult_interfaces_adef\mult_interfaces_adef_nop
1451 \mult_interfaces_get_parameters{#1#3:}[##3]
1452 \let\mult_interfaces_adef\mult_interfaces_adef_yes
1453 \expand#4}
1454 \processcommalist[##1]#8
1455 \fi
1456 \let#3#7}}
1457
1458 \permanent\protected\def\installnativeautosetuphandler#1#2
1459 {\mutable\letcsname current#2\endcsname\empty
1460 \normalexpanded
1461 {\mult_interfaces_install_native_auto_setup_handler
1462 {\noexpand#1}
1463 \expandafter\noexpand\csname setup#2\endcsname
1464 \expandafter\noexpand\csname current#2\endcsname
1465 \expandafter\noexpand\csname everysetup#2\endcsname
1466 \expandafter\noexpand\csname setupcurrent#2\endcsname
1467 \expandafter\noexpand\csname check#2parent\endcsname
1468 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
1469 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
1470
1471 \permanent\protected\def\installbasicnativeautosetuphandler#1#2
1472 {\installbasicparameterhandler {#1}{#2}
1473 \installnativeautosetuphandler{#1}{#2}}
1474
1475\fi
1476
1477\protect \endinput
1478 |