Merge branch 'master' into fix-typos

This commit is contained in:
Nigel Tao authored and GitHub committed 2020-01-17 13:38:12 +11:00
commit f1f388e1ef
69 files changed
+7033 -2807

No files matched your search

+13 -1
View File
@@ -1,6 +1,18 @@
# Changelog
## Work In Progress
- Added `std/wbmp` package.
- Renamed `decode_io_writer?` methods to `transform_io?`.
- Added interfaces.
- Renamed warnings to notes.
- Made `wuffs_base__pixel_format` a struct.
- Made `wuffs_base__pixel_subsampling` a struct.
- Made `wuffs_base__status` a struct.
- Removed `wuffs_base__frame_config__blend`.
## 2019-12-19 version 0.2.0
The headline feature is that the GIF decoder is now of production quality.
@@ -96,4 +108,4 @@ Wuffs version 0.1.
---
Updated on December 2019.
Updated on January 2020.
+9 -9
View File
@@ -5,7 +5,7 @@ involving [I/O](/doc/note/io-input-output.md) - return a status value. There
are four categories:
- OK: the request was completed, successfully.
- Warnings: the request was completed, unsuccessfully.
- Notes: the request was completed, unsuccessfully.
- Suspensions: the request was not completed, but can be re-tried.
- Errors: the request was not completed, permanently.
@@ -18,12 +18,12 @@ When a method returns a suspension, the suspended
again. However, calling any other public coroutine method, while already
suspended, will lead to an `"#interleaved coroutine calls"` error.
Otherwise, the call was complete. 'Warning' or 'unsuccessful' doesn't
Otherwise, the call was complete. 'Unsuccessful' (i.e. a note) doesn't
necessarily mean 'bad' or something to avoid, only that something occurred
other than the typical outcome. For example, when decoding an animated image,
without knowing the number of frames beforehand, a call to "decode the next
frame" could return OK, if there was a next frame, or an `"@end of data"`
warning, if there wasn't.
frame" could return OK, if there was a next frame, or an `"@end of data"` note,
if there wasn't.
## Statuses are Strings
@@ -60,17 +60,17 @@ information such as a source filename.
The first byte of the string message gives the category. For example, `"#bad
receiver"` is an error and `"$short read"` is a suspension:
- `'@'` means a warning.
- `'@'` means a note.
- `'$'` means a suspension.
- `'#'` means an error.
## C Implementation
In terms of C implementation, a status value is just its string message: a
`const char *`, with `ok` being the null pointer. That C string is statically
allocated and should never be `free`d. Status values can be compared by the
`==` operator and not just by `strcmp`.
In terms of C implementation, a status' `repr` (representation) is just its
string message: a `const char *`, with `ok` being the null pointer. That C
string is statically allocated and should never be `free`d. Status `repr`s can
be compared by the `==` operator and not just by `strcmp`.
The C string's contents has the Wuffs package name inserted by the Wuffs
compiler, just after that first byte. For example, the `std/deflate` package
+3 -3
View File
@@ -11,20 +11,20 @@ categories:
The general pattern is that a package `foo` (e.g. `jpeg`, `png`) contains a
struct `bar` (e.g. `hasher`, `decoder`, etc) that implements a
package-independent interface. For example, every compression decoder struct
would have a `decode_io_writer` method. In C, this would be invoked as
would have a `transform_io` method. In C, this would be invoked as
```
// Allocate and initialize the struct.
wuffs_foo__decoder* dec = etc;
// Do the work. Error checking is not shown, for brevity.
const char* status = wuffs_foo__decoder__decode_io_writer(dec, etc);
const char* status = wuffs_foo__decoder__transform_io(dec, etc);
```
When that C library is used as C++, that last line can be shortened:
```
const char* status = dec->decode_io_writer(etc);
const char* status = dec->transform_io(etc);
```
See also the [glossary](/doc/glossary.md), as well as the notes on:
+2 -4
View File
@@ -2,10 +2,8 @@
Compression decoders read from one input stream (an `io_reader` called `src`)
and write to an output stream (an `io_writer` called `dst`). Wuffs'
implementations have one key method: `decode_io_writer`, named after the
operation (decoding) and the type of the destination (an
[`io_writer`](/doc/note/io-input-output.md)). It incrementally decompresses the
source data.
implementations have one key method: `transform_io`. It incrementally
decompresses the source data.
This method is a [coroutine](/doc/note/coroutines.md), and does not require
either all of the input or all of the output to fit in a single contiguous
+1 -1
View File
@@ -31,7 +31,7 @@ wuffs_base__pixel_buffer pb = etc;
while (true) {
wuffs_base__frame_config fc;
status = wuffs_gif__decoder__decode_frame_config(dec, &fc, &src);
if (status == wuffs_base__warning__end_of_data) {
if (status == wuffs_base__note__end_of_data) {
break;
}
// Ditto re error checking.