summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2022-05-29 10:40:23 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2022-05-29 10:40:23 +0000
commit06070a7b9c2d65b7ffdd66e0fd6fdf8507bdc3e9 (patch)
treea4660ffc50e958ea39afa50d3db7211d6575d5a2
parent383b7f5f1e0ac6d3bcf45d07384c2a7ed4704cd5 (diff)
[CWEB] DRY up CWEAVE§120.
git-svn-id: svn://tug.org/texlive/trunk@63435 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/cwebdir/cweave.w19
2 files changed, 15 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index ee2d2fdd486..32a4011af6e 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,7 @@
+2022-05-29 Andreas Scherer <https://ascherer.github.io>
+
+ * cweave.w: DRY up section 120.
+
2022-05-28 Andreas Scherer <https://ascherer.github.io>
* ctwill-w2c.ch,
diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w
index 22dee651621..b57611851aa 100644
--- a/Build/source/texk/web2c/cwebdir/cweave.w
+++ b/Build/source/texk/web2c/cwebdir/cweave.w
@@ -2317,9 +2317,11 @@ tokens, and intercalates a `\.{\$}' token if necessary. When in
doubt what to use, use |big_app|.
@d app(a) *(tok_ptr++)=(token)(a)
+@#
@d big_app2(a) big_app1(a);@+big_app1(a+1)
@d big_app3(a) big_app2(a);@+big_app1(a+2)
@d big_app4(a) big_app3(a);@+big_app1(a+3)
+@#
@d big_app1_insert(p,c) big_app1(p);@+big_app(c);@+big_app1(p+1)
@d big_app1_insert_str(p,s) big_app1(p);@+app_str(s);@+big_app1(p+1)
@d big_app2_insert(p,c) big_app2(p);@+big_app(c);@+big_app2(p+2)
@@ -2358,6 +2360,11 @@ static int cur_mathness, init_mathness;
understanding the format by comparing the code with the symbolic
productions as they were listed earlier.
+@d begin_math if (cur_mathness==maybe_math) init_mathness=yes_math;
+ else if (cur_mathness==no_math) app_str("${}")
+@d end_math if (cur_mathness==maybe_math) init_mathness=no_math;
+ else if (cur_mathness==yes_math) app_str("{}$")
+
@c
static void
app_str(
@@ -2372,12 +2379,10 @@ token a)
{
if (a==' ' || (a>=big_cancel && a<=big_force) || a==dindent)
/* non-math token */ {
- if (cur_mathness==maybe_math) init_mathness=no_math;
- else if (cur_mathness==yes_math) app_str("{}$");
+ end_math;
cur_mathness=no_math;
} else {
- if (cur_mathness==maybe_math) init_mathness=yes_math;
- else if (cur_mathness==no_math) app_str("${}");
+ begin_math;
cur_mathness=yes_math;
}
app(a);
@@ -2389,13 +2394,11 @@ scrap_pointer a)
{
switch (a->mathness % 4) { /* left boundary */
case (no_math):
- if (cur_mathness==maybe_math) init_mathness=no_math;
- else if (cur_mathness==yes_math) app_str("{}$");
+ end_math;
cur_mathness=a->mathness / 4; /* right boundary */
break;
case (yes_math):
- if (cur_mathness==maybe_math) init_mathness=yes_math;
- else if (cur_mathness==no_math) app_str("${}");
+ begin_math;
cur_mathness=a->mathness / 4; /* right boundary */
break;
case (maybe_math): /* no changes */ break;