From 239008dde6332c07402854a105fc80709f80037e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 13 Mar 2024 11:42:45 +0100 Subject: [PATCH] Editorial: rename prepend to restore and make it operate on a list Fixes #325 and closes #326. --- encoding.bs | 71 ++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/encoding.bs b/encoding.bs index a736a18..fe9b0f2 100644 --- a/encoding.bs +++ b/encoding.bs @@ -188,15 +188,15 @@ from an I/O queue ioQueue, run these steps:

To push a sequence of items to an I/O queue ioQueue is to push each item in the sequence to ioQueue, in the given order. -

To prepend an item other -than end-of-queue to an I/O queue, perform the normal list -prepend operation. To prepend a sequence of items not containing -end-of-queue, insert those items, in the given order, before the first item in the queue. +

To restore an item other +than end-of-queue to an I/O queue, perform the list +prepend operation. To restore a list of +items excluding end-of-queue to an I/O queue, insert those +items, in the given order, before the first item in the queue. -

Inserting the sequence of scalar value items -💩 in an I/O queue of scalar values " hello world", results in -an I/O queue "💩 hello world". The next item to be read would be -&. +

Inserting the bytes « 0xF0, 0x9F » in an I/O queue +« 0x92 0xA9, end-of-queue », results in an I/O queue +« 0xF0, 0x9F, 0x92 0xA9, end-of-queue ». The next item to be read would be 0xF0.

To convert an I/O queue ioQueue into a list, string, or byte sequence, return the result of @@ -218,8 +218,8 @@ an I/O queue "💩 hello world". The next item to be read See whatwg/infra issue #319. [[INFRA]]

I/O queues are defined as lists, not -queues, because they feature a prepend operation. However, -this prepend operation is an internal detail of the algorithms in this specification, and is not to +queues, because they feature a restore operation. However, +this restore operation is an internal detail of the algorithms in this specification, and is not to be used by other standards. Implementations are free to find alternative ways to implement such algorithms, as detailed in [[#implementation-considerations]]. @@ -1355,7 +1355,7 @@ initially false. replacement, throws a {{RangeError}}.

decoder . encoding -

Returns encoding's name, lowercased. +

Returns encoding's name, lowercased.

decoder . fatal

Returns true if error mode is "fatal", otherwise @@ -1672,7 +1672,7 @@ TextDecoderStream includes GenericTransformStream; replacement, throws a {{RangeError}}.

decoder . encoding -

Returns encoding's name, lowercased. +

Returns encoding's name, lowercased.

decoder . fatal

Returns true if error mode is "fatal", and @@ -1981,7 +1981,7 @@ constructor steps are: whose value is 0x10000 + ((high surrogate − 0xD800) << 10) + (item − 0xDC00). -

  • Prepend item to input. +

  • Restore item to input.

  • Return U+FFFD. @@ -2113,7 +2113,7 @@ in deployed content. Therefore it is not part of the UTF-8 decoder algori set UTF-8 lower boundary to 0x80, and set UTF-8 upper boundary to 0xBF. -

  • Prepend byte to ioQueue. +

  • Restore byte to ioQueue.

  • Return error. @@ -2339,7 +2339,7 @@ consumers of content generated with GBK's encoder.

    If byte is not in the range 0x30 to 0x39, inclusive, then:

      -
    1. Prepend gb18030 second, gb18030 third, and byte to +

    2. Restore « gb18030 second, gb18030 third, byte » to ioQueue.

    3. Set gb18030 first, gb18030 second, and gb18030 third to 0x00. @@ -2366,10 +2366,8 @@ consumers of content generated with GBK's encoder.

    4. If byte is in the range 0x81 to 0xFE, inclusive, set gb18030 third to byte and return continue. -

    5. Prepend gb18030 second - followed by byte to ioQueue, set - gb18030 first and gb18030 second to 0x00, and return - error. +

    6. Restore « gb18030 second, byte » to ioQueue, set + gb18030 first and gb18030 second to 0x00, and return error.

  • @@ -2394,7 +2392,7 @@ consumers of content generated with GBK's encoder.
  • If code point is non-null, return a code point whose value is code point. -

  • If byte is an ASCII byte, prepend byte to +

  • If byte is an ASCII byte, restore byte to ioQueue.

  • Return error. @@ -2540,7 +2538,7 @@ and byte, runs these steps:

  • If code point is non-null, return a code point whose value is code point. -

  • If byte is an ASCII byte, prepend byte to +

  • If byte is an ASCII byte, restore byte to ioQueue.

  • Return error. @@ -2636,7 +2634,7 @@ and code point, runs these steps:

  • If code point is non-null, return a code point whose value is code point. -

  • If byte is an ASCII byte, prepend byte to +

  • If byte is an ASCII byte, restore byte to ioQueue.

  • Return error. @@ -2854,7 +2852,7 @@ and code point, runs these steps: escape, and return continue. -

  • If byte is not end-of-queue, then prepend +

  • If byte is not end-of-queue, then restore byte to ioQueue.

  • Set ISO-2022-JP output to false, @@ -2898,9 +2896,9 @@ and code point, runs these steps: error otherwise. -

  • If byte is end-of-queue, then prepend - lead to ioQueue. Otherwise, prepend - lead and byte to ioQueue. +

  • If byte is end-of-queue, then restore lead to + ioQueue; otherwise, restore « lead, byte » to + ioQueue.

  • Set ISO-2022-JP output to false, ISO-2022-JP decoder state to ISO-2022-JP decoder output state @@ -2972,7 +2970,7 @@ and code point, runs these steps:

  • If code point is an ASCII code point, and ISO-2022-JP encoder state is not ASCII, - prepend code point to + restore code point to ioQueue, set ISO-2022-JP encoder state to ASCII, and return three bytes 0x1B 0x28 0x42. @@ -2980,7 +2978,7 @@ and code point, runs these steps:

  • If code point is either U+00A5 or U+203E, and ISO-2022-JP encoder state is not Roman, - prepend code point to + restore code point to ioQueue, set ISO-2022-JP encoder state to Roman, and return three bytes 0x1B 0x28 0x4A. @@ -3003,7 +3001,7 @@ and code point, runs these steps:

    1. If ISO-2022-JP encoder state is jis0208, - then prepend code point to ioQueue, set + then restore code point to ioQueue, set ISO-2022-JP encoder state to ASCII, and return three bytes 0x1B 0x28 0x42. @@ -3012,7 +3010,7 @@ and code point, runs these steps:

    2. If ISO-2022-JP encoder state is not jis0208, - prepend code point to + restore code point to ioQueue, set ISO-2022-JP encoder state to jis0208, and return three bytes 0x1B 0x24 0x42. @@ -3071,7 +3069,7 @@ and code point, runs these steps:

    3. If code point is non-null, return a code point whose value is code point. -

    4. If byte is an ASCII byte, prepend byte to +

    5. If byte is an ASCII byte, restore byte to ioQueue.

    6. Return error. @@ -3171,7 +3169,7 @@ and code point, runs these steps:

    7. If code point is non-null, return a code point whose value is code point. -

    8. If byte is an ASCII byte, prepend byte to +

    9. If byte is an ASCII byte, restore byte to ioQueue.

    10. Return error. @@ -3297,10 +3295,11 @@ rather the decode algorithm.

    11. Let byte2 be code unit & 0x00FF. -

    12. Let bytes be two bytes whose values are byte1 and byte2, - if is UTF-16BE decoder is true, and byte2 and byte1 otherwise. +

    13. Let bytes be a list of two bytes whose values are byte1 + and byte2, if is UTF-16BE decoder is true; otherwise byte2 and + byte1. -

    14. Prepend the bytes to ioQueue and return error. +

    15. Restore bytes to ioQueue and return error.

    @@ -3396,7 +3395,7 @@ decoded using UTF-16BE/LE.

    Implementation considerations

    -

    Instead of supporting I/O queues with arbitrary prepend, the +

    Instead of supporting I/O queues with arbitrary restore, the decoders for encodings in this standard could be implemented with: