diff --git a/cmd/puffs-gen-c/data.go b/cmd/puffs-gen-c/data.go index b43c6bcb..8f0bc529 100644 --- a/cmd/puffs-gen-c/data.go +++ b/cmd/puffs-gen-c/data.go @@ -6,5 +6,6 @@ package main const preamble = "" + - "// 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#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 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 preamble.h.\n#define PUFFS_VERSION (0x00001)\n" + + "#ifndef PUFFS_BASE_H\n#define PUFFS_BASE_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#if __WORDSIZE < 32\n#error \"Puffs requires a word size of at least 32 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 preamble.h.\n#define PUFFS_VERSION (0x00001)\n\n#endif // PUFF" + + "S_BASE_H\n" + "" diff --git a/cmd/puffs-gen-c/preamble.h b/cmd/puffs-gen-c/preamble.h index ef2994b6..72e23b4b 100644 --- a/cmd/puffs-gen-c/preamble.h +++ b/cmd/puffs-gen-c/preamble.h @@ -1,5 +1,8 @@ // After editing this file, run "go generate" in this directory. +#ifndef PUFFS_BASE_H +#define PUFFS_BASE_H + // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. @@ -25,3 +28,5 @@ // // TODO: don't hard code this in preamble.h. #define PUFFS_VERSION (0x00001) + +#endif // PUFFS_BASE_H diff --git a/gen/c/gif.c b/gen/c/gif.c index 941bb6cb..2aa94372 100644 --- a/gen/c/gif.c +++ b/gen/c/gif.c @@ -3,6 +3,9 @@ // Code generated by puffs-gen-c. DO NOT EDIT. +#ifndef PUFFS_BASE_H +#define PUFFS_BASE_H + // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. @@ -29,6 +32,8 @@ // TODO: don't hard code this in preamble.h. #define PUFFS_VERSION (0x00001) +#endif // PUFFS_BASE_H + #ifdef __cplusplus extern "C" { #endif diff --git a/gen/h/gif.h b/gen/h/gif.h index f9544d1a..f1953fb3 100644 --- a/gen/h/gif.h +++ b/gen/h/gif.h @@ -3,6 +3,9 @@ // Code generated by puffs-gen-c. DO NOT EDIT. +#ifndef PUFFS_BASE_H +#define PUFFS_BASE_H + // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file. @@ -29,6 +32,8 @@ // TODO: don't hard code this in preamble.h. #define PUFFS_VERSION (0x00001) +#endif // PUFFS_BASE_H + #ifdef __cplusplus extern "C" { #endif