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
# 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
+4 -4
View File
@@ -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
+1
View File
@@ -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.
+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
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.
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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).
+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)
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.
@@ -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"