Rename PUFFS to WUFFS, part 9 of N

This commit is contained in:
Nigel Tao committed 2017-11-30 18:10:51 +11:00
1 parent 7fd51d44a2
commit 8e3b5cce5e
6 files changed
+40 -40

No files matched your search

+3 -3
View File
@@ -13,7 +13,7 @@
// limitations under the License.
// commonflags holds flag defaults and usage messages that are common to the
// Puffs command line tools.
// Wuffs command line tools.
//
// It also holds functions to parse and validate these flag values.
package commonflags
@@ -23,10 +23,10 @@ const (
CcompilersUsage = `comma-separated list of C compilers, e.g. "clang,gcc"`
FocusDefault = ""
FocusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "puffs_gif_decode"`
FocusUsage = `comma-separated list of tests or benchmarks (name prefixes) to focus on, e.g. "wuffs_gif_decode"`
MimicDefault = false
MimicUsage = `whether to compare Puffs' output with other libraries' output`
MimicUsage = `whether to compare Wuffs' output with other libraries' output`
RepsDefault = 5
RepsMin = 0
+2 -2
View File
@@ -103,13 +103,13 @@ func genLib(outDir string, cc string, dynamism string, filenames []string) error
args := []string(nil)
switch dynamism {
case "dynamic":
// TODO: add a "-Wl,-soname,libpuffs.so.1.2.3" argument?
// TODO: add a "-Wl,-soname,libwuffs.so.1.2.3" argument?
args = append(args, "-shared", "-fPIC", "-o")
case "static":
cc = "ar"
args = append(args, "rc")
}
out := filepath.Join(outDir, "libpuffs"+libExtensions[dynamism])
out := filepath.Join(outDir, "libwuffs"+libExtensions[dynamism])
args = append(args, out)
for _, filename := range filenames {
+2 -2
View File
@@ -90,7 +90,7 @@ func doBenchTest1(filename string, bench bool, ccompilers string, focus string,
}
ccArgs = append(ccArgs, "-std=c99", "-o", out, in)
if mimic {
extra, err := findPuffsMimicCflags(in)
extra, err := findWuffsMimicCflags(in)
if err != nil {
return false, err
}
@@ -132,7 +132,7 @@ func doBenchTest1(filename string, bench bool, ccompilers string, focus string,
return failed, nil
}
func findPuffsMimicCflags(filename string) ([]string, error) {
func findWuffsMimicCflags(filename string) ([]string, error) {
f, err := os.Open(filename)
if err != nil {
return nil, err
+8 -8
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// puffsfmt formats Puffs programs.
// wuffsfmt formats Wuffs programs.
//
// Without explicit paths, it rewrites the standard input to standard output.
// Otherwise, the -l or -w or both flags must be given. Given a file path, it
// operates on that file; given a directory path, it operates on all .puffs
// operates on that file; given a directory path, it operates on all .wuffs
// files in that directory, recursively. Files starting with a period are
// ignored.
package main
@@ -39,12 +39,12 @@ import (
)
var (
lFlag = flag.Bool("l", false, "list files whose formatting differs from puffsfmt's")
lFlag = flag.Bool("l", false, "list files whose formatting differs from wuffsfmt's")
wFlag = flag.Bool("w", false, "write result to (source) file instead of stdout")
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: puffsfmt [flags] [path ...]\n")
fmt.Fprintf(os.Stderr, "usage: wuffsfmt [flags] [path ...]\n")
flag.PrintDefaults()
}
@@ -90,17 +90,17 @@ func main1() error {
return nil
}
func isPuffsFile(info os.FileInfo) bool {
func isWuffsFile(info os.FileInfo) bool {
name := info.Name()
return !info.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".puffs")
return !info.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".wuffs")
}
func walk(filename string, info os.FileInfo, err error) error {
if err == nil && isPuffsFile(info) {
if err == nil && isWuffsFile(info) {
err = do(nil, filename)
}
// Don't complain if a file was deleted in the meantime (i.e. the directory
// changed concurrently while running puffsfmt).
// changed concurrently while running wuffsfmt).
if err != nil && !os.IsNotExist(err) {
return err
}
+13 -13
View File
@@ -13,17 +13,17 @@
// limitations under the License.
/*
library exercises the software libraries built by `puffs genlib`.
library exercises the software libraries built by `wuffs genlib`.
To exercise the static library:
$cc -static -I../../.. library.c ../../gen/lib/c/$cc-static/libpuffs.a
$cc -static -I../../.. library.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 -lpuffs
$cc -I../../.. library.c -L../../gen/lib/c/$cc-dynamic -lwuffs
LD_LIBRARY_PATH=../../gen/lib/c/$cc-dynamic ./a.out
rm -f a.out
@@ -32,7 +32,7 @@ for a C compiler $cc, such as clang or gcc.
#include <unistd.h>
#include "puffs/gen/h/std/flate.h"
#include "wuffs/gen/h/std/flate.h"
#define DST_BUFFER_SIZE (1024 * 1024)
@@ -48,18 +48,18 @@ static void ignore_return_value(int ignored) {}
static const char* decode() {
uint8_t dst_buffer[DST_BUFFER_SIZE];
puffs_base__buf1 dst = {.ptr = dst_buffer, .len = DST_BUFFER_SIZE};
puffs_base__buf1 src = {
wuffs_base__buf1 dst = {.ptr = dst_buffer, .len = DST_BUFFER_SIZE};
wuffs_base__buf1 src = {
.ptr = lgtm_ptr, .len = lgtm_len, .wi = lgtm_len, .closed = true};
puffs_base__writer1 dst_writer = {.buf = &dst};
puffs_base__reader1 src_reader = {.buf = &src};
wuffs_base__writer1 dst_writer = {.buf = &dst};
wuffs_base__reader1 src_reader = {.buf = &src};
puffs_flate__flate_decoder dec;
puffs_flate__flate_decoder__initialize(&dec, PUFFS_VERSION, 0);
puffs_flate__status s =
puffs_flate__flate_decoder__decode(&dec, dst_writer, src_reader);
wuffs_flate__flate_decoder dec;
wuffs_flate__flate_decoder__initialize(&dec, WUFFS_VERSION, 0);
wuffs_flate__status s =
wuffs_flate__flate_decoder__decode(&dec, dst_writer, src_reader);
if (s) {
return puffs_flate__status__string(s);
return wuffs_flate__status__string(s);
}
ignore_return_value(write(1, dst.ptr, dst.wi));
return NULL;
+12 -12
View File
@@ -30,7 +30,7 @@ for a C compiler $cc, such as clang or gcc.
#include <linux/seccomp.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
#define PUFFS_EXAMPLE_USE_SECCOMP
#define WUFFS_EXAMPLE_USE_SECCOMP
#endif
#define DST_BUFFER_SIZE (1024 * 1024)
@@ -47,18 +47,18 @@ static void ignore_return_value(int ignored) {}
static const char* decode() {
uint8_t dst_buffer[DST_BUFFER_SIZE];
puffs_base__buf1 dst = {.ptr = dst_buffer, .len = DST_BUFFER_SIZE};
puffs_base__buf1 src = {
wuffs_base__buf1 dst = {.ptr = dst_buffer, .len = DST_BUFFER_SIZE};
wuffs_base__buf1 src = {
.ptr = pjw_ptr, .len = pjw_len, .wi = pjw_len, .closed = true};
puffs_base__writer1 dst_writer = {.buf = &dst};
puffs_base__reader1 src_reader = {.buf = &src};
wuffs_base__writer1 dst_writer = {.buf = &dst};
wuffs_base__reader1 src_reader = {.buf = &src};
puffs_gif__decoder dec;
puffs_gif__decoder__initialize(&dec, PUFFS_VERSION, 0);
puffs_gif__status s =
puffs_gif__decoder__decode(&dec, dst_writer, src_reader);
wuffs_gif__decoder dec;
wuffs_gif__decoder__initialize(&dec, WUFFS_VERSION, 0);
wuffs_gif__status s =
wuffs_gif__decoder__decode(&dec, dst_writer, src_reader);
if (s) {
return puffs_gif__status__string(s);
return wuffs_gif__status__string(s);
}
if (dst.wi != WIDTH * HEIGHT) {
@@ -79,7 +79,7 @@ static const char* decode() {
}
int main(int argc, char** argv) {
#ifdef PUFFS_EXAMPLE_USE_SECCOMP
#ifdef WUFFS_EXAMPLE_USE_SECCOMP
prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT);
#endif
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
ignore_return_value(write(2, "\n", 1));
}
#ifdef PUFFS_EXAMPLE_USE_SECCOMP
#ifdef WUFFS_EXAMPLE_USE_SECCOMP
// Call SYS_exit explicitly instead of SYS_exit_group implicitly.
// SECCOMP_MODE_STRICT allows only the former.
syscall(SYS_exit, status);