summaryrefslogtreecommitdiff
path: root/support/splint/other/texmf/macros/protcode.tex
diff options
context:
space:
mode:
Diffstat (limited to 'support/splint/other/texmf/macros/protcode.tex')
-rw-r--r--support/splint/other/texmf/macros/protcode.tex83
1 files changed, 83 insertions, 0 deletions
diff --git a/support/splint/other/texmf/macros/protcode.tex b/support/splint/other/texmf/macros/protcode.tex
new file mode 100644
index 0000000000..57f735a973
--- /dev/null
+++ b/support/splint/other/texmf/macros/protcode.tex
@@ -0,0 +1,83 @@
+% this code works with OT1 encoding only!
+
+\def\setprotcode#1{%
+ \rpcode#1`\!=200
+ \rpcode#1`\,=700
+ \rpcode#1`\-=700
+ \rpcode#1`\.=700
+ \rpcode#1`\;=500
+ \rpcode#1`\:=500
+ \rpcode#1`\?=200
+ \lpcode#1`\`=700
+ \rpcode#1`\'=700
+ \lpcode#1 92=500 % ``
+ \rpcode#1 34=500 % ''
+ \rpcode#1 123=300 % --
+ \rpcode#1 124=200 % ---
+ \rpcode#1`\)=50
+ \rpcode#1`\A=50
+ \rpcode#1`\F=50
+ \rpcode#1`\K=50
+ \rpcode#1`\L=50
+ \rpcode#1`\T=50
+ \rpcode#1`\V=50
+ \rpcode#1`\W=50
+ \rpcode#1`\X=50
+ \rpcode#1`\Y=50
+ \rpcode#1`\k=50
+ \rpcode#1`\r=50
+ \rpcode#1`\t=50
+ \rpcode#1`\v=50
+ \rpcode#1`\w=50
+ \rpcode#1`\x=50
+ \rpcode#1`\y=50
+ \lpcode#1`\(=50
+ \lpcode#1`\A=50
+ \lpcode#1`\J=50
+ \lpcode#1`\T=50
+ \lpcode#1`\V=50
+ \lpcode#1`\W=50
+ \lpcode#1`\X=50
+ \lpcode#1`\Y=50
+ \lpcode#1`\v=50
+ \lpcode#1`\w=50
+ \lpcode#1`\x=50
+ \lpcode#1`\y=0
+ \adjustprotcode#1\relax
+}
+
+\newif\ifneedadjustprotcode
+\newbox\boxA
+\newcount\countA
+\newcount\countB
+\def\adjustprotcode#1{%
+ \needadjustprotcodefalse
+ \ifnum\pdftexversion = 14
+ \ifnum \expandafter`\pdftexrevision > `g
+ \needadjustprotcodetrue
+ \fi
+ \else\ifnum\pdftexversion > 14
+ \needadjustprotcodetrue
+ \fi \fi
+ \ifneedadjustprotcode
+ \countA=0
+ \loop
+ \ifcase\lpcode#1\countA\else
+ \adjustcp\lpcode#1\countA
+ \fi
+ \ifcase\rpcode#1\countA\else
+ \adjustcp\rpcode#1\countA
+ \fi
+ \advance\countA 1
+ \ifnum\countA < 256 \repeat
+ \fi
+}
+\def\adjustcp#1#2#3{%
+ \setbox\boxA=\hbox{%
+ \ifx#2\font\else#2\fi
+ \char#3}%
+ \countB=\wd\boxA
+ \multiply\countB #1#2#3\relax
+ \divide\countB \fontdimen6 #2\relax
+ #1#2#3=\countB\relax
+}