diff --git a/LICENSE b/LICENSE index d6b5de55..f433b1a5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,27 +1,177 @@ -Copyright (c) 2017 The Puffs Authors. All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/PATENTS b/PATENTS deleted file mode 100644 index 3bfc012d..00000000 --- a/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Puffs project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Puffs, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Puffs. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Puffs or any code incorporated within this -implementation of Puffs constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Puffs -shall terminate as of the date such litigation is filed. diff --git a/README.md b/README.md index 3bbd9e3b..6e0a2842 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ proposals and reach consensus before sending your first PR. # License -BSD-style with patent grant. See the LICENSE and PATENTS files for details. +Apache 2. See the LICENSE file for details. # Disclaimer diff --git a/cmd/puffs-c/genlib.go b/cmd/puffs-c/genlib.go index ed1c7377..13ef003a 100644 --- a/cmd/puffs-c/genlib.go +++ b/cmd/puffs-c/genlib.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main diff --git a/cmd/puffs-c/internal/cgen/base-header.h b/cmd/puffs-c/internal/cgen/base-header.h index e3fd8cd1..eaf384f3 100644 --- a/cmd/puffs-c/internal/cgen/base-header.h +++ b/cmd/puffs-c/internal/cgen/base-header.h @@ -3,8 +3,19 @@ #ifndef PUFFS_BASE_HEADER_H #define PUFFS_BASE_HEADER_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include diff --git a/cmd/puffs-c/internal/cgen/base-impl.h b/cmd/puffs-c/internal/cgen/base-impl.h index 93494520..c8e86892 100644 --- a/cmd/puffs-c/internal/cgen/base-impl.h +++ b/cmd/puffs-c/internal/cgen/base-impl.h @@ -3,8 +3,19 @@ #ifndef PUFFS_BASE_IMPL_H #define PUFFS_BASE_IMPL_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) diff --git a/cmd/puffs-c/internal/cgen/cgen.go b/cmd/puffs-c/internal/cgen/cgen.go index ea5a4dc8..838b8821 100644 --- a/cmd/puffs-c/internal/cgen/cgen.go +++ b/cmd/puffs-c/internal/cgen/cgen.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. //go:generate go run gen.go diff --git a/cmd/puffs-c/internal/cgen/data.go b/cmd/puffs-c/internal/cgen/data.go index d42a5195..9ad4855d 100644 --- a/cmd/puffs-c/internal/cgen/data.go +++ b/cmd/puffs-c/internal/cgen/data.go @@ -1,24 +1,36 @@ // Code generated by running "go generate". DO NOT EDIT. -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package cgen const baseHeader = "" + - "#ifndef PUFFS_BASE_HEADER_H\n#define PUFFS_BASE_HEADER_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#include \n#include \n#include \n\n// Puffs requires a word size of at least 32 bits because it assumes that\n// converting a u32 to usize will never overflow. For example, the size of a\n// decoded image is often represented, explicitly or implicitly in an image\n// file, as a u32, and it is convenient to compare that to a buffer size.\n//\n// Similarly, the word size is at most 64 bits because it assumes that\n// converting a usize to u64 will never overflow.\n#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 bits\"\n#elif __WORDSIZE > 64\n#error \"Puffs requires a word size of at most 64 bits\"\n#endif\n\n// PUFFS_VERSION is the major.minor version number as a uint32. The major\n// number is the high 16 bits. The minor number is the low 16 bits.\n//\n// The intention is to bump the version number at least on every API " + - "/ ABI\n// backwards incompatible change.\n//\n// For now, the API and ABI are simply unstable and can change at any time.\n//\n// TODO: don't hard code this in base-header.h.\n#define PUFFS_VERSION (0x00001)\n\n// puffs_base_slice_u8 is a 1-dimensional buffer (a pointer and length).\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} puffs_base_slice_u8;\n\n// puffs_base_buf1 is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} puffs_base_buf1;\n\n// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's curr" + - "ent read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct puffs_base_limit1 {\n uint64_t* ptr_to_len; // Pointer to N.\n struct puffs_base_limit1* next; // Linked list of limits.\n} puffs_base_limit1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_reader1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_writer1;\n\n#endif // PUFFS_BASE_HEADER_H\n" + + "#ifndef PUFFS_BASE_HEADER_H\n#define PUFFS_BASE_HEADER_H\n\n// Copyright 2017 The Puffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \n#include \n#include \n\n// Puffs requires a word size of at least 32 bits because it assumes that\n// converting a u32 to usize will never overflow. For example, the size of a\n// decoded image is often represented, explicitly or implicitly in an image\n// file, as a u32, and it is convenient to compare that to a buffer size.\n//\n// Si" + + "milarly, the word size is at most 64 bits because it assumes that\n// converting a usize to u64 will never overflow.\n#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 bits\"\n#elif __WORDSIZE > 64\n#error \"Puffs requires a word size of at most 64 bits\"\n#endif\n\n// PUFFS_VERSION is the major.minor version number as a uint32. The major\n// number is the high 16 bits. The minor number is the low 16 bits.\n//\n// The intention is to bump the version number at least on every API / ABI\n// backwards incompatible change.\n//\n// For now, the API and ABI are simply unstable and can change at any time.\n//\n// TODO: don't hard code this in base-header.h.\n#define PUFFS_VERSION (0x00001)\n\n// puffs_base_slice_u8 is a 1-dimensional buffer (a pointer and length).\n//\n// A value with all fields NULL or zero is a valid, empty slice.\ntypedef struct {\n uint8_t* ptr;\n size_t len;\n} puffs_base_slice_u8;\n\n// puffs_base_buf1 is a 1-dimensional buffer (a pointer and length), plus\n// additional indexes into that buffer, plus" + + " an opened / closed flag.\n//\n// A value with all fields NULL or zero is a valid, empty buffer.\ntypedef struct {\n uint8_t* ptr; // Pointer.\n size_t len; // Length.\n size_t wi; // Write index. Invariant: wi <= len.\n size_t ri; // Read index. Invariant: ri <= wi.\n bool closed; // No further writes are expected.\n} puffs_base_buf1;\n\n// puffs_base_limit1 provides a limited view of a 1-dimensional byte stream:\n// its first N bytes. That N can be greater than a buffer's current read or\n// write capacity. N decreases naturally over time as bytes are read from or\n// written to the stream.\n//\n// A value with all fields NULL or zero is a valid, unlimited view.\ntypedef struct puffs_base_limit1 {\n uint64_t* ptr_to_len; // Pointer to N.\n struct puffs_base_limit1* next; // Linked list of limits.\n} puffs_base_limit1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_reader1;\n\ntypedef struct {\n puffs_base_buf1* buf;\n puffs_base_limit1 limit;\n} puffs_base_write" + + "r1;\n\n#endif // PUFFS_BASE_HEADER_H\n" + "" const baseImpl = "" + - "#ifndef PUFFS_BASE_IMPL_H\n#define PUFFS_BASE_IMPL_H\n\n// Use of this source code is governed by a BSD-style license that can be found\n// in the LICENSE file.\n\n#define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use a trivial macro instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define PUFFS_COROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n case n:;\n\n#define PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (status < 0) { \\\n goto exit; \\\n } else if (status == 0) { \\\n goto ok; \\\n } \\\n coro_susp_point = n; " + - " \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n// Declare the printf prototype. The generated code shouldn't need this at all,\n// but it's useful for manual printf debugging.\nextern int printf(const char* __restrict __format, ...);\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#define PUFFS_UNLIKELY(expr) (expr)\n#endif\n\n// ---------------- Static Inline Functions\n//\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are in base-impl.h and hence copy/pasted into every generated C file,\n// instead of being in some \"base.c\" file, since a design goal is that users of\n// the generated C code can often just #include a single .c file, such as\n// \"gif.c\", without having to additionally include or otherwis" + - "e build and link\n// a \"base.c\" file.\n//\n// They are static, so that linking multiple puffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline uint16_t puffs_base_load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t puffs_base_load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t puffs_base_load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t puffs_base_load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline puffs_base_s" + - "lice_u8 puffs_base_slice_u8_subslice_i(\n puffs_base_slice_u8 s,\n uint64_t i) {\n if ((i <= SIZE_MAX) && (i <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = s.len - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_subslice_j(\n puffs_base_slice_u8 s,\n uint64_t j) {\n if ((j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){.ptr = s.ptr, .len = j});\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8\npuffs_base_slice_u8_subslice_ij(puffs_base_slice_u8 s, uint64_t i, uint64_t j) {\n if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\n// puffs_base_slice_u8_prefix returns up to the first n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_prefix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n)" + - " {\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_suffix returns up to the last n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_suffix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.ptr += (uint64_t)(s.len) - n;\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_copy_from calls memmove(dst.ptr, src.ptr, n) where n is\n// the minimum of dst.len and src.len.\n//\n// Passing a puffs_base_slice_u8 with all fields NULL or zero (a valid, empty\n// slice) is valid and results in a no-op.\nstatic inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,\n puffs_base_slice_u8 src) {\n size_t n = dst.len < src.len ? dst.len : src.len;\n if (n > 0) {\n memmove(dst.ptr, src.ptr, n);\n }\n return n;\n}\n\nstatic inline uint32_t puffs_base_writer1_copy_from32(uint8_t** ptr_wptr,\n uint8_t* wend,\n " + - " uint8_t** ptr_rptr,\n uint8_t* rend,\n uint32_t length) {\n uint8_t* wptr = *ptr_wptr;\n if (length > (wend - wptr)) {\n length = wend - wptr;\n }\n uint8_t* rptr = *ptr_rptr;\n if (length > (rend - rptr)) {\n length = rend - rptr;\n }\n if (length > 0) {\n memmove(wptr, rptr, length);\n *ptr_wptr += length;\n *ptr_rptr += length;\n }\n return length;\n}\n\nstatic inline uint32_t puffs_base_writer1_copy_history32(uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n uint8_t* ptr = *ptr_ptr;\n size_t d = ptr - start;\n if ((d == 0) || (d < (size_t)(distance))) {\n return 0;\n }\n start = ptr - distance;\n size_t l = end - ptr;\n if ((si" + - "ze_t)(length) > l) {\n length = l;\n } else {\n l = length;\n }\n // TODO: is manual unrolling actually helpful?\n for (; l >= 8; l -= 8) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; l; l--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n#endif // PUFFS_BASE_IMPL_H\n" + + "#ifndef PUFFS_BASE_IMPL_H\n#define PUFFS_BASE_IMPL_H\n\n// Copyright 2017 The Puffs Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x)\n\n// Use switch cases for coroutine suspension points, similar to the technique\n// in https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\n//\n// We use a trivial macro instead of an explicit assignment and case statement\n// so that clang-format doesn't get confused by the unusual \"case\"s.\n#define PUFFS_CO" + + "ROUTINE_SUSPENSION_POINT(n) \\\n coro_susp_point = n; \\\n case n:;\n\n#define PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(n) \\\n if (status < 0) { \\\n goto exit; \\\n } else if (status == 0) { \\\n goto ok; \\\n } \\\n coro_susp_point = n; \\\n goto suspend; \\\n case n:;\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define PUFFS_LIKELY(expr) (__builtin_expect(!!(expr), 1))\n#define PUFFS_UNLIKELY(expr) (__builtin_expect(!!(expr), 0))\n// Declare the printf prototype. The generated code shouldn't need this at all,\n// but it's useful for manual printf debugging.\nextern int printf(const char* __restrict __format, ...);\n#else\n#define PUFFS_LIKELY(expr) (expr)\n#define PUFFS_UNLIKELY(expr) (expr)\n#endif\n" + + "\n// ---------------- Static Inline Functions\n//\n// The helpers below are functions, instead of macros, because their arguments\n// can be an expression that we shouldn't evaluate more than once.\n//\n// They are in base-impl.h and hence copy/pasted into every generated C file,\n// instead of being in some \"base.c\" file, since a design goal is that users of\n// the generated C code can often just #include a single .c file, such as\n// \"gif.c\", without having to additionally include or otherwise build and link\n// a \"base.c\" file.\n//\n// They are static, so that linking multiple puffs .o files won't complain about\n// duplicate function definitions.\n//\n// They are explicitly marked inline, even if modern compilers don't use the\n// inline attribute to guide optimizations such as inlining, to avoid the\n// -Wunused-function warning, and we like to compile with -Wall -Werror.\n\nstatic inline uint16_t puffs_base_load_u16be(uint8_t* p) {\n return ((uint16_t)(p[0]) << 8) | ((uint16_t)(p[1]) << 0);\n}\n\nstatic inline uint16_t puff" + + "s_base_load_u16le(uint8_t* p) {\n return ((uint16_t)(p[0]) << 0) | ((uint16_t)(p[1]) << 8);\n}\n\nstatic inline uint32_t puffs_base_load_u32be(uint8_t* p) {\n return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |\n ((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);\n}\n\nstatic inline uint32_t puffs_base_load_u32le(uint8_t* p) {\n return ((uint32_t)(p[0]) << 0) | ((uint32_t)(p[1]) << 8) |\n ((uint32_t)(p[2]) << 16) | ((uint32_t)(p[3]) << 24);\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_subslice_i(\n puffs_base_slice_u8 s,\n uint64_t i) {\n if ((i <= SIZE_MAX) && (i <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = s.len - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_subslice_j(\n puffs_base_slice_u8 s,\n uint64_t j) {\n if ((j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){.ptr = s.ptr, .len = j});\n }\n return ((puffs_base_slice_u8){});\n}\n\nstatic inline " + + "puffs_base_slice_u8\npuffs_base_slice_u8_subslice_ij(puffs_base_slice_u8 s, uint64_t i, uint64_t j) {\n if ((i <= j) && (j <= SIZE_MAX) && (j <= s.len)) {\n return ((puffs_base_slice_u8){\n .ptr = s.ptr + i,\n .len = j - i,\n });\n }\n return ((puffs_base_slice_u8){});\n}\n\n// puffs_base_slice_u8_prefix returns up to the first n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_prefix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_suffix returns up to the last n bytes of s.\nstatic inline puffs_base_slice_u8 puffs_base_slice_u8_suffix(\n puffs_base_slice_u8 s,\n uint64_t n) {\n if ((uint64_t)(s.len) > n) {\n s.ptr += (uint64_t)(s.len) - n;\n s.len = n;\n }\n return s;\n}\n\n// puffs_base_slice_u8_copy_from calls memmove(dst.ptr, src.ptr, n) where n is\n// the minimum of dst.len and src.len.\n//\n// Passing a puffs_base_slice_u8 with all fields NULL or zero (a valid, empty\n// slice) is valid and" + + " results in a no-op.\nstatic inline uint64_t puffs_base_slice_u8_copy_from(puffs_base_slice_u8 dst,\n puffs_base_slice_u8 src) {\n size_t n = dst.len < src.len ? dst.len : src.len;\n if (n > 0) {\n memmove(dst.ptr, src.ptr, n);\n }\n return n;\n}\n\nstatic inline uint32_t puffs_base_writer1_copy_from32(uint8_t** ptr_wptr,\n uint8_t* wend,\n uint8_t** ptr_rptr,\n uint8_t* rend,\n uint32_t length) {\n uint8_t* wptr = *ptr_wptr;\n if (length > (wend - wptr)) {\n length = wend - wptr;\n }\n uint8_t* rptr = *ptr_rptr;\n if (length > (rend - rptr)) {\n length = rend - rptr;\n }\n if (length > 0) {\n memmove(wptr, rptr, length);\n *ptr_wptr += length;\n *ptr_rptr += length;\n }\n return length;\n}\n\nstatic inline uint32_t puffs_base_writer1_copy_history32(" + + "uint8_t** ptr_ptr,\n uint8_t* start,\n uint8_t* end,\n uint32_t distance,\n uint32_t length) {\n uint8_t* ptr = *ptr_ptr;\n size_t d = ptr - start;\n if ((d == 0) || (d < (size_t)(distance))) {\n return 0;\n }\n start = ptr - distance;\n size_t l = end - ptr;\n if ((size_t)(length) > l) {\n length = l;\n } else {\n l = length;\n }\n // TODO: is manual unrolling actually helpful?\n for (; l >= 8; l -= 8) {\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n *ptr++ = *start++;\n }\n for (; l; l--) {\n *ptr++ = *start++;\n }\n *ptr_ptr = ptr;\n return length;\n}\n\n#endif // PUFFS_BASE_IMPL_H\n" + "" type template_args_short_read struct { diff --git a/cmd/puffs-c/internal/cgen/expr.go b/cmd/puffs-c/internal/cgen/expr.go index 2d90d597..4b82cacc 100644 --- a/cmd/puffs-c/internal/cgen/expr.go +++ b/cmd/puffs-c/internal/cgen/expr.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package cgen diff --git a/cmd/puffs-c/internal/cgen/func.go b/cmd/puffs-c/internal/cgen/func.go index 7240b359..954eb55a 100644 --- a/cmd/puffs-c/internal/cgen/func.go +++ b/cmd/puffs-c/internal/cgen/func.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package cgen diff --git a/cmd/puffs-c/internal/cgen/gen.go b/cmd/puffs-c/internal/cgen/gen.go index a9725c6a..7000a76d 100644 --- a/cmd/puffs-c/internal/cgen/gen.go +++ b/cmd/puffs-c/internal/cgen/gen.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore @@ -33,8 +44,19 @@ func main1() error { out := &bytes.Buffer{} out.WriteString("// Code generated by running \"go generate\". DO NOT EDIT.\n") out.WriteString("\n") - out.WriteString("// Use of this source code is governed by a BSD-style license that can be found\n") - out.WriteString("// in the LICENSE file.\n") + out.WriteString("// Copyright 2017 The Puffs Authors.\n") + out.WriteString("//\n") + out.WriteString("// Licensed under the Apache License, Version 2.0 (the \"License\");\n") + out.WriteString("// you may not use this file except in compliance with the License.\n") + out.WriteString("// You may obtain a copy of the License at\n") + out.WriteString("//\n") + out.WriteString("// https://www.apache.org/licenses/LICENSE-2.0\n") + out.WriteString("//\n") + out.WriteString("// Unless required by applicable law or agreed to in writing, software\n") + out.WriteString("// distributed under the License is distributed on an \"AS IS\" BASIS,\n") + out.WriteString("// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n") + out.WriteString("// See the License for the specific language governing permissions and\n") + out.WriteString("// limitations under the License.\n") out.WriteString("\n") out.WriteString("package cgen\n") out.WriteString("\n") diff --git a/cmd/puffs-c/internal/cgen/statement.go b/cmd/puffs-c/internal/cgen/statement.go index da0476a6..ed01d718 100644 --- a/cmd/puffs-c/internal/cgen/statement.go +++ b/cmd/puffs-c/internal/cgen/statement.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package cgen diff --git a/cmd/puffs-c/internal/cgen/templates.h b/cmd/puffs-c/internal/cgen/templates.h index 5b3fe81c..9174d302 100644 --- a/cmd/puffs-c/internal/cgen/templates.h +++ b/cmd/puffs-c/internal/cgen/templates.h @@ -1,5 +1,19 @@ // After editing this file, run "go generate" in this directory. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // This file contains C-like code. It is close enough to C so that clang-format // can format it well. But it is not C code per se. It contains templates that // the code generator expands via a custom mechanism. diff --git a/cmd/puffs-c/internal/cgen/var.go b/cmd/puffs-c/internal/cgen/var.go index a3d88338..8aba8e6c 100644 --- a/cmd/puffs-c/internal/cgen/var.go +++ b/cmd/puffs-c/internal/cgen/var.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package cgen diff --git a/cmd/puffs-c/main.go b/cmd/puffs-c/main.go index 7180e7cb..c00b6764 100644 --- a/cmd/puffs-c/main.go +++ b/cmd/puffs-c/main.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // puffs-c handles the C language specific parts of the puffs tool. package main diff --git a/cmd/puffs-c/test.go b/cmd/puffs-c/test.go index cee36ae4..e391f69a 100644 --- a/cmd/puffs-c/test.go +++ b/cmd/puffs-c/test.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main diff --git a/cmd/puffs/gen.go b/cmd/puffs/gen.go index ba3d3bca..91053f8f 100644 --- a/cmd/puffs/gen.go +++ b/cmd/puffs/gen.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main diff --git a/cmd/puffs/main.go b/cmd/puffs/main.go index adb0e6a3..b7bbba51 100644 --- a/cmd/puffs/main.go +++ b/cmd/puffs/main.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // puffs is a tool for managing Puffs source code. package main diff --git a/cmd/puffs/test.go b/cmd/puffs/test.go index c1598dea..bf31740e 100644 --- a/cmd/puffs/test.go +++ b/cmd/puffs/test.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main diff --git a/cmd/puffsfmt/main.go b/cmd/puffsfmt/main.go index b3fb4586..a07d69c1 100644 --- a/cmd/puffsfmt/main.go +++ b/cmd/puffsfmt/main.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // puffsfmt formats Puffs programs. // diff --git a/example/library/library.c b/example/library/library.c index b17925d2..fa446306 100644 --- a/example/library/library.c +++ b/example/library/library.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. /* library exercises the software libraries built by `puffs genlib`. diff --git a/example/peterface/peterface.c b/example/peterface/peterface.c index 9ff81c32..62c54b6f 100644 --- a/example/peterface/peterface.c +++ b/example/peterface/peterface.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. /* peterface decodes pjw's iconic face, stored as a GIF image. To run: diff --git a/gen/c/std/flate.c b/gen/c/std/flate.c index 0b2ce6e5..c599a041 100644 --- a/gen/c/std/flate.c +++ b/gen/c/std/flate.c @@ -6,8 +6,19 @@ #ifndef PUFFS_BASE_HEADER_H #define PUFFS_BASE_HEADER_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include @@ -285,8 +296,19 @@ puffs_flate_status puffs_flate_zlib_decoder_decode( #ifndef PUFFS_BASE_IMPL_H #define PUFFS_BASE_IMPL_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index c2ae0074..a43e970b 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -6,8 +6,19 @@ #ifndef PUFFS_BASE_HEADER_H #define PUFFS_BASE_HEADER_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include @@ -254,8 +265,19 @@ puffs_gif_status puffs_gif_lzw_decoder_decode(puffs_gif_lzw_decoder* self, #ifndef PUFFS_BASE_IMPL_H #define PUFFS_BASE_IMPL_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #define PUFFS_IGNORE_POTENTIALLY_UNUSED_VARIABLE(x) (void)(x) diff --git a/gen/h/std/flate.h b/gen/h/std/flate.h index fc199e8b..697e60fe 100644 --- a/gen/h/std/flate.h +++ b/gen/h/std/flate.h @@ -6,8 +6,19 @@ #ifndef PUFFS_BASE_HEADER_H #define PUFFS_BASE_HEADER_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include diff --git a/gen/h/std/gif.h b/gen/h/std/gif.h index 8a92cf52..27529ace 100644 --- a/gen/h/std/gif.h +++ b/gen/h/std/gif.h @@ -6,8 +6,19 @@ #ifndef PUFFS_BASE_HEADER_H #define PUFFS_BASE_HEADER_H -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include diff --git a/lang/ast/ast.go b/lang/ast/ast.go index 601bd682..d6c81678 100644 --- a/lang/ast/ast.go +++ b/lang/ast/ast.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package ast diff --git a/lang/ast/eq.go b/lang/ast/eq.go index 62c2eb2b..08abccb1 100644 --- a/lang/ast/eq.go +++ b/lang/ast/eq.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package ast diff --git a/lang/ast/sort.go b/lang/ast/sort.go index ace34f1a..f756854c 100644 --- a/lang/ast/sort.go +++ b/lang/ast/sort.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package ast diff --git a/lang/ast/string.go b/lang/ast/string.go index 1d1f2743..0d9d3380 100644 --- a/lang/ast/string.go +++ b/lang/ast/string.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package ast diff --git a/lang/ast/string_test.go b/lang/ast/string_test.go index b7d3f725..9e08c295 100644 --- a/lang/ast/string_test.go +++ b/lang/ast/string_test.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package ast_test diff --git a/lang/base38/base38.go b/lang/base38/base38.go index 69013318..e362b4c0 100644 --- a/lang/base38/base38.go +++ b/lang/base38/base38.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // Package base38 converts a 4-byte string, each byte in [ 0-9?a-z], to a base // 38 number. diff --git a/lang/base38/base38_test.go b/lang/base38/base38_test.go index 2bbd3e91..10e92e14 100644 --- a/lang/base38/base38_test.go +++ b/lang/base38/base38_test.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package base38 diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 89ee6ddb..705be683 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // Package builtin lists Puffs' built-in concepts such as status codes. package builtin diff --git a/lang/check/assert.go b/lang/check/assert.go index 26d7a2b5..a2d61280 100644 --- a/lang/check/assert.go +++ b/lang/check/assert.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 88355027..e93c9c85 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/check/check.go b/lang/check/check.go index c1da23f4..0f50dbd1 100644 --- a/lang/check/check.go +++ b/lang/check/check.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. //go:generate go run gen.go diff --git a/lang/check/check_test.go b/lang/check/check_test.go index 35c5e390..90b1006d 100644 --- a/lang/check/check_test.go +++ b/lang/check/check_test.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/check/data.go b/lang/check/data.go index d4bf7af9..013c8027 100644 --- a/lang/check/data.go +++ b/lang/check/data.go @@ -1,7 +1,18 @@ // Code generated by running "go generate". DO NOT EDIT. -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/check/gen.go b/lang/check/gen.go index 4f30f8e3..a67f44ae 100644 --- a/lang/check/gen.go +++ b/lang/check/gen.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore @@ -298,8 +309,19 @@ var keys = map[string]string{ const header = `// Code generated by running "go generate". DO NOT EDIT. -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/check/type.go b/lang/check/type.go index 25d0b634..6a9e8047 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package check diff --git a/lang/generate/generate.go b/lang/generate/generate.go index f80f44d8..f8fc1d8b 100644 --- a/lang/generate/generate.go +++ b/lang/generate/generate.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package generate diff --git a/lang/parse/parse.go b/lang/parse/parse.go index 055fa27f..88fc0913 100644 --- a/lang/parse/parse.go +++ b/lang/parse/parse.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package parse diff --git a/lang/render/render.go b/lang/render/render.go index c55d9421..12f97db0 100644 --- a/lang/render/render.go +++ b/lang/render/render.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package render diff --git a/lang/token/list.go b/lang/token/list.go index 1dc718b9..e0006292 100644 --- a/lang/token/list.go +++ b/lang/token/list.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package token diff --git a/lang/token/token.go b/lang/token/token.go index b06c66dc..6f2f5dee 100644 --- a/lang/token/token.go +++ b/lang/token/token.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package token diff --git a/script/compress-giflzw.go b/script/compress-giflzw.go index 71cf93c6..279a1dd5 100644 --- a/script/compress-giflzw.go +++ b/script/compress-giflzw.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/extract-flate-offsets.go b/script/extract-flate-offsets.go index bb7794ea..8d26d56d 100644 --- a/script/extract-flate-offsets.go +++ b/script/extract-flate-offsets.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/extract-giflzw.go b/script/extract-giflzw.go index 08a1bbd9..a44d47c1 100644 --- a/script/extract-giflzw.go +++ b/script/extract-giflzw.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/extract-palette-indexes.go b/script/extract-palette-indexes.go index 7d9cd71e..f043ccfa 100644 --- a/script/extract-palette-indexes.go +++ b/script/extract-palette-indexes.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/print-bits.go b/script/print-bits.go index 0171abd7..b09eef19 100644 --- a/script/print-bits.go +++ b/script/print-bits.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/print-flate-magic-numbers.go b/script/print-flate-magic-numbers.go index 119aa97e..476631bf 100644 --- a/script/print-flate-magic-numbers.go +++ b/script/print-flate-magic-numbers.go @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // +build ignore diff --git a/script/puffs-flate-decoder-decode-huffman.c b/script/puffs-flate-decoder-decode-huffman.c index 4c1b87b1..35c9ab01 100644 --- a/script/puffs-flate-decoder-decode-huffman.c +++ b/script/puffs-flate-decoder-decode-huffman.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // This file contains a hand-written C implementation of gen/c/std/flate.c's // generated puffs_flate_decoder_decode_huffman function. diff --git a/std/flate/codec_consts.puffs b/std/flate/codec_consts.puffs index e5c45325..e9f86eef 100644 --- a/std/flate/codec_consts.puffs +++ b/std/flate/codec_consts.puffs @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // code_order is defined in the RFC section 3.2.7. pri const code_order[19] u8[..18] = $( diff --git a/std/flate/decode_flate.puffs b/std/flate/decode_flate.puffs index bddba502..7c5de514 100644 --- a/std/flate/decode_flate.puffs +++ b/std/flate/decode_flate.puffs @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. packageid "flte" diff --git a/std/flate/decode_zlib.puffs b/std/flate/decode_zlib.puffs index be9a61de..ab97b9ee 100644 --- a/std/flate/decode_zlib.puffs +++ b/std/flate/decode_zlib.puffs @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pub error "invalid zlib compression method" pub error "invalid zlib compression window size" diff --git a/std/gif/decode_gif.puffs b/std/gif/decode_gif.puffs index 1d9cc136..3b09dc5e 100644 --- a/std/gif/decode_gif.puffs +++ b/std/gif/decode_gif.puffs @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. packageid "gif " diff --git a/std/gif/decode_lzw.puffs b/std/gif/decode_lzw.puffs index ed78bd6d..4a4089ad 100644 --- a/std/gif/decode_lzw.puffs +++ b/std/gif/decode_lzw.puffs @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // TODO: some mechanism for fixing the error code's value, such as a trailing // "= 100", to maintain API stability. diff --git a/test/c/mimiclib/flate.c b/test/c/mimiclib/flate.c index 4373dbf5..7abf1d6e 100644 --- a/test/c/mimiclib/flate.c +++ b/test/c/mimiclib/flate.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include "zlib.h" diff --git a/test/c/mimiclib/gif.c b/test/c/mimiclib/gif.c index fcf77655..7111b44b 100644 --- a/test/c/mimiclib/gif.c +++ b/test/c/mimiclib/gif.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include "gif_lib.h" diff --git a/test/c/std/flate.c b/test/c/std/flate.c index cd07d994..1c294efe 100644 --- a/test/c/std/flate.c +++ b/test/c/std/flate.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. /* This test program is typically run indirectly, by the "puffs test" or "puffs diff --git a/test/c/std/gif.c b/test/c/std/gif.c index 4d1795b0..8d0c853a 100644 --- a/test/c/std/gif.c +++ b/test/c/std/gif.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. /* This test program is typically run indirectly, by the "puffs test" or "puffs diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c index 28dd5825..ff37bb10 100644 --- a/test/c/testlib/testlib.c +++ b/test/c/testlib/testlib.c @@ -1,5 +1,16 @@ -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. +// Copyright 2017 The Puffs Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include #include