1
2
3
4
5
6
7
8
9
10
11
12
13
14\registerctxluafile{systaux}{}
15\registerctxluafile{systmac}{}
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42\unprotect
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57\let\unexpanded\normalprotected
58
59\def\startlmtxmode#1\stoplmtxmode{}
60\let\stoplmtxmode \relax
61\let\startmkivmode\relax
62\let\stopmkivmode \relax
63
64
65
66\ifdefined\c_syst_helpers_n_of_namespaces
67
68
69
70\else
71
72 \newcount\c_syst_helpers_n_of_namespaces \c_syst_helpers_n_of_namespaces\pluseight
73
74 \def\v_interfaces_prefix_template_system{\number \c_syst_helpers_n_of_namespaces>>}
75
76
77\fi
78
79\protected\def\installsystemnamespace#1
80 {\ifcsname ??#1\endcsname
81 \writestatus\m!system{duplicate system namespace #1}\wait
82 \else
83 \global\advance\c_syst_helpers_n_of_namespaces\plusone
84 \expandafter\edef\csname ??#1\endcsname{\v_interfaces_prefix_template_system}
85 \fi}
86
87
88
89
90
91
92\def\normalspace{ }
93
94
95
96
97
98
99
100
101\newcount\!!counta \newtoks\!!toksa \newdimen\!!dimena \newbox\!!boxa
102\newcount\!!countb \newtoks\!!toksb \newdimen\!!dimenb \newbox\!!boxb
103\newcount\!!countc \newtoks\!!toksc \newdimen\!!dimenc \newbox\!!boxc
104\newcount\!!countd \newtoks\!!toksd \newdimen\!!dimend \newbox\!!boxd
105\newcount\!!counte \newtoks\!!tokse \newdimen\!!dimene \newbox\!!boxe
106\newcount\!!countf \newtoks\!!toksf \newdimen\!!dimenf \newbox\!!boxf
107 \newdimen\!!dimeng
108 \newdimen\!!dimenh
109 \newdimen\!!dimeni
110 \newdimen\!!dimenj
111 \newdimen\!!dimenk
112
113\let\!!stringa\empty \let\!!stringb\empty \let\!!stringc\empty
114\let\!!stringd\empty \let\!!stringe\empty \let\!!stringf\empty
115
116\newdimen\!!widtha \newdimen\!!heighta \newdimen\!!deptha
117\newdimen\!!widthb \newdimen\!!heightb \newdimen\!!depthb
118\newdimen\!!widthc \newdimen\!!heightc \newdimen\!!depthc
119\newdimen\!!widthd \newdimen\!!heightd \newdimen\!!depthd
120
121\newif\if!!donea \newif\if!!doneb \newif\if!!donec
122\newif\if!!doned \newif\if!!donee \newif\if!!donef
123
124\def\!!zerocount {0}
125\def\!!minusone {1}
126\def\!!plusone {1}
127\def\!!plustwo {2}
128\def\!!plusthree {3}
129\def\!!plusfour {4}
130\def\!!plusfive {5}
131\def\!!plussix {6}
132\def\!!plusseven {7}
133\def\!!pluseight {8}
134\def\!!plusnine {9}
135
136\setnewconstant \uprotationangle 0
137\setnewconstant\rightrotationangle 90
138\setnewconstant \downrotationangle 180
139\setnewconstant \leftrotationangle 270
140
141\ifdefined\data \else \let\data \relax \fi
142
143
144
145
146
147
148
149\def\v!prefix! {v!}
150\def\c!prefix! {c!}
151\def\s!prefix! {s!}
152
153\def\s!next {next}
154\def\s!default {default}
155\def\s!dummy {dummy}
156\def\s!unknown {unknown}
157
158\def\s!do {do}
159\def\s!dodo {dodo}
160
161\def\s!complex {complex}
162\def\s!start {start}
163\def\s!simple {simple}
164\def\s!stop {stop}
165
166\def\s!empty {empty}
167
168
169
170
171\let\@EA \singleexpandafter
172\let\@EAEAEA \doubleexpandafter
173\let\@EAEAEAEAEAEA\tripleexpandafter
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189\let\m_syst_helpers_expanded\empty
190
191\protected\def\expanded#1
192 {\xdef\m_syst_helpers_expanded{\noexpand#1}\m_syst_helpers_expanded}
193
194\protected\def\startexpanded#1\stopexpanded
195 {\xdef\m_syst_helpers_expanded{#1}\m_syst_helpers_expanded}
196
197\let\stopexpanded\relax
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216\def\gobbleoneargument #1{}
217\def\gobbletwoarguments #1#2{}
218\def\gobblethreearguments#1#2#3{}
219\def\gobblefourarguments #1#2#3#4{}
220\def\gobblefivearguments #1#2#3#4#5{}
221\def\gobblesixarguments #1#2#3#4#5#6{}
222\def\gobblesevenarguments#1#2#3#4#5#6#7{}
223\def\gobbleeightarguments#1#2#3#4#5#6#7#8{}
224\def\gobbleninearguments #1#2#3#4#5#6#7#8#9{}
225\def\gobbletenarguments #1{\gobbleninearguments}
226
227\def\gobbleoneoptional [#1]{}
228\def\gobbletwooptionals [#1][#2]{}
229\def\gobblethreeoptionals[#1][#2][#3]{}
230\def\gobblefouroptionals [#1][#2][#3][#4]{}
231\def\gobblefiveoptionals [#1][#2][#3][#4][#5]{}
232
233
234
235\let\donothing\empty
236
237\let\m_syst_string_one \empty
238\let\m_syst_string_two \empty
239\let\m_syst_string_three\empty
240\let\m_syst_string_four \empty
241
242\let\m_syst_action_yes \empty
243\let\m_syst_action_nop \empty
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266\let\next \relax
267\let\nextnext \relax
268\let\nextnextnext \relax
269\let\nexttoken \relax
270\let\charactertoken\relax
271
272\let\m_syst_action_yes\relax
273\let\m_syst_action_nop\relax
274
275\def\syst_helpers_inspect_next_character
276 {\ifx\nexttoken\blankspace
277 \expandafter\syst_helpers_reinspect_next_character
278 \else
279 \expandafter\syst_helpers_inspect_next_character_indeed
280 \fi}
281
282\def\syst_helpers_inspect_next_character_indeed
283 {\ifx\nexttoken\charactertoken
284 \expandafter\m_syst_action_yes
285 \else
286 \expandafter\m_syst_action_nop
287 \fi}
288
289\protected\def\doifelsenextchar#1#2#3
290 {\let\charactertoken=#1
291 \def\m_syst_action_yes{#2}
292 \def\m_syst_action_nop{#3}
293 \futurelet\nexttoken\syst_helpers_inspect_next_character}
294
295\protected\def\doifelsenextcharcs#1#2#3
296 {\let\charactertoken=#1
297 \let\m_syst_action_yes#2
298 \let\m_syst_action_nop#3
299 \futurelet\nexttoken\syst_helpers_inspect_next_character}
300
301\let\doifnextcharelse \doifelsenextchar
302\let\doifnextcharcselse\doifelsenextcharcs
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318\newif\if_next_blank_space_token
319
320\let\syst_helpers_next_optional_character_token=[
321
322\def\syst_helpers_inspect_next_optional_character
323 {\ifx\nexttoken\blankspace
324 \expandafter\syst_helpers_reinspect_next_optional_character
325 \else
326 \expandafter\syst_helpers_inspect_next_optional_character_indeed
327 \fi}
328
329\def\syst_helpers_inspect_next_optional_character_indeed
330 {\ifx\nexttoken\syst_helpers_next_optional_character_token
331 \expandafter\m_syst_action_yes
332 \else
333 \expandafter\m_syst_action_nop
334 \fi}
335
336\protected\def\doifelsenextoptional#1#2
337 {\def\m_syst_action_yes{#1}
338 \def\m_syst_action_nop{#2}
339 \let\if_next_blank_space_token\iffalse
340 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
341
342\protected\def\doifelsenextoptionalcs#1#2
343 {\let\m_syst_action_yes#1
344 \let\m_syst_action_nop#2
345 \let\if_next_blank_space_token\iffalse
346 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
347
348\let\doifnextoptionalelse \doifelsenextoptional
349\let\doifnextoptionalcselse\doifelsenextoptionalcs
350
351
352
353
354
355
356
357
358
359
360
361
362
363\let\syst_helpers_next_bgroup_character_token\bgroup
364
365\def\syst_helpers_inspect_next_bgroup_character
366 {\ifx\nexttoken\blankspace
367 \expandafter\syst_helpers_reinspect_next_bgroup_character
368 \else
369 \expandafter\syst_helpers_inspect_next_bgroup_character_indeed
370 \fi}
371
372\def\syst_helpers_inspect_next_bgroup_character_indeed
373 {\ifx\nexttoken\syst_helpers_next_bgroup_character_token
374 \expandafter\m_syst_action_yes
375 \else
376 \expandafter\m_syst_action_nop
377 \fi}
378
379\protected\def\doifelsenextbgroup#1#2
380 {\def\m_syst_action_yes{#1}
381 \def\m_syst_action_nop{#2}
382 \let\if_next_blank_space_token\iffalse
383 \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character}
384
385\protected\def\doifelsenextbgroupcs#1#2
386 {\let\m_syst_action_yes#1
387 \let\m_syst_action_nop#2
388 \let\if_next_blank_space_token\iffalse
389 \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character}
390
391\let\doifnextbgroupelse \doifelsenextbgroup
392\let\doifnextbgroupcselse\doifelsenextbgroupcs
393
394\let\syst_helpers_next_parenthesis_character_token(
395
396\def\syst_helpers_inspect_next_parenthesis_character
397 {\ifx\nexttoken\blankspace
398 \expandafter\syst_helpers_reinspect_next_parenthesis_character
399 \else
400 \expandafter\syst_helpers_inspect_next_parenthesis_character_indeed
401 \fi}
402
403\def\syst_helpers_inspect_next_parenthesis_character_indeed
404 {\ifx\nexttoken\syst_helpers_next_parenthesis_character_token
405 \expandafter\m_syst_action_yes
406 \else
407 \expandafter\m_syst_action_nop
408 \fi}
409
410\protected\def\doifelsenextparenthesis#1#2
411 {\def\m_syst_action_yes{#1}
412 \def\m_syst_action_nop{#2}
413 \let\if_next_blank_space_token\iffalse
414 \futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character}
415
416\let\doifnextparenthesiselse\doifelsenextparenthesis
417
418
419
420\def\syst_helpers_do_if_fast_optional_check_else
421 {\ifx\nexttoken\syst_helpers_next_optional_character_token
422 \expandafter\m_syst_action_yes
423 \else
424 \expandafter\m_syst_action_nop
425 \fi}
426
427\protected\def\doifelsefastoptionalcheck#1#2
428 {\def\m_syst_action_yes{#1}
429 \def\m_syst_action_nop{#2}
430 \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else}
431
432\protected\def\doifelsefastoptionalcheckcs#1#2
433 {\let\m_syst_action_yes#1
434 \let\m_syst_action_nop#2
435 \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else}
436
437\let\doiffastoptionalcheckelse \doifelsefastoptionalcheck
438\let\doiffastoptionalcheckcselse\doifelsefastoptionalcheckcs
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469\protected\def\assumelongusagecs#1
470 {\let\m_syst_action#1
471 \futurelet\nexttoken\syst_helpers_ignore_spacing}
472
473\def\syst_helpers_ignore_spacing
474 {\ifx\nexttoken\blankspace
475 \singleexpandafter\syst_helpers_ignore_spacing_blankspace
476 \else\ifx\nexttoken\par
477 \doubleexpandafter\syst_helpers_ignore_spacing_partoken
478 \else
479 \doubleexpandafter\m_syst_action
480 \fi\fi}
481
482\def\syst_helpers_ignore_spacing_partoken\par
483 {\futurelet\nexttoken\syst_helpers_ignore_spacing}
484
485
486
487
488
489
490
491
492
493
494
495
496
497 \let\next\:
498
499 \def\:{\let\blankspace= } \:
500
501 \def\:{\syst_helpers_reinspect_next_character}
502 \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_character}
503
504 \def\:{\syst_helpers_reinspect_next_optional_character}
505 \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
506
507 \def\:{\syst_helpers_reinspect_next_bgroup_character}
508 \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character}
509
510 \def\:{\syst_helpers_reinspect_next_parenthesis_character}
511 \expandafter\def\: {\let\if_next_blank_space_token\iftrue\futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character}
512
513 \def\:{\syst_helpers_ignore_spacing_blankspace}
514 \expandafter\def\: {\futurelet\nexttoken\syst_helpers_ignore_spacing}
515
516 \let\:\next
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572\def\setvalue #1{\expandafter\def \csname#1\endcsname}
573\def\setgvalue #1{\expandafter\gdef\csname#1\endcsname}
574\def\setevalue #1{\expandafter\edef\csname#1\endcsname}
575\def\setxvalue #1{\expandafter\xdef\csname#1\endcsname}
576\def\getvalue #1{\csname#1\endcsname}
577\def\letvalue #1{\expandafter\let \csname#1\endcsname}
578\def\letgvalue #1{\expandafter\glet\csname#1\endcsname}
579\def\resetvalue #1{\expandafter\let \csname#1\endcsname\empty}
580\def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined}
581\def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty}
582
583\def\setuvalue #1{\protected\expandafter \def\csname#1\endcsname}
584\def\setuevalue #1{\protected\expandafter\edef\csname#1\endcsname}
585\def\setugvalue #1{\protected\expandafter\gdef\csname#1\endcsname}
586\def\setuxvalue #1{\protected\expandafter\xdef\csname#1\endcsname}
587
588\protected\def\getuvalue#1{\csname#1\endcsname}
589
590
591
592
593
594
595
596
597\let\globallet\glet
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632\def\doifelseundefined#1
633 {\ifcsname#1\endcsname
634 \expandafter\secondoftwoarguments\else\expandafter\firstoftwoarguments
635 \fi}
636
637\def\doifelsedefined#1
638 {\ifcsname#1\endcsname
639 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments
640 \fi}
641
642\def\doifundefined#1
643 {\ifcsname#1\endcsname
644 \expandafter\gobbleoneargument\else\expandafter\firstofoneargument
645 \fi}
646
647\def\doifdefined#1
648 {\ifcsname#1\endcsname
649 \expandafter\firstofoneargument\else\expandafter\gobbleoneargument
650 \fi}
651
652\let\doifundefinedelse\doifelseundefined
653\let\doifdefinedelse \doifelsedefined
654
655
656
657
658
659
660
661
662
663\protected\def\letbeundefined#1
664 {\expandafter\let\csname#1\endcsname\undefined}
665
666\protected\def\localundefine#1
667 {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi}
668
669\protected\def\globalundefine#1
670 {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi}
671
672
673
674
675
676
677
678\protected\def\doifelsealldefined#1
679 {\begingroup
680 \donetrue
681 \processcommalist[#1]\syst_helpers_do_if_all_defined_else
682 \ifdone
683 \endgroup\expandafter\firstoftwoarguments
684 \else
685 \endgroup\expandafter\secondoftwoarguments
686 \fi}
687
688\let\doifalldefinedelse\doifelsealldefined
689
690\def\syst_helpers_do_if_all_defined_else#1
691 {\ifcsname#1\endcsname\else
692 \donefalse
693 \expandafter\quitcommalist
694 \fi}
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713\protected\def\doif#1#2
714 {\edef\m_syst_string_one{#1}
715 \edef\m_syst_string_two{#2}
716 \ifx\m_syst_string_one\m_syst_string_two
717 \expandafter\firstofoneargument
718 \else
719 \expandafter\gobbleoneargument
720 \fi}
721
722\protected\def\doifnot#1#2
723 {\edef\m_syst_string_one{#1}
724 \edef\m_syst_string_two{#2}
725 \ifx\m_syst_string_one\m_syst_string_two
726 \expandafter\gobbleoneargument
727 \else
728 \expandafter\firstofoneargument
729 \fi}
730
731\protected\def\doifelse#1#2
732 {\edef\m_syst_string_one{#1}
733 \edef\m_syst_string_two{#2}
734 \ifx\m_syst_string_one\m_syst_string_two
735 \expandafter\firstoftwoarguments
736 \else
737 \expandafter\secondoftwoarguments
738 \fi}
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753\protected\def\doifelseempty#1
754 {\def\m_syst_string_one{#1}
755 \ifx\m_syst_string_one\empty
756 \expandafter\firstoftwoarguments
757 \else
758 \expandafter\secondoftwoarguments
759 \fi}
760
761\let\doifemptyelse\doifelseempty
762
763\protected\def\doifempty#1
764 {\def\m_syst_string_one{#1}
765 \ifx\m_syst_string_one\empty
766 \expandafter\firstofoneargument
767 \else
768 \expandafter\gobbleoneargument
769 \fi}
770
771\protected\def\doifnotempty#1
772 {\def\m_syst_string_one{#1}
773 \ifx\m_syst_string_one\empty
774 \expandafter\gobbleoneargument
775 \else
776 \expandafter\firstofoneargument
777 \fi}
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944\protected\def\doifelseinset#1#2{\clf_doifelseinset{#1}{#2}}
945\protected\def\doifinset #1#2{\clf_doifinset {#1}{#2}}
946\protected\def\doifnotinset #1#2{\clf_doifnotinset {#1}{#2}}
947
948
949\let\doifinsetelse\doifelseinset
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041\protected\def\doifelsecommon#1#2{\clf_doifelsecommon{#1}{#2}}
1042\protected\def\doifcommon #1#2{\clf_doifcommon {#1}{#2}}
1043\protected\def\doifnotcommon #1#2{\clf_doifnotcommon {#1}{#2}}
1044
1045\let\doifcommonelse\doifelsecommon
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079\newcount\commalevel
1080
1081\installsystemnamespace{nextcommalevel}
1082
1083\def\syst_helpers_do_do_do_process_comma_item
1084 {\csname\??nextcommalevel\the\commalevel\endcsname}
1085
1086
1087
1088 \def\syst_helpers_do_process_comma_item
1089 {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item}
1090
1091 \def\syst_helpers_do_do_process_comma_item
1092 {\ifx\nexttoken\blankspace
1093 \expandafter\syst_helpers_re_do_process_comma_item
1094 \else
1095 \expandafter\syst_helpers_do_do_process_comma_item_indeed
1096 \fi}
1097
1098 \def\syst_helpers_do_do_process_comma_item_indeed
1099 {\ifx\nexttoken]
1100 \expandafter\gobbleoneargument
1101 \else
1102 \expandafter\syst_helpers_do_do_do_process_comma_item
1103 \fi}
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115\protected\def\processcommalist[
1116 {\futurelet\nexttoken\syst_helpers_do_check_comma_item}
1117
1118\def\syst_helpers_do_check_comma_item
1119 {\ifx\nexttoken]
1120 \expandafter\gobblethreearguments
1121 \else
1122 \expandafter\syst_helpers_do_process_comma_list
1123 \fi
1124 \relax}
1125
1126
1127
1128
1129
1130
1131
1132
1133\def\syst_helpers_do_process_comma_list#1]#2
1134 {\global\advance\commalevel \plusone
1135 \expandafter\def\csname\??nextcommalevel\the\commalevel\endcsname##1,
1136 {#2{##1}\syst_helpers_do_process_comma_item}
1137 \syst_helpers_do_do_process_comma_item_gobble#1,]\relax
1138 \global\advance\commalevel \minusone }
1139
1140\def\syst_helpers_do_do_process_comma_item_gobble#1{\syst_helpers_do_do_process_comma_item}
1141
1142
1143
1144\protected\def\quitcommalist
1145 {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_comma_list}
1146
1147\def\syst_helpers_do_quit_comma_list#1]
1148 {\endgroup}
1149
1150\protected\def\quitprevcommalist
1151 {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_prev_comma_list}
1152
1153\def\syst_helpers_do_quit_prev_comma_list#1]
1154 {\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_comma_list}
1155
1156
1157
1158
1159
1160
1161 \let\next\:
1162
1163 \def\:{\syst_helpers_re_do_process_comma_item}
1164
1165 \expandafter\def\: {\futurelet\nexttoken\syst_helpers_do_do_process_comma_item}
1166
1167 \let\:\next
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\protected\def\processcommacommand[#1]
1202 {\normalexpanded{\processcommalist[#1]}}
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217\protected\def\processcommalistwithparameters[#1]#2
1218 {\def\syst_helpers_do_process_comma_list_with_parameters##1{#2[##1]}
1219 \processcommalist[#1]\syst_helpers_do_process_comma_list_with_parameters}
1220
1221
1222
1223
1224
1225
1226\let\syst_helpers_comma_list_step\relax
1227
1228\protected\def\startprocesscommalist[#1]#2\stopprocesscommalist
1229 {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}
1230 \processcommalist[#1]\syst_helpers_comma_list_step}
1231
1232\protected\def\startprocesscommacommand[#1]#2\stopprocesscommacommand
1233 {\def\syst_helpers_comma_list_step##1{\def\currentcommalistitem{##1}#2}
1234 \normalexpanded{\processcommalist[#1]}\syst_helpers_comma_list_step}
1235
1236\let\stopprocesscommalist \relax
1237\let\stopprocesscommacommand\relax
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
1268
1269
1270
1271
1272
1273
1274
1275
1276\newcount\processlevel
1277
1278
1279
1280\protected\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]
1281 {\edef\m_syst_string_two{#1}
1282 \ifx\m_syst_string_two\s!default
1283 \let\commalistelement\empty
1284 #2
1285 \fi}
1286
1287
1288
1289\protected\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]
1290 {\edef\m_syst_string_two{#1}
1291 \ifx\m_syst_string_one\m_syst_string_two
1292 \def\commalistelement{#3}
1293 #2
1294 \expandafter\quitcommalist
1295 \else\ifx\m_syst_string_two\s!unknown
1296 \def\commalistelement{#3}
1297 #2
1298 \fi\fi}
1299
1300\protected\def\processaction[#1]#2[
1301 {\edef\m_syst_string_one{#1}
1302 \ifx\m_syst_string_one\empty
1303 \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a
1304 \else
1305 \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_b
1306 \fi
1307 \edef\syst_helpers_do_process_action##1{\syst_helpers_do_compare_process_action[##1][#1]}
1308 \processnextcommalist\relax\relax\syst_helpers_do_process_action[}
1309
1310\protected\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]
1311 {\edef\m_syst_string_one{#1}
1312 \edef\m_syst_string_two{#3}
1313 \ifx\m_syst_string_one\m_syst_string_two
1314 \def\commalistelement{#3}
1315 #2
1316 \expandafter\quitprevcommalist
1317 \else
1318 \edef\m_syst_string_one{#1}
1319 \ifx\m_syst_string_one\s!unknown
1320 \def\commalistelement{#3}
1321 #2
1322 \fi
1323 \fi}
1324
1325\protected\def\processfirstactioninset[#1]
1326 {\edef\m_syst_string_one{#1}
1327 \ifx\m_syst_string_one\empty
1328 \expandafter\processaction
1329 \else
1330 \expandafter\syst_helpers_process_first_action_in_set_indeed
1331 \fi
1332 [#1]}
1333
1334\protected\def\syst_helpers_process_first_action_in_set_indeed[#1]#2[#3]
1335 {\def\syst_helpers_do_process_action##1
1336 {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_c[####1][##1]}
1337 \processcommalist[#3]\syst_helpers_do_do_process_action}
1338 \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_action}
1339
1340\protected\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]
1341 {\edef\m_syst_string_one{#1}
1342 \edef\m_syst_string_two{#3}
1343 \ifx\m_syst_string_one\m_syst_string_two
1344 \def\commalistelement{#3}
1345 #2
1346 \expandafter\quitcommalist
1347 \else
1348 \edef\m_syst_string_one{#1}
1349 \ifx\m_syst_string_one\s!unknown
1350 \def\commalistelement{#3}
1351 #2
1352 \fi
1353 \fi}
1354
1355\installsystemnamespace{nextactionlevel}
1356
1357\protected\def\syst_helpers_do_process_all_actions_in_set
1358 {\csname\??nextactionlevel\the\processlevel\endcsname}
1359
1360\protected\def\processallactionsinset[#1]
1361 {\edef\m_syst_string_one{#1}
1362 \ifx\m_syst_string_one\empty
1363 \expandafter\processaction
1364 \else
1365 \expandafter\syst_helpers_process_all_actions_in_set_indeed
1366 \fi
1367 [#1]}
1368
1369\protected\def\syst_helpers_process_all_actions_in_set_indeed[#1]#2[#3]
1370 {\advance\processlevel \plusone
1371 \expandafter\def\csname\??nextactionlevel\the\processlevel\endcsname##1
1372 {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_d[####1][##1]}
1373 \processcommalist[#3]\syst_helpers_do_do_process_action}
1374 \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_all_actions_in_set
1375 \advance\processlevel\minusone}
1376
1377
1378
1379\protected\def\processnextcommalist#1#2#3[#4#5]
1380 {#1
1381 \let\nexttoken#4
1382 \global\advance\commalevel \plusone
1383 \expandafter\def\csname\??nextcommalevel\the\commalevel\endcsname##1,
1384 {#3{##1}\syst_helpers_do_process_comma_item}
1385 \syst_helpers_do_do_process_comma_item#4#5,]\relax
1386 \global\advance\commalevel\minusone
1387 #2}
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402\let\firstcharacter \empty
1403\let\remainingcharacters\empty
1404
1405\protected\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}}
1406\protected\def\doifelsefirstchar #1#2{\clf_doifelsefirstchar{#1}{#2}}
1407\protected\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}}
1408\protected\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}}
1409
1410\let\doiffirstcharelse\doifelsefirstchar
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421\let\m_syst_sub_string\empty
1422
1423\protected\def\doifelseinstring#1
1424 {\edef\m_syst_sub_string{#1}
1425 \ifx\m_syst_sub_string\empty
1426 \expandafter\thirdofthreearguments
1427 \else
1428 \expandafter\syst_helpers_do_if_in_string_else_indeed
1429 \fi}
1430
1431\let\doifinstringelse\doifelseinstring
1432
1433\protected\def\syst_helpers_do_if_in_string_else_indeed#1
1434 {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}
1435 \expandafter\firstoftwoarguments
1436 \else
1437 \expandafter\secondoftwoarguments
1438 \fi}
1439
1440\protected\def\doifinstring#1
1441 {\edef\m_syst_sub_string{#1}
1442 \ifx\m_syst_sub_string\empty
1443 \expandafter\gobbletwoarguments
1444 \else
1445 \expandafter\syst_helpers_do_if_in_string_indeed
1446 \fi}
1447
1448\protected\def\syst_helpers_do_if_in_string_indeed#1
1449 {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}
1450 \expandafter\firstofoneargument
1451 \else
1452 \expandafter\gobbleoneargument
1453 \fi}
1454
1455\protected\def\doifnotinstring#1
1456 {\edef\m_syst_sub_string{#1}
1457 \ifx\m_syst_sub_string\empty
1458
1459 \expandafter\secondoftwoarguments
1460 \else
1461 \expandafter\syst_helpers_do_if_not_in_string_indeed
1462 \fi}
1463
1464\protected\def\syst_helpers_do_if_not_in_string_indeed#1
1465 {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}
1466 \expandafter\gobbleoneargument
1467 \else
1468 \expandafter\firstofoneargument
1469 \fi}
1470
1471
1472
1473\protected\def\syst_helpers_do_if_in_string_else#1#2
1474 {\expandafter\def\expandafter\syst_helpers_do_do_if_in_string_else
1475 \expandafter##\expandafter1#1##2##30004{\unless\if##2@}
1476 \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@0004}
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489\protected\def\syst_helpers_do_if_in_csname_else#1#2
1490 {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##30004
1491 {\unless\if##2@}
1492 \expandafter\syst_helpers_do_do_if_in_csname_else#2#1@@0004}
1493
1494\protected\def\doifelseincsname#1#2
1495 {\normalexpanded{\syst_helpers_do_if_in_csname_else{#1}}{#2}
1496 \expandafter\firstoftwoarguments
1497 \else
1498 \expandafter\secondoftwoarguments
1499 \fi}
1500
1501\let\doifincsnameelse\doifelseincsname
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517\def\doifelsenumber#1
1518 {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space
1519 \expandafter\secondoftwoarguments
1520 \else
1521 \expandafter\firstoftwoarguments
1522 \fi}
1523
1524\def\doifnumber#1
1525 {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space
1526 \expandafter\firstofoneargument
1527 \else
1528 \expandafter\gobbleoneargument
1529 \fi}
1530
1531\def\doifnotnumber#1
1532 {\ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi\space
1533 \expandafter\gobbleoneargument
1534 \else
1535 \expandafter\firstofoneargument
1536 \fi}
1537
1538\let\doifnumberelse\doifelsenumber
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549\def\percentdimen#1#2
1550 {\dimexpr\clf_percentageof{#2}\dimexpr#1\relax}
1551
1552\protected\def\setpercentdimen#1#2
1553 {#1=\clf_percentageof{#2}\dimexpr#1\relax}
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580\protected\def\makerawcommalist[#1]#2
1581 {\def\syst_helpers_do_make_raw_comma_list##1
1582 {\ifx#2\empty
1583 \def#2{##1}
1584 \else
1585 \expandafter\def\expandafter#2\expandafter{#2,##1}
1586 \fi}
1587 \let#2\empty
1588 \processcommalist[#1]\syst_helpers_do_make_raw_comma_list}
1589
1590\def\syst_helpers_raw_process_comma_item#1,#2
1591 {\if]#1\else
1592 \csname\??nextcommalevel\the\commalevel\endcsname{#1}
1593 \expandafter\syst_helpers_raw_process_comma_item
1594 \fi#2}
1595
1596\protected\def\rawprocesscommalist[#1]#2
1597 {\global\advance\commalevel \plusone
1598 \expandafter\let\csname\??nextcommalevel\the\commalevel\endcsname#2
1599 \expandafter\syst_helpers_raw_process_comma_item#1,],
1600 \global\advance\commalevel \minusone }
1601
1602\protected\def\rawprocesscommacommand[#1]
1603 {\normalexpanded{\rawprocesscommalist[#1]}}
1604
1605
1606
1607\protected\def\syst_helpers_fast_process_comma_item#1,#2
1608 {\if]#1\else
1609 \syst_helpers_fast_process_comma_command{#1}
1610 \expandafter\syst_helpers_fast_process_comma_item
1611 \fi#2}
1612
1613\protected\def\fastprocesscommalist[#1]#2
1614 {\let\syst_helpers_fast_process_comma_command#2
1615 \expandafter\syst_helpers_fast_process_comma_item#1,],}
1616
1617\protected\def\fastprocesscommacommand[#1]#2
1618 {\let\syst_helpers_fast_process_comma_command#2
1619 \normalexpanded{\syst_helpers_fast_process_comma_item#1},],}
1620
1621
1622
1623
1624\def\m_syst_two_commas{,,}
1625
1626\protected\def\rawdoifelseinset#1
1627 {\edef\m_syst_sub_string{,#1,}
1628 \ifx\m_syst_sub_string\m_syst_two_commas
1629 \expandafter\thirdofthreearguments
1630 \else
1631 \expandafter\syst_helpers_raw_do_if_in_set_else
1632 \fi}
1633
1634\let\rawdoifinsetelse\rawdoifelseinset
1635
1636\protected\def\syst_helpers_raw_do_if_in_set_else#1
1637 {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}
1638 \expandafter\firstoftwoarguments
1639 \else
1640 \expandafter\secondoftwoarguments
1641 \fi}
1642
1643\protected\def\rawdoifinset#1
1644 {\edef\m_syst_sub_string{,#1,}
1645 \ifx\m_syst_sub_string\m_syst_two_commas
1646 \expandafter\gobbletwoarguments
1647 \else
1648 \expandafter\syst_helpers_raw_do_if_in_set
1649 \fi}
1650
1651\protected\def\syst_helpers_raw_do_if_in_set#1
1652 {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}
1653 \expandafter\firstofoneargument
1654 \else
1655 \expandafter\gobbleoneargument
1656 \fi}
1657
1658
1659
1660\def\syst_helpers_do_raw_process_action[#1][#2]
1661 {\def\syst_helpers_do_do_raw_process_action##1,#1=>##2,##30004
1662 {\if##3@\else
1663 \def\m_syst_helpers_process_action{##2}
1664 \fi}
1665 \syst_helpers_do_do_raw_process_action,#2,#1=>,@0004}
1666
1667\protected\def\rawprocessaction[#1]#2[#3]
1668 {\edef\m_syst_string_one{#1}
1669 \edef\m_syst_string_two{undefined}
1670 \let\m_syst_helpers_process_action\m_syst_string_two
1671 \ifx\m_syst_string_one\empty
1672 \expandafter\syst_helpers_do_raw_process_action\expandafter[\s!default][#3]
1673 \else
1674 \expandafter\syst_helpers_do_raw_process_action\expandafter[\m_syst_string_one][#3]
1675 \ifx\m_syst_helpers_process_action\m_syst_string_two
1676 \expandafter\syst_helpers_do_raw_process_action\expandafter[\s!unknown][#3]
1677 \fi
1678 \fi
1679 \ifx\m_syst_helpers_process_action\m_syst_string_two
1680 \else
1681 \m_syst_helpers_process_action
1682 \fi}
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707\def\dosetvalue#1#2
1708 {\expandafter\def\csname#1#2\endcsname}
1709
1710\def\dosetevalue#1#2
1711 {\expandafter\edef\csname#1#2\endcsname}
1712
1713\def\dosetgvalue#1#2
1714 {\expandafter\gdef\csname#1#2\endcsname}
1715
1716\def\doresetvalue#1#2
1717 {\expandafter\let\csname#1#2\endcsname\empty}
1718
1719\def\doignorevalue#1#2#3
1720 {\expandafter\let\csname#1#2\endcsname\empty}
1721
1722\def\docopyvalue#1#2#3
1723 {\expandafter\def\csname#1#3\endcsname{\csname#2#3\endcsname}}
1724
1725
1726
1727\edef\m_syst_protected{\detokenize{protected}}
1728
1729\protected\def\aliasmacro#1#2
1730 {\doifinstring{\m_syst_protected}{\meaning#2}\protected
1731 \def#1{#2}}
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765\protected\def\showassignerror#1#2
1766 {\writestatus{setup}{missing or ungrouped = after #1 in line #2}}
1767
1768\protected\def\doassignempty[#1][#2=#3]
1769 {\ifcsname#1#2\endcsname\else\dosetvalue{#1}{#2}{#3}\fi}
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836\let\currentvalue\empty
1837
1838\protected\def\getparameters {\dogetparameters\dosetvalue}
1839\protected\def\geteparameters {\dogetparameters\dosetevalue}
1840\protected\def\getgparameters {\dogetparameters\dosetgvalue}
1841\protected\def\getxparameters {\dogetparameters\dosetxvalue}
1842\protected\def\forgetparameters{\dogetparameters\doignorevalue}
1843
1844\let\getexpandedparameters\geteparameters
1845
1846\protected\def\dogetparameters#1[#2]#3[#4
1847 {\if\noexpand#4]
1848 \expandafter\gobbleoneargument
1849 \else
1850 \let\setsomevalue#1
1851 \def\syst_helpers_get_parameters_assign{\syst_helpers_get_parameters_assign_indeed#2}
1852 \expandafter\syst_helpers_get_parameters
1853 \fi#4}
1854
1855\def\syst_helpers_get_parameters#1]
1856 {\xprocesscommaitem#1,],0004}
1857
1858\def\syst_helpers_process_comma_item#1,#2
1859 {\if,#1,
1860 \expandafter\syst_helpers_process_comma_item
1861 \else\if]#1
1862 \doubleexpandafter\gobbleoneargument
1863 \else
1864 \syst_helpers_get_parameters_assign0004#1==\empty0004
1865 \doubleexpandafter\syst_helpers_process_comma_item
1866 \fi\fi#2}
1867
1868\def\syst_helpers_assign_error#1#2#3
1869 {\showassignerror{#2}{\the\inputlineno\space(#1)}}
1870
1871\def\syst_helpers_get_parameters_assign_normal#10004#2=#3=#4#50004
1872 {\ifx\empty#2\empty
1873 \expandafter\syst_helpers_assign_error
1874 \else\ifx#4\empty
1875 \doubleexpandafter\syst_helpers_assign_error
1876 \else
1877 \doubleexpandafter\setsomevalue
1878 \fi\fi
1879 {#1}{#2}{#3}}
1880
1881\def\syst_helpers_get_parameters_assign_error#10004#2=#3=#4#50004
1882 {\ifx\empty#2\empty
1883 \expandafter\syst_helpers_assign_error
1884 \else\ifx#4\empty
1885 \doubleexpandafter\syst_helpers_assign_error
1886 \else
1887 \ifcsname#1#2\endcsname
1888 \expandafter\let\expandafter\currentvalue\csname#1#2\endcsname
1889 \else
1890 \let\currentvalue\empty
1891 \fi
1892 \doubleexpandafter\setsomevalue
1893 \fi\fi
1894 {#1}{#2}{#3}}
1895
1896\let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal
1897
1898\protected\def\doassign [#1][#2]{\let\setsomevalue\dosetvalue \syst_helpers_get_parameters_assign_indeed#10004#2==\empty0004}
1899\protected\def\doeassign [#1][#2]{\let\setsomevalue\dosetevalue \syst_helpers_get_parameters_assign_indeed#10004#2==\empty0004}
1900\protected\def\undoassign[#1][#2]{\let\setsomevalue\doresetvalue\syst_helpers_get_parameters_assign_indeed#10004#2==\empty0004}
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916\protected\def\processassignmentlist[#1]#2
1917 {\def\syst_helpers_process_assignment_entry##1{#2}
1918 \dogetparameters\syst_helpers_process_assignment_entry[][#1]}
1919
1920\protected\def\processassignmentcommand[#1]
1921 {\normalexpanded{\processassignmentlist[#1]}}
1922
1923\protected\def\startprocessassignmentlist[#1]#2\stopprocessassignmentlist
1924 {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}
1925 \processassignmentlist[#1]\currentassignmentlistcommand}
1926
1927\protected\def\startprocessassignmentcommand[#1]#2\stopprocessassignmentcommand
1928 {\def\currentassignmentlistcommand##1##2{\def\currentassignmentlistkey{##1}\def\currentassignmentlistvalue{##2}#2}
1929 \normalexpanded{\processassignmentlist[#1]}\currentassignmentlistcommand}
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965\def\syst_helpers_get_parameters_normal#1]
1966 {\syst_helpers_process_comma_item#1,],0004}
1967
1968\def\syst_helpers_get_parameters_expanded#1]
1969 {\let\dosetnvalue\setsomevalue
1970 \let\setsomevalue\dosetevalue
1971 \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_error
1972 \let\setsomevalue\dosetevalue
1973 \syst_helpers_process_comma_item#1,],0004
1974 \let\syst_helpers_get_parameters_assign_indeed\syst_helpers_get_parameters_assign_normal
1975 \let\setsomevalue\dosetnvalue
1976 \let\syst_helpers_get_parameters\syst_helpers_get_parameters_normal
1977 \let\currentvalue\empty}
1978
1979\let\syst_helpers_get_parameters\syst_helpers_get_parameters_normal
1980
1981\protected\def\expandparameters
1982 {\let\syst_helpers_get_parameters\syst_helpers_get_parameters_expanded}
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994\protected\def\getemptyparameters[#1]#2[#3]
1995 {\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}
1996 \processcommalist[#3]\syst_helpers_get_empty_parameters}
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027\protected\def\copyparameters[#1]#2[#3]#4[#5]
2028 {\doifnot{#1}{#3}
2029 {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#3}}
2030 \processcommalist[#5]\syst_helpers_copy_parameter}}
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045\newif\ifparameters
2046
2047\def\syst_helpers_check_parameters#1=#2#30004
2048 {\if#20003\parametersfalse\else\parameterstrue\fi}
2049
2050\protected\def\checkparameters[#1]
2051 {\syst_helpers_check_parameters#1=000300030004}
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080\newcount\commalistcounter
2081
2082\def\commalistsize{0}
2083
2084\def\syst_helpers_get_comma_list_size#1
2085 {\advance\commalistcounter\plusone}
2086
2087\protected\def\getcommalistsize#1]
2088 {\commalistcounter\zerocount
2089 \processcommalist#1]\syst_helpers_get_comma_list_size
2090 \edef\commalistsize{\the\commalistcounter}}
2091
2092
2093
2094
2095
2096
2097\protected\def\getcommacommandsize[#1]
2098 {\normalexpanded{\getcommalistsize[#1]}}
2099
2100\def\syst_helpers_get_from_comma_list#1
2101 {\advance\commalistcounter \minusone
2102 \ifcase\commalistcounter
2103 \def\commalistelement{#1}
2104 \expandafter\quitcommalist
2105 \fi}
2106
2107\protected\def\getfromcommalist[#1]#2[#3]
2108 {\let\commalistelement\empty
2109 \commalistcounter#3\relax
2110 \processcommalist[#1]\syst_helpers_get_from_comma_list}
2111
2112\protected\def\getfromcommacommand[#1]
2113 {\normalexpanded{\getfromcommalist[#1]}}
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147\def\syst_helpers_get_comma_list_element#1\from#2,#3,#4,#5,#6,#7,#8\to#9
2148 {\edef#9{\ifcase#1\relax\or#2\or#3\or#4\or#5\or#6\or#7\or#8\fi}}
2149
2150\def\dogetcommacommandelement#1\from#2\to
2151 {\expandafter\syst_helpers_get_comma_list_element\expandafter#1\expandafter\from#2,,,,,,\to}
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222\newif\iffirstargument
2223\newif\ifsecondargument
2224\newif\ifthirdargument
2225\newif\iffourthargument
2226\newif\iffifthargument
2227\newif\ifsixthargument
2228\newif\ifseventhargument
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293\newtoks\t_syst_aux
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336\def\syst_helpers_empty_spaced_six {\the\t_syst_aux[][][][][][] }
2337\def\syst_helpers_empty_normal_six {\the\t_syst_aux[][][][][][]}
2338\def\syst_helpers_empty_spaced_five {\the\t_syst_aux[][][][][] }
2339\def\syst_helpers_empty_normal_five {\the\t_syst_aux[][][][][]}
2340\def\syst_helpers_empty_spaced_four {\the\t_syst_aux[][][][] }
2341\def\syst_helpers_empty_normal_four {\the\t_syst_aux[][][][]}
2342\def\syst_helpers_empty_spaced_three{\the\t_syst_aux[][][] }
2343\def\syst_helpers_empty_normal_three{\the\t_syst_aux[][][]}
2344\def\syst_helpers_empty_spaced_two {\the\t_syst_aux[][] }
2345\def\syst_helpers_empty_normal_two {\the\t_syst_aux[][]}
2346\def\syst_helpers_empty_spaced_one {\the\t_syst_aux[] }
2347\def\syst_helpers_empty_normal_one {\the\t_syst_aux[]}
2348
2349\def\syst_helpers_single_empty_one_yes {\firstargumenttrue \the\t_syst_aux}
2350\def\syst_helpers_double_empty_two_yes {\secondargumenttrue \the\t_syst_aux}
2351\def\syst_helpers_triple_empty_three_yes {\thirdargumenttrue \the\t_syst_aux}
2352\def\syst_helpers_quadruple_empty_four_yes {\fourthargumenttrue \the\t_syst_aux}
2353\def\syst_helpers_quintuple_empty_five_yes {\fifthargumenttrue \the\t_syst_aux}
2354\def\syst_helpers_sixtuple_empty_six_yes {\sixthargumenttrue \the\t_syst_aux}
2355\def\syst_helpers_seventuple_empty_seven_yes{\seventhargumenttrue\the\t_syst_aux}
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369\protected\def\dosingleempty#1
2370 {
2371 \t_syst_aux{#1}
2372 \let\m_syst_action_yes\syst_helpers_single_empty_one_yes
2373 \let\m_syst_action_nop\syst_helpers_single_empty_one_nop
2374 \let\if_next_blank_space_token\iffalse
2375 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2376
2377\def\syst_helpers_single_empty_one_nop
2378 {\firstargumentfalse
2379 \the\t_syst_aux[]}
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411\protected\def\dodoubleempty#1
2412 {
2413 \t_syst_aux{#1}
2414 \let\m_syst_action_yes\syst_helpers_double_empty_one_yes
2415 \let\m_syst_action_nop\syst_helpers_double_empty_one_nop
2416 \let\if_next_blank_space_token\iffalse
2417 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2418
2419\def\syst_helpers_double_empty_one_yes[#1]
2420 {\firstargumenttrue
2421 \toksapp\t_syst_aux{[{#1}]}
2422 \let\m_syst_action_yes\syst_helpers_double_empty_two_yes
2423 \let\m_syst_action_nop\syst_helpers_double_empty_two_nop
2424 \let\if_next_blank_space_token\iffalse
2425 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2426
2427\def\syst_helpers_double_empty_one_nop
2428 {\firstargumentfalse
2429 \secondargumentfalse
2430 \the\t_syst_aux[][]}
2431
2432\def\syst_helpers_double_empty_two_nop
2433 {\secondargumentfalse
2434 \if_next_blank_space_token
2435 \expandafter\syst_helpers_empty_spaced_one
2436 \else
2437 \expandafter\syst_helpers_empty_normal_one
2438 \fi}
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488\protected\def\dotripleempty#1
2489 {
2490 \t_syst_aux{#1}
2491 \let\m_syst_action_yes\syst_helpers_triple_empty_one_yes
2492 \let\m_syst_action_nop\syst_helpers_triple_empty_one_nop
2493 \let\if_next_blank_space_token\iffalse
2494 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2495
2496\def\syst_helpers_triple_empty_one_yes[#1]
2497 {\firstargumenttrue
2498 \toksapp\t_syst_aux{[{#1}]}
2499 \let\m_syst_action_yes\syst_helpers_triple_empty_two_yes
2500 \let\m_syst_action_nop\syst_helpers_triple_empty_two_nop
2501 \let\if_next_blank_space_token\iffalse
2502 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2503
2504\def\syst_helpers_triple_empty_two_yes[#1]
2505 {\secondargumenttrue
2506 \toksapp\t_syst_aux{[{#1}]}
2507 \let\m_syst_action_yes\syst_helpers_triple_empty_three_yes
2508 \let\m_syst_action_nop\syst_helpers_triple_empty_three_nop
2509 \let\if_next_blank_space_token\iffalse
2510 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2511
2512\def\syst_helpers_triple_empty_one_nop
2513 {\firstargumentfalse
2514 \secondargumentfalse
2515 \thirdargumentfalse
2516 \the\t_syst_aux[][][]}
2517
2518\def\syst_helpers_triple_empty_two_nop
2519 {\secondargumentfalse
2520 \thirdargumentfalse
2521 \if_next_blank_space_token
2522 \expandafter\syst_helpers_empty_spaced_two
2523 \else
2524 \expandafter\syst_helpers_empty_normal_two
2525 \fi}
2526
2527\def\syst_helpers_triple_empty_three_nop
2528 {\thirdargumentfalse
2529 \if_next_blank_space_token
2530 \expandafter\syst_helpers_empty_spaced_one
2531 \else
2532 \expandafter\syst_helpers_empty_normal_one
2533 \fi}
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602\protected\def\doquadrupleempty#1
2603 {
2604 \t_syst_aux{#1}
2605 \let\m_syst_action_yes\syst_helpers_quadruple_empty_one_yes
2606 \let\m_syst_action_nop\syst_helpers_quadruple_empty_one_nop
2607 \let\if_next_blank_space_token\iffalse
2608 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2609
2610\def\syst_helpers_quadruple_empty_one_yes[#1]
2611 {\firstargumenttrue
2612 \toksapp\t_syst_aux{[{#1}]}
2613 \let\m_syst_action_yes\syst_helpers_quadruple_empty_two_yes
2614 \let\m_syst_action_nop\syst_helpers_quadruple_empty_two_nop
2615 \let\if_next_blank_space_token\iffalse
2616 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2617
2618\def\syst_helpers_quadruple_empty_two_yes[#1]
2619 {\secondargumenttrue
2620 \toksapp\t_syst_aux{[{#1}]}
2621 \let\m_syst_action_yes\syst_helpers_quadruple_empty_three_yes
2622 \let\m_syst_action_nop\syst_helpers_quadruple_empty_three_nop
2623 \let\if_next_blank_space_token\iffalse
2624 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2625
2626\def\syst_helpers_quadruple_empty_three_yes[#1]
2627 {\thirdargumenttrue
2628 \toksapp\t_syst_aux{[{#1}]}
2629 \let\m_syst_action_yes\syst_helpers_quadruple_empty_four_yes
2630 \let\m_syst_action_nop\syst_helpers_quadruple_empty_four_nop
2631 \let\if_next_blank_space_token\iffalse
2632 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2633
2634\def\syst_helpers_quadruple_empty_one_nop
2635 {\firstargumentfalse
2636 \secondargumentfalse
2637 \thirdargumentfalse
2638 \fourthargumentfalse
2639 \the\t_syst_aux[][][][]}
2640
2641\def\syst_helpers_quadruple_empty_two_nop
2642 {\secondargumentfalse
2643 \thirdargumentfalse
2644 \fourthargumentfalse
2645 \if_next_blank_space_token
2646 \expandafter\syst_helpers_empty_spaced_three
2647 \else
2648 \expandafter\syst_helpers_empty_normal_three
2649 \fi}
2650
2651\def\syst_helpers_quadruple_empty_three_nop
2652 {\thirdargumentfalse
2653 \fourthargumentfalse
2654 \if_next_blank_space_token
2655 \expandafter\syst_helpers_empty_spaced_two
2656 \else
2657 \expandafter\syst_helpers_empty_normal_two
2658 \fi}
2659
2660\def\syst_helpers_quadruple_empty_four_nop
2661 {\fourthargumentfalse
2662 \if_next_blank_space_token
2663 \expandafter\syst_helpers_empty_spaced_one
2664 \else
2665 \expandafter\syst_helpers_empty_normal_one
2666 \fi}
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755\protected\def\doquintupleempty#1
2756 {
2757 \t_syst_aux{#1}
2758 \let\m_syst_action_yes\syst_helpers_quintuple_empty_one_yes
2759 \let\m_syst_action_nop\syst_helpers_quintuple_empty_one_nop
2760 \let\if_next_blank_space_token\iffalse
2761 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2762
2763\def\syst_helpers_quintuple_empty_one_yes[#1]
2764 {\firstargumenttrue
2765 \toksapp\t_syst_aux{[{#1}]}
2766 \let\m_syst_action_yes\syst_helpers_quintuple_empty_two_yes
2767 \let\m_syst_action_nop\syst_helpers_quintuple_empty_two_nop
2768 \let\if_next_blank_space_token\iffalse
2769 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2770
2771\def\syst_helpers_quintuple_empty_two_yes[#1]
2772 {\secondargumenttrue
2773 \toksapp\t_syst_aux{[{#1}]}
2774 \let\m_syst_action_yes\syst_helpers_quintuple_empty_three_yes
2775 \let\m_syst_action_nop\syst_helpers_quintuple_empty_three_nop
2776 \let\if_next_blank_space_token\iffalse
2777 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2778
2779\def\syst_helpers_quintuple_empty_three_yes[#1]
2780 {\thirdargumenttrue
2781 \toksapp\t_syst_aux{[{#1}]}
2782 \let\m_syst_action_yes\syst_helpers_quintuple_empty_four_yes
2783 \let\m_syst_action_nop\syst_helpers_quintuple_empty_four_nop
2784 \let\if_next_blank_space_token\iffalse
2785 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2786
2787\def\syst_helpers_quintuple_empty_four_yes[#1]
2788 {\fourthargumenttrue
2789 \toksapp\t_syst_aux{[{#1}]}
2790 \let\m_syst_action_yes\syst_helpers_quintuple_empty_five_yes
2791 \let\m_syst_action_nop\syst_helpers_quintuple_empty_five_nop
2792 \let\if_next_blank_space_token\iffalse
2793 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2794
2795\def\syst_helpers_quintuple_empty_one_nop
2796 {\firstargumentfalse
2797 \secondargumentfalse
2798 \thirdargumentfalse
2799 \fourthargumentfalse
2800 \fifthargumentfalse
2801 \the\t_syst_aux[][][][][]}
2802
2803\def\syst_helpers_quintuple_empty_two_nop
2804 {\secondargumentfalse
2805 \thirdargumentfalse
2806 \fourthargumentfalse
2807 \fifthargumentfalse
2808 \if_next_blank_space_token
2809 \expandafter\syst_helpers_empty_spaced_four
2810 \else
2811 \expandafter\syst_helpers_empty_normal_four
2812 \fi}
2813
2814\def\syst_helpers_quintuple_empty_three_nop
2815 {\thirdargumentfalse
2816 \fourthargumentfalse
2817 \fifthargumentfalse
2818 \if_next_blank_space_token
2819 \expandafter\syst_helpers_empty_spaced_three
2820 \else
2821 \expandafter\syst_helpers_empty_normal_three
2822 \fi}
2823
2824\def\syst_helpers_quintuple_empty_four_nop
2825 {\fourthargumentfalse
2826 \fifthargumentfalse
2827 \if_next_blank_space_token
2828 \expandafter\syst_helpers_empty_spaced_two
2829 \else
2830 \expandafter\syst_helpers_empty_normal_two
2831 \fi}
2832
2833\def\syst_helpers_quintuple_empty_five_nop
2834 {\fifthargumentfalse
2835 \if_next_blank_space_token
2836 \expandafter\syst_helpers_empty_spaced_one
2837 \else
2838 \expandafter\syst_helpers_empty_normal_one
2839 \fi}
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949\protected\def\dosixtupleempty#1
2950 {
2951 \t_syst_aux{#1}
2952 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_one_yes
2953 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_one_nop
2954 \let\if_next_blank_space_token\iffalse
2955 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2956
2957\def\syst_helpers_sixtuple_empty_one_yes[#1]
2958 {\firstargumenttrue
2959 \toksapp\t_syst_aux{[{#1}]}
2960 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_two_yes
2961 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_two_nop
2962 \let\if_next_blank_space_token\iffalse
2963 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2964
2965\def\syst_helpers_sixtuple_empty_two_yes[#1]
2966 {\secondargumenttrue
2967 \toksapp\t_syst_aux{[{#1}]}
2968 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_three_yes
2969 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_three_nop
2970 \let\if_next_blank_space_token\iffalse
2971 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2972
2973\def\syst_helpers_sixtuple_empty_three_yes[#1]
2974 {\thirdargumenttrue
2975 \toksapp\t_syst_aux{[{#1}]}
2976 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_four_yes
2977 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_four_nop
2978 \let\if_next_blank_space_token\iffalse
2979 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2980
2981\def\syst_helpers_sixtuple_empty_four_yes[#1]
2982 {\fourthargumenttrue
2983 \toksapp\t_syst_aux{[{#1}]}
2984 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_five_yes
2985 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_five_nop
2986 \let\if_next_blank_space_token\iffalse
2987 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2988
2989\def\syst_helpers_sixtuple_empty_five_yes[#1]
2990 {\fifthargumenttrue
2991 \toksapp\t_syst_aux{[{#1}]}
2992 \let\m_syst_action_yes\syst_helpers_sixtuple_empty_six_yes
2993 \let\m_syst_action_nop\syst_helpers_sixtuple_empty_six_nop
2994 \let\if_next_blank_space_token\iffalse
2995 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
2996
2997\def\syst_helpers_sixtuple_empty_one_nop
2998 {\firstargumentfalse
2999 \secondargumentfalse
3000 \thirdargumentfalse
3001 \fourthargumentfalse
3002 \fifthargumentfalse
3003 \sixthargumentfalse
3004 \the\t_syst_aux[][][][][][]}
3005
3006\def\syst_helpers_sixtuple_empty_two_nop
3007 {\secondargumentfalse
3008 \thirdargumentfalse
3009 \fourthargumentfalse
3010 \fifthargumentfalse
3011 \sixthargumentfalse
3012 \if_next_blank_space_token
3013 \expandafter\syst_helpers_empty_spaced_five
3014 \else
3015 \expandafter\syst_helpers_empty_normal_five
3016 \fi}
3017
3018\def\syst_helpers_sixtuple_empty_three_nop
3019 {\thirdargumentfalse
3020 \fourthargumentfalse
3021 \fifthargumentfalse
3022 \sixthargumentfalse
3023 \if_next_blank_space_token
3024 \expandafter\syst_helpers_empty_spaced_four
3025 \else
3026 \expandafter\syst_helpers_empty_normal_four
3027 \fi}
3028
3029\def\syst_helpers_sixtuple_empty_four_nop
3030 {\fourthargumentfalse
3031 \fifthargumentfalse
3032 \sixthargumentfalse
3033 \if_next_blank_space_token
3034 \expandafter\syst_helpers_empty_spaced_three
3035 \else
3036 \expandafter\syst_helpers_empty_normal_three
3037 \fi}
3038
3039\def\syst_helpers_sixtuple_empty_five_nop
3040 {\fifthargumentfalse
3041 \sixthargumentfalse
3042 \if_next_blank_space_token
3043 \expandafter\syst_helpers_empty_spaced_two
3044 \else
3045 \expandafter\syst_helpers_empty_normal_two
3046 \fi}
3047
3048\def\syst_helpers_sixtuple_empty_six_nop
3049 {\sixthargumentfalse
3050 \if_next_blank_space_token
3051 \expandafter\syst_helpers_empty_spaced_one
3052 \else
3053 \expandafter\syst_helpers_empty_normal_one
3054 \fi}
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186\protected\def\doseventupleempty#1
3187 {
3188 \t_syst_aux{#1}
3189 \let\m_syst_action_yes\syst_helpers_seventuple_empty_one_yes
3190 \let\m_syst_action_nop\syst_helpers_seventuple_empty_one_nop
3191 \let\if_next_blank_space_token\iffalse
3192 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3193
3194\def\syst_helpers_seventuple_empty_one_yes[#1]
3195 {\firstargumenttrue
3196 \toksapp\t_syst_aux{[{#1}]}
3197 \let\m_syst_action_yes\syst_helpers_seventuple_empty_two_yes
3198 \let\m_syst_action_nop\syst_helpers_seventuple_empty_two_nop
3199 \let\if_next_blank_space_token\iffalse
3200 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3201
3202\def\syst_helpers_seventuple_empty_two_yes[#1]
3203 {\secondargumenttrue
3204 \toksapp\t_syst_aux{[{#1}]}
3205 \let\m_syst_action_yes\syst_helpers_seventuple_empty_three_yes
3206 \let\m_syst_action_nop\syst_helpers_seventuple_empty_three_nop
3207 \let\if_next_blank_space_token\iffalse
3208 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3209
3210\def\syst_helpers_seventuple_empty_three_yes[#1]
3211 {\thirdargumenttrue
3212 \toksapp\t_syst_aux{[{#1}]}
3213 \let\m_syst_action_yes\syst_helpers_seventuple_empty_four_yes
3214 \let\m_syst_action_nop\syst_helpers_seventuple_empty_four_nop
3215 \let\if_next_blank_space_token\iffalse
3216 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3217
3218\def\syst_helpers_seventuple_empty_four_yes[#1]
3219 {\fourthargumenttrue
3220 \toksapp\t_syst_aux{[{#1}]}
3221 \let\m_syst_action_yes\syst_helpers_seventuple_empty_five_yes
3222 \let\m_syst_action_nop\syst_helpers_seventuple_empty_five_nop
3223 \let\if_next_blank_space_token\iffalse
3224 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3225
3226\def\syst_helpers_seventuple_empty_five_yes[#1]
3227 {\fifthargumenttrue
3228 \toksapp\t_syst_aux{[{#1}]}
3229 \let\m_syst_action_yes\syst_helpers_seventuple_empty_six_yes
3230 \let\m_syst_action_nop\syst_helpers_seventuple_empty_six_nop
3231 \let\if_next_blank_space_token\iffalse
3232 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3233
3234\def\syst_helpers_seventuple_empty_six_yes[#1]
3235 {\sixthargumenttrue
3236 \toksapp\t_syst_aux{[{#1}]}
3237 \let\m_syst_action_yes\syst_helpers_seventuple_empty_seven_yes
3238 \let\m_syst_action_nop\syst_helpers_seventuple_empty_seven_nop
3239 \let\if_next_blank_space_token\iffalse
3240 \futurelet\nexttoken\syst_helpers_inspect_next_optional_character}
3241
3242\def\syst_helpers_seventuple_empty_one_nop
3243 {\firstargumentfalse
3244 \secondargumentfalse
3245 \thirdargumentfalse
3246 \fourthargumentfalse
3247 \fifthargumentfalse
3248 \sixthargumentfalse
3249 \seventhargumentfalse
3250 \the\t_syst_aux[][][][][][][]}
3251
3252\def\syst_helpers_seventuple_empty_two_nop
3253 {\secondargumentfalse
3254 \thirdargumentfalse
3255 \fourthargumentfalse
3256 \fifthargumentfalse
3257 \sixthargumentfalse
3258 \seventhargumentfalse
3259 \if_next_blank_space_token
3260 \expandafter\syst_helpers_empty_spaced_six
3261 \else
3262 \expandafter\syst_helpers_empty_normal_six
3263 \fi}
3264
3265\def\syst_helpers_seventuple_empty_three_nop
3266 {\thirdargumentfalse
3267 \fourthargumentfalse
3268 \fifthargumentfalse
3269 \sixthargumentfalse
3270 \seventhargumentfalse
3271 \if_next_blank_space_token
3272 \expandafter\syst_helpers_empty_spaced_five
3273 \else
3274 \expandafter\syst_helpers_empty_normal_five
3275 \fi}
3276
3277\def\syst_helpers_seventuple_empty_four_nop
3278 {\fourthargumentfalse
3279 \fifthargumentfalse
3280 \sixthargumentfalse
3281 \seventhargumentfalse
3282 \if_next_blank_space_token
3283 \expandafter\syst_helpers_empty_spaced_four
3284 \else
3285 \expandafter\syst_helpers_empty_normal_four
3286 \fi}
3287
3288\def\syst_helpers_seventuple_empty_five_nop
3289 {\fifthargumentfalse
3290 \sixthargumentfalse
3291 \seventhargumentfalse
3292 \if_next_blank_space_token
3293 \expandafter\syst_helpers_empty_spaced_three
3294 \else
3295 \expandafter\syst_helpers_empty_normal_three
3296 \fi}
3297
3298\def\syst_helpers_seventuple_empty_six_nop
3299 {\sixthargumentfalse
3300 \seventhargumentfalse
3301 \if_next_blank_space_token
3302 \expandafter\syst_helpers_empty_spaced_two
3303 \else
3304 \expandafter\syst_helpers_empty_normal_two
3305 \fi}
3306
3307\def\syst_helpers_seventuple_empty_seven_nop
3308 {\seventhargumentfalse
3309 \if_next_blank_space_token
3310 \expandafter\syst_helpers_empty_spaced_one
3311 \else
3312 \expandafter\syst_helpers_empty_normal_one
3313 \fi}
3314
3315
3316
3317\let\dosingleargument \dosingleempty
3318\let\dodoubleargument \dodoubleempty
3319\let\dotripleargument \dotripleempty
3320\let\doquadrupleargument \doquadrupleempty
3321\let\doquintupleargument \doquintupleempty
3322\let\dosixtupleargument \dosixtupleempty
3323\let\doseventupleargument\doseventupleempty
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339\let\strippedcsname\csstring
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380\protected\def\complexorsimple#1
3381 {
3382 \doifelsenextoptional
3383 {\firstargumenttrue \csname\s!complex\csstring#1\endcsname}
3384 {\firstargumentfalse\csname\s!simple \csstring#1\endcsname}}
3385
3386\protected\def\complexorsimpleempty#1
3387 {
3388 \doifelsenextoptional
3389 {\firstargumenttrue \csname\s!complex\csstring#1\endcsname}
3390 {\firstargumentfalse\csname\s!complex\csstring#1\endcsname[]}}
3391
3392
3393
3394
3395
3396
3397
3398\protected\def\syst_helpers_complex_or_simple#1#2
3399 {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#2}}
3400
3401\protected\def\syst_helpers_complex_or_simple_empty#1
3402 {\doifelsenextoptional{\firstargumenttrue#1}{\firstargumentfalse#1[]}}
3403
3404\protected\def\definecomplexorsimple#1
3405 {\protected\edef#1{\syst_helpers_complex_or_simple
3406 \expandafter\noexpand\csname\s!complex\csstring#1\endcsname
3407 \expandafter\noexpand\csname\s!simple \csstring#1\endcsname}}
3408
3409\protected\def\definecomplexorsimpleempty#1
3410 {\protected\edef#1{\syst_helpers_complex_or_simple_empty
3411 \expandafter\noexpand\csname\s!complex\csstring#1\endcsname}}
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446\newconditional\c_syst_helpers_permit_spaces_between_groups
3447
3448\protected\def \permitspacesbetweengroups{\settrue \c_syst_helpers_permit_spaces_between_groups}
3449\protected\def\dontpermitspacesbetweengroups{\setfalse\c_syst_helpers_permit_spaces_between_groups}
3450
3451\dontpermitspacesbetweengroups
3452
3453
3454
3455
3456
3457
3458\protected\def\syst_helpers_get_grouped_argument#1#2
3459 {\let\syst_helpers_get_grouped_argument_yes#1
3460 \let\syst_helpers_get_grouped_argument_nop#2
3461 \futurelet\nextargument\syst_helpers_get_grouped_argument_indeed}
3462
3463\def\syst_helpers_get_grouped_argument_indeed
3464 {\ifx\nextargument\bgroup
3465 \expandafter\syst_helpers_get_grouped_argument_a
3466 \else
3467 \expandafter\syst_helpers_get_grouped_argument_b
3468 \fi}
3469
3470\def\syst_helpers_get_grouped_argument_a
3471 {
3472 \syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nested}
3473
3474\def\syst_helpers_get_grouped_argument_b
3475 {\ifconditional\c_syst_helpers_permit_spaces_between_groups
3476 \expandafter\syst_helpers_get_grouped_argument_f
3477 \else
3478 \expandafter\syst_helpers_get_grouped_argument_d
3479 \fi}
3480
3481\def\syst_helpers_get_grouped_argument_d
3482 {
3483 \syst_helpers_get_grouped_argument_nop\syst_helpers_get_grouped_argument_nested{}}
3484
3485\begingroup
3486 \def\\ {\syst_helpers_get_grouped_argument\syst_helpers_get_grouped_argument_yes\syst_helpers_get_grouped_argument_nop}
3487 \glet\syst_helpers_get_grouped_argument_e\\
3488\endgroup
3489
3490\def\syst_helpers_get_grouped_argument_f
3491 {\ifx\nextargument\blankspace
3492 \expandafter\syst_helpers_get_grouped_argument_e
3493 \else
3494 \expandafter\syst_helpers_get_grouped_argument_d
3495 \fi}
3496
3497\protected\def\dosinglegroupempty#1
3498 {\def\syst_helpers_get_grouped_argument_nested
3499 {\dontpermitspacesbetweengroups
3500 #1}
3501 \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse}
3502
3503\protected\def\dodoublegroupempty#1
3504 {\def\syst_helpers_get_grouped_argument_nested##1
3505 {\def\syst_helpers_get_grouped_argument_nested
3506 {\dontpermitspacesbetweengroups
3507 #1{##1}}
3508 \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}
3509 \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse}
3510
3511\protected\def\dotriplegroupempty#1
3512 {\def\syst_helpers_get_grouped_argument_nested##1
3513 {\def\syst_helpers_get_grouped_argument_nested####1
3514 {\def\syst_helpers_get_grouped_argument_nested
3515 {\dontpermitspacesbetweengroups
3516 #1{##1}{####1}}
3517 \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}
3518 \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}
3519 \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse}
3520
3521\protected\def\doquadruplegroupempty#1
3522 {\def\syst_helpers_get_grouped_argument_nested##1
3523 {\def\syst_helpers_get_grouped_argument_nested####1
3524 {\def\syst_helpers_get_grouped_argument_nested########1
3525 {\def\syst_helpers_get_grouped_argument_nested
3526 {\dontpermitspacesbetweengroups
3527 #1{##1}{####1}{########1}}
3528 \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}
3529 \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}
3530 \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}
3531 \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse}
3532
3533\protected\def\doquintuplegroupempty#1
3534 {\def\syst_helpers_get_grouped_argument_nested##1
3535 {\def\syst_helpers_get_grouped_argument_nested####1
3536 {\def\syst_helpers_get_grouped_argument_nested########1
3537 {\def\syst_helpers_get_grouped_argument_nested################1
3538 {\def\syst_helpers_get_grouped_argument_nested
3539 {\dontpermitspacesbetweengroups
3540 #1{##1}{####1}{########1}{################1}}
3541 \syst_helpers_get_grouped_argument\fifthargumenttrue\fifthargumentfalse}
3542 \syst_helpers_get_grouped_argument\fourthargumenttrue\fourthargumentfalse}
3543 \syst_helpers_get_grouped_argument\thirdargumenttrue\thirdargumentfalse}
3544 \syst_helpers_get_grouped_argument\secondargumenttrue\secondargumentfalse}
3545 \syst_helpers_get_grouped_argument\firstargumenttrue\firstargumentfalse}
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574\def\firstofoneargument #1{#1}
3575
3576\def\firstoftwoarguments #1#2{#1}
3577\def\secondoftwoarguments #1#2{#2}
3578
3579\def\firstofthreearguments #1#2#3{#1}
3580\def\secondofthreearguments #1#2#3{#2}
3581\def\thirdofthreearguments #1#2#3{#3}
3582
3583\def\firstoffourarguments #1#2#3#4{#1}
3584\def\secondoffourarguments #1#2#3#4{#2}
3585\def\thirdoffourarguments #1#2#3#4{#3}
3586\def\fourthoffourarguments #1#2#3#4{#4}
3587
3588\def\firstoffivearguments #1#2#3#4#5{#1}
3589\def\secondoffivearguments #1#2#3#4#5{#2}
3590\def\thirdoffivearguments #1#2#3#4#5{#3}
3591\def\fourthoffivearguments #1#2#3#4#5{#4}
3592\def\fifthoffivearguments #1#2#3#4#5{#5}
3593
3594\def\firstofsixarguments #1#2#3#4#5#6{#1}
3595\def\secondofsixarguments#1#2#3#4#5#6{#2}
3596\def\thirdofsixarguments #1#2#3#4#5#6{#3}
3597\def\fourthofsixarguments#1#2#3#4#5#6{#4}
3598\def\fifthofsixarguments #1#2#3#4#5#6{#5}
3599\def\sixthofsixarguments #1#2#3#4#5#6{#6}
3600
3601\protected\def\firstofoneunexpanded #1{#1}
3602
3603\protected\def\firstoftwounexpanded #1#2{#1}
3604\protected\def\secondoftwounexpanded #1#2{#2}
3605
3606\protected\def\firstofthreeunexpanded #1#2#3{#1}
3607\protected\def\secondofthreeunexpanded#1#2#3{#2}
3608\protected\def\thirdofthreeunexpanded #1#2#3{#3}
3609
3610
3611
3612
3613
3614
3615
3616
3617\protected\def\letempty #1{\let #1\empty}
3618\protected\def\globalletempty#1{\glet#1\empty}
3619
3620\protected\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty}
3621\protected\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty}
3622\protected\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax}
3623\protected\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax}
3624
3625\protected\def\relaxvalueifundefined#1
3626 {\ifcsname#1\endcsname \else
3627 \expandafter\let\csname#1\endcsname\relax
3628 \fi}
3629
3630
3631
3632
3633
3634
3635
3636\protected\def\wait
3637 {\begingroup
3638 \read16 to \wait
3639 \endgroup}
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658\setnewconstant\statuswidth 15
3659\setnewconstant\statuswrite 128
3660
3661\ifdefined\writestring \else
3662
3663 \protected\def\writestring{\immediate\write\statuswrite}
3664 \protected\def\writeline {\writestring{}}
3665
3666\fi
3667
3668\protected\def\normalwritestatus#1#2
3669 {\writestring{\expandafter\syst_helpers_split_status_yes\expandafter\statuswidth#1
3670 \space\space\space\space\space\space\space
3671 \space\space\space\space\space\space\space
3672 \space\space\space\space\space\space\end
3673 \space:\space#2}}
3674
3675\def\syst_helpers_split_status_yes#1#2
3676 {\ifcase#1 \expandafter\syst_helpers_split_status_nop\fi#2
3677 \expandafter\syst_helpers_split_status_yes\expandafter{\the\numexpr#1\minusone\relax}}
3678
3679\def\syst_helpers_split_status_nop#1\end
3680 {}
3681
3682
3683
3684
3685
3686
3687\let\immediatemessage\clf_immediatemessage
3688
3689
3690
3691
3692
3693
3694\protected\def\rawsetparameter#1=#2,
3695 {\if]#1\else
3696 \expandafter\def\csname\rawparameterprefix#1\endcsname{#2}
3697 \expandafter\rawsetparameter
3698 \fi}
3699
3700\protected\def\rawgetparameters[#1][#2
3701 {\ifx#2]
3702 \expandafter\gobbleoneargument
3703 \else
3704 \def\rawparameterprefix{#1}
3705 \expandafter\dorawgetparameters
3706 \fi#2}
3707
3708\def\dorawgetparameters#1]
3709 {\expandafter\rawsetparameter#1,]=,}
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721\protected\def\resetglobal
3722 {\let\redoglobal\relax
3723 \let\dodoglobal\relax}
3724
3725\resetglobal
3726
3727\protected\def\doglobal
3728 {\ifx\redoglobal\relax
3729 \let\redoglobal\global
3730 \let\dodoglobal\syst_helpers_dodo_global
3731 \fi}
3732
3733\def\syst_helpers_dodo_global
3734 {\resetglobal\global}
3735
3736\def\saveglobal
3737 {\let\syst_helpers_dodo_global\dodoglobal
3738 \let\syst_helpers_redo_global\redoglobal}
3739
3740\def\restoreglobal
3741 {\let\redoglobal\syst_helpers_redo_global
3742 \let\dodoglobal\syst_helpers_dodo_global}
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773\protected\def\newif#1
3774 {\let\new_if_saved\newif
3775 \let\newif\new_if_check
3776 \expandafter\redoglobal\expandafter\def\csname\expandafter\newif\csstring#1true\endcsname {\let#1\iftrue }
3777 \expandafter\redoglobal\expandafter\def\csname\expandafter\newif\csstring#1false\endcsname{\let#1\iffalse}
3778 \dodoglobal\csname\expandafter\newif\csstring#1false\endcsname
3779 \let\newif\new_if_saved}
3780
3781
3782
3783\protected\def\define#1
3784 {\ifdefined#1
3785 \message{[\noexpand#1is already defined]}
3786 \protected\expandafter\def\expandafter\gobbleddefinition
3787 \else
3788 \protected\expandafter\def
3789 \fi#1}
3790
3791\protected\def\redefine#1
3792 {\ifdefined#1
3793 \message{[\noexpand#1is redefined]}
3794 \fi
3795 \protected\def#1}
3796
3797\protected\def\definemacro#1
3798 {\ifdefined#1
3799 \message{[\noexpand#1is already defined]}
3800 \protected\expandafter\def\expandafter\gobbleddefinition
3801 \else
3802 \protected\expandafter\def
3803 \fi#1}
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827\def\s!unexpanded{unexpanded}
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905\bgroup \obeylines
3906
3907\glet\stoptexdefinition\relax
3908
3909\protected\gdef\starttexdefinition
3910 {\bgroup
3911 \obeylines
3912 \syst_helpers_start_tex_definition}
3913
3914\gdef\syst_helpers_start_tex_definition#1
3915 {\catcode\endoflineasciicode\ignorecatcode
3916 \clf_texdefinition_one{#1}}
3917
3918\gdef\dostarttexdefinition#1\stoptexdefinition
3919 {\egroup
3920 \clf_texdefinition_two{#1}}
3921
3922\egroup
3923
3924
3925
3926\protected\def\texdefinition#1{\begincsname#1\endcsname}
3927
3928
3929
3930\protected\def\starttexcode{\unprotect}
3931\protected\def\stoptexcode {\protect}
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984\def\zerocountervalue{0}
3985
3986\protected\def\newcounter#1
3987 {\dodoglobal\let#1\zerocountervalue}
3988
3989
3990
3991\def\syst_helpers_do_increment#1{\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi\plusone \relax}}
3992\def\syst_helpers_do_decrement#1{\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi\minusone\relax}}
3993
3994\def\syst_helpers_do_do_do_increment#1,#2){\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi#2\relax}}
3995\def\syst_helpers_do_do_do_decrement#1,#2){\dodoglobal\edef#1{\the\numexpr\ifdefined#1\ifx#1\relax\else#1\fi\fi#2\relax}}
3996
3997\def\syst_helpers_do_do_increment(#1
3998 {\def\m_syst_action_yes{\syst_helpers_do_do_do_increment#1}
3999 \def\m_syst_action_nop{\syst_helpers_do_do_do_increment#1,\plusone}
4000 \doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop}
4001
4002\def\syst_helpers_do_do_decrement(#1
4003 {\def\m_syst_action_yes{\syst_helpers_do_do_do_decrement#1}
4004 \def\m_syst_action_nop{\syst_helpers_do_do_do_decrement#1,\plusone}
4005 \doifelsenextcharcs,\m_syst_action_yes\m_syst_action_nop}
4006
4007\protected\def\increment{\doifelsenextcharcs(\syst_helpers_do_do_increment\syst_helpers_do_increment}
4008\protected\def\decrement{\doifelsenextcharcs(\syst_helpers_do_do_decrement\syst_helpers_do_decrement}
4009
4010\protected\def\fastincrement#1{\dodoglobal\edef#1{\the\numexpr#1\plusone \relax}}
4011\protected\def\fastdecrement#1{\dodoglobal\edef#1{\the\numexpr#1\minusone\relax}}
4012
4013\protected\def\incrementvalue#1{\expandafter\increment\csname#1\endcsname}
4014\protected\def\decrementvalue#1{\expandafter\decrement\csname#1\endcsname}
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031\newdimen\maximumsignal
4032
4033\protected\def\newsignal#1
4034 {\ifdefined#1\else
4035 \advance\maximumsignal 2\scaledpoint
4036 \edef#1{\the\maximumsignal}
4037 \fi}
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055\let\checkedstrippedcsname\csstring
4056
4057
4058
4059
4060
4061
4062\protected\def\savenormalmeaning#1
4063 {\ifcsname normal\csstring#1\endcsname \else
4064 \expandafter\let\csname normal\csstring#1\endcsname#1
4065 \fi}
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104\newcount\outerrecurse
4105\newcount\innerrecurse
4106
4107\def\recursedepth{\the\outerrecurse}
4108\def\recurselevel{0}
4109
4110\let\syst_helpers_stepwise_next\relax
4111
4112\installsystemnamespace{recurseindex}
4113\installsystemnamespace{recurseaction}
4114
4115\protected\def\dostepwiserecurse#1#2#3#4
4116 {\global\advance\outerrecurse \plusone
4117 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#4}
4118 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4119 \ifnum#3>\zerocount\relax
4120 \ifnum#2<#1\relax
4121 \let\syst_helpers_stepwise_next\syst_helpers_stepwise_exit
4122 \else
4123 \let\syst_helpers_stepwise_next\syst_helpers_stepwise_recurse
4124 \fi
4125 \else
4126 \ifnum#3<\zerocount\relax
4127 \ifnum#1<#2\relax
4128 \let\syst_helpers_stepwise_next\syst_helpers_stepwise_exit
4129 \else
4130 \let\syst_helpers_stepwise_next\syst_helpers_stepwise_reverse
4131 \fi
4132 \else
4133 \let\syst_helpers_stepwise_next\syst_helpers_stepwise_exit
4134 \fi
4135 \fi\normalexpanded{\syst_helpers_stepwise_next{\number#1}{\number#2}{\number#3}}}
4136
4137\protected\def\syst_helpers_stepwise_recurse#1#2#3
4138 {\ifnum#1>#2\relax
4139 \expandafter\syst_helpers_stepwise_recurse_nop
4140 \else
4141 \def\recurselevel{#1}
4142 \doubleexpandafter\syst_helpers_stepwise_recurse_yes\expandafter
4143 \fi\expandafter{\the\numexpr\recurselevel#3\relax}{#2}{#3}}
4144
4145\protected\def\syst_helpers_recurse_content
4146 {\csname\??recurseaction\the\outerrecurse\endcsname}
4147
4148\protected\def\syst_helpers_stepwise_recurse_yes
4149 {\syst_helpers_recurse_content
4150 \syst_helpers_stepwise_recurse}
4151
4152\protected\def\syst_helpers_stepwise_reverse#1#2#3
4153 {\ifnum#1<#2\relax
4154 \expandafter\syst_helpers_stepwise_recurse_nop
4155 \else
4156 \def\recurselevel{#1}
4157 \innerrecurse#1\relax
4158 \advance\innerrecurse#3\relax
4159 \doubleexpandafter\syst_helpers_stepwise_reverse_yes\expandafter
4160 \fi\expandafter{\the\innerrecurse}{#2}{#3}}
4161
4162\protected\def\syst_helpers_stepwise_reverse_yes
4163 {\syst_helpers_recurse_content
4164 \syst_helpers_stepwise_reverse}
4165
4166\protected\def\syst_helpers_stepwise_exit
4167 {\syst_helpers_stepwise_recurse_nop\relax}
4168
4169\protected\def\syst_helpers_stepwise_recurse_nop#1#2#3#4
4170 {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname
4171 \global\advance\outerrecurse\minusone}
4172
4173
4174
4175
4176
4177\protected\def\dorecurse#1
4178 {\dostepwiserecurse\plusone{#1}\plusone}
4179
4180\def\doexpandedrecurse#1#2
4181 {\ifnum#1>\zerocount
4182 #2\expandafter\doexpandedrecurse\expandafter{\the\numexpr#1\plusone\relax}{#2}
4183 \fi}
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202\protected\def\dorecurse#1
4203 {\ifcase#1\relax
4204 \expandafter\gobbletwoarguments
4205 \or
4206 \expandafter\syst_helpers_recurse_y
4207 \else
4208 \expandafter\syst_helpers_recurse_x
4209 \fi{#1}}
4210
4211\protected\def\syst_helpers_recurse_x#1#2
4212 {\global\advance\outerrecurse \plusone
4213 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#2}
4214 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4215 \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}}
4216
4217\protected\def\syst_helpers_recurse_y#1#2
4218 {\global\advance\outerrecurse \plusone
4219 \expandafter\glet\csname\??recurseindex\the\outerrecurse\endcsname\recurselevel
4220 \let\recurselevel\!!plusone
4221 #2
4222 \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname
4223 \global\advance\outerrecurse \minusone}
4224
4225\protected\def\syst_helpers_recurse_indeed#1#2
4226 {\ifnum#1>#2\relax
4227 \expandafter\syst_helpers_recurse_indeed_nop
4228 \else
4229 \def\recurselevel{#1}
4230 \doubleexpandafter\syst_helpers_recurse_indeed_yes
4231 \fi\expandafter{\the\numexpr\recurselevel\plusone\relax}{#2}}
4232
4233\protected\def\syst_helpers_recurse_indeed#1#2
4234 {\ifnum#1>#2\relax
4235 \expandafter\syst_helpers_recurse_indeed_nop
4236 \else
4237 \def\recurselevel{#1}
4238 \innerrecurse#1\advance\innerrecurse\plusone
4239 \doubleexpandafter\syst_helpers_recurse_indeed_yes
4240 \fi\expandafter{\the\innerrecurse}{#2}}
4241
4242\protected\def\syst_helpers_recurse_indeed_yes
4243 {\syst_helpers_recurse_content
4244 \syst_helpers_recurse_indeed}
4245
4246\protected\def\syst_helpers_recurse_indeed_nop#1#2#3
4247 {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname
4248 \global\advance\outerrecurse \minusone }
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259\protected\def\dowith#1#2
4260 {\def\syst_helpers_with##1{#2}
4261 \normalexpanded{\processcommalist[#1]}\syst_helpers_with}
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279\let\endofloop\donothing
4280
4281\protected\def\doloop#1
4282 {\global\advance\outerrecurse \plusone
4283 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname{#1}
4284 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4285 \let\endofloop\syst_helpers_loop
4286 \syst_helpers_loop1}
4287
4288\protected\def\syst_helpers_loop#1
4289 {\def\recurselevel{#1}
4290 \expandafter\syst_helpers_loop_yes\expandafter{\the\numexpr\recurselevel\plusone\relax}}
4291
4292\protected\def\syst_helpers_loop_yes
4293 {\syst_helpers_recurse_content
4294 \endofloop}
4295
4296\protected\def\syst_helpers_loop_nop#1
4297 {\let\endofloop\syst_helpers_loop
4298 \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname
4299 \global\advance\outerrecurse\minusone}
4300
4301\protected\def\exitloop
4302 {\let\endofloop\syst_helpers_loop_nop}
4303
4304\protected\def\exitloopnow#1\endofloop
4305 {\syst_helpers_loop_nop}
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343\def\syst_helpers_recurse_content
4344 {\csname\??recurseaction\the\outerrecurse\expandafter\expandafter\expandafter\endcsname
4345 \expandafter\expandafter\expandafter{\expandafter\recurselevel\expandafter}\expandafter{\the\outerrecurse}}
4346
4347\protected\def\syst_helpers_recurse_x#1#2
4348 {\global\advance\outerrecurse \plusone
4349 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#2}
4350 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4351 \expandafter\syst_helpers_recurse_indeed\expandafter1\expandafter{\number#1}}
4352
4353\protected\def\syst_helpers_recurse_y#1#2
4354 {\global\advance\outerrecurse \plusone
4355 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4356 \let\recurselevel\!!plusone
4357 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#2}
4358 \syst_helpers_recurse_content
4359 \expandafter\let\expandafter\recurselevel\csname\??recurseindex\the\outerrecurse\endcsname
4360 \global\advance\outerrecurse \minusone}
4361
4362\protected\def\doloop#1
4363 {\global\advance\outerrecurse \plusone
4364 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#1}
4365 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4366 \let\endofloop\syst_helpers_loop
4367 \syst_helpers_loop1}
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413\installsystemnamespace{recursestepwise}
4414
4415\protected\def\dostepwiserecurse#1#2#3#4
4416 {\global\advance\outerrecurse \plusone
4417 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1##2{#4}
4418 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recurselevel
4419 \csname\??recursestepwise
4420
4421 \ifnum#3>\zerocount
4422 \ifnum#2<#1x\else d\fi
4423 \else\ifnum#3<\zerocount
4424 \ifnum#1<#2x\else r\fi
4425 \else
4426 x
4427 \fi\fi
4428 \expandafter\endcsname\normalexpanded{{\number#1}{\number#2}{\number#3}}}
4429
4430
4431\letvalue{\??recursestepwise x}\syst_helpers_stepwise_exit
4432\letvalue{\??recursestepwise d}\syst_helpers_stepwise_recurse
4433\letvalue{\??recursestepwise r}\syst_helpers_stepwise_reverse
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462\newcount\fastloopindex
4463\newcount\fastloopfinal
4464
4465\let\m_syst_helpers_fast_loop_cs\relax
4466
4467\protected\def\dofastloopcs#1
4468 {\fastloopfinal#1\relax
4469 \ifcase\fastloopfinal
4470 \expandafter\gobbleoneargument
4471 \else
4472 \expandafter\syst_helpers_fast_loop_cs
4473 \fi}
4474
4475\protected\def\syst_helpers_fast_loop_cs#1
4476 {\let\m_syst_helpers_fast_loop_cs#1
4477 \fastloopindex\plusone
4478 \syst_helpers_fast_loop_cs_step}
4479
4480\protected\def\syst_helpers_fast_loop_cs_step
4481 {\ifnum\fastloopindex>\fastloopfinal
4482 \let\m_syst_helpers_fast_loop_cs\relax
4483 \else
4484 \m_syst_helpers_fast_loop_cs
4485 \advance\fastloopindex\plusone
4486 \expandafter\syst_helpers_fast_loop_cs_step
4487 \fi}
4488
4489
4490
4491\protected\def\resetrecurselevel{\let\recurselevel\!!zerocount}
4492
4493\let\recurselevel \!!zerocount
4494\let\recurseaction\relax
4495\let\recursestring\empty
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522\protected\def\doloopoverlist#1#2
4523 {\global\advance\outerrecurse\plusone
4524 \expandafter\gdef\csname\??recurseaction\the\outerrecurse\endcsname##1{\edef\recursestring{##1}#2}
4525 \expandafter\glet\csname\??recurseindex \the\outerrecurse\endcsname\recursestring
4526 \normalexpanded{\processcommalist[#1]{\expandafter\noexpand\csname\??recurseaction\the\outerrecurse\endcsname}}
4527 \expandafter\let\expandafter\recursestring\csname\??recurseindex\the\outerrecurse\endcsname
4528 \global\advance\outerrecurse\minusone}
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552\installsystemnamespace{extraevery}
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566\protected\def\newevery#1#2
4567 {\ifx#1\everypar\else\newtoks#1\fi
4568 \ifx#2\relax\else\ifdefined#2\else
4569 \expandafter\newtoks\csname\??extraevery\csstring#1\endcsname
4570 \edef#2{\syst_helpers_every#1\csname\??extraevery\csstring#1\endcsname}
4571 \fi\fi}
4572
4573\protected\def\syst_helpers_every#1#2
4574 {\removetoks\the#2\from#1
4575 \appendtoks\the#2\to #1
4576 #2}
4577
4578
4579
4580\newevery \everypar \EveryPar
4581\newevery \everyline \EveryLine
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598\newtoks \neverypar
4599
4600\protected\def\forgeteverypar
4601 {\everypar{\the\neverypar}}
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666\protected\def\convertvalue#1\to
4667 {\expandafter\convertcommand\csname#1\endcsname\to}
4668
4669\protected\def\defconvertedvalue#1#2
4670 {\expandafter\defconvertedcommand\expandafter#1\csname#2\endcsname}
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690\def\syst_helpers_check_if_assignment_else#1=#2#30004{\if#20003}
4691\def\syst_helpers_check_else_assignment_if#1=#2#30004{\unless\if#20003}
4692
4693\protected\def\doifelseassignment#1
4694 {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=000300030004
4695 \expandafter\secondoftwoarguments
4696 \else
4697 \expandafter\firstoftwoarguments
4698 \fi}
4699
4700\protected\def\doifelseassignmentcs#1#2#3
4701 {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=000300030004
4702 \expandafter#3
4703 \else
4704 \expandafter#2
4705 \fi}
4706
4707\let\doifassignmentelse \doifelseassignment
4708\let\doifassignmentelsecs\doifelseassignmentcs
4709
4710\newif\ifassignment
4711
4712\protected\def\docheckassignment#1
4713 {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=000300030004
4714 \assignmentfalse
4715 \else
4716 \assignmenttrue
4717 \fi}
4718
4719
4720
4721\protected\def\validassignment#1
4722 {\expandafter\syst_helpers_check_else_assignment_if\detokenize{#1}=000300030004}
4723
4724\protected\def\novalidassignment#1
4725 {\expandafter\syst_helpers_check_if_assignment_else\detokenize{#1}=000300030004}
4726
4727
4728
4729
4730
4731
4732\protected\def\convertargument#1\to#2{\dodoglobal\edef#2{\detokenize{#1}}}
4733\protected\def\convertcommand #1\to#2{\dodoglobal\edef#2{\expandafter\detokenize\expandafter{#1}}}
4734
4735\protected\def\defconvertedargument #1#2{\edef#1{\detokenize{#2}}}
4736\protected\def\defconvertedcommand #1#2{\edef#1{\detokenize\expandafter{#2}}}
4737\protected\def\edefconvertedargument#1#2{\edef#1{#2}
4738 \edef#1{\detokenize\expandafter{#1}}}
4739\protected\def\gdefconvertedargument#1#2{\xdef#1{\detokenize{#2}}}
4740\protected\def\gdefconvertedcommand #1#2{\xdef#1{\detokenize\expandafter{#2}}}
4741\protected\def\xdefconvertedargument#1#2{\xdef#1{#2}
4742 \xdef#1{\detokenize\expandafter{#1}}}
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765\protected\def\showvalue#1
4766 {\ifcsname#1\endcsname
4767 \expandafter\show\csname#1\endcsname
4768 \else
4769 \show\undefined
4770 \fi}
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785\protected\def\doifelsemeaning#1#2
4786 {\edef\m_syst_string_one{\normalmeaning#1}
4787 \def \m_syst_string_two{#2}
4788 \edef\m_syst_string_two{\normalmeaning\m_syst_string_two}
4789 \ifx\m_syst_string_one\m_syst_string_two
4790 \expandafter\firstoftwoarguments
4791 \else
4792 \expandafter\secondoftwoarguments
4793 \fi}
4794
4795\let\doifmeaningelse\doifelsemeaning
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809\def\syst_helpers_if_samestring_else#1#2#3#4
4810 {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#3}}}
4811 \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}
4812 \ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi}
4813
4814\protected\def\doifelsesamestring{\syst_helpers_if_samestring_else\firstoftwoarguments\secondoftwoarguments}
4815\protected\def\doifsamestring {\syst_helpers_if_samestring_else\firstofoneargument \gobbleoneargument }
4816\protected\def\doifnotsamestring {\syst_helpers_if_samestring_else\gobbleoneargument \firstofoneargument }
4817
4818\let\doifsamestringelse\doifelsesamestring
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844\protected\def\ConvertToConstant#1#2#3
4845 {\edef\m_syst_string_one{\expandafter\detokenize\expandafter{#2}}
4846 \edef\m_syst_string_two{\expandafter\detokenize\expandafter{#3}}
4847 #1{\m_syst_string_one}{\m_syst_string_two}}
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874\protected\def\CheckConstantAfter#1#2
4875 {\expandafter\convertargument\v!prefix!\to\ascii
4876 \convertargument#1\to#2\relax
4877 \doifelseinstring\ascii{#2}
4878 {\expandafter\convertargument#1\to#2}
4879 {}}
4880
4881\protected\def\ConvertConstantAfter#1#2#3
4882 {\CheckConstantAfter{#2}\asciia
4883 \CheckConstantAfter{#3}\asciib
4884 #1{\asciia}{\asciib}}
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897\protected\def\assignifempty#1#2
4898 {\doifnothing{#1}{\def#1{#2}}}
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936\let\syst_helpers_grab_indeed\relax
4937
4938\protected\def\syst_helpers_grab#1#2
4939 {\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed}
4940
4941\protected\def\grabuntil#1
4942 {\expandafter\syst_helpers_grab\expandafter{\csname#1\endcsname}}
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966\let\syst_helpers_gobble_indeed\relax
4967
4968\protected\def\processbetween#1#2
4969 {\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}}
4970
4971\protected\def\gobbleuntil#1
4972 {\def\syst_helpers_gobble_indeed##1#1{}\syst_helpers_gobble_indeed}
4973
4974\protected\def\gobbleuntilrelax#1\relax
4975 {}
4976
4977
4978
4979\protected\def\gobblenested#1#2#3
4980 {\normalexpanded{\def\noexpand\next##1\csname#2\endcsname}{\csname#3\endcsname}
4981 \next}
4982
4983
4984
4985
4986
4987
4988
4989\let\syst_helpers_until_indeed\relax
4990
4991\protected\def\processuntil#1
4992 {\def\syst_helpers_until_indeed##1#1{##1}\syst_helpers_until_indeed}
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058\let\m_syst_helpers_handle_group_after \relax
5059\let\m_syst_helpers_handle_group_before\relax
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135\protected\def\syst_helpers_handle_group_nop
5136 {\ifnum\currentgrouptype=\semisimplegroupcode
5137 \expandafter\syst_helpers_handle_group_nop_a
5138 \else
5139 \expandafter\syst_helpers_handle_group_nop_b
5140 \fi}
5141
5142\def\syst_helpers_handle_group_nop_a
5143 {\begingroup
5144 \aftergroup\m_syst_helpers_handle_group_a
5145 \aftergroup\endgroup
5146 \m_syst_helpers_handle_group_b}
5147
5148\def\syst_helpers_handle_group_nop_b
5149 {\bgroup
5150 \aftergroup\m_syst_helpers_handle_group_a
5151 \aftergroup\egroup
5152 \m_syst_helpers_handle_group_b}
5153
5154\protected\def\syst_helpers_handle_group_normal
5155 {\bgroup
5156 \afterassignment\m_syst_helpers_handle_group_normal_before
5157 \let\next=}
5158
5159\def\m_syst_helpers_handle_group_normal_before
5160 {\bgroup
5161 \m_syst_helpers_handle_group_b
5162 \bgroup
5163 \aftergroup\m_syst_helpers_handle_group_a
5164 \aftergroup\egroup
5165 \aftergroup\egroup}
5166
5167\protected\def\syst_helpers_handle_group_simple
5168 {\bgroup
5169 \afterassignment\m_syst_helpers_handle_group_simple_before
5170 \let\next=}
5171
5172\def\m_syst_helpers_handle_group_simple_before
5173 {\bgroup
5174 \aftergroup\m_syst_helpers_handle_group_simple_after
5175 \m_syst_helpers_handle_group_b}
5176
5177\def\m_syst_helpers_handle_group_simple_after
5178 {\m_syst_helpers_handle_group_a
5179 \egroup}
5180
5181\protected\def\syst_helpers_handle_group_pickup
5182 {\bgroup
5183 \afterassignment\m_syst_helpers_handle_group_pickup_before
5184 \let\next=}
5185
5186\def\m_syst_helpers_handle_group_pickup_before
5187 {\bgroup
5188 \aftergroup\m_syst_helpers_handle_group_a
5189 \aftergroup\egroup
5190 \aftergroup\m_syst_helpers_handle_group_p
5191 \m_syst_helpers_handle_group_b}
5192
5193\protected\def\syst_helpers_handle_group_nop_x
5194 {\ifnum\currentgrouptype=\semisimplegroupcode
5195 \begingroup
5196 \aftergroup\endgroup
5197 \else
5198 \bgroup
5199 \aftergroup\egroup
5200 \fi
5201 \m_syst_helpers_handle_group_b}
5202
5203\protected\def\syst_helpers_handle_group_normal_x
5204 {\bgroup
5205 \afterassignment\m_syst_helpers_handle_group_normal_before_x
5206 \let\next=}
5207
5208\def\m_syst_helpers_handle_group_normal_before_x
5209 {\bgroup
5210 \m_syst_helpers_handle_group_b
5211 \bgroup
5212 \aftergroup\egroup
5213 \aftergroup\egroup}
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244\protected\def\groupedcommand#1#2
5245 {\def\m_syst_helpers_handle_group_b{#1}
5246 \def\m_syst_helpers_handle_group_a{#2}
5247 \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop}
5248
5249\protected\def\groupedcommandcs#1#2
5250 {\let\m_syst_helpers_handle_group_b#1
5251 \let\m_syst_helpers_handle_group_a#2
5252 \doifelsenextbgroupcs\syst_helpers_handle_group_normal\syst_helpers_handle_group_nop}
5253
5254\protected\def\simplegroupedcommand#1#2
5255 {\def\m_syst_helpers_handle_group_b{#1}
5256 \def\m_syst_helpers_handle_group_a{#2}
5257 \doifelsenextbgroupcs\syst_helpers_handle_group_simple\syst_helpers_handle_group_nop}
5258
5259\protected\def\pickupgroupedcommand#1#2#3
5260 {\def\m_syst_helpers_handle_group_b{#1}
5261 \def\m_syst_helpers_handle_group_a{#2}
5262 \def\m_syst_helpers_handle_group_p{#3}
5263 \doifelsenextbgroupcs\syst_helpers_handle_group_pickup\syst_helpers_handle_group_nop}
5264
5265\protected\def\triggergroupedcommand#1
5266 {\def\m_syst_helpers_handle_group_b{#1}
5267 \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x}
5268
5269\protected\def\triggergroupedcommandcs#1
5270 {\let\m_syst_helpers_handle_group_b#1
5271 \doifelsenextbgroupcs\syst_helpers_handle_group_normal_x\syst_helpers_handle_group_nop_x}
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298\protected\def\showdefinederror#1#2
5299 {\writestatus\m!system{#1 #2 replaces a macro, use CAPITALS!}}
5300
5301\protected\def\checkdefined#1#2#3
5302 {\doifdefined{#3}{\showdefinederror{#2}{#3}}}
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353\newtoks\BeforePar
5354\newtoks\AfterPar
5355
5356\protected\def\redowithpar\par
5357 {\doifelsenextchar\par\redowithpar\dodowithpar}
5358
5359\protected\def\dowithpar#1#2
5360 {\def\dodowithpar##1\par{#1##1#2}
5361 \redowithpar\par}
5362
5363\protected\def\redogotopar\par
5364 {\doifelsenextchar\par\redogotopar\dodogotopar}
5365
5366\protected\def\dogotopar#1
5367 {\def\dodogotopar{#1}
5368 \redogotopar\par}
5369
5370\protected\def\dogotoparcs#1
5371 {\let\dodogotopar#1
5372 \redogotopar\par}
5373
5374\ifdefined \ignorepars \else
5375 \protected\def\ignorepars{\dogotoparcs\relax}
5376\fi
5377
5378\protected\def\GetPar
5379 {\expanded
5380 {\dowithpar
5381 {\the\BeforePar
5382 \BeforePar\emptytoks}
5383 {\the\AfterPar
5384 \BeforePar\emptytoks
5385 \AfterPar\emptytoks}}}
5386
5387\protected\def\GotoPar
5388 {\expanded
5389 {\dogotopar
5390 {\the\BeforePar
5391 \BeforePar\emptytoks}}}
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423\let\syst_helpers_next_par\relax
5424\let\syst_helpers_next_arg\relax
5425
5426\protected\def\dowithpargument#1
5427 {\def\syst_helpers_next_par##1 \par{#1{##1}}
5428 \def\syst_helpers_next_arg##1{#1{##1}}
5429 \doifelsenextbgroup\syst_helpers_next_arg{\doifelsenextchar\par{#1{}}\syst_helpers_next_par}}
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451\let\syst_helpers_next_war\relax
5452\let\syst_helpers_next_arg\relax
5453
5454\protected\def\dowithwargument#1
5455 {\def\syst_helpers_next_war##1 {#1{##1}}
5456 \def\syst_helpers_next_arg##1{#1{##1}}
5457 \doifelsenextbgroup\syst_helpers_next_arg\syst_helpers_next_war}
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488\protected\def\dorepeatwithcommand[#1]
5489 {\syst_helpers_repeat_with_command#1*\empty*\relax}
5490
5491\def\syst_helpers_repeat_with_command#1*#2#3*#4\relax#5
5492 {\ifx#2\empty\syst_helpers_repeat_with_command_again[#1]#5\else\syst_helpers_repeat_with_command_indeed{#1}{#2}{#3}#5\fi}
5493
5494\def\syst_helpers_repeat_with_command_indeed#1#2#3#4
5495 {\ifx#2\empty
5496 #4{#1}
5497 \else\ifnum#1<\zerocount
5498
5499 \dorecurse{#1}{#4{#2#3}}
5500 \else\ifx#2
5501 \dorecurse{#1}{#4{#3}}
5502 \else
5503 \dorecurse{#1}{#4{#2#3}}
5504 \fi\fi\fi}
5505
5506\def\syst_helpers_repeat_with_command_again[#1]#2
5507 {#2{#1}}
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544\def\syst_helpers_if_instring_else_indeed#1
5545 {\if#1@
5546 \expandafter\secondoftwoarguments
5547 \else
5548 \expandafter\firstoftwoarguments
5549 \fi}
5550
5551\def\doifelsestringinstring#1#2
5552 {\expandafter\def\expandafter\syst_helpers_if_instring_else\expandafter##\expandafter1#1##2##30004
5553 {\syst_helpers_if_instring_else_indeed##2}
5554 \expandafter\expandafter\expandafter\syst_helpers_if_instring_else\expandafter#2#1@@0004}
5555
5556\let\doifstringinstringelse\doifelsestringinstring
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574\newtoks\t_syst_helpers_scratch
5575\let \m_syst_helpers_scratch\empty
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638\protected\def\appendtoks#1\to#2
5639 {\ifx\dodoglobal\relax
5640 \expandafter\toksapp
5641 \else
5642 \resetglobal
5643 \expandafter\gtoksapp
5644 \fi#2{#1}}
5645
5646\protected\def\prependtoks#1\to#2
5647 {\ifx\dodoglobal\relax
5648 \expandafter\tokspre
5649 \else
5650 \resetglobal
5651 \expandafter\gtokspre
5652 \fi#2{#1}}
5653
5654\def\syst_helpers_append_toks_indeed
5655 {\ifx\dodoglobal\relax
5656 \expandafter\toksapp
5657 \else
5658 \resetglobal
5659 \expandafter\gtoksapp
5660 \fi\m_syst_helpers_scratch\t_syst_helpers_scratch}
5661
5662\def\syst_helpers_prepend_toks_indeed
5663 {\ifx\dodoglobal\relax
5664 \expandafter\tokspre
5665 \else
5666 \resetglobal
5667 \expandafter\gtokspre
5668 \fi\m_syst_helpers_scratch\t_syst_helpers_scratch}
5669
5670\protected\def\appendtoksonce#1\to#2
5671 {\let\m_syst_helpers_scratch#2
5672 \t_syst_helpers_scratch{#1}
5673 \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch
5674 \donothing
5675 \syst_helpers_append_toks_indeed}
5676
5677\protected\def\prependtoksonce#1\to#2
5678 {\let\m_syst_helpers_scratch#2
5679 \t_syst_helpers_scratch{#1}
5680 \doifelseintoks\t_syst_helpers_scratch\m_syst_helpers_scratch
5681 \donothing
5682 \syst_helpers_prepend_toks_indeed}
5683
5684
5685
5686\protected\def\doifelseintoks#1#2
5687 {\edef\asciia{\detokenize\expandafter{\the#1}}
5688 \edef\asciib{\detokenize\expandafter{\the#2}}
5689 \doifelsestringinstring\asciia\asciib}
5690
5691\let\doifintokselse\doifelseintoks
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712\newtoks \collectingtoks
5713
5714\protected\def\startcollect #1\stopcollect {\toksapp \collectingtoks{#1}}
5715\protected\def\startexpandedcollect#1\stopexpandedcollect{\etoksapp\collectingtoks{#1}}
5716
5717\protected\def\startcollecting{\collectingtoks\emptytoks}
5718\protected\def\stopcollecting {\the\collectingtoks}
5719
5720\protected\def\collect {\toksapp \collectingtoks}
5721\protected\def\collectexpanded{\etoksapp\collectingtoks}
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731\protected\def\removetoks#1\from#2
5732 {\def\syst_helpers_remove_toks##1#1##2\empty\empty\empty##30004
5733 {\def\m_syst_string_one{##3}
5734 \ifx\m_syst_string_one\empty#2{##1}\else#2{##1##2}\fi}
5735 \expandafter\syst_helpers_remove_toks\the#2\empty\empty\empty#1\empty\empty\empty0004}
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754\protected\def\appendetoks#1\to#2
5755 {\ifx\dodoglobal\relax
5756 \expandafter\etoksapp
5757 \else
5758 \resetglobal
5759 \expandafter\xtoksapp
5760 \fi#2{#1}}
5761
5762\protected\def\prependetoks#1\to#2
5763 {\ifx\dodoglobal\relax
5764 \expandafter\etokspre
5765 \else
5766 \resetglobal
5767 \expandafter\xtokspre
5768 \fi#2{#1}}
5769
5770
5771
5772\protected\def\flushtoks#1
5773 {\t_syst_helpers_scratch#1\relax
5774 \dodoglobal#1\emptytoks
5775 \the\t_syst_helpers_scratch\relax}
5776
5777
5778
5779\let\dotoks\the
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797\let\syst_helpers_split_string\relax
5798
5799\protected\def\beforesplitstring#1\at#2\to#3
5800 {\def\syst_helpers_split_string##1#2##2#2##3\\
5801 {\def#3{##1}}
5802 \expandafter\syst_helpers_split_string#1#2#2\\}
5803
5804\protected\def\aftersplitstring#1\at#2\to#3
5805 {\def\syst_helpers_split_string##1#2##2@@@##3\\
5806 {\def#3{##2}}
5807 \expandafter\syst_helpers_split_string#1@@@#2@@@\\}
5808
5809
5810
5811
5812
5813
5814\protected\def\splitstring#1\at#2\to#3\and#4
5815 {\def\syst_helpers_split_string##1#2##2\empty\empty\empty##3\\
5816 {\def#3{##1}
5817 \def\syst_helpers_split_string{##3}
5818 \ifx\syst_helpers_split_string\empty
5819 \let#4\empty
5820 \else
5821 \def#4{##2}
5822 \fi}
5823 \expandafter\syst_helpers_split_string#1\empty\empty\empty#2\empty\empty\empty\\}
5824
5825\protected\def\greedysplitstring#1\at#2\to#3\and#4
5826 {\edef\asciib{#1}
5827 \let\asciic\asciib
5828 \let#3\empty
5829 \let#4\empty
5830 \doloop
5831 {\expandafter\splitstring\asciib\at#2\to\asciia\and\asciib
5832 \ifx\asciib\empty
5833 \exitloop
5834 \else
5835
5836
5837 \edef#3{\ifcase\recurselevel\or\else#3#2\fi\asciia}
5838 \let#4\asciib
5839 \fi}
5840 \ifx#3\empty\let#3\asciic\fi}
5841
5842
5843
5844
5845
5846
5847\protected\def\beforetestandsplitstring#1\at#2\to#3
5848 {\def\syst_helpers_split_string##1#2##2#2##3##4\\
5849 {\ifx##3\empty\let#3\empty\else\def#3{##1}\fi}
5850 \expandafter\syst_helpers_split_string#1#2#2\empty\\}
5851
5852\protected\def\aftertestandsplitstring#1\at#2\to#3
5853 {\def\syst_helpers_split_string ##1#2##2@@@##3##4\\
5854 {\ifx##3\empty\let#3\empty\else\def#3{##2}\fi}
5855 \expandafter\syst_helpers_split_string #1@@@#2@@@\empty\\}
5856
5857\def\testandsplitstring#1\at#2\to#3\and#4
5858 {\def\syst_helpers_split_string##1#2##2#2##3##4\\
5859 {\ifx##3\empty\let#3\empty\let#4\empty\else\def#3{##1}\def#4{##2}\fi}
5860 \expandafter\syst_helpers_split_string#1#2#2\empty\\}
5861
5862
5863
5864
5865
5866
5867
5868
5869\protected\def\splitatperiod #1{\normalexpanded{\syst_helpers_splitatperiod #1}..\relax}
5870\protected\def\splitatcomma #1{\normalexpanded{\syst_helpers_splitatcomma #1},,\relax}
5871\protected\def\splitatasterisk#1{\normalexpanded{\syst_helpers_splitatasterisk#1}**\relax}
5872\protected\def\splitatcolon #1{\normalexpanded{\syst_helpers_splitatcolon #1}::\relax}
5873\protected\def\splitatcolons #1{\normalexpanded{\syst_helpers_splitatcolons #1}::::\relax}
5874
5875\protected\def\syst_helpers_splitatperiod #1.#2.#3\relax#4#5{\def#4{#1}\def#5{#2}}
5876\protected\def\syst_helpers_splitatcomma #1,#2,#3\relax#4#5{\def#4{#1}\def#5{#2}}
5877\protected\def\syst_helpers_splitatasterisk #1*#2*#3\relax#4#5{\def#4{#1}\def#5{#2}}
5878\protected\def\syst_helpers_splitatcolon #1:#2:#3\relax#4#5{\def#4{#1}\def#5{#2}}
5879\protected\def\syst_helpers_splitatcolons #1::#2::#3\relax#4#5{\edef#4{#1}\edef#5{#2}}
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892\protected\def\removesubstring#1\from#2\to#3
5893 {\splitstring#2\to\m_syst_string_one\and\m_syst_string_two
5894 \dodoglobal#3{\m_syst_string_one\m_syst_string_two}}
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949\protected\def\appendtocommalist#1#2
5950 {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}
5951
5952\protected\def\prependtocommalist#1#2
5953 {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}
5954
5955\protected\def\addtocommalist#1#2
5956 {\rawdoifelseinset{#1}#2\resetglobal
5957 {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}}
5958
5959\protected\def\pretocommalist#1#2
5960 {\rawdoifelseinset{#1}#2\resetglobal
5961 {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}}
5962
5963\protected\def\robustdoifelseinset#1#2
5964 {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#1}}}
5965 \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#2}}}
5966 \rawdoifelseinset\m_syst_string_one\m_syst_string_two}
5967
5968\let\robustdoifinsetelse\robustdoifelseinset
5969
5970\protected\def\robustaddtocommalist#1#2
5971 {\robustdoifelseinset{#1}#2\resetglobal
5972 {\dodoglobal\edef#2{\ifx#2\empty\else#2,\fi#1}}}
5973
5974\protected\def\robustpretocommalist#1#2
5975 {\robustdoifelseinset{#1}#2\resetglobal
5976 {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}}
5977
5978\protected\def\xsplitstring#1#2
5979 {\def\syst_helpers_split_string##1,#2,##2,#2,##3\\
5980 {\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}
5981 \edef\m_syst_string_two{\acleanedupcommalist##2,,\relax}}
5982 \expandafter\syst_helpers_split_string\expandafter,#1,,#2,,#2,\\}
5983
5984\def\bcleanedupcommalist#1#2#3\relax{\if#1,\else#1\fi\if#2,\else#2\fi#3}
5985\def\bcleanedupcommalist#1#2\relax{\if#1,\else#1\fi#2}
5986\def\acleanedupcommalist#1,,#2\relax{#1}
5987
5988\protected\def\removefromcommalist#1#2
5989 {\rawdoifelseinset{#1}#2
5990 {\normalexpanded{\xsplitstring\noexpand#2{#1}}
5991 \dodoglobal\edef#2
5992 {\ifx\m_syst_string_one\empty
5993 \m_syst_string_two
5994 \else
5995 \m_syst_string_one\ifx\m_syst_string_two\empty\else,\m_syst_string_two\fi
5996 \fi}}
5997 \resetglobal}
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014\def\syst_helpers_substitute_in_comma_list_step#1
6015 {\edef\m_syst_string_three{#1}
6016 \ifx\m_syst_string_one\m_syst_string_three
6017 \ifx\m_syst_string_two\empty \else
6018 \edef\m_syst_string_four{\ifx\m_syst_string_four\empty\else\m_syst_string_four,\fi\m_syst_string_two}
6019 \fi
6020 \else
6021 \edef\m_syst_string_four{\ifx\m_syst_string_four\empty\else\m_syst_string_four,\fi#1}
6022 \fi}
6023
6024\protected\def\substituteincommalist#1#2#3
6025 {\edef\m_syst_string_one{#1}
6026 \edef\m_syst_string_two{#2}
6027 \let\m_syst_string_four\empty
6028 \normalexpanded{\rawprocesscommacommand[#3]}\syst_helpers_substitute_in_comma_list_step
6029 \let#3\m_syst_string_four}
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053\newcount\c_syst_helpers_comma_list_index
6054\let \m_syst_helpers_comma_list_target\empty
6055
6056\let\newcommalistelement\empty
6057
6058\def\syst_helpers_replace_in_comma_list_step#1
6059 {\ifnum\commalistcounter=\c_syst_helpers_comma_list_index\relax
6060 \ifx\newcommalistelement\empty\else
6061 \ifx\m_syst_helpers_comma_list_target\empty
6062 \let\m_syst_helpers_comma_list_target\newcommalistelement
6063 \else
6064 \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter
6065 \m_syst_helpers_comma_list_target\expandafter\expandafter\expandafter
6066 {\expandafter\m_syst_helpers_comma_list_target\expandafter,\newcommalistelement}
6067 \fi
6068 \fi
6069 \def\commalistelement{#1}
6070 \else
6071 \ifx\m_syst_helpers_comma_list_target\empty
6072 \ifx\nexttoken\bgroup
6073 \def\m_syst_helpers_comma_list_target{{#1}}
6074 \else
6075 \def\m_syst_helpers_comma_list_target{#1}
6076 \fi
6077 \else
6078 \ifx\nexttoken\bgroup
6079 \expandafter\def\expandafter\m_syst_helpers_comma_list_target\expandafter{\m_syst_helpers_comma_list_target,{#1}}
6080 \else
6081 \expandafter\def\expandafter\m_syst_helpers_comma_list_target\expandafter{\m_syst_helpers_comma_list_target,#1}
6082 \fi
6083 \fi
6084 \fi
6085 \advance\commalistcounter\plusone}
6086
6087\protected\def\replaceincommalist#1#2
6088 {\c_syst_helpers_comma_list_index#2\relax
6089 \let\m_syst_helpers_comma_list_target\empty
6090 \let\commalistelement\empty
6091 \commalistcounter\plusone
6092 \expandafter\processcommalist\expandafter[#1]\syst_helpers_replace_in_comma_list_step
6093 \dodoglobal\let#1\m_syst_helpers_comma_list_target}
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103\let\m_syst_helpers_comma_list_command_global\empty
6104
6105\def\syst_helpers_comma_list_command_global_step#1,
6106 {\if]#1\else
6107 \m_syst_helpers_comma_list_command_global{#1}
6108 \expandafter\syst_helpers_comma_list_command_global_step
6109 \fi}
6110
6111\protected\def\globalprocesscommalist[#1]#2
6112 {\glet\m_syst_helpers_comma_list_command_global#2
6113 \expandafter\syst_helpers_comma_list_command_global_step#1,],}
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125{\catcode\.=\othercatcode
6126 \catcode\p=\othercatcode
6127 \catcode\t=\othercatcode
6128 \gdef\WITHOUTPT#1pt{#1}}
6129
6130\def\withoutpt#1
6131 {\expandafter\WITHOUTPT#1}
6132
6133
6134
6135
6136
6137
6138
6139\def\PtToCm#1
6140 {\withoutpt\the\dimexpr0.0351459804\dimexpr#1\relax\relax cm}
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154\def\dimensiontocount#1#2{#2\numexpr\dimexpr#1\relax\maxcard\relax}
6155\def\numberofpoints #1{\the\numexpr\dimexpr#1\relax\maxcard\relax}
6156
6157
6158
6159
6160
6161
6162
6163
6164\newdimen\d_syst_helpers_swapped
6165\newskip \s_syst_helpers_swapped
6166\newcount\c_syst_helpers_swapped
6167\let \m_syst_helpers_swapped\relax
6168
6169\protected\def\swapdimens#1#2{\d_syst_helpers_swapped #1\relax#1#2\relax#2\d_syst_helpers_swapped}
6170\protected\def\swapskips #1#2{\s_syst_helpers_swapped #1\relax#1#2\relax#2\s_syst_helpers_swapped}
6171\protected\def\swapcounts#1#2{\c_syst_helpers_swapped #1\relax#1#2\relax#2\c_syst_helpers_swapped}
6172\protected\def\swapmacros#1#2{\let\m_syst_helpers_swapped#1\let #1#2\let #2\m_syst_helpers_swapped}
6173
6174\protected\def\globalswapdimens#1#2{\d_syst_helpers_swapped #1\global#1#2\global#2\d_syst_helpers_swapped}
6175\protected\def\globalswapskips #1#2{\s_syst_helpers_swapped #1\global#1#2\global#2\s_syst_helpers_swapped}
6176\protected\def\globalswapcounts#1#2{\c_syst_helpers_swapped #1\global#1#2\global#2\c_syst_helpers_swapped}
6177\protected\def\globalswapmacros#1#2{\let\m_syst_helpers_swapped#1\glet #1#2\glet #2\m_syst_helpers_swapped}
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191\installsystemnamespace{localpushedmacro}
6192\installsystemnamespace{globalpushedmacro}
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229\let\m_syst_helpers_push_macro\empty
6230
6231\newcount\c_syst_helpers_pop_count
6232
6233\def\syst_helpers_push_macro_new_global
6234 {\expandafter\newcount\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname
6235 \global\advance\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname\plusone}
6236
6237\def\syst_helpers_push_macro_new_local
6238 {\expandafter\newcount\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname
6239 \global\advance\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname\plusone}
6240
6241\protected\def\globalpushmacro#1
6242 {\xdef\m_syst_helpers_push_macro{\csstring#1}
6243 \ifcsname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname
6244 \global\advance\lastnamedcs\plusone
6245 \else
6246 \syst_helpers_push_macro_new_global
6247 \fi
6248 \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1}
6249
6250\protected\def\localpushmacro#1
6251 {\xdef\m_syst_helpers_push_macro{\csstring#1}
6252 \ifcsname\??localpushedmacro\m_syst_helpers_push_macro\endcsname
6253 \global\advance\lastnamedcs\plusone
6254 \else
6255 \syst_helpers_push_macro_new_local
6256 \fi
6257 \expandafter\glet\csname\the\lastnamedcs\m_syst_helpers_push_macro\endcsname#1}
6258
6259\protected\def\globalpopmacro#1
6260 {\xdef\m_syst_helpers_push_macro{\csstring#1}
6261 \c_syst_helpers_pop_count\csname\??globalpushedmacro\m_syst_helpers_push_macro\endcsname
6262 \global\advance\lastnamedcs \minusone
6263 \expandafter\glet\expandafter#1\csname\the\c_syst_helpers_pop_count\m_syst_helpers_push_macro\endcsname}
6264
6265\protected\def\localpopmacro#1
6266 {\xdef\m_syst_helpers_push_macro{\csstring#1}
6267 \c_syst_helpers_pop_count\csname\??localpushedmacro\m_syst_helpers_push_macro\endcsname
6268 \global\advance\lastnamedcs \minusone
6269 \expandafter\let\expandafter#1\csname\the\c_syst_helpers_pop_count\m_syst_helpers_push_macro\endcsname}
6270
6271\let\pushmacro\localpushmacro
6272\let\popmacro \localpopmacro
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290\newdimen\localhsize
6291
6292\protected\def\setlocalhsize
6293 {\doifelsenextoptional
6294 \syst_helpers_set_local_hsize_yes
6295 \syst_helpers_set_local_hsize_nop}
6296
6297\def\syst_helpers_set_local_hsize_nop
6298 {\localhsize\availablehsize}
6299
6300\def\syst_helpers_set_local_hsize_yes[#1]
6301 {\syst_helpers_set_local_hsize_nop
6302 \advance\localhsize#1\relax}
6303
6304\def\availablehsize
6305 {\dimexpr
6306 \hsize\leftskip\rightskip
6307 \ifnum\hangafter<\zerocount
6308 \ifdim\hangindent>\zeropoint\else\fi\hangindent
6309 \fi
6310 \relax}
6311
6312\def\distributedhsize#1#2#3
6313 {\dimexpr(#1\numexpr#31\relax\dimexpr#2\relax)#3\relax}
6314
6315\def\hsizefraction#1#2
6316 {\dimexpr#1#2\relax}
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328\protected\def\doifvalue#1#2
6329 {\edef\m_syst_string_one{\csname#1\endcsname}
6330 \edef\m_syst_string_two{#2}
6331 \ifx\m_syst_string_one\m_syst_string_two
6332 \expandafter\firstofoneargument
6333 \else
6334 \expandafter\gobbleoneargument
6335 \fi}
6336
6337\protected\def\doifnotvalue#1#2
6338 {\edef\m_syst_string_one{\csname#1\endcsname}
6339 \edef\m_syst_string_two{#2}
6340 \ifx\m_syst_string_one\m_syst_string_two
6341 \expandafter\gobbleoneargument
6342 \else
6343 \expandafter\firstofoneargument
6344 \fi}
6345
6346\protected\def\doifelsevalue#1#2
6347 {\edef\m_syst_string_one{\csname#1\endcsname}
6348 \edef\m_syst_string_two{#2}
6349 \ifx\m_syst_string_one\m_syst_string_two
6350 \expandafter\firstoftwoarguments
6351 \else
6352 \expandafter\secondoftwoarguments
6353 \fi}
6354
6355\protected\def\doifnothing#1
6356 {\edef\m_syst_string_one{#1}
6357 \ifx\m_syst_string_one\empty
6358 \expandafter\firstofoneargument
6359 \else
6360 \expandafter\gobbleoneargument
6361 \fi}
6362
6363\protected\def\doifsomething#1
6364 {\edef\m_syst_string_one{#1}
6365 \ifx\m_syst_string_one\empty
6366 \expandafter\gobbleoneargument
6367 \else
6368 \expandafter\firstofoneargument
6369 \fi}
6370
6371\protected\def\doifelsenothing#1
6372 {\edef\m_syst_string_one{#1}
6373 \ifx\m_syst_string_one\empty
6374 \expandafter\firstoftwoarguments
6375 \else
6376 \expandafter\secondoftwoarguments
6377 \fi}
6378
6379\protected\def\doifelsesomething#1
6380 {\edef\m_syst_string_one{#1}
6381 \ifx\m_syst_string_one\empty
6382 \expandafter\secondoftwoarguments
6383 \else
6384 \expandafter\firstoftwoarguments
6385 \fi}
6386
6387\protected\def\doifvaluenothing#1
6388 {\edef\m_syst_string_one{\csname#1\endcsname}
6389 \ifx\m_syst_string_one\empty
6390 \expandafter\firstofoneargument
6391 \else
6392 \expandafter\gobbleoneargument
6393 \fi}
6394
6395\protected\def\doifvaluesomething#1
6396 {\edef\m_syst_string_one{\csname#1\endcsname}
6397 \ifx\m_syst_string_one\empty
6398 \expandafter\gobbleoneargument
6399 \else
6400 \expandafter\firstofoneargument
6401 \fi}
6402
6403\protected\def\doifelsevaluenothing#1
6404 {\edef\m_syst_string_one{\csname#1\endcsname}
6405 \ifx\m_syst_string_one\empty
6406 \expandafter\firstoftwoarguments
6407 \else
6408 \expandafter\secondoftwoarguments
6409 \fi}
6410
6411\let\doifvalueelse \doifelsevalue
6412\let\doifnothingelse \doifelsenothing
6413\let\doifsomethingelse \doifelsesomething
6414\let\doifvaluenothingelse\doifelsevaluenothing
6415
6416
6417
6418
6419
6420
6421\def\doifelseemptyvalue#1
6422 {\expandafter\ifx\csname#1\endcsname\empty
6423 \expandafter\firstoftwoarguments
6424 \else
6425 \expandafter\secondoftwoarguments
6426 \fi}
6427
6428\let\doifemptyvalueelse\doifelseemptyvalue
6429
6430\def\doifemptyvalue#1
6431 {\expandafter\ifx\csname#1\endcsname\empty
6432 \expandafter\firstofoneargument
6433 \else
6434 \expandafter\gobbleoneargument
6435 \fi}
6436
6437\def\doifnotemptyvalue#1
6438 {\expandafter\ifx\csname#1\endcsname\empty
6439 \expandafter\gobbleoneargument
6440 \else
6441 \expandafter\firstofoneargument
6442 \fi}
6443
6444
6445
6446
6447
6448
6449
6450\def\syst_helpers_do_if_all_common_else#1#2#3#4
6451 {\def\syst_helpers_do_common_check_all##1
6452 {\doifnotinset{##1}{#4}\donefalse
6453 \ifdone\else\expandafter\quitcommalist\fi}
6454 \donetrue
6455 \processcommalist[#3]\syst_helpers_do_common_check_all
6456 \ifdone\expandafter#1\else\expandafter#2\fi}
6457
6458\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments}
6459\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument }
6460\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments }
6461
6462\let\doifallcommonelse\doifelseallcommon
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483\protected\def\syst_helpers_do_IF#1#2
6484 {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}
6485 \expandafter\firstofoneargument
6486 \else
6487 \expandafter\gobbleoneargument
6488 \fi}
6489
6490\protected\def\syst_helpers_do_IF_NOT#1#2
6491 {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}
6492 \expandafter\gobbleoneargument
6493 \else
6494 \expandafter\firstofoneargument
6495 \fi}
6496
6497\protected\def\syst_helpers_do_IF_ELSE#1#2
6498 {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}
6499 \expandafter\firstoftwoarguments
6500 \else
6501 \expandafter\secondoftwoarguments
6502 \fi}
6503
6504\protected\def\syst_helpers_do_IF_INSTRING_ELSE#1#2
6505 {\uppercase{\syst_helpers_do_if_in_string_else{$#1$}{$#2$}}
6506 \expandafter\firstoftwoarguments
6507 \else
6508 \expandafter\secondoftwoarguments
6509 \fi}
6510
6511\protected\def\DOIF #1#2{\normalexpanded{\syst_helpers_do_IF {#1}{#2}}}
6512\protected\def\DOIFNOT #1#2{\normalexpanded{\syst_helpers_do_IF_NOT {#1}{#2}}}
6513\protected\def\DOIFELSE #1#2{\normalexpanded{\syst_helpers_do_IF_ELSE {#1}{#2}}}
6514\protected\def\DOIFINSTRINGELSE #1#2{\normalexpanded{\syst_helpers_do_IF_INSTRING_ELSE{#1}{#2}}}
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549\let\m_syst_helpers_with_set_command\empty
6550\let\syst_helpers_with_set_step \relax
6551
6552\def\syst_helpers_with_set_double[#1][#2]
6553 {\doifsomething{#1}
6554 {\def\syst_helpers_with_set_step##1{\m_syst_helpers_with_set_command[##1][#2]}
6555 \processcommalist[#1]\syst_helpers_with_set_step}}
6556
6557\def\syst_helpers_with_set_triple[#1][#2][#3]
6558 {\doifsomething{#1}
6559 {\def\syst_helpers_with_set_step##1{\m_syst_helpers_with_set_command[##1][#2][#3]}
6560 \processcommalist[#1]\syst_helpers_with_set_step}}
6561
6562\def\dodoubleemptywithset #1{\let\m_syst_helpers_with_set_command#1\dodoubleempty \syst_helpers_with_set_double}
6563\def\dodoubleargumentwithset#1{\let\m_syst_helpers_with_set_command#1\dodoubleargument\syst_helpers_with_set_double}
6564
6565\def\dotripleemptywithset #1{\let\m_syst_helpers_with_set_command#1\dotripleempty \syst_helpers_with_set_triple}
6566\def\dotripleargumentwithset#1{\let\m_syst_helpers_with_set_command#1\dotripleargument\syst_helpers_with_set_triple}
6567
6568
6569
6570
6571
6572
6573
|