Skip to content

Commit 239008d

Browse files
authored
Editorial: rename prepend to restore and make it operate on a list
Fixes #325 and closes #326.
1 parent b53fc98 commit 239008d

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

encoding.bs

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ from an <a for=/>I/O queue</a> <var>ioQueue</var>, run these steps:
188188
<p>To <a for="I/O queue">push</a> a sequence of items to an <a for=/>I/O queue</a>
189189
<var>ioQueue</var> is to push each item in the sequence to <var>ioQueue</var>, in the given order.
190190

191-
<p>To <dfn id=concept-stream-prepend for="I/O queue">prepend</dfn> an <a for=list>item</a> other
192-
than <a>end-of-queue</a> to an <a for=/>I/O queue</a>, perform the normal <a for=/>list</a>
193-
<a for=list>prepend</a> operation. To prepend a sequence of items not containing
194-
<a>end-of-queue</a>, insert those items, in the given order, before the first item in the queue.
191+
<p>To <dfn id=concept-stream-prepend for="I/O queue">restore</dfn> an <a for=list>item</a> other
192+
than <a>end-of-queue</a> to an <a for=/>I/O queue</a>, perform the <a for=/>list</a>
193+
<a for=list>prepend</a> operation. To <a for="I/O queue">restore</a> a <a for=/>list</a> of
194+
<a for=list>items</a> excluding <a>end-of-queue</a> to an <a for=/>I/O queue</a>, insert those
195+
items, in the given order, before the first item in the queue.
195196

196-
<p class=example id=example-tokens>Inserting the sequence of scalar value items
197-
<code>&amp;#128169;</code> in an I/O queue of scalar values "<code> hello world</code>", results in
198-
an I/O queue "<code>&amp;#128169; hello world</code>". The next item to be read would be
199-
<code>&amp;</code>. <!-- 💩 -->
197+
<p class=example id=example-tokens>Inserting the bytes « 0xF0, 0x9F » in an I/O queue
198+
« 0x92 0xA9, <a>end-of-queue</a> », results in an I/O queue
199+
« 0xF0, 0x9F, 0x92 0xA9, <a>end-of-queue</a> ». The next item to be read would be 0xF0. <!-- 💩 -->
200200

201201
<p>To <dfn for="from I/O queue">convert</dfn> an <a for=/>I/O queue</a> <var>ioQueue</var> into a
202202
<a for=/>list</a>, <a>string</a>, or <a>byte sequence</a>, return the result of
@@ -218,8 +218,8 @@ an I/O queue "<code>&amp;#128169; hello world</code>". The next item to be read
218218
See <a href="https://github.com/whatwg/infra/issues/319">whatwg/infra issue #319</a>. [[INFRA]]
219219

220220
<p class=note><a for=/>I/O queues</a> are defined as <a for=/>lists</a>, not
221-
<a spec=infra>queues</a>, because they feature a <a for="I/O queue">prepend</a> operation. However,
222-
this prepend operation is an internal detail of the algorithms in this specification, and is not to
221+
<a spec=infra>queues</a>, because they feature a <a for="I/O queue">restore</a> operation. However,
222+
this restore operation is an internal detail of the algorithms in this specification, and is not to
223223
be used by other standards. Implementations are free to find alternative ways to implement such
224224
algorithms, as detailed in [[#implementation-considerations]].
225225

@@ -1355,7 +1355,7 @@ initially false.
13551355
<a>replacement</a>, <a>throws</a> a {{RangeError}}.
13561356

13571357
<dt><code><var>decoder</var> . <a attribute for=TextDecoderCommon>encoding</a></code>
1358-
<dd><p>Returns <a for=TextDecoderCommon>encoding</a>'s <a>name</a>, lowercased.
1358+
<dd><p>Returns <a for=TextDecoderCommon>encoding</a>'s <a for=encoding>name</a>, lowercased.
13591359

13601360
<dt><code><var>decoder</var> . <a attribute for=TextDecoderCommon>fatal</a></code>
13611361
<dd><p>Returns true if <a for=TextDecoderCommon>error mode</a> is "<code>fatal</code>", otherwise
@@ -1672,7 +1672,7 @@ TextDecoderStream includes GenericTransformStream;
16721672
<a>replacement</a>, <a>throws</a> a {{RangeError}}.
16731673

16741674
<dt><code><var>decoder</var> . <a attribute for=TextDecoderCommon>encoding</a></code>
1675-
<dd><p>Returns <a for=TextDecoderCommon>encoding</a>'s <a>name</a>, lowercased.
1675+
<dd><p>Returns <a for=TextDecoderCommon>encoding</a>'s <a for=encoding>name</a>, lowercased.
16761676

16771677
<dt><code><var>decoder</var> . <a attribute for=TextDecoderCommon>fatal</a></code>
16781678
<dd><p>Returns true if <a for=TextDecoderCommon>error mode</a> is "<code>fatal</code>", and
@@ -1981,7 +1981,7 @@ constructor steps are:
19811981
whose value is 0x10000 + ((<var>high surrogate</var> &minus; 0xD800) &lt;&lt; 10) +
19821982
(<var>item</var> &minus; 0xDC00).
19831983

1984-
<li><p><a>Prepend</a> <var>item</var> to <var>input</var>.
1984+
<li><p><a>Restore</a> <var>item</var> to <var>input</var>.
19851985

19861986
<li><p>Return U+FFFD.
19871987
</ol>
@@ -2113,7 +2113,7 @@ in deployed content. Therefore it is not part of the <a>UTF-8 decoder</a> algori
21132113
set <a>UTF-8 lower boundary</a> to 0x80, and set
21142114
<a>UTF-8 upper boundary</a> to 0xBF.
21152115

2116-
<li><p><a>Prepend</a> <var>byte</var> to <var>ioQueue</var>.
2116+
<li><p><a>Restore</a> <var>byte</var> to <var>ioQueue</var>.
21172117

21182118
<li><p>Return <a>error</a>.
21192119
</ol>
@@ -2339,7 +2339,7 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
23392339
<p>If <var>byte</var> is not in the range 0x30 to 0x39, inclusive, then:
23402340

23412341
<ol>
2342-
<li><p><a>Prepend</a> <a>gb18030 second</a>, <a>gb18030 third</a>, and <var>byte</var> to
2342+
<li><p><a>Restore</a> « <a>gb18030 second</a>, <a>gb18030 third</a>, <var>byte</var> » to
23432343
<var>ioQueue</var>.
23442344

23452345
<li><p>Set <a>gb18030 first</a>, <a>gb18030 second</a>, and <a>gb18030 third</a> to 0x00.
@@ -2366,10 +2366,8 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
23662366
<li><p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set
23672367
<a>gb18030 third</a> to <var>byte</var> and return <a>continue</a>.
23682368

2369-
<li><p><a>Prepend</a> <a>gb18030 second</a>
2370-
followed by <var>byte</var> to <var>ioQueue</var>, set
2371-
<a>gb18030 first</a> and <a>gb18030 second</a> to 0x00, and return
2372-
<a>error</a>.
2369+
<li><p><a>Restore</a> « <a>gb18030 second</a>, <var>byte</var> » to <var>ioQueue</var>, set
2370+
<a>gb18030 first</a> and <a>gb18030 second</a> to 0x00, and return <a>error</a>.
23732371
</ol>
23742372

23752373
<li>
@@ -2394,7 +2392,7 @@ consumers of content generated with <a>GBK</a>'s <a for=/>encoder</a>.
23942392
<li><p>If <var>code point</var> is non-null, return a code point whose value is
23952393
<var>code point</var>.
23962394

2397-
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
2395+
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
23982396
<var>ioQueue</var>.
23992397

24002398
<li><p>Return <a>error</a>.
@@ -2540,7 +2538,7 @@ and <var>byte</var>, runs these steps:
25402538
<li><p>If <var>code point</var> is non-null, return a code point whose value is
25412539
<var>code point</var>.
25422540

2543-
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
2541+
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
25442542
<var>ioQueue</var>.
25452543

25462544
<li><p>Return <a>error</a>.
@@ -2636,7 +2634,7 @@ and <var>code point</var>, runs these steps:
26362634
<li><p>If <var>code point</var> is non-null, return a code point whose value is
26372635
<var>code point</var>.
26382636

2639-
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
2637+
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
26402638
<var>ioQueue</var>.
26412639

26422640
<li><p>Return <a>error</a>.
@@ -2854,7 +2852,7 @@ and <var>code point</var>, runs these steps:
28542852
<a lt="ISO-2022-JP decoder escape">escape</a>, and return
28552853
<a>continue</a>.
28562854

2857-
<li><p>If <var>byte</var> is not <a>end-of-queue</a>, then <a>prepend</a>
2855+
<li><p>If <var>byte</var> is not <a>end-of-queue</a>, then <a>restore</a>
28582856
<var>byte</var> to <var>ioQueue</var>.
28592857

28602858
<li><p>Set <a>ISO-2022-JP output</a> to false,
@@ -2898,9 +2896,9 @@ and <var>code point</var>, runs these steps:
28982896
<a>error</a> otherwise.
28992897
</ol>
29002898

2901-
<li><p>If <var>byte</var> is <a>end-of-queue</a>, then <a>prepend</a>
2902-
<var>lead</var> to <var>ioQueue</var>. Otherwise, <a>prepend</a>
2903-
<var>lead</var> and <var>byte</var> to <var>ioQueue</var>.
2899+
<li><p>If <var>byte</var> is <a>end-of-queue</a>, then <a>restore</a> <var>lead</var> to
2900+
<var>ioQueue</var>; otherwise, <a>restore</a> « <var>lead</var>, <var>byte</var> » to
2901+
<var>ioQueue</var>.
29042902

29052903
<li><p>Set <a>ISO-2022-JP output</a> to false,
29062904
<a>ISO-2022-JP decoder state</a> to <a>ISO-2022-JP decoder output state</a>
@@ -2972,15 +2970,15 @@ and <var>code point</var>, runs these steps:
29722970
<li><p>If <var>code point</var> is an <a>ASCII code point</a>, and
29732971
<a>ISO-2022-JP encoder state</a> is not
29742972
<a lt="ISO-2022-JP encoder ASCII">ASCII</a>,
2975-
<a>prepend</a> <var>code point</var> to
2973+
<a>restore</a> <var>code point</var> to
29762974
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
29772975
<a lt="ISO-2022-JP encoder ASCII">ASCII</a>, and return three bytes
29782976
0x1B 0x28 0x42.
29792977

29802978
<li><p>If <var>code point</var> is either U+00A5 or U+203E, and
29812979
<a>ISO-2022-JP encoder state</a> is not
29822980
<a lt="ISO-2022-JP encoder Roman">Roman</a>,
2983-
<a>prepend</a> <var>code point</var> to
2981+
<a>restore</a> <var>code point</var> to
29842982
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
29852983
<a lt="ISO-2022-JP encoder Roman">Roman</a>, and return three bytes
29862984
0x1B 0x28 0x4A.
@@ -3003,7 +3001,7 @@ and <var>code point</var>, runs these steps:
30033001

30043002
<ol>
30053003
<li><p>If <a>ISO-2022-JP encoder state</a> is <a lt="ISO-2022-JP encoder jis0208">jis0208</a>,
3006-
then <a>prepend</a> <var>code point</var> to <var>ioQueue</var>, set
3004+
then <a>restore</a> <var>code point</var> to <var>ioQueue</var>, set
30073005
<a>ISO-2022-JP encoder state</a> to <a lt="ISO-2022-JP encoder ASCII">ASCII</a>, and return three
30083006
bytes 0x1B 0x28 0x42.
30093007

@@ -3012,7 +3010,7 @@ and <var>code point</var>, runs these steps:
30123010

30133011
<li><p>If <a>ISO-2022-JP encoder state</a> is not
30143012
<a lt="ISO-2022-JP encoder jis0208">jis0208</a>,
3015-
<a>prepend</a> <var>code point</var> to
3013+
<a>restore</a> <var>code point</var> to
30163014
<var>ioQueue</var>, set <a>ISO-2022-JP encoder state</a> to
30173015
<a lt="ISO-2022-JP encoder jis0208">jis0208</a>, and return three bytes
30183016
0x1B 0x24 0x42.
@@ -3071,7 +3069,7 @@ and <var>code point</var>, runs these steps:
30713069
<li><p>If <var>code point</var> is non-null, return a code point whose value is
30723070
<var>code point</var>.
30733071

3074-
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
3072+
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
30753073
<var>ioQueue</var>.
30763074

30773075
<li><p>Return <a>error</a>.
@@ -3171,7 +3169,7 @@ and <var>code point</var>, runs these steps:
31713169
<li><p>If <var>code point</var> is non-null, return a code point whose value is
31723170
<var>code point</var>.
31733171

3174-
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>prepend</a> <var>byte</var> to
3172+
<li><p>If <var>byte</var> is an <a>ASCII byte</a>, <a>restore</a> <var>byte</var> to
31753173
<var>ioQueue</var>.
31763174

31773175
<li><p>Return <a>error</a>.
@@ -3297,10 +3295,11 @@ rather the <a>decode</a> algorithm.
32973295

32983296
<li><p>Let <var>byte2</var> be <var>code unit</var> &amp; 0x00FF.
32993297

3300-
<li><p>Let <var>bytes</var> be two bytes whose values are <var>byte1</var> and <var>byte2</var>,
3301-
if <a>is UTF-16BE decoder</a> is true, and <var>byte2</var> and <var>byte1</var> otherwise.
3298+
<li><p>Let <var>bytes</var> be a <a for=/>list</a> of two bytes whose values are <var>byte1</var>
3299+
and <var>byte2</var>, if <a>is UTF-16BE decoder</a> is true; otherwise <var>byte2</var> and
3300+
<var>byte1</var>.
33023301

3303-
<li><p><a>Prepend</a> the <var>bytes</var> to <var>ioQueue</var> and return <a>error</a>.
3302+
<li><p><a>Restore</a> <var>bytes</var> to <var>ioQueue</var> and return <a>error</a>.
33043303
<!-- unpaired surrogates; IE/WebKit output them, Gecko/Opera U+FFFD them -->
33053304
</ol>
33063305

@@ -3396,7 +3395,7 @@ decoded using <a>UTF-16BE/LE</a>.
33963395

33973396
<h2 class=no-num id=implementation-considerations>Implementation considerations</h2>
33983397

3399-
<p>Instead of supporting <a for=/>I/O queues</a> with arbitrary <a for="I/O queue">prepend</a>, the
3398+
<p>Instead of supporting <a for=/>I/O queues</a> with arbitrary <a for="I/O queue">restore</a>, the
34003399
<a for=/>decoders</a> for <a for=/>encodings</a> in this standard could be implemented with:
34013400

34023401
<ol>

0 commit comments

Comments
 (0)