summaryrefslogtreecommitdiff
path: root/support/splint/examples/ld/ldint.sty
diff options
context:
space:
mode:
Diffstat (limited to 'support/splint/examples/ld/ldint.sty')
-rw-r--r--support/splint/examples/ld/ldint.sty27
1 files changed, 22 insertions, 5 deletions
diff --git a/support/splint/examples/ld/ldint.sty b/support/splint/examples/ld/ldint.sty
index 478bdef17d..83f3068dc5 100644
--- a/support/splint/examples/ld/ldint.sty
+++ b/support/splint/examples/ld/ldint.sty
@@ -1,4 +1,4 @@
-% Copyright 2012-2015, Alexander Shibakov
+% Copyright 2012-2020, Alexander Shibakov
% This file is part of SPLinT
%
% SPLinT is free software: you can redistribute it and/or modify
@@ -175,7 +175,7 @@
}
\def\ldsciinteger#1{%
- \ifcase\intprefix{#1}
+ \ifcase\intprefix{#1}%
% decimal number (no prefix)
\lddecsplitws{#1}{}%
\or % hex number (0X)
@@ -203,11 +203,23 @@
}
\def\displayinteger#1#2#3#4#5#6#7#8{%
- {\def\ldintsep{$\,$}\hbox{\tt#7#8${}_{#1}\yystringempty{#2}{}{\,\hbox{\tt#2}}$}}%
+ {\def\ldintsep{$\,$}\hbox{\rm#7#8\rlap{${}_{#1}$}$\yystringempty{#2}{}{\lddisplayintsuffix{#2}}$}}%
}
+\def\lddisplayintsuffix#1{%
+ \expandafter\ifx\csname ldspecialsuffixdisplay#1\endcsname\relax
+ \,\hbox{\tt#1}%
+ \else
+ \csname ldspecialsuffixdisplay#1\endcsname
+ \fi
+}
+
+\def\ldspecialsuffixdisplayK{{}\cdot2^{10}}
+
+\def\ldspecialsuffixdisplayK{\,\hbox{\rm Kb}}
+
\def\displayintegerws#1#2#3#4#5#6#7{%
- {\def\ldintsep{$\,$}\hbox{\tt#6#7${}_{\yystringempty{#1}{}{\csname ldradix#1\endcsname}}$}}%
+ {\def\ldintsep{$\,$}\hbox{\rm#6#7\rlap{${}_{\yystringempty{#1}{}{\csname ldradix#1\endcsname}}$}}}%
}
% typeseting examples in text
@@ -234,6 +246,7 @@
\let\acharswitch\texcharadjust
\let\onecharswitch\texcsadjust
\let\yyinputgroup\yyinputldgroup
+ \expandafter\hidecs\expandafter{\ldunion} % inhibit expansion so that fewer \noexpand are necessary
\toldparser
\ldparserinit
\yyparse#1\yyeof\yyeof\endparseinput\endparse
@@ -242,9 +255,13 @@
\else % Stage three, process the parsed table
\yybreak{%
{%
+ \restorecslist{ld-parser:restash}\ldunion % extract the stash and mark lhs of assignments
+ \setprodtable % use \bison's parser typesetting definitions
+ \the\ldcmds
\restorecslist{ld-display}\ldunion
+ \setprodtable % use \bison's parser typesetting definitions
+ \restorecs{ld-display}{\anint\bint\hexint} % ... except for integer typesetting
\the\ldcmds
-% \par
\the\lddisplay
}%
}%