summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ptexdir
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/ptexdir')
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch24
-rw-r--r--Build/source/texk/web2c/ptexdir/tests/control-symbol.tex80
3 files changed, 110 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index ba8d0f9432b..63b06a49d7f 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-30 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
+
+ * ptex-base.ch: Suppress a space character printed after the name
+ of a multibyte control symbol in print_cs().
+ * tests/control-symbol.tex: Added.
+
2017-10-04 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
* ptex-base.ch: Direction check in \discretionary.
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index 1600827d507..0b32a4d49b0 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -1410,6 +1410,30 @@ end;
tats
@z
+@x [17.???] l.???? - pTeX multibyte control symbol
+procedure print_cs(@!p:integer); {prints a purported control sequence}
+@y
+procedure print_cs(@!p:integer); {prints a purported control sequence}
+var j, l:pool_pointer; @!cat:0..max_char_code;
+@z
+
+@x
+else begin print_esc(text(p));
+ print_char(" ");
+ end;
+@y
+else begin l:=text(p);
+ print_esc(l); j:=str_start[l]; l:=str_start[l+1];
+ if l>j+1 then begin
+ if l-j=multistrlen(ustringcast(str_pool), l, j) then
+ begin cat:=kcat_code(kcatcodekey(fromBUFF(ustringcast(str_pool), l, j)));
+ if (cat<>other_kchar) then print_char(" ");
+ end
+ else print_char(" "); end
+ else print_char(" ");
+ end;
+@z
+
@x [18.265] l.5903 - pTeX: \jfont \tfont
primitive("font",def_font,0);@/
@!@:font_}{\.{\\font} primitive@>
diff --git a/Build/source/texk/web2c/ptexdir/tests/control-symbol.tex b/Build/source/texk/web2c/ptexdir/tests/control-symbol.tex
new file mode 100644
index 00000000000..b9e34054443
--- /dev/null
+++ b/Build/source/texk/web2c/ptexdir/tests/control-symbol.tex
@@ -0,0 +1,80 @@
+\scrollmode
+% plain TeX ソース
+\def\+{A}
+\def\+{A}
+\def\X{\+}
+\def\Y{\+}
+
+\message{■control symbol}
+% 記号類扱いの単文字命令 → control symbol
+% (この時の和文文字の挙動が tex-jp-build#37 の問題)
+\ifx\kanjiskip\undefined
+ \catcode`\+=12
+ \catcode`\+=12
+\else
+ \catcode`\+=12
+ \kcatcode`+=18
+\fi
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+
+\message{■control word}
+% 普通の文字扱いの単文字命令 → control word
+\ifx\kanjiskip\undefined
+ \catcode`\+=11
+ \catcode`\+=11
+\else
+ \catcode`\+=11
+ \kcatcode`+=17
+\fi
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+
+\message{■control word}
+% 複数文字命令 → control word
+\def\ABC{A}
+\def\あいう{A}
+\def\X{\ABC}
+\def\Y{\あいう}
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+
+% csname
+\ifx\protected\undefined\else
+\catcode`\:=12
+\ifx\kanjiskip\undefined\else
+\kcatcode`!=18
+\fi
+\message{■csname}
+\protected\expandafter\def\csname :AB\endcsname{A}
+\protected\expandafter\def\csname !あい\endcsname{A}
+\edef\X{\csname :AB\endcsname}
+\edef\Y{\csname !あい\endcsname}
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+
+\protected\expandafter\def\csname AB:\endcsname{A}
+\protected\expandafter\def\csname あい!\endcsname{A}
+\edef\X{\csname AB:\endcsname}
+\edef\Y{\csname あい!\endcsname}
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+
+\ifx\ucs\undefined\else
+\message{■not_cjk}
+\kcatcode`ア=15
+\kcatcode`!=15
+\catcode"8A=12\relax
+\protected\expandafter\def\csname ア\endcsname{A}
+\protected\expandafter\def\csname !\endcsname{A}
+\edef\X{\csname ア\endcsname}
+\edef\Y{\csname !\endcsname}
+\show\X\relax\message{(\meaning\X)}
+\show\Y\relax\message{(\meaning\Y)}
+\fi
+\fi
+
+
+\end
+
+