mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 17:01:35 +01:00
Merge pull request #1 from andrewda/readme-diffs
Beautify diffs in README
This commit is contained in:
1 file changed
+8
-3
@@ -42,7 +42,7 @@ For example, making this one-line edit to the GIF codec leads to a compile time
|
||||
error. `puffs gen` fails to generate the C code, i.e. fails to compile
|
||||
(transpile) the Puffs code to C code:
|
||||
|
||||
$ git diff
|
||||
```diff
|
||||
diff --git a/std/gif/decode_lzw.puffs b/std/gif/decode_lzw.puffs
|
||||
index f878c5e..f10dcee 100644
|
||||
--- a/std/gif/decode_lzw.puffs
|
||||
@@ -55,7 +55,9 @@ error. `puffs gen` fails to generate the C code, i.e. fails to compile
|
||||
+ this.suffixes[save_code] = (c + 1) as u8
|
||||
this.prefixes[save_code] = prev_code as u16
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ puffs gen std/gif
|
||||
check: expression "(c + 1) as u8" bounds [1..256] is not within bounds [0..255] at
|
||||
/home/n/go/src/github.com/google/puffs/std/gif/decode_lzw.puffs:101. Facts:
|
||||
@@ -63,11 +65,12 @@ error. `puffs gen` fails to generate the C code, i.e. fails to compile
|
||||
c < 256
|
||||
this.stack[s] == (c as u8)
|
||||
use_save_code
|
||||
```
|
||||
|
||||
In comparison, this two-line edit will compile (but the "does it decode GIF
|
||||
correctly" tests then fail):
|
||||
|
||||
$ git diff
|
||||
```diff
|
||||
diff --git a/std/gif/decode_lzw.puffs b/std/gif/decode_lzw.puffs
|
||||
index f878c5e..b43443d 100644
|
||||
--- a/std/gif/decode_lzw.puffs
|
||||
@@ -82,7 +85,9 @@ correctly" tests then fail):
|
||||
+ this.suffixes[save_code] = (c + 1) as u8
|
||||
this.prefixes[save_code] = prev_code as u16
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ puffs gen std/gif
|
||||
gen wrote: /home/n/go/src/github.com/google/puffs/gen/c/gif.c
|
||||
gen unchanged: /home/n/go/src/github.com/google/puffs/gen/h/gif.h
|
||||
@@ -118,7 +123,7 @@ correctly" tests then fail):
|
||||
|
||||
puffs-test-c: some tests failed
|
||||
puffs test: some tests failed
|
||||
|
||||
```
|
||||
|
||||
# Background
|
||||
|
||||
|
||||
Reference in new issue
Block a user