mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Add aux library
This commit is contained in:
1 parent
a4f2bbb249
commit
cf6c578973
14 files changed
+1278
-449
No files matched your search
@@ -26,6 +26,7 @@ import (
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const columns = 1024
|
||||
@@ -58,7 +59,7 @@ func main1() error {
|
||||
out.WriteString("package data\n")
|
||||
out.WriteString("\n")
|
||||
|
||||
if err := genBase(out); err != nil {
|
||||
if err := genData(out); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ func main1() error {
|
||||
return ioutil.WriteFile("data.go", formatted, 0644)
|
||||
}
|
||||
|
||||
func genBase(out *bytes.Buffer) error {
|
||||
func genData(out *bytes.Buffer) error {
|
||||
files := []struct {
|
||||
filename, varname string
|
||||
}{
|
||||
@@ -95,6 +96,11 @@ func genBase(out *bytes.Buffer) error {
|
||||
{"../base/intconv-submodule.c", "BaseIntConvSubmoduleC"},
|
||||
{"../base/pixconv-submodule.c", "BasePixConvSubmoduleC"},
|
||||
{"../base/utf8-submodule.c", "BaseUTF8SubmoduleC"},
|
||||
|
||||
{"../aux/base.cc", "AuxBaseCc"},
|
||||
{"../aux/base.hh", "AuxBaseHh"},
|
||||
{"../aux/json.cc", "AuxJsonCc"},
|
||||
{"../aux/json.hh", "AuxJsonHh"},
|
||||
}
|
||||
|
||||
prefixAfterEditing := []byte("// After editing this file,")
|
||||
@@ -130,6 +136,26 @@ func genBase(out *bytes.Buffer) error {
|
||||
out.WriteString("\"\"\n\n")
|
||||
}
|
||||
|
||||
fmt.Fprintf(out, "var AuxNonBaseCcFiles = []string{\n")
|
||||
for _, f := range files {
|
||||
if strings.HasPrefix(f.varname, "Aux") &&
|
||||
strings.HasSuffix(f.varname, "Cc") &&
|
||||
(f.varname != "AuxBaseCc") {
|
||||
fmt.Fprintf(out, "%s,\n", f.varname)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(out, "}\n\n")
|
||||
|
||||
fmt.Fprintf(out, "var AuxNonBaseHhFiles = []string{\n")
|
||||
for _, f := range files {
|
||||
if strings.HasPrefix(f.varname, "Aux") &&
|
||||
strings.HasSuffix(f.varname, "Hh") &&
|
||||
(f.varname != "AuxBaseHh") {
|
||||
fmt.Fprintf(out, "%s,\n", f.varname)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(out, "}\n\n")
|
||||
|
||||
fmt.Fprintf(out, "const BaseCopyright = \"\" +\n")
|
||||
writeStringConst(out, copyright)
|
||||
out.WriteString("\"\"\n\n")
|
||||
|
||||
Reference in new issue
Block a user