Thanks for the explanation. And of course I do know how PMX knows it's at
the end of the input, i.e.,  when there are no more lines of input to read.
The thing I still don't understand is exactly this: if someone sends me a
file generated in their favorite OS, and I look at its binary image using
the PC command line program debug, is there any specific binary character or
characters that announces "this is the end of the file"? I think that in PC
OS's the answer is "no", because after the last "0D 0A" (CR LF), the next
character is not consistently the same character from one file to another.

--Don

>-----Original Message-----
>From: [email protected] [mailto:[email protected]] On
Behalf Of
>Dirk Laurie
>Sent: Monday, August 01, 2011 1:23 AM
>To: Werner Icking Music Archive
>Subject: Re: [Tex-music] PMX: Repeat at the end ignored (was: M-Tx ...)
>
>On Mon, Aug 01, 2011 at 01:07:07AM +0200, Don Simons wrote:
>>
>> I'm not sure how any of the programs know when they come to the end of
the
>> file.
>>
>
>M-Tx keeps a boolean `eofAll` that can be set only at one point
>but is tested for in several places.
>
>1. The main loop asks for a complete paragraph; if this paragraph
>    contains no non-empty lines, that sets eofAll.
>2. The paragraph reader asks for one line at a time; if an empty
>    line is found (except right at the top of the file), that's the
>    end of the paragraph.  It then skips all further blank lines.
>3. The line reader keeps a one-line buffer `nextData` which it
>    serves up if not empty; otherwise it tries to read another
>    line and returns it whether empty or not.
>4. The routine that skips blank lines stores the first non-blank
>    line it finds in `nextData` for later use.
>
>The whole of M-Tx contains exactly one statement that actually reads
>from an input .mtx file.  That statement is a call to the system
>routine `readln`, which is supposed to strip off whatever the system
>uses for end-of-line before returning the result.  The Pascal system
>is also supposed to know how many characters a string may contain:
>M-Tx doesn't know your system's rules and can't check whether you
>obey them.
>
>This solution should be feasible in PMX too, replacing 'paragraph'
>by 'block'.  Some fancy footwork may be necessary to take into account
>that ' / ' may legally appear in TeX strings (or simply prohibit that).
>`nextData` would then on occasion contain the unprocessed part
>of line after ' / '.
>
>Dirk
>-------------------------------
>[email protected] mailing list
>If you want to unsubscribe or look at the archives, go to
>http://tug.org/mailman/listinfo/tex-music


-------------------------------
[email protected] mailing list
If you want to unsubscribe or look at the archives, go to 
http://tug.org/mailman/listinfo/tex-music

Reply via email to