Skip to content

Commit

Permalink
Also allow CK_ constants
Browse files Browse the repository at this point in the history
Amend const_generate.go to not skip CK_* constants and have them
in zconst.go as well.

Special case (~0) for CK_UNAVAILABLE_INFORMATION.

Fixes #149

Signed-off-by: Miek Gieben <miek@miek.nl>
  • Loading branch information
miekg committed Jan 5, 2022
1 parent ad34cbf commit ba12f4a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
9 changes: 6 additions & 3 deletions const_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func main() {
if fields[0] != "#define" {
continue
}
if strings.HasPrefix(fields[1], "CK_") {
continue
}
// fields[1] (const name) needs to be 3 chars, starting with CK
if !strings.HasPrefix(fields[1], "CK") {
continue
Expand All @@ -50,6 +47,12 @@ func main() {
if strings.HasSuffix(value, "UL)") {
value = strings.Replace(value, "UL)", ")", 1)
}
// CK_UNAVAILABLE_INFORMATION is encoded as (~0) (with UL) removed, this needs to be ^uint(0) in Go.
// Special case that here.
if value == "(~0)" {
value = "^uint(0)"
}

// check for /* deprecated */ comment
if len(fields) == 6 && fields[4] == "Deprecated" {
fmt.Fprintln(out, fields[1], " = ", value, "// Deprecated")
Expand Down
Binary file modified test_data/a24d090e-196a-ccd7-5b05-6e9cc42d3142/token.object
Binary file not shown.
28 changes: 28 additions & 0 deletions zconst.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba12f4a

Please sign in to comment.