[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LF/CR conversion
- Subject: Re: LF/CR conversion
- From: "Jeff Blakeney" <jeff.blakeney@a2central.com.remove-jvh-this>
- Date: Sun, 14 Jan 2007 20:28:26 GMT
- In-reply-to: <45a83435$0$80102$742ec2ed@news.sonic.net>
- Newsgroups: comp.sys.apple2
- Organization: A2Central.com
- References: <45a83435$0$80102$742ec2ed@news.sonic.net>
- Xref: g2news2.google.com comp.sys.apple2:16303
To: Andy McFadden
On Sat, 13 Jan 2007 01:21:57 +0000, "Andy McFadden"
<fadden@fadden.com> wrote:
>Jeff Blakeney <jeff.blakeney@a2central.com.remove-1ev-this> wrote:
>> This is why I didn't finish my Applesoft program. I was trying to
>> avoid using GET as it is slow. I was BLOADing the input file in
>> chunks into memory but then I ran into a few problems like having to
>> load the next chunk if the last character is a CR to see if the next
>> character is a LF.
>
>Instead of probing ahead, output your EOL (End-Of-Line) of choice
>immediately and set an "I just read a CR" flag. The next time through
>the loop, if the current character is "LF" and the "I just read a CR"
>flag is set, don't output anything.
I did think of doing that but wanted to avoid yet another check.
Especially since Applesoft doesn't have block IF commands or even an
ELSE statement.
Last night while at work I had lots of free time and I figured out
another way to do it. It simply involves moving my code to BLOAD a
chunk of the file from where it was into a subroutine so I could call
it if the last character in my current buffer was a CR and it would
reset my pointer to the start of the new data in the buffer so I could
check for a LF.
I'll have to think about which is the better approach now because they
both involve extra checks and such.
Jeff Blakeney
- to send me e-mail, CUT the obvious from my e-mail address
--- Synchronet 3.13a-Win32 NewsLink 1.83
A2Central.com - Your total source for Apple II computing.