Re: RfD - 2VALUE
- From: "GerryJ" <gerry@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: 29 Aug 2006 10:28:51 -0700
Alex McDonald wrote:
GerryJ wrote:
RfD - 2VALUE
==snipped==
The syntax is:
s" some string" 2VALUE stringref
to define <stringref> as a cell pair holding (caddr u) for the string
or
123. 2VALUE ddata
to define <ddata> as a double value initialized to <123.>.
To access the value of stringref and ddata:
stringref TYPE <cr> some string ok
ddata D. <cr> 123 ok
The string won't work; for systems without the FILE wordset;
<quote>
6.1.2165 S"
s-quote CORE
Interpretation: Interpretation semantics for this word are
undefined.
</quote>
and for systems with the FILE wordset
<quote>
11.6.1.2165 S"
s-quote FILE
Extend the semantics of 6.1.2165 S" to be:
Interpretation: ( "ccc<quote>" -- c-addr u )
Parse ccc delimited by " (double quote). Store the resulting string
c-addr u at a temporary location. The maximum length of the temporary
buffer is implementation-dependent but shall be no less than 80
characters. Subsequent uses of S" may overwrite the temporary buffer.
At least one such buffer shall be provided.
</quote>
Either it's ambiguous or you're in danger of addressing a buffer that
will be overwritten.
To change stringref and ddata uses TO:
s" another string" to stringref
Yes I realised that when I did the test case at the end, I suppose I
should have gone back to correct the syntax example. The syntax example
has the correct syntax but won't work for the reasons you describe.
Is there any logical reason for S" being a compile only word in the
core wordset which is then relaxed for the file-access wordset. I'd
have thought the extended behaviour was useful in the core as well.
Gerry
.
- Follow-Ups:
- Re: RfD - 2VALUE
- From: Elizabeth D Rather
- Re: RfD - 2VALUE
- References:
- RfD - 2VALUE
- From: GerryJ
- Re: RfD - 2VALUE
- From: Alex McDonald
- RfD - 2VALUE
- Prev by Date: Re: RfD - SYNONYM
- Next by Date: Re: The IMMEDIATE mess
- Previous by thread: Re: RfD - 2VALUE
- Next by thread: Re: RfD - 2VALUE
- Index(es):
Relevant Pages
|