Rename example/library to example/toy-genlib

This commit is contained in:
Nigel Tao committed 2020-08-05 11:55:51 +10:00
1 parent 50bfab9998
commit cf8884d44c
8 files changed
+24 -24

No files matched your search

+4 -4
View File
@@ -23,14 +23,14 @@
# its equivalent), although studying this script can help you learn how the # its equivalent), although studying this script can help you learn how the
# pieces fit together. # pieces fit together.
# #
# For example, this script builds command line tools, such as 'wuffs' and # 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 # `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 # 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. # 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 # 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 # programs (except the `example/toy-genlib` special case) out of the box,
# having to separately configure, build or install a library: # without having to separately configure, build or install a library:
# #
# git clone https://github.com/google/wuffs.git # git clone https://github.com/google/wuffs.git
# cd wuffs # cd wuffs
+4 -4
View File
@@ -43,10 +43,10 @@ for f in $sources; do
# example/imageviewer is unusual in that needs additional libraries. # example/imageviewer is unusual in that needs additional libraries.
echo "Building gen/bin/example-$f" echo "Building gen/bin/example-$f"
$CC -O3 example/$f/*.c -lxcb -lxcb-image -o gen/bin/example-$f $CC -O3 example/$f/*.c -lxcb -lxcb-image -o gen/bin/example-$f
elif [ $f = library ]; then elif [ $f = "toy-genlib" ]; then
# example/library is unusual in that it uses separately compiled libraries # example/toy-genlib is unusual in that it uses separately compiled
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of # libraries (built by "wuffs genlib", e.g. by running build-all.sh) instead
# directly #include'ing Wuffs' .c files. # of directly #include'ing Wuffs' .c files.
if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then
echo "Building gen/bin/example-$f" 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 $CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a -o gen/bin/example-$f
+1
View File
@@ -37,6 +37,7 @@
- Removed `ack_metadata_chunk?`. - Removed `ack_metadata_chunk?`.
- Removed `wuffs_base__frame_config__blend`. - Removed `wuffs_base__frame_config__blend`.
- Renamed `decode_io_writer?` methods to `transform_io?`. - Renamed `decode_io_writer?` methods to `transform_io?`.
- Renamed `example/library` to `example/toy-genlib`.
- Renamed `swizzle_interleaved!` to `swizzle_interleaved_from_slice!`. - Renamed `swizzle_interleaved!` to `swizzle_interleaved_from_slice!`.
- Renamed warnings to notes. - Renamed warnings to notes.
+2 -2
View File
@@ -13,8 +13,8 @@ implicit `this` pointer argument):
`wuffs_foo__bar` is deliberately an incomplete type. Its size is not part of `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 the stable ABI. Instead, call the `sizeof__wuffs_foo__bar` *function*, whose
return value can change across Wuffs versions, even across point releases. return value can change across Wuffs versions, even across point releases.
For an example, look for `calloc` in the For an example, look for `sizeof__wuffs_json__decoder` in the
[example/library](/example/library/library.c) program. [example/jsonptr](/example/jsonptr/jsonptr.cc) program.
- The Wuffs library version, `WUFFS_VERSION`. - The Wuffs library version, `WUFFS_VERSION`.
- Additional flags. - Additional flags.
+1 -1
View File
@@ -30,7 +30,7 @@ TODO: standardize the various dictionary APIs, after Wuffs v0.2 is released.
## Examples ## Examples
- [example/library](/example/library) - [example/toy-genlib](/example/toy-genlib)
- [example/zcat](/example/zcat) - [example/zcat](/example/zcat)
+3 -3
View File
@@ -27,6 +27,6 @@ file depending on the presence or absence of a `WUFFS_IMPLEMENTATION` macro
definition. definition.
Most of the example programs treat it as a `.c` file. The Most of the example programs treat it as a `.c` file. The
[`/example/library`](/example/library) program treats it as a `.h` file, and [`/example/toy-genlib`](/example/toy-genlib) program treats it as a `.h` file,
requires a separate step (e.g. running `wuffs genlib` beforehand) to build the and requires a separate step (running `wuffs genlib` beforehand) to build the
library implementation (e.g. a `libwuffs.a` or `libwuffs.so` file). library implementation (a `libwuffs.a` or `libwuffs.so` file).
+5 -6
View File
@@ -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) an example program that uses [Wuffs the Language](/doc/wuffs-the-language.md)
and its `wuffs-c` compiler. and its `wuffs-c` compiler.
Other than [example/library](/example/library/library.c), all of these programs Other than the `toy-*` examples, all of these programs do real work. They're
do real work. They're not just programming language toys at the "calculate the not just programming language toys at the "calculate the Fibonacci sequence"
Fibonacci sequence" level of triviality. For example, the level of triviality. For example, the [example/crc32](/example/crc32/crc32.cc)
[example/crc32](/example/crc32/crc32.cc) and and [example/zcat](/example/zcat/zcat.c) programs are roughly equivalent to
[example/zcat](/example/zcat/zcat.c) programs are roughly equivalent to Debian Debian Linux's `/usr/bin/crc32` and `/bin/zcat` programs.
Linux's `/usr/bin/crc32` and `/bin/zcat` programs.
@@ -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: 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 ./a.out
rm -f a.out rm -f a.out
To exercise the dynamic library: 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 LD_LIBRARY_PATH=../../gen/lib/c/$CC-dynamic ./a.out
rm -f 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 // 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. // it as a "foo.h"-like header, instead of a "foo.c"-like implementation.
#if defined(WUFFS_IMPLEMENTATION) #if defined(WUFFS_IMPLEMENTATION)
#error "example/library should not #define WUFFS_IMPLEMENTATION" #error "example/toy-genlib should not #define WUFFS_IMPLEMENTATION"
#endif #endif
#include "wuffs/release/c/wuffs-unsupported-snapshot.c" #include "wuffs/release/c/wuffs-unsupported-snapshot.c"