Search the web
Sign In
New User? Sign Up
forth200x
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Escaped Strings (Version 6.1)   Message List  
Reply | Forward Message #242 of 425 |
Escaped Strings (Version 6.1)

Peter said:

> Ed raised an interesting point in his comments. In that the reference
> implementation uses the PAD. The standard makes a point of stating that
> the PAD is for the application programmer, and that no standard word
> will use it. Thus I have re-worked the reference implementation to
> replace the escaped string in situ. While this is frowned on by the
> standard, writing into source, it is allowed.
>
> The change is actually fairly minor, it simple requires the definition
> of readEscape to be replace with the following:
>
> : readEscape
> source >in @ /string
> tuck over 1- dup >r
> parse\"
> nip - >in +!
> r>
> ;
>
> I have checked this on several system and they are all happy with it.

This fine for hosted systems running in RAM. PARSE\" requires a
writable destination area. In embedded systems, it is not
unusual to store text such as web scripts in Flash. Thus read-
only memory can easily become the input stream. I would much
rather leave the reference implementation alone, but state that
it is not standard because of its use of PAD.

Mitch said:
> Will there be problems if the string to be modified is in ROM, as with a
> string compiled into a colon definition in a ROM dictionary?

Yes.

Peter said:
> It shouldn't do, as S\" returns a string, which is then copied into the
> ROM space at compile time, the same as for S".

So it's in ROM at run time, and the assumption is that it is
expanded at compile time, which is true unless it is interpreted
at run time, e.g. for a web script.

Regardless what the standard says, the majority of Forth systems
(common practice) permit interpretation of S" and friends.

Regards, Stephen
--
Stephen Pelc, stephen@...
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads




Wed Jan 21, 2009 2:06 pm

sfprem
Offline Offline
Send Email Send Email

Forward
Message #242 of 425 |
Expand Messages Author Sort by Date

Ed raised an interesting point in his comments. In that the reference implementation uses the PAD. The standard makes a point of stating that the PAD is for...
Peter Knaggs
pknaggs
Offline Send Email
Jan 20, 2009
11:42 pm

Will there be problems if the string to be modified is in ROM, as with a string compiled into a colon definition in a ROM dictionary?...
Mitch Bradley
wmb@...
Send Email
Jan 20, 2009
11:48 pm

... It shouldn't do, as S\" returns a string, which is then copied into the ROM space at compile time, the same as for S". -- Peter Knaggs...
Peter Knaggs
pknaggs
Offline Send Email
Jan 21, 2009
12:17 am

... This fine for hosted systems running in RAM. PARSE\" requires a writable destination area. In embedded systems, it is not unusual to store text such as web...
Stephen Pelc
sfprem
Offline Send Email
Jan 21, 2009
2:06 pm

... That's very clear, to me at least. Neither a standard program nor a standard system may modify the input buffer while it is still valid. There is even an...
Anton Ertl
anton@...
Send Email
Jan 21, 2009
5:56 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help