Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #28758
| From | "Peter Knaggs" <pjk@bcs.org.uk> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | RfD: Interpret S\" |
| Date | 2014-02-25 01:14 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <op.xbtceeqosu5d0p@david> (permalink) |
Interpret S\"
=============
20140209 Original Text
Gerry Jackson, Bernd Paysan and Peter Knaggs
Problem
=======
S" is extended in the File-Access word set to be usable in
interpretation mode.
S\" is a sister word to S" but is not extended in the same way in the
File-Access word set.
It seems to me that S\" is just as useful as S" in interpretation
mode.
Discussion
==========
There are two possible solutions:
Revise the definition of 6.2.2266 S\" to include interpretation
semantics. Alternatively, add a new entry 11.6.2.2266 S\" which adds
the interpretation action, in the same manner as S".
The interpretation semantics of S" are provided in a separate
definition, so that small systems are not required to implement it.
The same can be said of the interpretation semantics for S\". Thus, we
propose taking the second option, and provide a new definition of S\"
in the FILE word set to provide the interpretation semantics.
This brings us to the question of which buffer should S\" use. As S\"
is intended as an extension to S" it would make sense to allow S\" to
use the same buffer as S". The description of the buffer lifetime in
S" will need to be revised.
The number of available buffers is defined as "At least one". As a
number of FILE words require two strings, this would be the right time
to change this to "at least two".
Solution
========
Provide a new definition in the FILE EXT word set, 11.6.2.2266 S\"
which extends 6.2.2266 S\" by providing interpretation semantics.
Proposal
========
a) Replace 11.3.4 Transient String Buffers:
The list of words using memory in transient regions is extended to
include 11.6.1.2165 S". See: 3.3.3.6 Other transient regions.
with:
The system provides transient buffers for S" and S\" strings.
These buffers shall be no less than 80 characters in length,
and there shall be no less than two buffers. The system should
be able to store two strings defined by sequential use of S"
or S\".
b) Add section A.11.3.4 Transient String Buffers
Additional transient buffers are provided for use by S" and S\".
The buffers should be able to store two consecutive strings,
thus allowing the command line:
S" name1" S" name2" RENAME-FILE
The buffers may be implemented in a circular arrangement, where
a string is placed into the next available buffer. When there
are no buffers available, the oldest buffer is overwritten.
S" and S\" share the same buffers.
The list of words using memory in transient regions is extended
to include 11.6.1.2165 S" and 11.6.2.2266 S\". See 3.3.3.6 Other
transient regions.
c) Add the following definition to the FILE EXT word set:
11.6.2.2266 S\" "s-backslash-quote" FILE EXT
Extend the semantics of 6.2.2266 S\" to be:
Interpretation: ( "ccc<quote>" -- c-addr u )
Parse ccc delimited by " (double quote) according to the
translation rules given in 6.2.2266 S\". Store the resulting
string in a temporary string buffer (c-addr u).
Compilation: ( "ccc<quote>" -- )
Parse ccc delimited by " (double quote) according to the
translation rules given in 6.2.2266 S\". Append the run-time
semantics given below to the current definition.
Run-time: ( -- c-addr u )
Return a string c-addr u describing the translation of ccc.
A program shall not alter the returned string.
See: 6.2.2266 S\", 11.3.4 Transient String Buffers, 11.6.1.2165
S", A.11.3.4 Transient String Buffers.
d) Alter the interpretation semantics of 11.6.1.2165 from:
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.
to:
Parse ccc delimited by " (double quote). Store the resulting
string in a temporary string buffer (c-addr u).
e) Add 11.6.2.2266 S\" and A.11.3.4 Transient String Buffers to the
see list of 11.6.1.2165 S".
f) Adjust the documentation requirements in 11.4.1.1 Implementation-
defined options from:
- number of string buffers provided (11.6.2.2165 S")
- size of string buffer used by 11.6.1.2165 S".
to:
- number of temporary string buffers provided (11.3.4
Temporary String Buffers)
- size of temporary string buffers (11.3.4 Temporary String
Buffers).
g) Add S\" to the list of string compilation words in 3.3.3.4 Text-
literal regions:
The text-literal regions, specified by strings compiled with
S", S\" and C", may be read-only.
A program shall not store into the text-literal regions
created by S", S\" and C" nor into any read-only system
variable or read-only transient regions. An ambiguous
condition exists when a program attempts to store
into read-only regions.
--
Peter Knaggs
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
RfD: Interpret S\" "Peter Knaggs" <pjk@bcs.org.uk> - 2014-02-25 01:14 +0000
Re: RfD: Interpret S\" "Alex McDonald" <blog@rivadpm.com> - 2014-02-25 08:26 +0000
Re: RfD: Interpret S\" stephenXXX@mpeforth.com (Stephen Pelc) - 2014-02-25 09:29 +0000
Re: RfD: Interpret S\" m.a.m.hendrix@tue.nl - 2014-02-25 03:43 -0800
Re: RfD: Interpret S\" Bernd Paysan <bernd.paysan@gmx.de> - 2014-03-04 02:46 +0100
Re: RfD: Interpret S\" albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-25 12:25 +0000
Re: RfD: Interpret S\" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-26 11:00 +0000
Re: RfD: Interpret S\" stephenXXX@mpeforth.com (Stephen Pelc) - 2014-02-26 15:18 +0000
Re: RfD: Interpret S\" "Elizabeth D. Rather" <erather@forth.com> - 2014-02-26 08:28 -1000
Re: RfD: Interpret S\" Mikael Nordman <oh2aun@gmail.com> - 2014-02-26 12:33 -0800
Re: RfD: Interpret S\" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-27 15:00 +0000
Re: RfD: Interpret S\" Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-02-25 04:55 -0600
Re: RfD: Interpret S\" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-26 11:53 +0000
csiph-web