pdftex[873] branches/stable: \showstream doc and tests

commits+karl at tug.org commits+karl at tug.org
Tue Nov 9 17:13:48 CET 2021


Revision: 873
          http://tug.org/svn/pdftex?view=revision&revision=873
Author:   karl
Date:     2021-11-09 17:13:48 +0100 (Tue, 09 Nov 2021)
Log Message:
-----------
\showstream doc and tests

Modified Paths:
--------------
    branches/stable/doc/manual/ChangeLog
    branches/stable/doc/manual/pdftex-t.tex

Added Paths:
-----------
    branches/stable/tests/22-showstream/
    branches/stable/tests/22-showstream/Makefile
    branches/stable/tests/22-showstream/test-showstream-basic.tex
    branches/stable/tests/22-showstream/test-showstream-only.tex

Modified: branches/stable/doc/manual/ChangeLog
===================================================================
--- branches/stable/doc/manual/ChangeLog	2021-11-07 22:57:43 UTC (rev 872)
+++ branches/stable/doc/manual/ChangeLog	2021-11-09 16:13:48 UTC (rev 873)
@@ -1,5 +1,9 @@
 2021-11-06  Marcel Kr\"uger  <tex at 2krueger.de>
 
+	* pdftex-t.tex (\showstream): document.
+
+2021-11-06  Marcel Kr\"uger  <tex at 2krueger.de>
+
 	* pdftex-t.tex: missed bookmarks for \pdfgentounicode and
 	a few other primitives.
 
@@ -11,7 +15,7 @@
 	
 2021-11-04  Marcel Kr\"uger  <tex at 2krueger.de>
 
-	* pdftex-t.tex: document structured destinations.
+	* pdftex-t.tex: document structured destinations (\pdfdest struct NNN).
 	Also bump document font size to 11pt.
 
 2021-09-25  Karl Berry  <karl at freefriends.org>

Modified: branches/stable/doc/manual/pdftex-t.tex
===================================================================
--- branches/stable/doc/manual/pdftex-t.tex	2021-11-07 22:57:43 UTC (rev 872)
+++ branches/stable/doc/manual/pdftex-t.tex	2021-11-09 16:13:48 UTC (rev 873)
@@ -4327,9 +4327,46 @@
 
 The behavior is the same in all \TeX\ engines except the original \TEX\
 and \eTeX, where \type{\tracingstacklevels} remains undefined.
-
 \introduced{1.40.22}
 
+\pdftexprimitive{\Syntax{\Tex{\showstream} \Whatever{integer}}}
+\bookmark{\tex{showstream}}
+
+If this primitive parameter has a value corresponding to an open output
+stream (which has been opened with \type{\openout}), then any
+\type{\show}, \type{\showthe}, \type{\showbox} or \type{\showlists}
+commands do not write output to the terminal, but instead write to only
+the refereced output stream, as if they were written with
+\type{\immediate\write}.
+
+For example:
+\starttyping
+\newwrite\myoutstream
+\immediate\openout\myoutstream="infofile"
+\showstream=\myoutstream
+% From now on, \show... commands are redirected to "infofile.tex".
+\show\TeX
+%
+\showstream=-1
+% -1 is never a open file and therefore restores
+% normal \show... behavior.
+\immediate\closeout\myoutstream
+\stoptyping
+
+This example would not generate any special output to the terminal or
+log file (except for any logging done by \type{\newwrite}. It writes
+this text to \type{infofile.tex}, including the initial blank line,
+since that is what \type{\show} does:
+
+\starttyping
+
+> \TeX=macro:
+->T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emX
+\stoptyping
+
+The behavior is the same in all \TeX\ engines except the original \TEX\
+and \eTeX, where \type{\showstream} remains undefined. \introduced{1.40.24}
+
 %***********************************************************************
 
 \subsection{\PDFTEX\ execution environment}

Index: branches/stable/tests/22-showstream
===================================================================
--- branches/stable/tests/22-showstream	2021-11-07 22:57:43 UTC (rev 872)
+++ branches/stable/tests/22-showstream	2021-11-09 16:13:48 UTC (rev 873)

Property changes on: branches/stable/tests/22-showstream
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+*.xray
Added: branches/stable/tests/22-showstream/Makefile
===================================================================
--- branches/stable/tests/22-showstream/Makefile	                        (rev 0)
+++ branches/stable/tests/22-showstream/Makefile	2021-11-09 16:13:48 UTC (rev 873)
@@ -0,0 +1,28 @@
+# $Id$
+# Public domain.
+# Test \showstream.
+
+include ../Common.mak
+
+default: test-showstream
+
+test-showstream: test-showstream-basic test-showstream-only
+
+# bad return status since normal \show's happen.
+test-showstream-basic: test-showstream-basic.tex
+	! $(prog) $<
+	$(MAKE) xray=test-showstream-basic.xray grep-xray
+
+# good return status since only showstream.
+test-showstream-only: test-showstream-only.tex
+	$(prog) $<
+	$(MAKE) xray=test-showstream-only.xray grep-xray
+
+# the .xray files have the same contents in both contents
+grep-xray:
+	grep 42 $(xray) >/dev/null
+	grep '\\undefined=undefined' $(xray) >/dev/null
+	grep '\\par=\\par' $(xray) >/dev/null
+
+clean:
+	$(clean)


Property changes on: branches/stable/tests/22-showstream/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: branches/stable/tests/22-showstream/test-showstream-basic.tex
===================================================================
--- branches/stable/tests/22-showstream/test-showstream-basic.tex	                        (rev 0)
+++ branches/stable/tests/22-showstream/test-showstream-basic.tex	2021-11-09 16:13:48 UTC (rev 873)
@@ -0,0 +1,29 @@
+% $Id$
+% Public domain. Originally by Marcel Kr\"uger, 2021.
+%
+% Test basic \showstream output and that it doesn't interfere with
+% regular \show commands when inactive.
+% It should print the meaning of \stillVisible and \backToNormal while the
+% remaining \show commands should not lead to any terminal interaction but
+% get written to the .xray file.
+
+\pdfcompresslevel=0 \pdfobjcompresslevel=0
+\pdfoutput=1
+\catcode`\{=1 \catcode`\}=2
+%\output={\global\advance\count0 by 1 \shipout\box255 }
+
+\begingroup
+\chardef\showout=1 % \newwrite\showout
+\showstream=\showout
+\show\stillVisible
+\immediate\openout\showout"\jobname.xray"
+\count0=42
+\showthe\count0
+\show\undefined
+\show\par
+\setbox0\hbox{Hello world}
+\showbox0
+\immediate\closeout\showout
+\endgroup
+\show\backToNormal
+\end


Property changes on: branches/stable/tests/22-showstream/test-showstream-basic.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: branches/stable/tests/22-showstream/test-showstream-only.tex
===================================================================
--- branches/stable/tests/22-showstream/test-showstream-only.tex	                        (rev 0)
+++ branches/stable/tests/22-showstream/test-showstream-only.tex	2021-11-09 16:13:48 UTC (rev 873)
@@ -0,0 +1,26 @@
+% $Id$
+% Public domain. Originally by Marcel Kr\"uger, 2021.
+%
+% Test basic \showstream output, and that no error code is returned if
+% only redirected \show commands occurred in a run.
+
+\pdfcompresslevel=0 \pdfobjcompresslevel=0
+\pdfoutput=1
+\catcode`\{=1 \catcode`\}=2
+\output={\global\advance\count0 by 1 \shipout\box255 }
+
+\begingroup
+\chardef\showout=1 % \newwrite\showout
+\showstream=\showout
+% \show\stillVisible
+\immediate\openout\showout"\jobname.xray"
+\count0=42
+\showthe\count0
+\show\undefined
+\show\par
+\setbox0\hbox{Hello world}
+\showbox0
+\immediate\closeout\showout
+\endgroup
+% \show\backToNormal
+\end


Property changes on: branches/stable/tests/22-showstream/test-showstream-only.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property


More information about the pdftex-commits mailing list.