1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18\writestatus{loading}{ConTeXt Multilingual Macros Helpers}
19
20\registerctxluafile{multaux}{}
21
22\unprotect
23
24\edef\??empty{\Uchar25} \letvalue{\Uchar25}\empty
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\let\m_mult_interfaces_namespace\empty
86
87\def\mult_interfaces_get_parameters#1[#2
88 {\if\noexpand#2]
89 \expandafter\gobbleoneargument
90 \else
91 \def\m_mult_interfaces_namespace{#1}
92 \expandafter\mult_interfaces_get_parameters_indeed
93 \fi#2}
94
95\def\mult_interfaces_get_parameters_indeed#1]
96 {\mult_interfaces_get_parameters_item#1,],0004}
97
98\def\mult_interfaces_get_parameters_item#1,#2
99 {\if,#1,
100 \expandafter\mult_interfaces_get_parameters_item
101 \else\if]#1
102 \doubleexpandafter\gobbleoneargument
103 \else
104 \mult_interfaces_get_parameters_assign#1==\empty0004
105
106 \fi\fi#2}
107
108\def\mult_interfaces_get_parameters_error#1#2
109 {\mult_interfaces_get_parameters_error_indeed{#1}{#2}
110 \gobbleoneargument}
111
112\def\mult_interfaces_get_parameters_error_indeed#1#2
113 {\showassignerror{#2}{\the\inputlineno\space(#1)}}
114
115\def\mult_interfaces_get_parameters_assign#1=#2=#3#40004
116 {\ifx\empty#1\empty
117 \expandafter\mult_interfaces_get_parameters_error
118 \else\ifx#3\empty
119 \doubleexpandafter\mult_interfaces_get_parameters_error
120 \else
121 \doubleexpandafter\mult_interfaces_def
122 \fi\fi
123 \m_mult_interfaces_namespace{#1}{#2}
124 \doubleexpandafter\mult_interfaces_get_parameters_item}
125
126\startinterface english
127
128
129
130 \let\mult_interfaces_get_parameters_error\undefined
131
132 \def\mult_interfaces_get_parameters_error_one#1\csname#2#3\endcsname#4
133 {\mult_interfaces_get_parameters_error_indeed{#2}{#3}\iftrue}
134
135 \def\mult_interfaces_get_parameters_error_two#1\csname#2#3\endcsname#4
136 {\mult_interfaces_get_parameters_error_indeed{#2}{#3}}
137
138 \def\mult_interfaces_get_parameters_assign#1=#2=#3#40004
139 {\ifx\empty#1\empty
140 \mult_interfaces_get_parameters_error_one
141 \else\ifx#3\empty
142 \mult_interfaces_get_parameters_error_two
143 \else
144 \expandafter\def\csname\m_mult_interfaces_namespace#1\endcsname{#2}
145 \fi\fi
146 \doubleexpandafter\mult_interfaces_get_parameters_item}
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168\stopinterface
169
170\newif\ifassignment
171
172\def\mult_check_for_assignment_indeed#1=#2#30004
173 {\if#20003\assignmentfalse\else\assignmenttrue\fi}
174
175\def\mult_check_for_assignment_indeed_begin_#1=#2#30004
176 {\if#20003}
177
178\def\mult_check_for_assignment#1
179 {\expandafter\mult_check_for_assignment_indeed\detokenize{#1}=000300030004}
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197 \protected\def\mult_interfaces_let #1#2{\expandafter \let\csname#1#2\endcsname}
198 \protected\def\mult_interfaces_lete#1#2{\expandafter \let\csname#1#2\endcsname\empty}
199 \protected\def\mult_interfaces_def #1#2{\expandafter \def\csname#1#2\endcsname}
200 \protected\def\mult_interfaces_edef#1#2{\expandafter\edef\csname#1#2\endcsname}
201 \protected\def\mult_interfaces_gdef#1#2{\expandafter\gdef\csname#1#2\endcsname}
202 \protected\def\mult_interfaces_xdef#1#2{\expandafter\xdef\csname#1#2\endcsname}
203
204
205
206
207\protected\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
208
209\startinterface english
210 \protected\def\mult_interfaces_adef#1#2{\expandafter \def\csname#1#2\endcsname}
211\stopinterface
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227\def\mult_interfaces_detokenize{\expandafter\expandafter\expandafter\detokenize\expandafter\expandafter\expandafter}
228
229\protected\def\mult_interfaces_install_parameter_handler#1#2#3#4#5#6#7#8#9
230 {\ifx#2\relax\let#2\empty\fi
231 \def#3##1{\csname\ifcsname#1#2:##1\endcsname#1#2:##1\else\expandafter#5\csname#1#2:\s!parent\endcsname{##1}\fi\endcsname}
232 \def#4##1##2{\ifcsname##1:##2\endcsname##1:##2\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
233
234
235 \def#5##1##2{\ifx##1\relax0019\else#4##1{##2}\fi}
236 \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}
237 \def#7##1{\detokenize\expandafter\expandafter\expandafter{\csname#1#2:##1\endcsname}}
238 \def#8##1{\begincsname#1#2:##1\endcsname}
239 \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}}
240
241\protected\def\installparameterhandler#1#2
242 {\normalexpanded
243 {\mult_interfaces_install_parameter_handler
244 {\noexpand#1}
245 \expandafter\noexpand\csname current#2\endcsname
246 \expandafter\noexpand\csname #2parameter\endcsname
247 \expandafter\noexpand\csname do#2parameter\endcsname
248 \expandafter\noexpand\csname do#2parentparameter\endcsname
249 \expandafter\noexpand\csname named#2parameter\endcsname
250 \expandafter\noexpand\csname detokenized#2parameter\endcsname
251 \expandafter\noexpand\csname direct#2parameter\endcsname
252 \expandafter\noexpand\csname letfrom#2parameter\endcsname}}
253
254\protected\def\mult_interfaces_install_root_parameter_handler#1#2#3
255 {\def#2##1{\detokenize\expandafter\expandafter\expandafter{\csname#1:##1\endcsname}}
256 \def#3##1{\begincsname#1:##1\endcsname}}
257
258\protected\def\installrootparameterhandler#1#2
259 {\normalexpanded
260 {\mult_interfaces_install_root_parameter_handler
261 {\noexpand#1}
262 \expandafter\noexpand\csname detokenizedroot#2parameter\endcsname
263 \expandafter\noexpand\csname root#2parameter\endcsname}}
264
265\protected\def\mult_interfaces_install_parameter_hash_handler#1#2#3#4#5#6#7#8#9
266 {\ifx#2\relax\let#2\empty\fi
267 \def#3##1{#1#4{#1#2}{##1}:}
268 \def#4##1##2{\ifcsname##1:##2\endcsname##1\else\expandafter#5\csname##1:\s!parent\endcsname{##2}\fi}
269
270 \def#5##1##2{\ifx##1\relax\else#4##1{##2}\fi}
271 \def#6{#1#2:}
272 \def#7##1{#1##1:}
273 \def#8{\ifx#2\empty\else\ifcsname#1#2:\s!parent\endcsname\else\expandafter\let\csname#1#2:\s!parent\endcsname#1\fi\fi}
274 \protected\def#9##1{\expandafter\edef\csname#1##1:\s!parent\endcsname{#1#2}}}
275
276\protected\def\installparameterhashhandler#1#2
277 {\expandafter\let\csname#2namespace\endcsname#1
278 \normalexpanded
279 {\mult_interfaces_install_parameter_hash_handler
280 {\noexpand#1}
281 \expandafter\noexpand\csname current#2\endcsname
282 \expandafter\noexpand\csname #2parameterhash\endcsname
283 \expandafter\noexpand\csname do#2parameterhash\endcsname
284 \expandafter\noexpand\csname do#2parentparameterhash\endcsname
285 \expandafter\noexpand\csname current#2hash\endcsname
286 \expandafter\noexpand\csname named#2hash\endcsname
287 \expandafter\noexpand\csname check#2parent\endcsname
288 \expandafter\noexpand\csname chaintocurrent#2\endcsname}}
289
290
291
292
293
294
295
296
297
298
299
300
301
302 \protected\def\mult_interfaces_install_parameter_set_handler#1#2#3#4#5#6
303 {\ifx#2\relax\let#2\empty\fi
304 \protected\def#3##1{\expandafter \def\csname#1#2:##1\endcsname}
305 \protected\def#4##1{\expandafter\edef\csname#1#2:##1\endcsname}
306 \protected\def#5##1{\expandafter \let\csname#1#2:##1\endcsname}
307 \protected\def#6##1{\expandafter \let\csname#1#2:##1\endcsname\empty}}
308
309
310\protected\def\installparametersethandler#1#2
311 {\normalexpanded
312 {\mult_interfaces_install_parameter_set_handler
313 {\noexpand#1}
314 \expandafter\noexpand\csname current#2\endcsname
315 \expandafter\noexpand\csname set#2parameter\endcsname
316 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
317 \expandafter\noexpand\csname let#2parameter\endcsname
318 \expandafter\noexpand\csname reset#2parameter\endcsname}}
319
320\let\dousecurrentstyleparameter\relax
321\let\dousecurrentcolorparameter\relax
322
323\let\currentstyleparameter\empty
324\let\currentcolorparameter\empty
325
326\protected\def\mult_interfaces_install_style_and_color_handler#1#2#3#4
327 {\protected\def#2##1##2
328 {\edef\currentstyleparameter{#1{##1}}
329 \ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi
330 \edef\currentcolorparameter{#1{##2}}
331 \ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}
332 \protected\def#3##1
333 {\edef\currentstyleparameter{#1{##1}}
334 \ifx\currentstyleparameter\empty\else\dousecurrentstyleparameter\fi}
335 \protected\def#4##1
336 {\edef\currentcolorparameter{#1{##1}}
337 \ifx\currentcolorparameter\empty\else\dousecurrentcolorparameter\fi}}
338
339\protected\def\installstyleandcolorhandler#1#2
340 {\normalexpanded
341 {\mult_interfaces_install_style_and_color_handler
342 \expandafter\noexpand\csname #2parameter\endcsname
343 \expandafter\noexpand\csname use#2styleandcolor\endcsname
344 \expandafter\noexpand\csname use#2styleparameter\endcsname
345 \expandafter\noexpand\csname use#2colorparameter\endcsname}}
346
347\let\definehandlerparent\empty
348
349\def\mult_check_for_parent#1#2#3#4
350 {\ifcsname#1#4:\s!parent\endcsname \else \ifx#4\empty \else
351 \writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}
352 \expandafter\edef\csname#1#4:\s!parent\endcsname{#2}
353 \fi \fi}
354
355
356
357
358
359\def\mult_interfaces_chain#1#2{\ifcsname#1#2:\s!chain\endcsname\lastnamedcs\space\fi}
360\def\getparentchain #1#2{\begincsname#1#2:\s!chain\endcsname}
361\def\getcurrentparentchain#1#2{\begincsname#1#2:\s!chain\endcsname}
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\protected\def\mult_interfaces_install_define_handler#1#2#3#4#5#6#7#8#9
402 {\ifx#4\relax\let#4\empty\fi
403 \protected\def#2{\dotripleempty#5}
404 \newtoks#6
405 \newtoks#7
406 \protected\def#5[##1][##2][##3]
407 {\let#9#4
408 \edef#4{##1}
409 \ifthirdargument
410 \the#6
411 \edef#8{##2}
412 \mult_check_for_parent{#1}{#3}#4#8
413 \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
414 \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}
415 \mult_interfaces_get_parameters{#1#4:}[##3]
416 \else\ifsecondargument
417 \the#6
418 \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##2}=000300030004
419 \edef#8{##2}
420 \mult_check_for_parent{#1}{#3}#4#8
421 \expandafter\edef\csname#1#4:\s!chain\endcsname{\mult_interfaces_chain#1{##2}##1}
422 \expandafter\edef\csname#1#4:\s!parent\endcsname{#1##2}
423 \else
424 \let#8\empty
425 \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}
426 \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}
427 \mult_interfaces_get_parameters{#1#4:}[##2]
428 \fi
429 \else
430 \the#6
431 \let#8\empty
432 \expandafter\edef\csname#1#4:\s!chain\endcsname{##1}
433 \expandafter\edef\csname#1#4:\s!parent\endcsname{#3}
434 \fi\fi
435 \the#7
436 \let#4#9}}
437
438\protected\def\installdefinehandler#1#2#3
439 {\normalexpanded
440 {\mult_interfaces_install_define_handler
441 {\noexpand#1}
442 \expandafter\noexpand\csname define#2\endcsname
443 {\noexpand#3}
444 \expandafter\noexpand\csname current#2\endcsname
445 \expandafter\noexpand\csname define#2\endcsname
446 \expandafter\noexpand\csname everypreset#2\endcsname
447 \expandafter\noexpand\csname everydefine#2\endcsname
448 \expandafter\noexpand\csname current#2parent\endcsname
449 \expandafter\noexpand\csname saveddefined#2\endcsname}}
450
451\protected\def\mult_interfaces_install_setup_handler#1#2#3#4#5#6#7#8#9
452 {\ifx#3\relax\let#3\empty\fi
453 \protected\def#2{\dodoubleempty#4}
454 \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}
455 \newtoks#5
456 \newtoks#8
457 \protected\def#4[##1][##2]
458 {\let#7#3
459 \ifsecondargument
460 \def#9####1
461 {\edef#3{####1}
462 \mult_interfaces_get_parameters{#1#3:}[##2]
463 \the#5}
464 \processcommalist[##1]#9
465 \else
466 \let#3\empty
467 \mult_interfaces_get_parameters{#1:}[##1]
468 \the#5
469 \fi
470 \let#3#7
471 \the#8}}
472
473\protected\def\installsetuphandler#1#2
474 {\normalexpanded
475 {\mult_interfaces_install_setup_handler
476 {\noexpand#1}
477 \expandafter\noexpand\csname setup#2\endcsname
478 \expandafter\noexpand\csname current#2\endcsname
479 \expandafter\noexpand\csname setup#2\endcsname
480 \expandafter\noexpand\csname everysetup#2\endcsname
481 \expandafter\noexpand\csname setupcurrent#2\endcsname
482 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
483 \expandafter\noexpand\csname everysetup#2root\endcsname
484 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
485
486\let\doingrootsetupnamed\plusone
487\let\doingrootsetuproot \plustwo
488\let\doingrootsetnamed \plusthree
489\let\doingrootsetroot \plusfour
490
491\protected\def\mult_interfaces_install_switch_setup_handler_a#1#2#3#4#5
492 {\ifx#3\relax\let#3\empty\fi
493 \protected\def#2{\dodoubleempty#4}
494 \protected\def#5{\mult_interfaces_get_parameters{#1#3:}}}
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\protected\def\mult_interfaces_install_switch_setup_handler_b#1#2#3#4#5#6#7#8#9
546 {\newtoks#5
547 \newconstant#2
548 \newtoks#8
549 \newtoks#9
550 \ifx#6\relax\let#6\empty\fi
551 \protected\def#4[##1][##2]
552 {\ifsecondargument
553
554 \let#7#3
555 \let#6#3
556 \edef#3{##1}
557 #2\doingrootsetupnamed
558 \mult_interfaces_get_parameters{#1#3:}[##2]
559 \the#5
560 \ifx#3#6\the#8\fi
561 \let#3#7
562 \else\iffirstargument
563
564 \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=000300030004
565
566 \let#6#3
567 \edef#3{##1}
568 #2\doingrootsetnamed
569 \the#5
570 \the#8
571 \else
572
573 \let#7#3
574 \let#6#3
575 \let#3\empty
576 #2\doingrootsetuproot
577 \mult_interfaces_get_parameters{#1:}[##1]
578 \the#5
579 \the#8
580 \let#3#7
581 \fi
582 \else
583
584 \let#6#3
585 \let#3\empty
586 #2\doingrootsetroot
587 \the#5
588 \the#8
589 \fi\fi
590 #2\zerocount
591 \the#9}}
592
593\protected\def\installswitchsetuphandler#1#2
594 {\normalexpanded
595 {\mult_interfaces_install_switch_setup_handler_a
596 {\noexpand#1}
597 \expandafter\noexpand\csname setup#2\endcsname
598 \expandafter\noexpand\csname current#2\endcsname
599 \expandafter\noexpand\csname setup#2\endcsname
600 \expandafter\noexpand\csname setupcurrent#2\endcsname
601 \mult_interfaces_install_switch_setup_handler_b
602 {\noexpand#1}
603 \expandafter\noexpand\csname #2setupmode\endcsname
604 \expandafter\noexpand\csname current#2\endcsname
605 \expandafter\noexpand\csname setup#2\endcsname
606 \expandafter\noexpand\csname everysetup#2\endcsname
607 \expandafter\noexpand\csname previous#2\endcsname
608 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
609 \expandafter\noexpand\csname everyswitch#2\endcsname
610 \expandafter\noexpand\csname everysetup#2root\endcsname}}
611
612\protected\def\mult_interfaces_install_auto_setup_handler#1#2#3#4#5#6#7#8#9
613 {\ifx#3\relax\let#3\empty\fi
614 \protected\def#2{\dotripleempty#4}
615 \protected\def#6{\mult_interfaces_get_parameters{#1#3:}}
616 \newtoks#5
617 \def#4[##1][##2][##3]
618 {\let#8#3
619 \ifthirdargument
620 \def#9####1
621 {\edef#3{####1}
622 \expandafter\def\csname#1#3:\s!parent\endcsname{#1##2}
623 \mult_interfaces_get_parameters{#1#3:}[##3]
624 \the#5}
625 \processcommalist[##1]#9
626 \else\ifsecondargument
627 \def#9####1
628 {\edef#3{####1}
629 #7
630 \mult_interfaces_get_parameters{#1#3:}[##2]
631 \the#5}
632 \processcommalist[##1]#9
633 \else
634 \let#3\empty
635 \mult_interfaces_get_parameters{#1:}[##1]
636 \the#5
637 \fi\fi
638 \let#3#8}}
639
640\protected\def\installautosetuphandler#1#2
641 {\normalexpanded
642 {\mult_interfaces_install_auto_setup_handler
643 {\noexpand#1}
644 \expandafter\noexpand\csname setup#2\endcsname
645 \expandafter\noexpand\csname current#2\endcsname
646 \expandafter\noexpand\csname setup#2\endcsname
647 \expandafter\noexpand\csname everysetup#2\endcsname
648 \expandafter\noexpand\csname setupcurrent#2\endcsname
649 \expandafter\noexpand\csname check#2parent\endcsname
650 \expandafter\noexpand\csname savedsetupcurrent#2\endcsname
651 \expandafter\noexpand\csname nestedsetupcurrent#2\endcsname}}
652
653\protected\def\installbasicparameterhandler#1#2
654 {\installparameterhandler {#1}{#2}
655 \installparameterhashhandler{#1}{#2}
656 \installparametersethandler {#1}{#2}
657 \installrootparameterhandler{#1}{#2}}
658
659\protected\def\installbasicautosetuphandler#1#2
660 {\installbasicparameterhandler{#1}{#2}
661 \installautosetuphandler {#1}{#2}}
662
663\protected\def\installstylisticautosetuphandler#1#2
664 {\installbasicparameterhandler{#1}{#2}
665 \installautosetuphandler {#1}{#2}
666 \installstyleandcolorhandler {#1}{#2}}
667
668\protected\def\installcommandhandler#1#2#3
669 {\installbasicparameterhandler{#1}{#2}
670 \installdefinehandler {#1}{#2}{#3}
671 \installsetuphandler {#1}{#2}
672 \installstyleandcolorhandler {#1}{#2}}
673
674\protected\def\installswitchcommandhandler#1#2#3
675 {\installbasicparameterhandler{#1}{#2}
676 \installdefinehandler {#1}{#2}{#3}
677 \installswitchsetuphandler {#1}{#2}
678 \installstyleandcolorhandler {#1}{#2}}
679
680\protected\def\installautocommandhandler#1#2#3
681 {\installbasicparameterhandler{#1}{#2}
682 \installdefinehandler {#1}{#2}{#3}
683 \installautosetuphandler {#1}{#2}
684 \installstyleandcolorhandler {#1}{#2}}
685
686\protected\def\installsimplecommandhandler#1#2#3
687 {\installbasicparameterhandler{#1}{#2}
688 \installsetuphandler {#1}{#2}
689 \installstyleandcolorhandler {#1}{#2}}
690
691
692
693
694
695
696
697
698
699
700
701
702\protected\def\mult_interfaces_install_direct_parameter_handler#1#2#3#4#5
703
704 {\def#3##1{\begincsname#1##1\endcsname}
705 \def#4##1{\detokenize\expandafter\expandafter\expandafter{\csname#1##1\endcsname}}
706
707 \def#5##1{\begincsname#1##1\endcsname}}
708
709\protected\def\installdirectparameterhandler#1#2
710 {\normalexpanded
711 {\mult_interfaces_install_direct_parameter_handler
712 {\noexpand#1}
713 \expandafter\noexpand\csname current#2\endcsname
714 \expandafter\noexpand\csname #2parameter\endcsname
715 \expandafter\noexpand\csname detokenized#2parameter\endcsname
716 \expandafter\noexpand\csname direct#2parameter\endcsname}}
717
718\protected\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5
719 {\protected\def#2{\dosingleempty#3}
720 \newtoks#5
721 \def#3[##1]{\mult_interfaces_get_parameters#1[##1]\the#5}
722 \def#4{\mult_interfaces_get_parameters#1}}
723
724\protected\def\installdirectsetuphandler#1#2
725 {\normalexpanded
726 {\mult_interfaces_install_direct_setup_handler
727 {\noexpand#1}
728 \expandafter\noexpand\csname setup#2\endcsname
729 \expandafter\noexpand\csname setup#2\endcsname
730 \expandafter\noexpand\csname setupcurrent#2\endcsname
731 \expandafter\noexpand\csname everysetup#2\endcsname}}
732
733
734
735
736
737
738
739
740 \protected\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5
741 {\protected\def#2##1{\expandafter \def\csname#1##1\endcsname}
742 \protected\def#3##1{\expandafter\edef\csname#1##1\endcsname}
743 \protected\def#4##1{\expandafter \let\csname#1##1\endcsname}
744 \protected\def#5##1{\expandafter \let\csname#1##1\endcsname\empty}}
745
746
747\protected\def\installdirectparametersethandler#1#2
748 {\normalexpanded
749 {\mult_interfaces_install_direct_parameter_set_handler
750 {\noexpand#1}
751 \expandafter\noexpand\csname set#2parameter\endcsname
752 \expandafter\noexpand\csname setexpanded#2parameter\endcsname
753 \expandafter\noexpand\csname let#2parameter\endcsname
754 \expandafter\noexpand\csname reset#2parameter\endcsname}}
755
756\let\installdirectstyleandcolorhandler\installstyleandcolorhandler
757
758\protected\def\installdirectcommandhandler#1#2
759 {\installdirectparameterhandler {#1}{#2}
760 \installdirectsetuphandler {#1}{#2}
761 \installdirectparametersethandler {#1}{#2}
762 \installdirectstyleandcolorhandler{#1}{#2}}
763
764\protected\def\installsetuponlycommandhandler#1#2
765 {\installdirectparameterhandler{#1}{#2}
766 \installdirectsetuphandler {#1}{#2}
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\protected\def\relateparameterhandlers#1#2#3#4
793 {\expandafter\edef\csname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}}
794
795\protected\def\relateparameterhandlersbyns#1#2#3#4
796 {\expandafter\edef\csname#1#2:\s!parent\endcsname{#3#4}}
797
798
799
800\protected\def\installactionhandler#1
801 {\normalexpanded
802 {\mult_interfaces_install_action_handler
803 {#1}
804 \expandafter\noexpand\csname current#1\endcsname
805 \expandafter\noexpand\csname setupcurrent#1\endcsname
806 \expandafter\noexpand\csname #1action\endcsname}}
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826\protected\def\mult_interfaces_install_action_handler#1#2#3#4
827 {\protected\expandafter\def\csname#1\endcsname{\dodoubleempty#4}
828 \protected\def#4[##1][##2]
829 {\begingroup
830 \ifsecondargument
831 \edef#2{##1}
832 #3[##2]
833 \else\iffirstargument
834 \ifcondition\expandafter\mult_check_for_assignment_indeed_begin_\detokenize{##1}=000300030004
835 \edef#2{##1}
836 \else
837 \let#2\empty
838 #3[##1]
839 \fi
840 \else
841 \let#2\empty
842 \fi\fi
843 \directsetup{handler:action:#1}
844 \endgroup}}
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\newcount\c_mult_interfaces_n_of_namespaces
872
873
874
875
876
877
878
879
880\def\v_interfaces_prefix_template
881 {\number\c_mult_interfaces_n_of_namespaces>}
882
883\protected\def\installnamespace#1
884 {\ifcsname ????#1\endcsname
885 \writestatus\m!system{duplicate user namespace #1}\wait
886 \else
887 \global\advance\c_mult_interfaces_n_of_namespaces\plusone
888 \expandafter\edef\csname ????#1\endcsname{\v_interfaces_prefix_template}
889 \fi}
890
891\protected\def\installcorenamespace#1
892 {\ifcsname ??#1\endcsname
893 \writestatus\m!system{duplicate core namespace #1}\wait
894 \else
895 \global\advance\c_mult_interfaces_n_of_namespaces\plusone
896 \expandafter\edef\csname ??#1\endcsname{\v_interfaces_prefix_template}
897 \clf_registernamespace\c_mult_interfaces_n_of_namespaces{#1}
898 \fi}
899
900\def\mult_interfaces_get_parameters_error_indeed#1#2
901 {\clf_showassignerror{#1}{#2}\inputlineno}
902
903
904
905
906\installcorenamespace{fontinstanceready}
907\installcorenamespace{fontinstancebasic}
908\installcorenamespace{fontinstanceclass}
909
910
911
912\installcorenamespace{dummy}
913
914\letvalue\??dummy\empty
915
916 \def\dummyparameter #1{\begincsname\??dummy#1\endcsname}
917 \def\directdummyparameter #1{\begincsname\??dummy#1\endcsname}
918\protected\def\setdummyparameter #1{\expandafter\def\csname\??dummy#1\endcsname}
919\protected\def\setexpandeddummyparameter#1{\expandafter\edef\csname\??dummy#1\endcsname}
920\protected\def\letdummyparameter #1{\expandafter\let\csname\??dummy#1\endcsname}
921
922
923
924
925\protected\def\getdummyparameters[#1
926 {\if\noexpand#1]
927 \expandafter\gobbleoneargument
928 \else
929 \let\m_mult_interfaces_namespace\??dummy
930 \expandafter\mult_interfaces_get_parameters_indeed
931 \fi#1}
932
933\mult_interfaces_install_style_and_color_handler
934 \directdummyparameter
935 \usedummystyleandcolor
936 \usedummystyleparameter
937 \usedummycolorparameter
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980\protected\def\definenamespace
981 {\dodoubleargument\mult_interfaces_define_name_space}
982
983\def\mult_interfaces_define_name_space[#1][#2]
984 {\clf_definenamespace{#1}{#2}}
985
986\def\listnamespaces
987 {\clf_listnamespaces}
988
989
990
991
992
993
994
995\protected\def\showparentchain#1#2
996 {\writestatus\m!system{chain: [ \mult_interfaces_show_parent_chain{#1#2}]}}
997
998
999
1000
1001
1002
1003
1004\def\mult_interfaces_show_parent_chain#1
1005 {#1 =>
1006 \ifcsname#1:\s!parent\endcsname
1007
1008 \expandafter\mult_interfaces_show_parent_chain\lastnamedcs
1009 \fi}
1010
1011
1012
1013\protected\def\doifelsecommandhandler#1#2
1014 {\ifcsname#1#2:\s!parent\endcsname
1015 \expandafter\firstoftwoarguments
1016 \else
1017 \expandafter\secondoftwoarguments
1018 \fi}
1019
1020\let\doifcommandhandlerelse\doifelsecommandhandler
1021
1022\protected\def\doifcommandhandler#1#2
1023 {\ifcsname#1#2:\s!parent\endcsname
1024 \expandafter\firstofoneargument
1025 \else
1026 \expandafter\gobbleoneargument
1027 \fi}
1028
1029\protected\def\doifnotcommandhandler#1#2
1030 {\ifcsname#1#2:\s!parent\endcsname
1031 \expandafter\gobbleoneargument
1032 \else
1033 \expandafter\firstofoneargument
1034 \fi}
1035
1036\let\doifcommandhandlerelse\doifelsecommandhandler
1037
1038
1039
1040\def\expandnamespaceparameter#1#2#3
1041 {\csname#1\ifcsname#1\expandafter\expandafter\expandafter\mult_aux_expand_namespace_parameter#2#3}
1042
1043\def\mult_aux_expand_namespace_parameter#1#2
1044 {#1\endcsname#1\else#2\fi\endcsname}
1045
1046\def\expandnamespacemacro#1#2#3
1047 {\csname#1\ifcsname#1#2\endcsname#2\else#3\fi\endcsname}
1048
1049\def\expandnamespacevalue#1#2
1050 {\csname#1\ifcsname#1\normalexpanded{\noexpand\syst_helpers_expand_checked_value{#2}}}
1051
1052\def\syst_helpers_expand_checked_value#1#2
1053 {#1\endcsname#1\else#2\fi\endcsname}
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075\def\s!simple{simple}
1076\def\s!single{single}
1077\def\s!double{double}
1078\def\s!triple{triple}
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
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
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
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267\let\c_mult_set\relax
1268
1269\protected\def\mult_interfaces_install_definition_set#1#2#3#4#5#6#7
1270 {\newcount#3
1271 \let#6\empty
1272 \protected\def#2
1273 {\expandafter\let\expandafter\c_mult_set\csname #1t#6\endcsname
1274 \ifx\c_mult_set\relax
1275 \expandafter\newtoks\c_mult_set
1276 \expandafter\let\csname #1t#6\endcsname\c_mult_set
1277 \fi}
1278 \protected\def#4##1
1279 {\pushmacro#6
1280 \advance#3\plusone
1281 \edef#6{##1}
1282 \unprotect}
1283 \protected\def#5
1284 {\protect
1285 \advance#3\minusone
1286 \popmacro#6}
1287 \protected\def#7##1
1288 {\edef#6{##1}
1289 #2
1290 \the\c_mult_set\relax}}
1291
1292\protected\def\installdefinitionset#1#2
1293 {\normalexpanded
1294 {\mult_interfaces_install_definition_set
1295 {\noexpand#1}
1296 \expandafter\noexpand\csname set#2toks\endcsname
1297 \expandafter\noexpand\csname #2nestingdepth\endcsname
1298 \expandafter\noexpand\csname push#2\endcsname
1299 \expandafter\noexpand\csname pop#2\endcsname
1300 \expandafter\noexpand\csname current#2\endcsname
1301 \expandafter\noexpand\csname use#2\endcsname}}
1302
1303\protected\def\mult_interfaces_install_definition_set_member#1#2#3#4#5#6#7#8#9
1304 {\let#5#2
1305 \protected\def#2
1306 {\ifcase#4\relax\expandafter#5\else\expandafter#6\fi}
1307 \protected\def#6
1308 {\dodoubleempty#7}
1309 \protected\def#7[##1][##2]
1310 {\ifsecondargument
1311
1312 #3\toksapp\c_mult_set{#9[##1][##2]}
1313 \else\iffirstargument
1314
1315 #3\toksapp\c_mult_set{#8[##1]}
1316 \fi\fi}}
1317
1318\protected\def\installdefinitionsetmember#1#2#3#4
1319 {\normalexpanded
1320 {\mult_interfaces_install_definition_set_member
1321 {\noexpand#3}
1322 \expandafter\noexpand\csname setup#4\endcsname
1323 \expandafter\noexpand\csname set#2toks\endcsname
1324 \expandafter\noexpand\csname #2nestingdepth\endcsname
1325 \expandafter\noexpand\csname normalsetup#4\endcsname
1326 \expandafter\noexpand\csname delayedsetup#4\endcsname
1327 \expandafter\noexpand\csname dodelayedsetup#4\endcsname
1328 \expandafter\noexpand\csname setup#4\s!single\endcsname
1329 \expandafter\noexpand\csname setup#4\s!double\endcsname}}
1330
1331
1332
1333\protected\def\mult_interfaces_install_parent_injector#1#2#3#4
1334 {\protected\def#4##1
1335 {\ifx#3\empty
1336 \expandafter\def\csname#1#2:\s!parent\endcsname{#1##1}
1337 \fi}}
1338
1339\protected\def\installparentinjector#1#2
1340 {\normalexpanded{\mult_interfaces_install_parent_injector
1341 {\noexpand#1}
1342 \expandafter\noexpand\csname current#2\endcsname
1343 \expandafter\noexpand\csname current#2parent\endcsname
1344 \expandafter\noexpand\csname inject#2parent\endcsname}}
1345
1346
1347
1348
1349\protected\def\syst_helpers_install_macro_stack#1#2#3
1350 {\xdef\m_syst_helpers_push_macro{\csstring#1}
1351 \ifcsname#3\m_syst_helpers_push_macro\endcsname\else
1352 \expandafter\newcount\csname#3\m_syst_helpers_push_macro\endcsname
1353 \expandafter\edef\csname pushmacro\m_syst_helpers_push_macro\endcsname
1354 {\noexpand\expandafter\glet
1355 \noexpand\csname\m_syst_helpers_push_macro\noexpand\the\csname#3\m_syst_helpers_push_macro\endcsname\endcsname
1356 \noexpand#1
1357 \global\advance\csname#3\m_syst_helpers_push_macro\endcsname\plusone}
1358 \expandafter\edef\csname popmacro\m_syst_helpers_push_macro\endcsname
1359 {\global\advance\csname#3\m_syst_helpers_push_macro\endcsname\minusone
1360 \noexpand\expandafter#2
1361 \noexpand\expandafter\noexpand#1
1362 \noexpand\csname\m_syst_helpers_push_macro\noexpand\the\csname#3\m_syst_helpers_push_macro\endcsname\endcsname}
1363 \fi}
1364
1365\protected\def\installmacrostack #1{\syst_helpers_install_macro_stack#1\let \??localpushedmacro }
1366\protected\def\installglobalmacrostack#1{\syst_helpers_install_macro_stack#1\glet\??globalpushedmacro}
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
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426\installcorenamespace{commalistprocessor}
1427\installcorenamespace{commalistprocessorwrap}
1428\installcorenamespace{commalistprocessorfirst}
1429\installcorenamespace{commalistprocessornext}
1430\installcorenamespace{commalistprocessoraction}
1431
1432\installcorenamespace{commalistprocessorcheck}
1433\installcorenamespace{commalistprocessorspace}
1434\installcorenamespace{commalistprocessorpickup}
1435\installcorenamespace{commalistprocessorfinish}
1436
1437\protected\def\installcommalistprocessor#1#2
1438 {\let\nexttoken\relax
1439 \protected\expandafter\edef\csname\??commalistprocessor#1\endcsname[
1440 {\futurelet\nexttoken\csname\??commalistprocessorcheck#1\endcsname}
1441 \protected\expandafter\edef\csname\??commalistprocessorcheck#1\endcsname
1442 {\noexpand\ifx\nexttoken]
1443 \noexpand\expandafter\noexpand\gobblethreearguments
1444 \noexpand\else
1445 \noexpand\expandafter\csname\??commalistprocessorwrap#1\endcsname
1446 \noexpand\fi
1447 \relax}
1448 \protected\expandafter\edef\csname\??commalistprocessorwrap#1\endcsname##1]
1449 {\csname\??commalistprocessorfirst#1\endcsname##1,]\relax}
1450 \protected\expandafter\edef\csname\??commalistprocessorfirst#1\endcsname##1
1451 {\csname\??commalistprocessornext#1\endcsname}
1452 \protected\expandafter\edef\csname\??commalistprocessornext#1\endcsname
1453 {\noexpand\ifx\nexttoken\noexpand\blankspace
1454 \noexpand\expandafter\csname\??commalistprocessorspace#1\endcsname
1455 \noexpand\else
1456 \noexpand\expandafter\csname\??commalistprocessorfinish#1\endcsname
1457 \noexpand\fi}
1458 \protected\expandafter\edef\csname\??commalistprocessorfinish#1\endcsname
1459 {\noexpand\ifx\nexttoken]
1460 \noexpand\expandafter\noexpand\gobbleoneargument
1461 \noexpand\else
1462 \noexpand\expandafter\csname\??commalistprocessoraction#1\endcsname
1463 \noexpand\fi}
1464 \protected\expandafter\edef\csname\??commalistprocessoraction#1\endcsname##1,
1465 {\noexpand#2{##1}
1466 \futurelet\nexttoken\csname\??commalistprocessornext#1\endcsname}
1467 \let\next\:
1468 \protected\edef \:{\csname\??commalistprocessorspace#1\endcsname}
1469 \protected\expandafter\edef\: {\futurelet\nexttoken\csname\??commalistprocessornext#1\endcsname}
1470 \let\:\next}
1471
1472\protected\def\installcommalistprocessorcommand#1#2
1473 {\edef\p_name{\csstring#2}
1474 \installcommalistprocessor\p_name{#2}
1475 \expandafter\let\expandafter#1\csname\??commalistprocessor\p_name\endcsname}
1476
1477\protected\def\commalistprocessor#1{\csname\??commalistprocessor#1\endcsname}
1478
1479\protect \endinput
1480 |