From 97e9b8aa8d36e46fdd79e8382bd58bd9e0a568e2 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 17 Jun 2018 09:53:03 +1000 Subject: [PATCH] Have example/zcat use the release edition --- example/zcat/zcat.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/example/zcat/zcat.c b/example/zcat/zcat.c index c35e1d8e..d227f1bd 100644 --- a/example/zcat/zcat.c +++ b/example/zcat/zcat.c @@ -25,13 +25,32 @@ for a C compiler $cc, such as clang or gcc. #include #include +// Defining the WUFFS_CONFIG__MODULE* macros are optional, but it lets users of +// the release/c/wuffs-etc/etc.c code whitelist which parts of Wuffs to build. +// That C file contains the entire Wuffs standard library, implementing a +// variety of codecs and file formats. Without this macro definition, an +// optimizing compiler or linker may very well discard Wuffs code for unused +// codecs, but listing the Wuffs modules we use makes that process explicit. +// Preprocessing means that such code simply isn't compiled. +#define WUFFS_CONFIG__MODULES +#define WUFFS_CONFIG__MODULE__BASE +#define WUFFS_CONFIG__MODULE__CRC32 +#define WUFFS_CONFIG__MODULE__DEFLATE +#define WUFFS_CONFIG__MODULE__GZIP + // If building this program in an environment that doesn't easily accomodate // relative includes, you can use the script/inline-c-relative-includes.go // program to generate a stand-alone C file. -#include "../../gen/c/base.c" -#include "../../gen/c/std/crc32.c" -#include "../../gen/c/std/deflate.c" -#include "../../gen/c/std/gzip.c" +#include "../../release/c/wuffs-v0.2/wuffs-v0.2.c" +// +// To build this program against the development (instead of the release) +// editions, comment out the #include line above and uncomment the #include +// lines below. +// +// #include "../../gen/c/base.c" +// #include "../../gen/c/std/crc32.c" +// #include "../../gen/c/std/deflate.c" +// #include "../../gen/c/std/gzip.c" #ifdef __linux__ #include