mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
Add cmd/puffs-gen-c/base-impl.h.
Also rename preamble.h to base-header.h.
This commit is contained in:
1 parent
1841ed8a36
commit
930ff53ff6
7 files changed
+67
-38
No files matched your search
@@ -45,9 +45,8 @@ func (gen) Generate(pkgName string, m *t.IDMap, files []*a.File) ([]byte, error)
|
||||
includeGuard := "PUFFS_" + strings.ToUpper(pkgName) + "_H"
|
||||
fmt.Fprintf(b, "#ifndef %s\n#define %s\n\n", includeGuard, includeGuard)
|
||||
|
||||
// Write preamble.
|
||||
fmt.Fprintf(b, "// Code generated by puffs-gen-c. DO NOT EDIT.\n\n")
|
||||
b.WriteString(preamble)
|
||||
b.WriteString(baseHeader)
|
||||
b.WriteString("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n")
|
||||
|
||||
b.WriteString("// ---------------- Status Codes\n\n")
|
||||
@@ -82,6 +81,8 @@ func (gen) Generate(pkgName string, m *t.IDMap, files []*a.File) ([]byte, error)
|
||||
b.WriteString("\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n")
|
||||
fmt.Fprintf(b, "#endif // %s\n\n", includeGuard)
|
||||
b.WriteString("// C HEADER ENDS HERE.\n\n")
|
||||
b.WriteString(baseImpl)
|
||||
b.WriteString("\n")
|
||||
|
||||
b.WriteString("// ---------------- Private Structs\n\n")
|
||||
if err := forEachStruct(b, pkgName, m, files, priOnly, writeStruct); err != nil {
|
||||
|
||||
Reference in new issue
Block a user