%%
%% This is file `delimtxt.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% delimtxt.dtx  (with options: `delimtxt')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from delimtxt.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file delimtxt.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% This is heavily based on:
%% textmerg.dtx  (with options: `textmerg')
%%
%% Copyright (C) 1992,1994 Mike Piff, University of Sheffield, England
\def\fileversion{1.02}
\def\filedate{1999/05/03}
\def\filename{delimtxt.dtx}
\def\Copyright{Copyright 1999 Bjoern Pedersen}
\NeedsTeXFormat{LaTeX2e}[1998/06/01]
\ProvidesPackage{delimtxt}[\filedate]
\typeout{Package `delimtxt� <\filedate>.}
\typeout{\Copyright}
\def\glet{\global\let}

\newread\DelimFile

\def\InputFile#1{%
   \openin\DelimFile=#1
   \ifeof\DelimFile
   \errmessage{Empty Delim file}%
   \closein\DelimFile
   \long\def\MakeTemplate##1{%
      \def\Template{}}%
   \else\GetInput
   \fi}
\def\GetInput{{
 \global\LF@false
 \endlinechar=-1%
 \expandafter\catcode\expandafter`\the\Del=12
   \global\read\DelimFile to\InputBuffer}}
\def\SeeIfEof{%
   \let\NextLook\relax
   \ifeof\DelimFile
   \else
      \ifx\InputBuffer\empty
         \LookAgain
      \fi
   \fi
   \NextLook}

\def\LookAgain{\GetInput
   \let\NextLook\SeeIfEof}

\newif\ifNonBlank \NonBlankfalse
\def\AllowBlank{\global\NonBlankfalse}
\def\DontAllowBlank{\global\NonBlanktrue}

\newif\ifLF@
\def\mark{\relax}
\newtoks\InPutField
\newtoks\Del
\newtoks\StripT@k
\newtoks\NextFieldT@k
\StripT@k={%
{%
\aftergroup\gdef%
\aftergroup\StripMark%
\aftergroup#\aftergroup1%
\expandafter\aftergroup\the\Del%
\aftergroup\mark%
}{\gdef\InputBuffer{#1}}}

\NextFieldT@k={%
{%begin of aftergroup group
\aftergroup\gdef%
\aftergroup\GetNextInputField%
\aftergroup#\aftergroup1%
\expandafter\aftergroup\the\Del%
\aftergroup#\aftergroup2%
\aftergroup\lineend}%end of aftergroup group
{%
 \if\mark #2%
    \global\LF@true%
     \glet\InputBuffer=\empty%
  \else%
     \global\LF@false%
     \StripMark#2%
  \fi%
  \InPutField={#1}%
  \if!#1!% check if Field is empty (Ref: D.Carlise in comp.text.tex)
      \ifNonBlank%
         \MissingField%
         \InPutField={???}%
      \else%
         \InPutField={#1}%
      \fi%
      \else
      \relax
  \fi%
}}
\def\SetDel#1{\global\Del={#1}%
\the\StripT@k%
\the\NextFieldT@k%
}
\SetDel|


\def\ReadIn#1{%
     \expandafter\expandafter\expandafter%
     \GetNextInputField%
     \expandafter\InputBuffer\the\Del%
     \mark\lineend%
      \global\edef#1{\the\InPutField}%
}
\def\MissingField{%
  \message{Missing field in file}}

\newtoks\GlobalFields
\def\Fields#1{\GlobalFields{#1}}
\def\ParseFields#1{%
  \ifx#1\EndParseFields%
  \let\NextParse\relax%
      \ifLF@%
        \message{ Line was OK}%
      \else%
        {\message{ There were more items than fields on line
        \the\Iteratecounter.  They will be skipped.}
        \glet\InputBuffer=\empty}%
      \fi%
  \else%
      \let\NextParse\ParseFields%
      \ifx#1+\DontAllowBlank%
      \else%
         \ifx#1-\AllowBlank%
         \else\ReadIn#1%
         \fi%
      \fi%
  \fi\NextParse}%

\let\EndParseFields\ParseFields%
\def\ReadFields#1{
\ifeof\DelimFile%
  \else%
\expandafter\ParseFields%
  \the#1\EndParseFields%
\fi}%
\long\def\DelimRead#1#2{\begingroup%
   \InputFile{#1}%
   \def\Fields##1{%
      \ParseFields##1\EndParseFields}%
   \MakeTemplate{#2}\Iterate}%
\long\def\MakeTemplate#1{\def\Template{#1}}
\countdef\Iteratecounter=1%

\Iteratecounter=0
\def\Iterate{%
   \global\advance\Iteratecounter by1%
   \ReadFields\GlobalFields%
   \Template%
   \SeeIfEof%
   \ifeof\DelimFile%
      \def\NextIteration{%
         \endgroup\closein\DelimFile}%
   \else%
      \let\NextIteration\Iterate%
   \fi%
   \NextIteration}
\endinput
%%
%% End of file `delimtxt.sty'.
