Google Groups Home
Help | Sign in
Message from discussion RfD: Escaped Strings S\" (version 5)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Anton Ertl  
View profile
 More options 2 Dec 2007, 10:44
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Sun, 02 Dec 2007 10:44:04 GMT
Local: Sun 2 Dec 2007 10:44
Subject: Re: RfD: Escaped Strings S\" (version 5)
Dick van Oudheusden <dvoudheus...@gmail.com> writes:

>On 30 Oct, 22:16, Peter Knaggs <pkna...@bournemouth.ac.uk> wrote:

>> : parse\"  \ caddr len dest -- caddr' len'
...
>Perhaps it is also a good idea to standardize the underlying word

>   parse\"  ( -- c-addr u)

>in this proposal so that programmers can use it for other words, like
>.\" and ,\" and so on?

Yes, such a word would be useful, especially if S\" has no
interrpetation semantics (as currently proposed) or if it has
interpretation semantics, but cannot be ticked or POSPONEd to allow
state-smart implementations (as I suggested).

However, the word with the ( "string<">" -- c-addr u ) stack effect is
called READESCAPED in the reference implementation.

A lower-level word like the PARSE\" ( c-addr1 u1 c-addr2 -- c-addr2 u2 )
from the reference implementation might be useful in a few additional
cases and thus might be a better choice.  One thing that has to be
considered is the length of the buffer at c-addr2.  With the current
escape sequences it is good enough if the buffer has length u1, and
that will also be the case for any likely candidates for escape
sequences, so the stack effect above may be ok.

An advantage of standardizing a word that passes the destination
buffer rather than a word that writes to a system-supplied buffer is
that we don't need to specify the lifetime of the result.  The
disadvantage is that we need to consider the buffer length, what
happens on overflow (not an issue here), and the programmer can make a
mistake and supply buffer smaller than the specified length, leading
to a buffer overflow.

- anton
--
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2007: http://www.complang.tuwien.ac.at/anton/euroforth2007/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google