Add base-private.h. to base-impl.c

This commit is contained in:
Nigel Tao committed 2018-06-16 08:17:20 +10:00
1 parent 25a106903f
commit 56491b384e
4 files changed
+574 -2

No files matched your search

@@ -16,6 +16,10 @@
// !! INSERT base-public.h.
// C HEADER ENDS HERE.
// !! INSERT base-private.h.
// !! INSERT wuffs_base__status__string data.
const char* wuffs_base__status__string(wuffs_base__status s) {
+7 -1
View File
@@ -81,7 +81,8 @@ func Do(args []string) error {
}
buf := make(buffer, 0, 128*1024)
if err := expandBangBangInsert(&buf, baseImplC, map[string]func(*buffer) error{
"// !! INSERT base-public.h.\n": insertBasePublicH,
"// !! INSERT base-private.h.\n": insertBasePrivateH,
"// !! INSERT base-public.h.\n": insertBasePublicH,
"// !! INSERT wuffs_base__status__string data.\n": func(b *buffer) error {
messages := [256]string{}
for _, z := range builtin.StatusList {
@@ -195,6 +196,11 @@ func expandBangBangInsert(b *buffer, s string, m map[string]func(*buffer) error)
return nil
}
func insertBasePrivateH(buf *buffer) error {
buf.writes(basePrivateH)
return nil
}
func insertBasePublicH(buf *buffer) error {
buf.writes("// Code generated by wuffs-c. DO NOT EDIT.\n\n")
if err := expandBangBangInsert(buf, basePublicH, map[string]func(*buffer) error{
+1 -1
View File
@@ -123,7 +123,7 @@ const basePrivateH = "" +
""
const baseImplC = "" +
"// Copyright 2018 The Wuffs 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// !! INSERT base-public.h.\n\n// !! INSERT wuffs_base__status__string data.\n\nconst char* wuffs_base__status__string(wuffs_base__status s) {\n uint16_t o = wuffs_base__status__string_offsets[(uint8_t)(s >> 24)];\n return o ? wuffs_base__status__string_data + o : \"unknown status\";\n}\n" +
"// Copyright 2018 The Wuffs 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// !! INSERT base-public.h.\n\n// C HEADER ENDS HERE.\n\n// !! INSERT base-private.h.\n\n// !! INSERT wuffs_base__status__string data.\n\nconst char* wuffs_base__status__string(wuffs_base__status s) {\n uint16_t o = wuffs_base__status__string_offsets[(uint8_t)(s >> 24)];\n return o ? wuffs_base__status__string_data + o : \"unknown status\";\n}\n" +
""
type template_args_short_read struct {