summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rvwrite/rvwrite.sty
blob: dc3ea14b5fc8a4790967f3a62d183f2273408e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
%%                                   
%%
%% This is file 'rvwrite.sty'.
%%
%% File: rvwrite.sty Copyright (c) 2010 C. V. Radhakrishnan
%%       River Valley, Mepukada, Malayinkil, Trivandrum 695571
%%       http://www.river-valley.com Email: <cvr@river-valley.org>
%%       
%% This package may be distributed under the terms of the LaTeX Project 
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% $Id: rvwrite.sty,v 1.2 2010/08/25 08:59:06 cvr Exp cvr $
%% 
\NeedsTeXFormat{LaTeX2e}
\def\Fileversion$#1: #2 ${\gdef\fileversion{#2}}
\def\Filedate$#1: #2 #3 ${\gdef\filedate{#2}}
\Fileversion$Revision: 1.2 $
\Filedate$Date: 2010/08/25 08:59:06 $
\ProvidesPackage{rvwrite}
   [\filedate\space\fileversion\space enhanced write registers (CVR)]
\PackageWarningNoLine{rvwrite}
   {****************************************\MessageBreak
    Package rvwrite v,\fileversion\space loaded\MessageBreak
    [enhanced write registers (CVR)]\MessageBreak
    ****************************************}
%
%
\newwrite\rvtwrite

\def\dlrchr{\expandafter\@gobble\string\$}
\def\hshchr{\expandafter\@gobble\string\#}
\def\bslchr{\expandafter\@gobble\string\\}
\def\lbrchr{\expandafter\@gobble\string\{}
\def\rbrchr{\expandafter\@gobble\string\}}
\def\tldchr{\expandafter\@gobble\string\~}
\def\ampchr{\expandafter\@gobble\string\&}

\immediate\openout\rvtwrite=\jobname-write.tex
\immediate\write\rvtwrite{\string\documentclass{article}}
\immediate\write\rvtwrite{ }
\immediate\write\rvtwrite{\string\input\space ProTex.sty}
\immediate\write\rvtwrite{\string\AlProTex{tex,<<<>>>,list,title,|,[]}}
\immediate\write\rvtwrite{ }
\immediate\write\rvtwrite{\string\begin{document}}
\immediate\write\rvtwrite{ }

\def\newrvwrite#1{\@ifundefined{RV@#1}{\@namedef{RV@#1}{#1}}{}%
     \AtEndDocument{\immediate\write\rvtwrite{%
       \string\OutputCode\string\<\jobname-#1\string\>}}}
%
% \rvwrite #1 => file type
%          #2 => string(s) to write out
\def\ervwrite#1#2{\@ifundefined{RV@#1}{\newrvwrite{#1}}{}%
     \immediate\write\rvtwrite{\string\<\jobname-#1\string\><<<}
      \immediate\write\rvtwrite{#2^^J>>>}}

\def\rvwrite#1#2{\@ifundefined{RV@#1}{\newrvwrite{#1}}{}\def\next{#2}%
    \immediate\write\rvtwrite{\string\<\jobname-#1\string\>%
       <<<^^J\expandafter\strip@prefix\meaning\next^^J>>>}}

\AtEndDocument{\write\rvtwrite{\space^^J\string\end{document}}}

\endinput

%%
%% End of file 'rvwrite.sty'
%%