summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:00:35 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:00:35 +0000
commite1d8dd01f067204a5ba87f57b4ad9f04a3e67e0a (patch)
tree7114b51764cbbc422e8c45350ee2f2716d67bd64 /Master
parent092017c515db38de4f282ae593042c0818fea981 (diff)
newfile
git-svn-id: svn://tug.org/texlive/trunk@1135 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/tex/latex/newfile/newfile.sty213
1 files changed, 213 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/newfile/newfile.sty b/Master/texmf-dist/tex/latex/newfile/newfile.sty
new file mode 100644
index 00000000000..a562bb7d1bd
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/newfile/newfile.sty
@@ -0,0 +1,213 @@
+%%
+%% This is file `newfile.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% newfile.dtx (with options: `outin')
+%%
+%% This program is provided under the terms of the
+%% LaTeX Project Public License distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt.
+%%
+%% Author: Peter Wilson (CUA)
+%% now at: peter.r.wilson@boeing.com
+%%
+\NeedsTeXFormat{LaTeX2e}[1996/06/01]
+\ProvidesPackage{newfile}[2002/06/21 v1.0 Output and input files]
+\RequirePackage{verbatim}
+\newcommand{\newoutputstream}[1]{%
+ \@ifundefined{#1outstre@m}%
+ {\expandafter\newwrite\csname #1outstre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\PackageError{newfile}{Output stream #1 is already defined}{\@ehc}}}
+
+\newcommand{\newinputstream}[1]{%
+ \@ifundefined{#1instre@m}%
+ {\expandafter\newread\csname #1instre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\PackageError{newfile}{Input stream #1 is already defined}{\@ehc}}}
+
+\newcommand{\@ifstre@mopen}[3]{%
+ \csname ifstre@m#1open\endcsname#2\else#3\fi}
+\newcommand{\instre@mandopen}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \PackageError{newfile}{#1\space is not an input stream}{\@ehc}}%
+ {\@ifstre@mopen{#1}{#2}{%
+ \PackageError{newfile}{Input stream #1\space is not open}{\@ehc}}}}
+
+\newcommand{\instre@mandclosed}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \PackageError{newfile}{#1\space is not an input stream}{\@ehc}}%
+ {\@ifstre@mopen{#1}{%
+ \PackageError{newfile}{Input stream #1\space is open}{\@ehc}}{#2}}}
+
+\newcommand{\outstre@mandopen}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \PackageError{newfile}{#1\space is not an output stream}{\@ehc}}%
+ {\@ifstre@mopen{#1}{#2}{%
+ \PackageError{newfile}{Output stream #1\space is not open}{\@ehc}}}}
+
+\newcommand{\outstre@mandclosed}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \PackageError{newfile}{#1\space is not an output stream}{\@ehc}}%
+ {\@ifstre@mopen{#1}{%
+ \PackageError{newfile}{Output stream #1\space is open}{\@ehc}}{#2}}}
+
+\newcommand{\openoutputfile}[2]{%
+ \outstre@mandclosed{#2}{%
+ \global\@namedef{#1@filename}{#1}%
+ \if@filesw
+ \immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}%
+ \fi
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}%
+ }%
+}
+
+\newcommand{\closeoutputstream}[1]{%
+ \outstre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closeout\@nameuse{#1outstre@m}%
+ \global\csname stre@m#1openfalse\endcsname}%
+}
+
+\newcommand{\openinputfile}[2]{%
+ \IfFileExists{#1}{% file exists
+ \instre@mandclosed{#2}{%
+ \@addtofilelist{#1}%
+ \global\@namedef{#1@filename}{#1}%
+ \immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}%
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}}}%
+ {% file not found
+ \PackageError{newfile}{Can't find file #1}{\@ehc}%
+ }%
+}
+
+\newcommand{\closeinputstream}[1]{%
+ \instre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closein\@nameuse{#1instre@m}%
+ \global\csname stre@m#1openfalse\endcsname}%
+}
+
+\def\writeverbatim#1{%
+ \@bsphack
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active
+ \verbatim@startline
+ \verbatim@addtoline
+ \verbatim@finish
+ \def\verbatim@processline{%
+ \immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}%
+ \verbatim@start}
+\def\endwriteverbatim{\@esphack}
+
+\newcommand{\addtostream}[2]{%
+ \@bsphack
+ \outstre@mandopen{#1}{%
+ {\let\protect\string
+ \immediate\write\@nameuse{#1outstre@m}{#2}%
+ }}%
+ \@esphack
+}
+
+\newif\ifstre@mnoteof
+\newcommand{\checkstre@meof}[1]{%
+ \stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi}
+
+\def\readstream#1{
+ \instre@mandopen{#1}{%
+ \loop \checkstre@meof{#1} \ifstre@mnoteof
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \repeat
+ }%
+}
+
+\def\readaline#1{
+ \instre@mandopen{#1}{%
+ \ifeof\@nameuse{#1instre@m}
+ \PackageWarning{newfile}{No more to read from stream #1}
+ \else
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \fi
+ }%
+}
+
+\def\readverbatim{\begingroup
+ \@ifstar{\stre@mverbatim@input\relax}%
+ {\stre@mverbatim@input{\frenchspacing\@vobeyspaces}}}
+
+\def\stre@mverbatim@input#1#2{%
+ \@ifstre@mopen{#2}%
+ {\@verbatim #1\relax
+ \def\verbatim@in@stream{\@nameuse{#2instre@m}}
+ \verbatim@readstre@m{#2}\endtrivlist\endgroup\@doendpe}%
+ {\PackageError{newfile}{Stream #2 is not open}{\@ehc}\endgroup}%
+}
+
+\def\verbatim@readstre@m#1{%
+ \verbatim@startline
+ \expandafter\endlinechar\expandafter\m@ne
+ \expandafter\verbatim@read@file
+ \expandafter\endlinechar\the\endlinechar\relax
+ \verbatim@finish
+}
+
+\newcommand{\plainvstream}{%
+ \def\verbatim@processline{\the\verbatim@line\par}%
+}
+
+\newcounter{streamvline}
+\newcommand{\streamvnumfont}[1]{\def\stre@mvnfont{#1}}
+\streamvnumfont{\footnotesize}
+
+\newcommand{\verbatimfont}[1]{%
+ \def\verbatim@font{#1%
+ \hyphenchar\font\m@ne
+ \let\do\do@noligs
+ \verbatim@nolig@list}}
+\verbatimfont{\normalfont\ttfamily}
+
+\newcommand{\numbervstream}{%
+ \setcounter{streamvline}{0}%
+ \def\verbatim@processline{%
+ \addtocounter{streamvline}{1}%
+ \leavevmode
+ {\stre@mvnfont \thestreamvline}\space
+ \the\verbatim@line\par}%
+}
+
+\newcommand{\marginnumbervstream}{%
+ \setcounter{streamvline}{0}%
+ \def\verbatim@processline{%
+ \addtocounter{streamvline}{1}%
+ \leavevmode
+ \llap{{\stre@mvnfont \thestreamvline} \hskip\@totalleftmargin}
+ \the\verbatim@line\par}%
+}
+
+\endinput
+%%
+%% End of file `newfile.sty'.