Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
move C header prologue and epilogue to constants
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <denys@sourced.tech>
  • Loading branch information
Denys Smirnov authored and dennwc committed Jun 20, 2019
1 parent b8b90da commit 6ee88f8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions gen_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@ func main() {
}
}

func run() error {
buf := new(bytes.Buffer)
buf.WriteString(`
const (
headerPrologue = `
#ifdef __cplusplus
extern "C" {
#endif
`)
defer buf.WriteString(`
`
headerEpilogue = `
#ifdef __cplusplus
}
#endif
`)
`
)

func run() error {
buf := new(bytes.Buffer)
buf.WriteString(headerPrologue)
for _, fname := range []string{
"api.go",
"src_index.go",
Expand Down Expand Up @@ -72,6 +76,7 @@ extern "C" {
}
}
}
buf.WriteString(headerEpilogue)
return writeHeader(buf.Bytes())
}

Expand Down

0 comments on commit 6ee88f8

Please sign in to comment.