forked from Forth-Standard/forth200x
/
structures2.html
193 lines (167 loc) · 6.11 KB
/
structures2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<html>
<head>
<title>Structures Wording</title>
<style type="text/css">
ol li { margin-left: -1em; }
.item { width: 5em; }
ul.results { margin-left: 0em; padding-left: 20px; }
ul.results li { margin-bottom: 1ex; }
ul.results li:first-line { font-weight: bold; }
.history dd { margin-bottom: 1ex; }
.def dd { margin-bottom: 2ex; }
</style>
</head>
<body>
<h3>Structures Wording</h3>
<p>
[ <a href="rfds.html">RfDs/CfVs</a> | <a href="proposals.html">Other proposals</a> ]
</p>
<h3>Poll Standings</h3>
See <a href="#voting">below</a> for voting instructions.
<h4>Systems</h4>
<dl>
<dt> [ ] I agree with the proposed alteration to the document text.</dt>
<dd>Gerry Jackson<br/>
Hans Bezemer<br/>
Bernd Paysan
</dd>
<dt> [ ] I do not agree with the proposed alteration to the document text.</dt>
</dl>
<h4>Informal Results</h4>
<ul class="results">
<li>Hans Bezemer<br/>
I have no problems with the rewording, although I have to add 4tH only
supports <code>FIELD:</code> and <code>+FIELD</code> since it uses the classic gForth standard (which
can portably be defined with 0 and <code>CONSTANT</code>) unless you're using the 4tH
preprocessor. Still, a subset in any form or shape.
</li>
</ul>
<table width="500"><tr><td>
<h3>Problem</h3>
The X:structures extension defines <code>FIELD:</code> as:
<pre>
10.6.2.xxxx FIELD: "field-colon" FACILITY EXT
( -- ) X:structures
</pre>
<dl class="def">
<dd>
The semantics of <code>FIELD:</code> are identical to the execution semantics
of the phrase:
<blockquote>
<code>ALIGNED 1 CELLS +FIELD</code>
</blockquote>
</dd>
<dt>See:</dt>
<dd>
10.6.2.---- <code>+FIELD</code>, 10.6.2.---- <code>BEGIN-STRUCTURE</code> and
10.6.2.---- <code>END-STRUCTURE</code>.
</dd>
</dl>
While this is a very concise definition, there are a few difficulties
with it:
<ol>
<li>The stack description is incorrect, it should be:
<code>( n1 "<spaces>name" -- n2 )</code></li>
<li>It defines a child word which is not described. Normally this is
described in a "<em>name</em> Execution" clause.</li>
<li>There is no actual description of the word, simply what amounts
to a reference implementation.</li>
</ol>
This applies to <code>CFIELD:</code>, <code>DFFIELD:</code>, <code>FFIELD:</code> and <code>SFFIELD:</code> as well.
<h3>Solution</h3>
Replace the definition of <code>FIELD:</code> and friends with:
<pre>
10.6.2.xxxx FIELD: "field-colon" FACILITY EXT
( n1 "<spaces>name" -- n2 ) X:structures
</pre>
<dl class="def">
<dd>
Skip leading space delimiters. Parse <em>name</em> delimited by a space.
<em>Offset</em> is the first cell aligned value greater than or equal to
<em>n1</em>. <em>n2</em> = offset + 1 cells.
<p/>
Create a definition for <em>name</em> with the execution semantics given
below.
</dd>
<dt><em>name</em> Execution: ( a-addr1 -- a-addr2 )</dt>
<dd>
Add the <em>offset</em> calculated during the compile time action to
<em>a-addr1</em> giving the cell aligned address <em>a-addr2</em>.
</dd>
<dt>See:</dt>
<dd>
10.6.2.---- <code>BEGIN-STRUCTURE</code>, A.10.6.---- <code>BEGIN-STRUCTURE</code>,
A.10.6.2.---- <code>FIELD:</code>
</dd>
</dl>
<h3>Proposal</h3>
Modify the definition of the following words in accordance with the
text given in the Solution, above, with the modification of the
alignment as follows:
<blockquote><table>
<tr><td><code>FIELD:</code></td> <td>cell aligned</td> </tr>
<tr><td><code>CFIELD:</code></td> <td>character aligned</td> </tr>
<tr><td><code>FFIELD:</code></td> <td>float aligned</td> </tr>
<tr><td><code>SFFIELD:</code></td> <td>single-float aligned</td> </tr>
<tr><td><code>DFFIELD:</code></td> <td>double-float aligned</td> </tr>
</table></blockquote>
Add the following as the Rationale for 10.6.2.---- <code>FIELD:</code>
<blockquote>
A.10.6.2.xxxx <code>FIELD:</code>
<p/>
Create an aligned single cell field in a data structure.
<p/>
The various <em>x</em><code>FIELD:</code> words provide for different alignment and
size allocation.
<p/>
The <em>x</em><code>FIELD:</code> words could be defined as:
<blockquote><pre>
: FIELD: ALIGNED 1 CELLS +FIELD ; \ cell aligned
: CFIELD: 1 CHARS +FIELD ; \ character aligned
: FFIELD: FALIGNED 1 FLOATS +FIELD ; \ float aligned
: SFFIELD: SFALIGNED 1 SFLOATS +FIELD ; \ single-float aligned
: DFFIELD: DFALIGNED 1 DFLOATS +FIELD ; \ double-float aligned
</pre></blockquote>
</blockquote>
</td></tr></table>
<h3>Change History</h3>
<dl class="history">
<dt>2010-08-31</dt>
<dd>Revised into a documentation change (RfC)</dd>
<dt>2010-03-17 (not published)</dt>
<dd>Corrected spelling of <code>FILED:</code><br/>
Revised wording at Rostock meeting<br/>
Introduction of rationale text.
</dd>
<dt>2010-02-24</dt>
<dd>Drafting of RfD</dd>
<dt>2009-09-03</dt>
<dd>Original wordsmithing of solution during Exeter meeting.</dd>
</dl>
<h3>Credits</h3>
Peter Knaggs <pjk<em>@</em>bcs<em>.</em>org<em>.</em>uk><br/>
Engineering, Mathematics and Physical Sciences,<br/>
University of Exeter, Exeter, Devon EX4 7QF, England<br/>
web: <a href="http://www.rigwit.co.uk">www.rigwit.co.uk</a>
</p>
<a name="voting"><h3>Voting Instructions</h3></a>
Fill out the ballot below and email it <vote@forth200x.org>.
Your vote will be published (including your name (without email
address) and/or the name of your system) here. You can vote (or
change your vote) at any time, and the results will be published
here.
<p>
<h4>Ballot</h4>
Please mark the statements that are correct for you
(e.g., by putting an ":<em>x</em>" between the brackets).
<dl>
<dt>[ ] I agree with the proposed alteration to the document text.</dt>
<dt>[ ] I do not agree with the proposed alteration to the document text.</dt>
</dl>
If you feel that the text does not cover all the aspects you would
expect, then please make an informal comment. These will be reported
in addition to the formal votes. Note that the best time to voice
such issues is the RfD stage. Alternatively, you could propose a
counter RfD.
</body>
</html>