Commit Graph
860 Commits
Author SHA1 Message Date
Nigel Tao 263bbfabf0 lib/handsum: add EncodeOptions type 2025-03-02 14:10:11 +11:00
Nigel Tao 12b404f58d cmd/handsum: new tool for the Handsum file format 2025-02-23 12:15:59 +11:00
Nigel Tao 85af5a4bed std/tga: rename to std/targa 2024-09-08 09:00:10 +10:00
Nigel Tao 8924b5f003 cgen: add ETC__ENABLE_DROP_IN_REPLACEMENT__STB
Fixes #153
2024-09-07 22:21:00 +10:00
Patrick Georgi f563f32f82 Add SPDX identifier to license headers
SPDX is an ISO standard for describing licenses in a computer readable
format, which is useful when applying license compliance tools and the
like to source code.

In addition to ensuring that the Wuffs C distribution is properly
annotated to the benefit of projects using Wuffs and SPDX-supporting
tools, add it everywhere else where there's a license in this repo for
consistency, too.
2023-10-06 20:52:36 +02:00
Nigel Tao 74a6ea2fcd all: relicense from Apache2 to dual Apache2/MIT
The LICENSE has changed from a single license (Apache2) to a dual
license (Apache2 or MIT, at your option).

If you've previously used Wuffs under the Apache2 license, you are able
to keep doing so. No further action required by you.

The two files listed below (previous releases) are exceptions, as they
are older snapshots, frozen in time. Their license has not changed:
release/c/wuffs-v0.2.c
release/c/wuffs-v0.3.c

Every name in the AUTHORS file, other than Google Inc., has signed
Google's CLA (Contributor License Agreement).
2023-10-06 10:00:59 +11:00
Nigel Tao 84d1aa0d79 cmd/wuffs: show cmdArgs when "wuffs gen" fails 2023-07-16 11:44:08 +10:00
Nigel Tao 6ede29ab3a cmd/wuffs: tweak genWuffs output to be wuffsfmt'ed 2023-04-09 15:58:04 +10:00
Nigel Tao be1f605108 Run gofmt 2022-08-21 21:41:06 +10:00
Nigel Tao 425eefeb35 Replace "go get" advice with "go install"
Fixes #62
2021-12-30 22:58:12 +11:00
Nigel Tao e1a6a7cd8c Add "wuffs help foo" for the command line tool
Updates #62
2021-12-30 22:34:27 +11:00
Nigel Tao 4e85543d9c Change default -ccompilers to "clang,gcc"
Updates #62
2021-12-30 19:29:44 +11:00
Nigel Tao 2f65d6fc74 Use go:embed instead of ".../internal/cgen/data" 2021-08-22 12:52:52 +10:00
Nigel Tao 226c476994 Remove calls to Go's deprecated "io/ioutil" 2021-08-22 11:17:34 +10:00
Nigel Tao 788479dd64 Run "gofmt -w ." for new "//go:build" lines 2021-08-22 10:53:06 +10:00
Nigel Tao ea50956b5a Ignore "-Wimplicit-fallthrough" 2021-07-05 21:40:25 +10:00
Nigel Tao 76e6872498 Have clang-cl ignore unused-function etc warnings 2021-06-25 13:51:27 +10:00
Nigel Tao 543ac9af28 Restrict "ignore -Wold-style-cast" to C++ 2021-04-02 22:43:55 +11:00
Nigel Tao 97e30c29da Add some more #pragma's for GCC to ignore warnings 2021-04-02 19:21:54 +11:00
Nigel Tao ad40102c5a Change mimic marker symbol from "!!" to "¿" 2021-03-25 22:22:27 +11:00
Nigel Tao bb2e9e90b5 Change cgen marker symbol from "!!" to "¡" 2021-03-25 22:17:26 +11:00
Nigel Tao 61635213cd Add "‼" to "WUFFS C HEADER ENDS HERE" comment 2021-03-25 14:11:23 +11:00
Nigel Tao f2ed33375c Gate wuffs_aux on WUFFS_BASE__HAVE_UNIQUE_PTR 2021-03-11 10:52:49 +11:00
Nigel Tao 2f2bbc6ab0 Rename default github.com branch s/master/main/ 2021-01-25 11:30:15 +11:00
Nigel Tao 2f78804e62 Use more inclusive language 2021-01-23 19:50:47 +11:00
Nigel Tao 592560e0f1 Upgrade default clang C compiler from v5 to v9 2020-08-21 14:18:26 +10:00
Nigel Tao cf6c578973 Add aux library 2020-08-04 23:43:38 +10:00
Nigel Tao ab580e7696 Add more comments on wuffsfmt's -l and -w flags 2020-06-16 14:27:13 +10:00
Nigel Tao c9b50c0be7 Add links to dumbindent blog post 2020-06-16 14:25:46 +10:00
Nigel Tao 533b84b3b1 Simplify WUFFS_VERSION_ETC macros 2020-06-11 23:01:50 +10:00
Nigel Tao b1ea22045a Stop dumbindent adding or removing line breaks 2020-06-10 21:51:25 +10:00
Nigel Tao 8bf4084c8b Update dumbindent comparison for clang-format-9
The numbers are the median real time of 5 runs.
2020-06-09 15:46:56 +10:00
Nigel Tao 22d08366c8 Add dumbindent algorithm comment 2020-06-08 23:25:08 +10:00
Nigel Tao 2858c4cfc2 Add dumbindent.Options (tabs vs spaces) 2020-06-07 21:59:53 +10:00
Nigel Tao 53d5f5155c Have dumbindent break after some '{' and ';'s 2020-06-07 21:52:24 +10:00
Nigel Tao 6424bae087 Have dumbindent handle multi-line strings/comments
Fixes #31
2020-06-06 22:32:39 +10:00
Nigel Tao 3d7af06727 Have dumbindent take a dst slice argument 2020-06-06 21:09:41 +10:00
Nigel Tao dd04d55417 Update dumbindent comparison for clang-format-9 2020-06-05 18:35:05 +10:00
Nigel Tao d5d4da0ab6 Add some "// --------" section-break comments 2020-06-05 00:10:31 +10:00
Nigel Tao 8cd39fc1dd Remove -cformatter flag 2020-06-05 00:08:05 +10:00
Nigel Tao 12b0f4c0bc Change the default -cformatter to dumbindent
A follow-up commit will remove the -cformatter flag entirely.

Formatting the generated C code is now a small fraction of where "wuffs
gen" spends its time.

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m0.932s
user	0m0.837s
sys	0m0.187s

$ # After.
$ time wuffs gen > /dev/null
real	0m0.186s
user	0m0.170s
sys	0m0.069s

$ time wuffs gen -cformatter= > /dev/null
real	0m0.184s
user	0m0.170s
sys	0m0.059s
----
2020-06-04 23:59:20 +10:00
Nigel Tao d8cd72798a Add {cmd,lib}/dumbindent 2020-06-04 23:35:11 +10:00
Nigel Tao 3efb204f4e Drop wuffs-c genrelease's exec of the C-formatter
genrelease essentially concatenates the individual packages' generated C
files, which should already be formatted.

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m2.622s
user	0m2.457s
sys	0m0.266s

$ # After.
$ time wuffs gen > /dev/null
real	0m1.433s
user	0m1.335s
sys	0m0.191s
----
2020-06-03 13:46:24 +10:00
Nigel Tao 16c1f3cfd7 Clean up some wuffs-c output (before clang-format) 2020-06-03 13:36:04 +10:00
Nigel Tao ddc8973ef0 Let wuffs-c take a no-op C formatter
Reinforcing the previous commit's (e5cc4a42) observation, over 93% of
compilation time (converting foo.wuffs into foo.c) is spent piping the
generated C code through clang-format.

----
$ time wuffs gen -cformatter=clang-format-5.0 > /dev/null
real	0m2.855s
user	0m2.680s
sys	0m0.286s

$ time wuffs gen -cformatter=                 > /dev/null
real	0m0.175s
user	0m0.172s
sys	0m0.050s
----
2020-06-03 13:21:53 +10:00
Nigel Tao e5cc4a42e4 Measure how much of "wuffs gen" is clang-format
----
$ time wuffs gen
       1 milliseconds generating the C code
     753 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-base.c
       0 milliseconds generating the C code
      19 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-adler32.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/adler32.wuffs
       1 milliseconds generating the C code
      61 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-bmp.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/bmp.wuffs
       1 milliseconds generating the C code
      78 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-crc32.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/crc32.wuffs
       2 milliseconds generating the C code
      93 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-deflate.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/deflate.wuffs
       0 milliseconds generating the C code
      34 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-lzw.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/lzw.wuffs
       4 milliseconds generating the C code
     203 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-gif.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/gif.wuffs
       0 milliseconds generating the C code
      33 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-gzip.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/gzip.wuffs
       4 milliseconds generating the C code
     135 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-json.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/json.wuffs
       0 milliseconds generating the C code
      44 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-wbmp.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/wbmp.wuffs
       0 milliseconds generating the C code
      32 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/gen/c/wuffs-std-zlib.c
gen unchanged:  /etcetera/wuffs/gen/wuffs/std/zlib.wuffs
       3 milliseconds collecting the C code
    1173 milliseconds formatting the C code via "clang-format-5.0"
gen unchanged:  /etcetera/wuffs/release/c/wuffs-unsupported-snapshot.c

real	0m2.849s
user	0m2.674s
sys	0m0.278s
----
2020-06-03 12:30:47 +10:00
Nigel Tao 092b03cd1e Add WUFFS_CONFIG__MODULE__BASE__ETC sub-modules
$ ls -l gen/lib/c/*/{lib*,*base*} | awk '{print $5 " " $9}'

Before:
167976 gen/lib/c/clang-5.0-dynamic/libwuffs.so
 40824 gen/lib/c/clang-5.0-dynamic/wuffs-base.lo
203306 gen/lib/c/clang-5.0-static/libwuffs.a
 41816 gen/lib/c/clang-5.0-static/wuffs-base.o
188080 gen/lib/c/gcc-dynamic/libwuffs.so
 53976 gen/lib/c/gcc-dynamic/wuffs-base.lo
230002 gen/lib/c/gcc-static/libwuffs.a
 53976 gen/lib/c/gcc-static/wuffs-base.o

After:
168024 gen/lib/c/clang-5.0-dynamic/libwuffs.so
 20664 gen/lib/c/clang-5.0-dynamic/wuffs-base-core.lo
 10784 gen/lib/c/clang-5.0-dynamic/wuffs-base-f64conv.lo
 11640 gen/lib/c/clang-5.0-dynamic/wuffs-base-pixconv.lo
205752 gen/lib/c/clang-5.0-static/libwuffs.a
 20960 gen/lib/c/clang-5.0-static/wuffs-base-core.o
 11024 gen/lib/c/clang-5.0-static/wuffs-base-f64conv.o
 12096 gen/lib/c/clang-5.0-static/wuffs-base-pixconv.o
188128 gen/lib/c/gcc-dynamic/libwuffs.so
 18936 gen/lib/c/gcc-dynamic/wuffs-base-core.lo
 10672 gen/lib/c/gcc-dynamic/wuffs-base-f64conv.lo
 27232 gen/lib/c/gcc-dynamic/wuffs-base-pixconv.lo
232984 gen/lib/c/gcc-static/libwuffs.a
 18920 gen/lib/c/gcc-static/wuffs-base-core.o
 10640 gen/lib/c/gcc-static/wuffs-base-f64conv.o
 27216 gen/lib/c/gcc-static/wuffs-base-pixconv.o
2020-05-25 23:01:11 +10:00
Nigel Tao 532e18c4a5 Add colons to const syntax 2020-04-14 14:57:30 +10:00
Nigel Tao 1a1f36ce13 Disable clang's -Wunreachable-code warning 2020-04-03 21:57:49 +11:00
Nigel Tao 097e59853d Tweak cmd/wuffsfmt/main.go 2020-02-05 17:16:49 +11:00