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