Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-03

Patch for bug 2453

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Sterling Bates

This is my first shot, so be gentle :-)

The patch assumes FP wants sufficient compatibility with BP 7. If so, it fixes two problems; if not, at least it was a fun exercise.

First, BP ignores non-numeric characters when a ReadLn is called with an integer parameter. To fix this, I changed ReadNumeric's end condition to explicitly terminate on all non-numerics.

Second, BP will not read a Text file past an EOF character at all, regardless of its location in the file. The fix for this is inelegant (inline buffer check), but I can move this out to an external proc if it's onerous to maintain.

It's likely there are things I haven't thought of, so I appreciate comments on it.

Sterling

Reply by email

Sterling Bates

(My ISP's mail server is blacklisted, so sending this from Yahoo. Ugh.)

This is my first shot, so be gentle :-)

The patch assumes FP wants compatibility with BP 7. If so, it fixes two problems; if not, at least it was a fun exercise.

First, BP ignores non-numeric characters when a ReadLn is called with an integer parameter. To fix this, I changed ReadNumeric's end condition to explicitly terminate on all non-numerics.

Second, BP will not read a Text file past an EOF character at all, regardless of its location in the file. The fix for this is inelegant (inline buffer check), but I can move this out to an external proc if it's onerous to maintain.

It's likely there are things I haven't thought of, so I appreciate comments on it.

Sterling

---------------------------------
Post your free ad now! Yahoo! Canada Personals

Reply by email

Tomas Hajny
to Sterling Bates: This is my first shot, so be gentle :-) The patch assumes FP wants sufficient…

From: "Sterling Bates"
To:
Subject: [fpc-devel] Patch for bug 2453
Date: 30.3.2005 - 12:18:36

Show quoted text 5 lines
This is my first shot, so be gentle :-) The patch assumes FP wants sufficient compatibility with BP 7. If so, it fixes two problems; if not, at least it was a fun exercise.

The EOF part looks correctly to me (although I didn't check whether there aren't other places where the check should be added too). The current behaviour when the character is recognized in Eof function (depending on EOF_CTRLZ conditional), but not otherwise, isn't very consistent, IMHO. However, let's wait what other core team members would think about it.

Regarding function ReadNumeric, I think there's at least one open issue there, and that's missing handling of 'e' (or 'E') character for exponent. I'm not sure whether there are any other allowed characters, but at least this one should be supported.

Tomas

! NOVINKA ! -- SURVIVAL L-Carnitin+Chrom -- Zbav se kil a dej se do formy! http://www.sportwave.cz

Reply by email

Sterling Bates

In response to Tomas Hajny:

I wasn't entirely certain about the use of EOF_CTRLZ, but since it's a conditional compile, and the patch is in an include, I felt it better to use it than ignore it :)

I agree regarding ReadNumeric. That one will need some work.

Thanks,

Sterling

Your message below:
--------------------------
The EOF part looks correctly to me (although I didn't check whether there aren't other places where the check should be added too). The current behaviour when the character is recognized in Eof function (depending on EOF_CTRLZ conditional), but not otherwise, isn't very consistent, IMHO. However, let's wait what other core team members would think about it.

Regarding function ReadNumeric, I think there's at least one open issue there, and that's missing handling of 'e' (or 'E') character for exponent. I'm not sure whether there are any other allowed characters, but at least this one should be supported.

---------------------------------
Post your free ad now! Yahoo! Canada Personals

Reply by email

Tomas Hajny
to Sterling Bates: (My ISP's mail server is blacklisted, so sending this from Yahoo. Ugh.) This is my first…

Date sent: Sat, 26 Mar 2005 19:13:36 -0500 (EST) From: Sterling Bates
To:
Subject: [fpc-devel] Patch for bug 2453
Send reply to: FPC developers' list

First, BP ignores non-numeric characters when a ReadLn is called with an integer parameter. To fix this, I changed ReadNumeric's end condition to explicitly terminate on all non-numerics.

This isn't really correct - only characters < ' ' should be treated as delimiters (as already mentioned in the bug report).

Second, BP will not read a Text file past an EOF character at all, regardless of its location in the file. The fix for this is inelegant (inline buffer check), but I can move this out to an external proc if it's onerous to maintain.

I slightly modified your patch (we decided to change the conditional define to a variable, because this allows users to override the default if needed), extended it for handling of #26 in some other routines and applied it, thanks!

Tomas

Reply by email