diff --git a/build-all.sh b/build-all.sh index 3ebe5198..4652bd70 100755 --- a/build-all.sh +++ b/build-all.sh @@ -23,14 +23,14 @@ # its equivalent), although studying this script can help you learn how the # pieces fit together. # -# For example, this script builds command line tools, such as 'wuffs' and -# 'wuffs-fmt', that are used when *developing* Wuffs, but aren't necessary if +# For example, this script builds command line tools, such as `wuffs` and +# `wuffs-fmt`, that are used when *developing* Wuffs, but aren't necessary if # all you want to do is *use* Wuffs as a third party library. In the latter # case, the only files you need are those under the release/ directory. # # Instead of running this script, you should be able to run the example -# programs (except the 'example/library' special case) out of the box, without -# having to separately configure, build or install a library: +# programs (except the `example/toy-genlib` special case) out of the box, +# without having to separately configure, build or install a library: # # git clone https://github.com/google/wuffs.git # cd wuffs diff --git a/build-example.sh b/build-example.sh index b7a3a4be..93d97531 100755 --- a/build-example.sh +++ b/build-example.sh @@ -43,10 +43,10 @@ for f in $sources; do # example/imageviewer is unusual in that needs additional libraries. echo "Building gen/bin/example-$f" $CC -O3 example/$f/*.c -lxcb -lxcb-image -o gen/bin/example-$f - elif [ $f = library ]; then - # example/library is unusual in that it uses separately compiled libraries - # (built by "wuffs genlib", e.g. by running build-all.sh) instead of - # directly #include'ing Wuffs' .c files. + elif [ $f = "toy-genlib" ]; then + # example/toy-genlib is unusual in that it uses separately compiled + # libraries (built by "wuffs genlib", e.g. by running build-all.sh) instead + # of directly #include'ing Wuffs' .c files. if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then echo "Building gen/bin/example-$f" $CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a -o gen/bin/example-$f diff --git a/doc/changelog.md b/doc/changelog.md index e8817c35..fed041ad 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -37,6 +37,7 @@ - Removed `ack_metadata_chunk?`. - Removed `wuffs_base__frame_config__blend`. - Renamed `decode_io_writer?` methods to `transform_io?`. +- Renamed `example/library` to `example/toy-genlib`. - Renamed `swizzle_interleaved!` to `swizzle_interleaved_from_slice!`. - Renamed warnings to notes. diff --git a/doc/note/initialization.md b/doc/note/initialization.md index b126dde8..b93fb79b 100644 --- a/doc/note/initialization.md +++ b/doc/note/initialization.md @@ -13,8 +13,8 @@ implicit `this` pointer argument): `wuffs_foo__bar` is deliberately an incomplete type. Its size is not part of the stable ABI. Instead, call the `sizeof__wuffs_foo__bar` *function*, whose return value can change across Wuffs versions, even across point releases. - For an example, look for `calloc` in the - [example/library](/example/library/library.c) program. + For an example, look for `sizeof__wuffs_json__decoder` in the + [example/jsonptr](/example/jsonptr/jsonptr.cc) program. - The Wuffs library version, `WUFFS_VERSION`. - Additional flags. diff --git a/doc/std/compression-decoders.md b/doc/std/compression-decoders.md index 8dac8e42..19a0d459 100644 --- a/doc/std/compression-decoders.md +++ b/doc/std/compression-decoders.md @@ -30,7 +30,7 @@ TODO: standardize the various dictionary APIs, after Wuffs v0.2 is released. ## Examples -- [example/library](/example/library) +- [example/toy-genlib](/example/toy-genlib) - [example/zcat](/example/zcat) diff --git a/doc/wuffs-the-library.md b/doc/wuffs-the-library.md index 8887f862..4554ab1c 100644 --- a/doc/wuffs-the-library.md +++ b/doc/wuffs-the-library.md @@ -27,6 +27,6 @@ file depending on the presence or absence of a `WUFFS_IMPLEMENTATION` macro definition. Most of the example programs treat it as a `.c` file. The -[`/example/library`](/example/library) program treats it as a `.h` file, and -requires a separate step (e.g. running `wuffs genlib` beforehand) to build the -library implementation (e.g. a `libwuffs.a` or `libwuffs.so` file). +[`/example/toy-genlib`](/example/toy-genlib) program treats it as a `.h` file, +and requires a separate step (running `wuffs genlib` beforehand) to build the +library implementation (a `libwuffs.a` or `libwuffs.so` file). diff --git a/example/README.md b/example/README.md index 2988b448..6758b8bb 100644 --- a/example/README.md +++ b/example/README.md @@ -3,9 +3,8 @@ Library](/doc/wuffs-the-library.md). See [Hello `wuffs-c`](/hello-wuffs-c) for an example program that uses [Wuffs the Language](/doc/wuffs-the-language.md) and its `wuffs-c` compiler. -Other than [example/library](/example/library/library.c), all of these programs -do real work. They're not just programming language toys at the "calculate the -Fibonacci sequence" level of triviality. For example, the -[example/crc32](/example/crc32/crc32.cc) and -[example/zcat](/example/zcat/zcat.c) programs are roughly equivalent to Debian -Linux's `/usr/bin/crc32` and `/bin/zcat` programs. +Other than the `toy-*` examples, all of these programs do real work. They're +not just programming language toys at the "calculate the Fibonacci sequence" +level of triviality. For example, the [example/crc32](/example/crc32/crc32.cc) +and [example/zcat](/example/zcat/zcat.c) programs are roughly equivalent to +Debian Linux's `/usr/bin/crc32` and `/bin/zcat` programs. diff --git a/example/library/library.c b/example/toy-genlib/toy-genlib.c similarity index 92% rename from example/library/library.c rename to example/toy-genlib/toy-genlib.c index d705cddb..0ebebf8b 100644 --- a/example/library/library.c +++ b/example/toy-genlib/toy-genlib.c @@ -15,17 +15,17 @@ // ---------------- /* -library exercises the software libraries built by `wuffs genlib`. +toy-genlib exercises the software libraries built by `wuffs genlib`. To exercise the static library: -$CC -static -I../../.. library.c ../../gen/lib/c/$CC-static/libwuffs.a +$CC -static -I../../.. toy-genlib.c ../../gen/lib/c/$CC-static/libwuffs.a ./a.out rm -f a.out To exercise the dynamic library: -$CC -I../../.. library.c -L../../gen/lib/c/$CC-dynamic -lwuffs +$CC -I../../.. toy-genlib.c -L../../gen/lib/c/$CC-dynamic -lwuffs LD_LIBRARY_PATH=../../gen/lib/c/$CC-dynamic ./a.out rm -f a.out @@ -40,7 +40,7 @@ for a C compiler $CC, such as clang or gcc. // By #include'ing it "as is" without #define'ing WUFFS_IMPLEMENTATION, we use // it as a "foo.h"-like header, instead of a "foo.c"-like implementation. #if defined(WUFFS_IMPLEMENTATION) -#error "example/library should not #define WUFFS_IMPLEMENTATION" +#error "example/toy-genlib should not #define WUFFS_IMPLEMENTATION" #endif #include "wuffs/release/c/wuffs-unsupported-snapshot.c"