perf(raw): dispatch libxkbcommon through fixed-arity Syscall6/Syscall15
The generator now emits one allocation-free method per function that calls
purego.Syscall6 (or Syscall15 above six arguments) on an address resolved
once at load time, replacing reflection-based purego.RegisterFunc. Adds
xkb_keymap_key_repeats and xkb_state_mod_{name,index}_is_active.- commit
- 26c26f2480736020363bafacd8c3b403c7051b2c
- author
- brice · · 2026-10-01 18:44 UTC
- parent
- 0e37717
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +349 -78
M internal/gen/gen.go +63 -8
| @@ -59,10 +59,11 @@ var Functions = []struct{ Name, Signature string }{ | |||
| 59 | 59 | {"xkb_context_new", "func(uint32) uintptr"}, {"xkb_context_ref", "func(uintptr) uintptr"}, {"xkb_context_unref", "func(uintptr)"}, | |
| 60 | 60 | {"xkb_keymap_new_from_names", "func(uintptr, uintptr, uint32) uintptr"}, {"xkb_keymap_new_from_string", "func(uintptr, uintptr, uint32, uint32) uintptr"}, {"xkb_keymap_new_from_buffer", "func(uintptr, uintptr, uintptr, uint32, uint32) uintptr"}, | |
| 61 | 61 | {"xkb_keymap_ref", "func(uintptr) uintptr"}, {"xkb_keymap_unref", "func(uintptr)"}, {"xkb_keymap_get_as_string", "func(uintptr,uint32) uintptr"}, | |
| 62 | - | {"xkb_keymap_mod_get_index", "func(uintptr,uintptr) uint32"}, {"xkb_keymap_num_layouts", "func(uintptr) uint32"}, | |
| 62 | + | {"xkb_keymap_mod_get_index", "func(uintptr,uintptr) uint32"}, {"xkb_keymap_key_repeats", "func(uintptr,uint32) int32"}, {"xkb_keymap_num_layouts", "func(uintptr) uint32"}, | |
| 63 | 63 | {"xkb_state_new", "func(uintptr) uintptr"}, {"xkb_state_ref", "func(uintptr) uintptr"}, {"xkb_state_unref", "func(uintptr)"}, | |
| 64 | 64 | {"xkb_state_update_mask", "func(uintptr,uint32,uint32,uint32,uint32,uint32,uint32) uint32"}, | |
| 65 | 65 | {"xkb_state_serialize_layout", "func(uintptr,uint32) uint32"}, {"xkb_state_serialize_mods", "func(uintptr,uint32) uint32"}, | |
| 66 | + | {"xkb_state_mod_name_is_active", "func(uintptr,uintptr,uint32) int32"}, {"xkb_state_mod_index_is_active", "func(uintptr,uint32,uint32) int32"}, | |
| 66 | 67 | {"xkb_state_key_get_one_sym", "func(uintptr,uint32) uint32"}, {"xkb_state_key_get_utf8", "func(uintptr,uint32,uintptr,uintptr) int32"}, | |
| 67 | 68 | {"xkb_keysym_get_name", "func(uint32,uintptr,uintptr) int32"}, {"xkb_keysym_from_name", "func(uintptr,uint32) uint32"}, | |
| 68 | 69 | {"xkb_compose_table_new_from_locale", "func(uintptr,uintptr,uint32) uintptr"}, {"xkb_compose_table_ref", "func(uintptr) uintptr"}, {"xkb_compose_table_unref", "func(uintptr)"}, | |
| @@ -72,6 +73,54 @@ var Functions = []struct{ Name, Signature string }{ | |||
| 72 | 73 | } | |
| 73 | 74 | ||
| 74 | 75 | func field(name string) string { return strings.ToUpper(name[:1]) + name[1:] } | |
| 76 | + | ||
| 77 | + | // method renders an exported, allocation-free wrapper calling the resolved | |
| 78 | + | // address through purego.Syscall6 (up to 6 arguments) or Syscall15. | |
| 79 | + | func method(name, sig string) (string, error) { | |
| 80 | + | rest, ok := strings.CutPrefix(sig, "func(") | |
| 81 | + | if !ok { | |
| 82 | + | return "", fmt.Errorf("bad signature for %s: %s", name, sig) | |
| 83 | + | } | |
| 84 | + | params, ret, _ := strings.Cut(rest, ")") | |
| 85 | + | ret = strings.TrimSpace(ret) | |
| 86 | + | var types []string | |
| 87 | + | if strings.TrimSpace(params) != "" { | |
| 88 | + | for _, p := range strings.Split(params, ",") { | |
| 89 | + | types = append(types, strings.TrimSpace(p)) | |
| 90 | + | } | |
| 91 | + | } | |
| 92 | + | if len(types) > 15 { | |
| 93 | + | return "", fmt.Errorf("%s: more than 15 arguments", name) | |
| 94 | + | } | |
| 95 | + | var decl, args []string | |
| 96 | + | for i, t := range types { | |
| 97 | + | decl = append(decl, fmt.Sprintf("a%d %s", i+1, t)) | |
| 98 | + | if t == "uintptr" { | |
| 99 | + | args = append(args, fmt.Sprintf("a%d", i+1)) | |
| 100 | + | } else { | |
| 101 | + | args = append(args, fmt.Sprintf("uintptr(a%d)", i+1)) | |
| 102 | + | } | |
| 103 | + | } | |
| 104 | + | call, size := "purego.Syscall6", 6 | |
| 105 | + | if len(types) > 6 { | |
| 106 | + | call, size = "purego.Syscall15", 15 | |
| 107 | + | } | |
| 108 | + | for len(args) < size { | |
| 109 | + | args = append(args, "0") | |
| 110 | + | } | |
| 111 | + | var b strings.Builder | |
| 112 | + | fmt.Fprintf(&b, "\n// %s calls %s without allocating.\nfunc (f *Funcs) %s(%s) %s {\n", field(name), name, field(name), strings.Join(decl, ", "), ret) | |
| 113 | + | switch ret { | |
| 114 | + | case "": | |
| 115 | + | fmt.Fprintf(&b, "%s(f.%s, %s)\n", call, name, strings.Join(args, ", ")) | |
| 116 | + | case "uintptr": | |
| 117 | + | fmt.Fprintf(&b, "r, _, _ := %s(f.%s, %s)\nreturn r\n", call, name, strings.Join(args, ", ")) | |
| 118 | + | default: | |
| 119 | + | fmt.Fprintf(&b, "r, _, _ := %s(f.%s, %s)\nreturn %s(r)\n", call, name, strings.Join(args, ", "), ret) | |
| 120 | + | } | |
| 121 | + | b.WriteString("}\n") | |
| 122 | + | return b.String(), nil | |
| 123 | + | } | |
| 75 | 124 | func Generate(root string) error { | |
| 76 | 125 | h1, err := os.ReadFile(root + "/upstream/xkbcommon.h") | |
| 77 | 126 | if err != nil { | |
| @@ -83,7 +132,7 @@ func Generate(root string) error { | |||
| 83 | 132 | } | |
| 84 | 133 | hdr := string(h1) + "\n" + string(h2) | |
| 85 | 134 | var b strings.Builder | |
| 86 | - | b.WriteString("// Code generated by go generate; DO NOT EDIT.\npackage raw\n\n") | |
| 135 | + | b.WriteString("// Code generated by go generate; DO NOT EDIT.\npackage raw\n\nimport \"github.com/bnema/purego\"\n\n") | |
| 87 | 136 | b.WriteString("// Opaque C handles and scalar typedefs.\ntype Context uintptr\ntype Keymap uintptr\ntype State uintptr\ntype ComposeTable uintptr\ntype ComposeState uintptr\ntype Keycode uint32\ntype Keysym uint32\ntype LayoutIndex uint32\ntype ModIndex uint32\ntype ModMask uint32\ntype LayoutMask uint32\n") | |
| 88 | 137 | b.WriteString("// RuleNames matches struct xkb_rule_names (five const char pointers).\ntype RuleNames struct { Rules, Model, Layout, Variant, Options uintptr }\n") | |
| 89 | 138 | b.WriteString("const (\n" + constants(hdr)) | |
| @@ -94,24 +143,30 @@ func Generate(root string) error { | |||
| 94 | 143 | } | |
| 95 | 144 | b.WriteString(constants(string(data))) | |
| 96 | 145 | } | |
| 97 | - | b.WriteString(")\n\n// Funcs holds resolved library functions.\ntype Funcs struct {\n") | |
| 146 | + | b.WriteString(")\n\n// Funcs holds resolved library function addresses. Each function is invoked\n// through purego.Syscall6/Syscall15 (fixed arity, no reflection, no allocation).\ntype Funcs struct {\n") | |
| 98 | 147 | for _, f := range Functions { | |
| 99 | 148 | if !declared(hdr, f.Name) { | |
| 100 | 149 | return fmt.Errorf("missing pinned declaration: %s", f.Name) | |
| 101 | 150 | } | |
| 102 | - | fmt.Fprintf(&b, "%s %s\n", field(f.Name), f.Signature) | |
| 151 | + | fmt.Fprintf(&b, "%s uintptr\n", f.Name) | |
| 103 | 152 | } | |
| 104 | 153 | b.WriteString("}\n\n// Symbols is the complete required symbol set.\nvar Symbols = []string{\n") | |
| 105 | 154 | for _, f := range Functions { | |
| 106 | 155 | fmt.Fprintf(&b, "%q,\n", f.Name) | |
| 107 | 156 | } | |
| 108 | - | b.WriteString("}\n\n// Register registers prevalidated addresses in a Funcs value.\nfunc Register(f *Funcs, register func(any,uintptr)) {\n") | |
| 157 | + | b.WriteString("}\n\n// Register stores prevalidated symbol addresses in a Funcs value.\nfunc Register(f *Funcs, addresses map[string]uintptr) {\n") | |
| 109 | 158 | for _, f := range Functions { | |
| 110 | - | fmt.Fprintf(&b, "register(&f.%s, addresses[%q])\n", field(f.Name), f.Name) | |
| 159 | + | fmt.Fprintf(&b, "f.%s = addresses[%q]\n", f.Name, f.Name) | |
| 111 | 160 | } | |
| 112 | 161 | b.WriteString("}\n") | |
| 113 | - | // address map is passed in, not a global mutable singleton. | |
| 114 | - | s := strings.Replace(b.String(), "func Register(f *Funcs, register func(any,uintptr))", "func Register(f *Funcs, addresses map[string]uintptr, register func(any,uintptr))", 1) | |
| 162 | + | for _, f := range Functions { | |
| 163 | + | m, err := method(f.Name, f.Signature) | |
| 164 | + | if err != nil { | |
| 165 | + | return err | |
| 166 | + | } | |
| 167 | + | b.WriteString(m) | |
| 168 | + | } | |
| 169 | + | s := b.String() | |
| 115 | 170 | formatted, err := format.Source([]byte(s)) | |
| 116 | 171 | if err != nil { | |
| 117 | 172 | return fmt.Errorf("format generated file: %w", err) | |
| @@ -59,10 +59,11 @@ var Functions = []struct{ Name, Signature string }{ | |||||
| 59 | {"xkb_context_new", "func(uint32) uintptr"}, {"xkb_context_ref", "func(uintptr) uintptr"}, {"xkb_context_unref", "func(uintptr)"}, | 59 | {"xkb_context_new", "func(uint32) uintptr"}, {"xkb_context_ref", "func(uintptr) uintptr"}, {"xkb_context_unref", "func(uintptr)"}, | ||
| 60 | {"xkb_keymap_new_from_names", "func(uintptr, uintptr, uint32) uintptr"}, {"xkb_keymap_new_from_string", "func(uintptr, uintptr, uint32, uint32) uintptr"}, {"xkb_keymap_new_from_buffer", "func(uintptr, uintptr, uintptr, uint32, uint32) uintptr"}, | 60 | {"xkb_keymap_new_from_names", "func(uintptr, uintptr, uint32) uintptr"}, {"xkb_keymap_new_from_string", "func(uintptr, uintptr, uint32, uint32) uintptr"}, {"xkb_keymap_new_from_buffer", "func(uintptr, uintptr, uintptr, uint32, uint32) uintptr"}, | ||
| 61 | {"xkb_keymap_ref", "func(uintptr) uintptr"}, {"xkb_keymap_unref", "func(uintptr)"}, {"xkb_keymap_get_as_string", "func(uintptr,uint32) uintptr"}, | 61 | {"xkb_keymap_ref", "func(uintptr) uintptr"}, {"xkb_keymap_unref", "func(uintptr)"}, {"xkb_keymap_get_as_string", "func(uintptr,uint32) uintptr"}, | ||
| 62 | - | {"xkb_keymap_mod_get_index", "func(uintptr,uintptr) uint32"}, {"xkb_keymap_num_layouts", "func(uintptr) uint32"}, | 62 | + | {"xkb_keymap_mod_get_index", "func(uintptr,uintptr) uint32"}, {"xkb_keymap_key_repeats", "func(uintptr,uint32) int32"}, {"xkb_keymap_num_layouts", "func(uintptr) uint32"}, |
| 63 | {"xkb_state_new", "func(uintptr) uintptr"}, {"xkb_state_ref", "func(uintptr) uintptr"}, {"xkb_state_unref", "func(uintptr)"}, | 63 | {"xkb_state_new", "func(uintptr) uintptr"}, {"xkb_state_ref", "func(uintptr) uintptr"}, {"xkb_state_unref", "func(uintptr)"}, | ||
| 64 | {"xkb_state_update_mask", "func(uintptr,uint32,uint32,uint32,uint32,uint32,uint32) uint32"}, | 64 | {"xkb_state_update_mask", "func(uintptr,uint32,uint32,uint32,uint32,uint32,uint32) uint32"}, | ||
| 65 | {"xkb_state_serialize_layout", "func(uintptr,uint32) uint32"}, {"xkb_state_serialize_mods", "func(uintptr,uint32) uint32"}, | 65 | {"xkb_state_serialize_layout", "func(uintptr,uint32) uint32"}, {"xkb_state_serialize_mods", "func(uintptr,uint32) uint32"}, | ||
| 66 | + | {"xkb_state_mod_name_is_active", "func(uintptr,uintptr,uint32) int32"}, {"xkb_state_mod_index_is_active", "func(uintptr,uint32,uint32) int32"}, | |||
| 66 | {"xkb_state_key_get_one_sym", "func(uintptr,uint32) uint32"}, {"xkb_state_key_get_utf8", "func(uintptr,uint32,uintptr,uintptr) int32"}, | 67 | {"xkb_state_key_get_one_sym", "func(uintptr,uint32) uint32"}, {"xkb_state_key_get_utf8", "func(uintptr,uint32,uintptr,uintptr) int32"}, | ||
| 67 | {"xkb_keysym_get_name", "func(uint32,uintptr,uintptr) int32"}, {"xkb_keysym_from_name", "func(uintptr,uint32) uint32"}, | 68 | {"xkb_keysym_get_name", "func(uint32,uintptr,uintptr) int32"}, {"xkb_keysym_from_name", "func(uintptr,uint32) uint32"}, | ||
| 68 | {"xkb_compose_table_new_from_locale", "func(uintptr,uintptr,uint32) uintptr"}, {"xkb_compose_table_ref", "func(uintptr) uintptr"}, {"xkb_compose_table_unref", "func(uintptr)"}, | 69 | {"xkb_compose_table_new_from_locale", "func(uintptr,uintptr,uint32) uintptr"}, {"xkb_compose_table_ref", "func(uintptr) uintptr"}, {"xkb_compose_table_unref", "func(uintptr)"}, | ||
| @@ -72,6 +73,54 @@ var Functions = []struct{ Name, Signature string }{ | |||||
| 72 | } | 73 | } | ||
| 73 | 74 | ||||
| 74 | func field(name string) string { return strings.ToUpper(name[:1]) + name[1:] } | 75 | func field(name string) string { return strings.ToUpper(name[:1]) + name[1:] } | ||
| 76 | + | ||||
| 77 | + | // method renders an exported, allocation-free wrapper calling the resolved | |||
| 78 | + | // address through purego.Syscall6 (up to 6 arguments) or Syscall15. | |||
| 79 | + | func method(name, sig string) (string, error) { | |||
| 80 | + | rest, ok := strings.CutPrefix(sig, "func(") | |||
| 81 | + | if !ok { | |||
| 82 | + | return "", fmt.Errorf("bad signature for %s: %s", name, sig) | |||
| 83 | + | } | |||
| 84 | + | params, ret, _ := strings.Cut(rest, ")") | |||
| 85 | + | ret = strings.TrimSpace(ret) | |||
| 86 | + | var types []string | |||
| 87 | + | if strings.TrimSpace(params) != "" { | |||
| 88 | + | for _, p := range strings.Split(params, ",") { | |||
| 89 | + | types = append(types, strings.TrimSpace(p)) | |||
| 90 | + | } | |||
| 91 | + | } | |||
| 92 | + | if len(types) > 15 { | |||
| 93 | + | return "", fmt.Errorf("%s: more than 15 arguments", name) | |||
| 94 | + | } | |||
| 95 | + | var decl, args []string | |||
| 96 | + | for i, t := range types { | |||
| 97 | + | decl = append(decl, fmt.Sprintf("a%d %s", i+1, t)) | |||
| 98 | + | if t == "uintptr" { | |||
| 99 | + | args = append(args, fmt.Sprintf("a%d", i+1)) | |||
| 100 | + | } else { | |||
| 101 | + | args = append(args, fmt.Sprintf("uintptr(a%d)", i+1)) | |||
| 102 | + | } | |||
| 103 | + | } | |||
| 104 | + | call, size := "purego.Syscall6", 6 | |||
| 105 | + | if len(types) > 6 { | |||
| 106 | + | call, size = "purego.Syscall15", 15 | |||
| 107 | + | } | |||
| 108 | + | for len(args) < size { | |||
| 109 | + | args = append(args, "0") | |||
| 110 | + | } | |||
| 111 | + | var b strings.Builder | |||
| 112 | + | fmt.Fprintf(&b, "\n// %s calls %s without allocating.\nfunc (f *Funcs) %s(%s) %s {\n", field(name), name, field(name), strings.Join(decl, ", "), ret) | |||
| 113 | + | switch ret { | |||
| 114 | + | case "": | |||
| 115 | + | fmt.Fprintf(&b, "%s(f.%s, %s)\n", call, name, strings.Join(args, ", ")) | |||
| 116 | + | case "uintptr": | |||
| 117 | + | fmt.Fprintf(&b, "r, _, _ := %s(f.%s, %s)\nreturn r\n", call, name, strings.Join(args, ", ")) | |||
| 118 | + | default: | |||
| 119 | + | fmt.Fprintf(&b, "r, _, _ := %s(f.%s, %s)\nreturn %s(r)\n", call, name, strings.Join(args, ", "), ret) | |||
| 120 | + | } | |||
| 121 | + | b.WriteString("}\n") | |||
| 122 | + | return b.String(), nil | |||
| 123 | + | } | |||
| 75 | func Generate(root string) error { | 124 | func Generate(root string) error { | ||
| 76 | h1, err := os.ReadFile(root + "/upstream/xkbcommon.h") | 125 | h1, err := os.ReadFile(root + "/upstream/xkbcommon.h") | ||
| 77 | if err != nil { | 126 | if err != nil { | ||
| @@ -83,7 +132,7 @@ func Generate(root string) error { | |||||
| 83 | } | 132 | } | ||
| 84 | hdr := string(h1) + "\n" + string(h2) | 133 | hdr := string(h1) + "\n" + string(h2) | ||
| 85 | var b strings.Builder | 134 | var b strings.Builder | ||
| 86 | - | b.WriteString("// Code generated by go generate; DO NOT EDIT.\npackage raw\n\n") | 135 | + | b.WriteString("// Code generated by go generate; DO NOT EDIT.\npackage raw\n\nimport \"github.com/bnema/purego\"\n\n") |
| 87 | b.WriteString("// Opaque C handles and scalar typedefs.\ntype Context uintptr\ntype Keymap uintptr\ntype State uintptr\ntype ComposeTable uintptr\ntype ComposeState uintptr\ntype Keycode uint32\ntype Keysym uint32\ntype LayoutIndex uint32\ntype ModIndex uint32\ntype ModMask uint32\ntype LayoutMask uint32\n") | 136 | b.WriteString("// Opaque C handles and scalar typedefs.\ntype Context uintptr\ntype Keymap uintptr\ntype State uintptr\ntype ComposeTable uintptr\ntype ComposeState uintptr\ntype Keycode uint32\ntype Keysym uint32\ntype LayoutIndex uint32\ntype ModIndex uint32\ntype ModMask uint32\ntype LayoutMask uint32\n") | ||
| 88 | b.WriteString("// RuleNames matches struct xkb_rule_names (five const char pointers).\ntype RuleNames struct { Rules, Model, Layout, Variant, Options uintptr }\n") | 137 | b.WriteString("// RuleNames matches struct xkb_rule_names (five const char pointers).\ntype RuleNames struct { Rules, Model, Layout, Variant, Options uintptr }\n") | ||
| 89 | b.WriteString("const (\n" + constants(hdr)) | 138 | b.WriteString("const (\n" + constants(hdr)) | ||
| @@ -94,24 +143,30 @@ func Generate(root string) error { | |||||
| 94 | } | 143 | } | ||
| 95 | b.WriteString(constants(string(data))) | 144 | b.WriteString(constants(string(data))) | ||
| 96 | } | 145 | } | ||
| 97 | - | b.WriteString(")\n\n// Funcs holds resolved library functions.\ntype Funcs struct {\n") | 146 | + | b.WriteString(")\n\n// Funcs holds resolved library function addresses. Each function is invoked\n// through purego.Syscall6/Syscall15 (fixed arity, no reflection, no allocation).\ntype Funcs struct {\n") |
| 98 | for _, f := range Functions { | 147 | for _, f := range Functions { | ||
| 99 | if !declared(hdr, f.Name) { | 148 | if !declared(hdr, f.Name) { | ||
| 100 | return fmt.Errorf("missing pinned declaration: %s", f.Name) | 149 | return fmt.Errorf("missing pinned declaration: %s", f.Name) | ||
| 101 | } | 150 | } | ||
| 102 | - | fmt.Fprintf(&b, "%s %s\n", field(f.Name), f.Signature) | 151 | + | fmt.Fprintf(&b, "%s uintptr\n", f.Name) |
| 103 | } | 152 | } | ||
| 104 | b.WriteString("}\n\n// Symbols is the complete required symbol set.\nvar Symbols = []string{\n") | 153 | b.WriteString("}\n\n// Symbols is the complete required symbol set.\nvar Symbols = []string{\n") | ||
| 105 | for _, f := range Functions { | 154 | for _, f := range Functions { | ||
| 106 | fmt.Fprintf(&b, "%q,\n", f.Name) | 155 | fmt.Fprintf(&b, "%q,\n", f.Name) | ||
| 107 | } | 156 | } | ||
| 108 | - | b.WriteString("}\n\n// Register registers prevalidated addresses in a Funcs value.\nfunc Register(f *Funcs, register func(any,uintptr)) {\n") | 157 | + | b.WriteString("}\n\n// Register stores prevalidated symbol addresses in a Funcs value.\nfunc Register(f *Funcs, addresses map[string]uintptr) {\n") |
| 109 | for _, f := range Functions { | 158 | for _, f := range Functions { | ||
| 110 | - | fmt.Fprintf(&b, "register(&f.%s, addresses[%q])\n", field(f.Name), f.Name) | 159 | + | fmt.Fprintf(&b, "f.%s = addresses[%q]\n", f.Name, f.Name) |
| 111 | } | 160 | } | ||
| 112 | b.WriteString("}\n") | 161 | b.WriteString("}\n") | ||
| 113 | - | // address map is passed in, not a global mutable singleton. | 162 | + | for _, f := range Functions { |
| 114 | - | s := strings.Replace(b.String(), "func Register(f *Funcs, register func(any,uintptr))", "func Register(f *Funcs, addresses map[string]uintptr, register func(any,uintptr))", 1) | 163 | + | m, err := method(f.Name, f.Signature) |
| 164 | + | if err != nil { | |||
| 165 | + | return err | |||
| 166 | + | } | |||
| 167 | + | b.WriteString(m) | |||
| 168 | + | } | |||
| 169 | + | s := b.String() | |||
| 115 | formatted, err := format.Source([]byte(s)) | 170 | formatted, err := format.Source([]byte(s)) | ||
| 116 | if err != nil { | 171 | if err != nil { | ||
| 117 | return fmt.Errorf("format generated file: %w", err) | 172 | return fmt.Errorf("format generated file: %w", err) | ||
M loader.go +3 -3
| @@ -15,7 +15,7 @@ var loader struct { | |||
| 15 | 15 | } | |
| 16 | 16 | ||
| 17 | 17 | // resolveLibrary keeps path and required symbols injectable for diagnostic tests. | |
| 18 | - | // On success it leaves the library open for the lifetime of registered functions. | |
| 18 | + | // On success it leaves the library open for the lifetime of resolved function addresses. | |
| 19 | 19 | func resolveLibrary(path string, symbols []string) (map[string]uintptr, error) { | |
| 20 | 20 | lib, err := purego.Dlopen(path, purego.RTLD_NOW|purego.RTLD_LOCAL) | |
| 21 | 21 | if err != nil { | |
| @@ -42,8 +42,8 @@ func Available() error { | |||
| 42 | 42 | loader.err = err | |
| 43 | 43 | return | |
| 44 | 44 | } | |
| 45 | - | raw.Register(&loader.f, addresses, purego.RegisterFunc) | |
| 46 | - | // Intentionally keep the library open: registered function pointers and live | |
| 45 | + | raw.Register(&loader.f, addresses) | |
| 46 | + | // Intentionally keep the library open: resolved function addresses and live | |
| 47 | 47 | // native objects remain valid for the process lifetime. | |
| 48 | 48 | }) | |
| 49 | 49 | return loader.err | |
| @@ -15,7 +15,7 @@ var loader struct { | |||||
| 15 | } | 15 | } | ||
| 16 | 16 | ||||
| 17 | // resolveLibrary keeps path and required symbols injectable for diagnostic tests. | 17 | // resolveLibrary keeps path and required symbols injectable for diagnostic tests. | ||
| 18 | - | // On success it leaves the library open for the lifetime of registered functions. | 18 | + | // On success it leaves the library open for the lifetime of resolved function addresses. |
| 19 | func resolveLibrary(path string, symbols []string) (map[string]uintptr, error) { | 19 | func resolveLibrary(path string, symbols []string) (map[string]uintptr, error) { | ||
| 20 | lib, err := purego.Dlopen(path, purego.RTLD_NOW|purego.RTLD_LOCAL) | 20 | lib, err := purego.Dlopen(path, purego.RTLD_NOW|purego.RTLD_LOCAL) | ||
| 21 | if err != nil { | 21 | if err != nil { | ||
| @@ -42,8 +42,8 @@ func Available() error { | |||||
| 42 | loader.err = err | 42 | loader.err = err | ||
| 43 | return | 43 | return | ||
| 44 | } | 44 | } | ||
| 45 | - | raw.Register(&loader.f, addresses, purego.RegisterFunc) | 45 | + | raw.Register(&loader.f, addresses) |
| 46 | - | // Intentionally keep the library open: registered function pointers and live | 46 | + | // Intentionally keep the library open: resolved function addresses and live |
| 47 | // native objects remain valid for the process lifetime. | 47 | // native objects remain valid for the process lifetime. | ||
| 48 | }) | 48 | }) | ||
| 49 | return loader.err | 49 | return loader.err | ||
M raw/generated.go +283 -67
| @@ -1,6 +1,8 @@ | |||
| 1 | 1 | // Code generated by go generate; DO NOT EDIT. | |
| 2 | 2 | package raw | |
| 3 | 3 | ||
| 4 | + | import "github.com/bnema/purego" | |
| 5 | + | ||
| 4 | 6 | // Opaque C handles and scalar typedefs. | |
| 5 | 7 | type Context uintptr | |
| 6 | 8 | type Keymap uintptr | |
| @@ -2725,40 +2727,44 @@ const ( | |||
| 2725 | 2727 | XKB_LED_NAME_KANA = "Kana" | |
| 2726 | 2728 | ) | |
| 2727 | 2729 | ||
| 2728 | - | // Funcs holds resolved library functions. | |
| 2730 | + | // Funcs holds resolved library function addresses. Each function is invoked | |
| 2731 | + | // through purego.Syscall6/Syscall15 (fixed arity, no reflection, no allocation). | |
| 2729 | 2732 | type Funcs struct { | |
| 2730 | - | Xkb_context_new func(uint32) uintptr | |
| 2731 | - | Xkb_context_ref func(uintptr) uintptr | |
| 2732 | - | Xkb_context_unref func(uintptr) | |
| 2733 | - | Xkb_keymap_new_from_names func(uintptr, uintptr, uint32) uintptr | |
| 2734 | - | Xkb_keymap_new_from_string func(uintptr, uintptr, uint32, uint32) uintptr | |
| 2735 | - | Xkb_keymap_new_from_buffer func(uintptr, uintptr, uintptr, uint32, uint32) uintptr | |
| 2736 | - | Xkb_keymap_ref func(uintptr) uintptr | |
| 2737 | - | Xkb_keymap_unref func(uintptr) | |
| 2738 | - | Xkb_keymap_get_as_string func(uintptr, uint32) uintptr | |
| 2739 | - | Xkb_keymap_mod_get_index func(uintptr, uintptr) uint32 | |
| 2740 | - | Xkb_keymap_num_layouts func(uintptr) uint32 | |
| 2741 | - | Xkb_state_new func(uintptr) uintptr | |
| 2742 | - | Xkb_state_ref func(uintptr) uintptr | |
| 2743 | - | Xkb_state_unref func(uintptr) | |
| 2744 | - | Xkb_state_update_mask func(uintptr, uint32, uint32, uint32, uint32, uint32, uint32) uint32 | |
| 2745 | - | Xkb_state_serialize_layout func(uintptr, uint32) uint32 | |
| 2746 | - | Xkb_state_serialize_mods func(uintptr, uint32) uint32 | |
| 2747 | - | Xkb_state_key_get_one_sym func(uintptr, uint32) uint32 | |
| 2748 | - | Xkb_state_key_get_utf8 func(uintptr, uint32, uintptr, uintptr) int32 | |
| 2749 | - | Xkb_keysym_get_name func(uint32, uintptr, uintptr) int32 | |
| 2750 | - | Xkb_keysym_from_name func(uintptr, uint32) uint32 | |
| 2751 | - | Xkb_compose_table_new_from_locale func(uintptr, uintptr, uint32) uintptr | |
| 2752 | - | Xkb_compose_table_ref func(uintptr) uintptr | |
| 2753 | - | Xkb_compose_table_unref func(uintptr) | |
| 2754 | - | Xkb_compose_state_new func(uintptr, uint32) uintptr | |
| 2755 | - | Xkb_compose_state_ref func(uintptr) uintptr | |
| 2756 | - | Xkb_compose_state_unref func(uintptr) | |
| 2757 | - | Xkb_compose_state_feed func(uintptr, uint32) uint32 | |
| 2758 | - | Xkb_compose_state_get_status func(uintptr) uint32 | |
| 2759 | - | Xkb_compose_state_reset func(uintptr) | |
| 2760 | - | Xkb_compose_state_get_utf8 func(uintptr, uintptr, uintptr) int32 | |
| 2761 | - | Xkb_compose_state_get_one_sym func(uintptr) uint32 | |
| 2733 | + | xkb_context_new uintptr | |
| 2734 | + | xkb_context_ref uintptr | |
| 2735 | + | xkb_context_unref uintptr | |
| 2736 | + | xkb_keymap_new_from_names uintptr | |
| 2737 | + | xkb_keymap_new_from_string uintptr | |
| 2738 | + | xkb_keymap_new_from_buffer uintptr | |
| 2739 | + | xkb_keymap_ref uintptr | |
| 2740 | + | xkb_keymap_unref uintptr | |
| 2741 | + | xkb_keymap_get_as_string uintptr | |
| 2742 | + | xkb_keymap_mod_get_index uintptr | |
| 2743 | + | xkb_keymap_key_repeats uintptr | |
| 2744 | + | xkb_keymap_num_layouts uintptr | |
| 2745 | + | xkb_state_new uintptr | |
| 2746 | + | xkb_state_ref uintptr | |
| 2747 | + | xkb_state_unref uintptr | |
| 2748 | + | xkb_state_update_mask uintptr | |
| 2749 | + | xkb_state_serialize_layout uintptr | |
| 2750 | + | xkb_state_serialize_mods uintptr | |
| 2751 | + | xkb_state_mod_name_is_active uintptr | |
| 2752 | + | xkb_state_mod_index_is_active uintptr | |
| 2753 | + | xkb_state_key_get_one_sym uintptr | |
| 2754 | + | xkb_state_key_get_utf8 uintptr | |
| 2755 | + | xkb_keysym_get_name uintptr | |
| 2756 | + | xkb_keysym_from_name uintptr | |
| 2757 | + | xkb_compose_table_new_from_locale uintptr | |
| 2758 | + | xkb_compose_table_ref uintptr | |
| 2759 | + | xkb_compose_table_unref uintptr | |
| 2760 | + | xkb_compose_state_new uintptr | |
| 2761 | + | xkb_compose_state_ref uintptr | |
| 2762 | + | xkb_compose_state_unref uintptr | |
| 2763 | + | xkb_compose_state_feed uintptr | |
| 2764 | + | xkb_compose_state_get_status uintptr | |
| 2765 | + | xkb_compose_state_reset uintptr | |
| 2766 | + | xkb_compose_state_get_utf8 uintptr | |
| 2767 | + | xkb_compose_state_get_one_sym uintptr | |
| 2762 | 2768 | } | |
| 2763 | 2769 | ||
| 2764 | 2770 | // Symbols is the complete required symbol set. | |
| @@ -2773,6 +2779,7 @@ var Symbols = []string{ | |||
| 2773 | 2779 | "xkb_keymap_unref", | |
| 2774 | 2780 | "xkb_keymap_get_as_string", | |
| 2775 | 2781 | "xkb_keymap_mod_get_index", | |
| 2782 | + | "xkb_keymap_key_repeats", | |
| 2776 | 2783 | "xkb_keymap_num_layouts", | |
| 2777 | 2784 | "xkb_state_new", | |
| 2778 | 2785 | "xkb_state_ref", | |
| @@ -2780,6 +2787,8 @@ var Symbols = []string{ | |||
| 2780 | 2787 | "xkb_state_update_mask", | |
| 2781 | 2788 | "xkb_state_serialize_layout", | |
| 2782 | 2789 | "xkb_state_serialize_mods", | |
| 2790 | + | "xkb_state_mod_name_is_active", | |
| 2791 | + | "xkb_state_mod_index_is_active", | |
| 2783 | 2792 | "xkb_state_key_get_one_sym", | |
| 2784 | 2793 | "xkb_state_key_get_utf8", | |
| 2785 | 2794 | "xkb_keysym_get_name", | |
| @@ -2797,38 +2806,245 @@ var Symbols = []string{ | |||
| 2797 | 2806 | "xkb_compose_state_get_one_sym", | |
| 2798 | 2807 | } | |
| 2799 | 2808 | ||
| 2800 | - | // Register registers prevalidated addresses in a Funcs value. | |
| 2801 | - | func Register(f *Funcs, addresses map[string]uintptr, register func(any, uintptr)) { | |
| 2802 | - | register(&f.Xkb_context_new, addresses["xkb_context_new"]) | |
| 2803 | - | register(&f.Xkb_context_ref, addresses["xkb_context_ref"]) | |
| 2804 | - | register(&f.Xkb_context_unref, addresses["xkb_context_unref"]) | |
| 2805 | - | register(&f.Xkb_keymap_new_from_names, addresses["xkb_keymap_new_from_names"]) | |
| 2806 | - | register(&f.Xkb_keymap_new_from_string, addresses["xkb_keymap_new_from_string"]) | |
| 2807 | - | register(&f.Xkb_keymap_new_from_buffer, addresses["xkb_keymap_new_from_buffer"]) | |
| 2808 | - | register(&f.Xkb_keymap_ref, addresses["xkb_keymap_ref"]) | |
| 2809 | - | register(&f.Xkb_keymap_unref, addresses["xkb_keymap_unref"]) | |
| 2810 | - | register(&f.Xkb_keymap_get_as_string, addresses["xkb_keymap_get_as_string"]) | |
| 2811 | - | register(&f.Xkb_keymap_mod_get_index, addresses["xkb_keymap_mod_get_index"]) | |
| 2812 | - | register(&f.Xkb_keymap_num_layouts, addresses["xkb_keymap_num_layouts"]) | |
| 2813 | - | register(&f.Xkb_state_new, addresses["xkb_state_new"]) | |
| 2814 | - | register(&f.Xkb_state_ref, addresses["xkb_state_ref"]) | |
| 2815 | - | register(&f.Xkb_state_unref, addresses["xkb_state_unref"]) | |
| 2816 | - | register(&f.Xkb_state_update_mask, addresses["xkb_state_update_mask"]) | |
| 2817 | - | register(&f.Xkb_state_serialize_layout, addresses["xkb_state_serialize_layout"]) | |
| 2818 | - | register(&f.Xkb_state_serialize_mods, addresses["xkb_state_serialize_mods"]) | |
| 2819 | - | register(&f.Xkb_state_key_get_one_sym, addresses["xkb_state_key_get_one_sym"]) | |
| 2820 | - | register(&f.Xkb_state_key_get_utf8, addresses["xkb_state_key_get_utf8"]) | |
| 2821 | - | register(&f.Xkb_keysym_get_name, addresses["xkb_keysym_get_name"]) | |
| 2822 | - | register(&f.Xkb_keysym_from_name, addresses["xkb_keysym_from_name"]) | |
| 2823 | - | register(&f.Xkb_compose_table_new_from_locale, addresses["xkb_compose_table_new_from_locale"]) | |
| 2824 | - | register(&f.Xkb_compose_table_ref, addresses["xkb_compose_table_ref"]) | |
| 2825 | - | register(&f.Xkb_compose_table_unref, addresses["xkb_compose_table_unref"]) | |
| 2826 | - | register(&f.Xkb_compose_state_new, addresses["xkb_compose_state_new"]) | |
| 2827 | - | register(&f.Xkb_compose_state_ref, addresses["xkb_compose_state_ref"]) | |
| 2828 | - | register(&f.Xkb_compose_state_unref, addresses["xkb_compose_state_unref"]) | |
| 2829 | - | register(&f.Xkb_compose_state_feed, addresses["xkb_compose_state_feed"]) | |
| 2830 | - | register(&f.Xkb_compose_state_get_status, addresses["xkb_compose_state_get_status"]) | |
| 2831 | - | register(&f.Xkb_compose_state_reset, addresses["xkb_compose_state_reset"]) | |
| 2832 | - | register(&f.Xkb_compose_state_get_utf8, addresses["xkb_compose_state_get_utf8"]) | |
| 2833 | - | register(&f.Xkb_compose_state_get_one_sym, addresses["xkb_compose_state_get_one_sym"]) | |
| 2809 | + | // Register stores prevalidated symbol addresses in a Funcs value. | |
| 2810 | + | func Register(f *Funcs, addresses map[string]uintptr) { | |
| 2811 | + | f.xkb_context_new = addresses["xkb_context_new"] | |
| 2812 | + | f.xkb_context_ref = addresses["xkb_context_ref"] | |
| 2813 | + | f.xkb_context_unref = addresses["xkb_context_unref"] | |
| 2814 | + | f.xkb_keymap_new_from_names = addresses["xkb_keymap_new_from_names"] | |
| 2815 | + | f.xkb_keymap_new_from_string = addresses["xkb_keymap_new_from_string"] | |
| 2816 | + | f.xkb_keymap_new_from_buffer = addresses["xkb_keymap_new_from_buffer"] | |
| 2817 | + | f.xkb_keymap_ref = addresses["xkb_keymap_ref"] | |
| 2818 | + | f.xkb_keymap_unref = addresses["xkb_keymap_unref"] | |
| 2819 | + | f.xkb_keymap_get_as_string = addresses["xkb_keymap_get_as_string"] | |
| 2820 | + | f.xkb_keymap_mod_get_index = addresses["xkb_keymap_mod_get_index"] | |
| 2821 | + | f.xkb_keymap_key_repeats = addresses["xkb_keymap_key_repeats"] | |
| 2822 | + | f.xkb_keymap_num_layouts = addresses["xkb_keymap_num_layouts"] | |
| 2823 | + | f.xkb_state_new = addresses["xkb_state_new"] | |
| 2824 | + | f.xkb_state_ref = addresses["xkb_state_ref"] | |
| 2825 | + | f.xkb_state_unref = addresses["xkb_state_unref"] | |
| 2826 | + | f.xkb_state_update_mask = addresses["xkb_state_update_mask"] | |
| 2827 | + | f.xkb_state_serialize_layout = addresses["xkb_state_serialize_layout"] | |
| 2828 | + | f.xkb_state_serialize_mods = addresses["xkb_state_serialize_mods"] | |
| 2829 | + | f.xkb_state_mod_name_is_active = addresses["xkb_state_mod_name_is_active"] | |
| 2830 | + | f.xkb_state_mod_index_is_active = addresses["xkb_state_mod_index_is_active"] | |
| 2831 | + | f.xkb_state_key_get_one_sym = addresses["xkb_state_key_get_one_sym"] | |
| 2832 | + | f.xkb_state_key_get_utf8 = addresses["xkb_state_key_get_utf8"] | |
| 2833 | + | f.xkb_keysym_get_name = addresses["xkb_keysym_get_name"] | |
| 2834 | + | f.xkb_keysym_from_name = addresses["xkb_keysym_from_name"] | |
| 2835 | + | f.xkb_compose_table_new_from_locale = addresses["xkb_compose_table_new_from_locale"] | |
| 2836 | + | f.xkb_compose_table_ref = addresses["xkb_compose_table_ref"] | |
| 2837 | + | f.xkb_compose_table_unref = addresses["xkb_compose_table_unref"] | |
| 2838 | + | f.xkb_compose_state_new = addresses["xkb_compose_state_new"] | |
| 2839 | + | f.xkb_compose_state_ref = addresses["xkb_compose_state_ref"] | |
| 2840 | + | f.xkb_compose_state_unref = addresses["xkb_compose_state_unref"] | |
| 2841 | + | f.xkb_compose_state_feed = addresses["xkb_compose_state_feed"] | |
| 2842 | + | f.xkb_compose_state_get_status = addresses["xkb_compose_state_get_status"] | |
| 2843 | + | f.xkb_compose_state_reset = addresses["xkb_compose_state_reset"] | |
| 2844 | + | f.xkb_compose_state_get_utf8 = addresses["xkb_compose_state_get_utf8"] | |
| 2845 | + | f.xkb_compose_state_get_one_sym = addresses["xkb_compose_state_get_one_sym"] | |
| 2846 | + | } | |
| 2847 | + | ||
| 2848 | + | // Xkb_context_new calls xkb_context_new without allocating. | |
| 2849 | + | func (f *Funcs) Xkb_context_new(a1 uint32) uintptr { | |
| 2850 | + | r, _, _ := purego.Syscall6(f.xkb_context_new, uintptr(a1), 0, 0, 0, 0, 0) | |
| 2851 | + | return r | |
| 2852 | + | } | |
| 2853 | + | ||
| 2854 | + | // Xkb_context_ref calls xkb_context_ref without allocating. | |
| 2855 | + | func (f *Funcs) Xkb_context_ref(a1 uintptr) uintptr { | |
| 2856 | + | r, _, _ := purego.Syscall6(f.xkb_context_ref, a1, 0, 0, 0, 0, 0) | |
| 2857 | + | return r | |
| 2858 | + | } | |
| 2859 | + | ||
| 2860 | + | // Xkb_context_unref calls xkb_context_unref without allocating. | |
| 2861 | + | func (f *Funcs) Xkb_context_unref(a1 uintptr) { | |
| 2862 | + | purego.Syscall6(f.xkb_context_unref, a1, 0, 0, 0, 0, 0) | |
| 2863 | + | } | |
| 2864 | + | ||
| 2865 | + | // Xkb_keymap_new_from_names calls xkb_keymap_new_from_names without allocating. | |
| 2866 | + | func (f *Funcs) Xkb_keymap_new_from_names(a1 uintptr, a2 uintptr, a3 uint32) uintptr { | |
| 2867 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_names, a1, a2, uintptr(a3), 0, 0, 0) | |
| 2868 | + | return r | |
| 2869 | + | } | |
| 2870 | + | ||
| 2871 | + | // Xkb_keymap_new_from_string calls xkb_keymap_new_from_string without allocating. | |
| 2872 | + | func (f *Funcs) Xkb_keymap_new_from_string(a1 uintptr, a2 uintptr, a3 uint32, a4 uint32) uintptr { | |
| 2873 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_string, a1, a2, uintptr(a3), uintptr(a4), 0, 0) | |
| 2874 | + | return r | |
| 2875 | + | } | |
| 2876 | + | ||
| 2877 | + | // Xkb_keymap_new_from_buffer calls xkb_keymap_new_from_buffer without allocating. | |
| 2878 | + | func (f *Funcs) Xkb_keymap_new_from_buffer(a1 uintptr, a2 uintptr, a3 uintptr, a4 uint32, a5 uint32) uintptr { | |
| 2879 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_buffer, a1, a2, a3, uintptr(a4), uintptr(a5), 0) | |
| 2880 | + | return r | |
| 2881 | + | } | |
| 2882 | + | ||
| 2883 | + | // Xkb_keymap_ref calls xkb_keymap_ref without allocating. | |
| 2884 | + | func (f *Funcs) Xkb_keymap_ref(a1 uintptr) uintptr { | |
| 2885 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_ref, a1, 0, 0, 0, 0, 0) | |
| 2886 | + | return r | |
| 2887 | + | } | |
| 2888 | + | ||
| 2889 | + | // Xkb_keymap_unref calls xkb_keymap_unref without allocating. | |
| 2890 | + | func (f *Funcs) Xkb_keymap_unref(a1 uintptr) { | |
| 2891 | + | purego.Syscall6(f.xkb_keymap_unref, a1, 0, 0, 0, 0, 0) | |
| 2892 | + | } | |
| 2893 | + | ||
| 2894 | + | // Xkb_keymap_get_as_string calls xkb_keymap_get_as_string without allocating. | |
| 2895 | + | func (f *Funcs) Xkb_keymap_get_as_string(a1 uintptr, a2 uint32) uintptr { | |
| 2896 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_get_as_string, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2897 | + | return r | |
| 2898 | + | } | |
| 2899 | + | ||
| 2900 | + | // Xkb_keymap_mod_get_index calls xkb_keymap_mod_get_index without allocating. | |
| 2901 | + | func (f *Funcs) Xkb_keymap_mod_get_index(a1 uintptr, a2 uintptr) uint32 { | |
| 2902 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_mod_get_index, a1, a2, 0, 0, 0, 0) | |
| 2903 | + | return uint32(r) | |
| 2904 | + | } | |
| 2905 | + | ||
| 2906 | + | // Xkb_keymap_key_repeats calls xkb_keymap_key_repeats without allocating. | |
| 2907 | + | func (f *Funcs) Xkb_keymap_key_repeats(a1 uintptr, a2 uint32) int32 { | |
| 2908 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_key_repeats, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2909 | + | return int32(r) | |
| 2910 | + | } | |
| 2911 | + | ||
| 2912 | + | // Xkb_keymap_num_layouts calls xkb_keymap_num_layouts without allocating. | |
| 2913 | + | func (f *Funcs) Xkb_keymap_num_layouts(a1 uintptr) uint32 { | |
| 2914 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_num_layouts, a1, 0, 0, 0, 0, 0) | |
| 2915 | + | return uint32(r) | |
| 2916 | + | } | |
| 2917 | + | ||
| 2918 | + | // Xkb_state_new calls xkb_state_new without allocating. | |
| 2919 | + | func (f *Funcs) Xkb_state_new(a1 uintptr) uintptr { | |
| 2920 | + | r, _, _ := purego.Syscall6(f.xkb_state_new, a1, 0, 0, 0, 0, 0) | |
| 2921 | + | return r | |
| 2922 | + | } | |
| 2923 | + | ||
| 2924 | + | // Xkb_state_ref calls xkb_state_ref without allocating. | |
| 2925 | + | func (f *Funcs) Xkb_state_ref(a1 uintptr) uintptr { | |
| 2926 | + | r, _, _ := purego.Syscall6(f.xkb_state_ref, a1, 0, 0, 0, 0, 0) | |
| 2927 | + | return r | |
| 2928 | + | } | |
| 2929 | + | ||
| 2930 | + | // Xkb_state_unref calls xkb_state_unref without allocating. | |
| 2931 | + | func (f *Funcs) Xkb_state_unref(a1 uintptr) { | |
| 2932 | + | purego.Syscall6(f.xkb_state_unref, a1, 0, 0, 0, 0, 0) | |
| 2933 | + | } | |
| 2934 | + | ||
| 2935 | + | // Xkb_state_update_mask calls xkb_state_update_mask without allocating. | |
| 2936 | + | func (f *Funcs) Xkb_state_update_mask(a1 uintptr, a2 uint32, a3 uint32, a4 uint32, a5 uint32, a6 uint32, a7 uint32) uint32 { | |
| 2937 | + | r, _, _ := purego.Syscall15(f.xkb_state_update_mask, a1, uintptr(a2), uintptr(a3), uintptr(a4), uintptr(a5), uintptr(a6), uintptr(a7), 0, 0, 0, 0, 0, 0, 0, 0) | |
| 2938 | + | return uint32(r) | |
| 2939 | + | } | |
| 2940 | + | ||
| 2941 | + | // Xkb_state_serialize_layout calls xkb_state_serialize_layout without allocating. | |
| 2942 | + | func (f *Funcs) Xkb_state_serialize_layout(a1 uintptr, a2 uint32) uint32 { | |
| 2943 | + | r, _, _ := purego.Syscall6(f.xkb_state_serialize_layout, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2944 | + | return uint32(r) | |
| 2945 | + | } | |
| 2946 | + | ||
| 2947 | + | // Xkb_state_serialize_mods calls xkb_state_serialize_mods without allocating. | |
| 2948 | + | func (f *Funcs) Xkb_state_serialize_mods(a1 uintptr, a2 uint32) uint32 { | |
| 2949 | + | r, _, _ := purego.Syscall6(f.xkb_state_serialize_mods, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2950 | + | return uint32(r) | |
| 2951 | + | } | |
| 2952 | + | ||
| 2953 | + | // Xkb_state_mod_name_is_active calls xkb_state_mod_name_is_active without allocating. | |
| 2954 | + | func (f *Funcs) Xkb_state_mod_name_is_active(a1 uintptr, a2 uintptr, a3 uint32) int32 { | |
| 2955 | + | r, _, _ := purego.Syscall6(f.xkb_state_mod_name_is_active, a1, a2, uintptr(a3), 0, 0, 0) | |
| 2956 | + | return int32(r) | |
| 2957 | + | } | |
| 2958 | + | ||
| 2959 | + | // Xkb_state_mod_index_is_active calls xkb_state_mod_index_is_active without allocating. | |
| 2960 | + | func (f *Funcs) Xkb_state_mod_index_is_active(a1 uintptr, a2 uint32, a3 uint32) int32 { | |
| 2961 | + | r, _, _ := purego.Syscall6(f.xkb_state_mod_index_is_active, a1, uintptr(a2), uintptr(a3), 0, 0, 0) | |
| 2962 | + | return int32(r) | |
| 2963 | + | } | |
| 2964 | + | ||
| 2965 | + | // Xkb_state_key_get_one_sym calls xkb_state_key_get_one_sym without allocating. | |
| 2966 | + | func (f *Funcs) Xkb_state_key_get_one_sym(a1 uintptr, a2 uint32) uint32 { | |
| 2967 | + | r, _, _ := purego.Syscall6(f.xkb_state_key_get_one_sym, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2968 | + | return uint32(r) | |
| 2969 | + | } | |
| 2970 | + | ||
| 2971 | + | // Xkb_state_key_get_utf8 calls xkb_state_key_get_utf8 without allocating. | |
| 2972 | + | func (f *Funcs) Xkb_state_key_get_utf8(a1 uintptr, a2 uint32, a3 uintptr, a4 uintptr) int32 { | |
| 2973 | + | r, _, _ := purego.Syscall6(f.xkb_state_key_get_utf8, a1, uintptr(a2), a3, a4, 0, 0) | |
| 2974 | + | return int32(r) | |
| 2975 | + | } | |
| 2976 | + | ||
| 2977 | + | // Xkb_keysym_get_name calls xkb_keysym_get_name without allocating. | |
| 2978 | + | func (f *Funcs) Xkb_keysym_get_name(a1 uint32, a2 uintptr, a3 uintptr) int32 { | |
| 2979 | + | r, _, _ := purego.Syscall6(f.xkb_keysym_get_name, uintptr(a1), a2, a3, 0, 0, 0) | |
| 2980 | + | return int32(r) | |
| 2981 | + | } | |
| 2982 | + | ||
| 2983 | + | // Xkb_keysym_from_name calls xkb_keysym_from_name without allocating. | |
| 2984 | + | func (f *Funcs) Xkb_keysym_from_name(a1 uintptr, a2 uint32) uint32 { | |
| 2985 | + | r, _, _ := purego.Syscall6(f.xkb_keysym_from_name, a1, uintptr(a2), 0, 0, 0, 0) | |
| 2986 | + | return uint32(r) | |
| 2987 | + | } | |
| 2988 | + | ||
| 2989 | + | // Xkb_compose_table_new_from_locale calls xkb_compose_table_new_from_locale without allocating. | |
| 2990 | + | func (f *Funcs) Xkb_compose_table_new_from_locale(a1 uintptr, a2 uintptr, a3 uint32) uintptr { | |
| 2991 | + | r, _, _ := purego.Syscall6(f.xkb_compose_table_new_from_locale, a1, a2, uintptr(a3), 0, 0, 0) | |
| 2992 | + | return r | |
| 2993 | + | } | |
| 2994 | + | ||
| 2995 | + | // Xkb_compose_table_ref calls xkb_compose_table_ref without allocating. | |
| 2996 | + | func (f *Funcs) Xkb_compose_table_ref(a1 uintptr) uintptr { | |
| 2997 | + | r, _, _ := purego.Syscall6(f.xkb_compose_table_ref, a1, 0, 0, 0, 0, 0) | |
| 2998 | + | return r | |
| 2999 | + | } | |
| 3000 | + | ||
| 3001 | + | // Xkb_compose_table_unref calls xkb_compose_table_unref without allocating. | |
| 3002 | + | func (f *Funcs) Xkb_compose_table_unref(a1 uintptr) { | |
| 3003 | + | purego.Syscall6(f.xkb_compose_table_unref, a1, 0, 0, 0, 0, 0) | |
| 3004 | + | } | |
| 3005 | + | ||
| 3006 | + | // Xkb_compose_state_new calls xkb_compose_state_new without allocating. | |
| 3007 | + | func (f *Funcs) Xkb_compose_state_new(a1 uintptr, a2 uint32) uintptr { | |
| 3008 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_new, a1, uintptr(a2), 0, 0, 0, 0) | |
| 3009 | + | return r | |
| 3010 | + | } | |
| 3011 | + | ||
| 3012 | + | // Xkb_compose_state_ref calls xkb_compose_state_ref without allocating. | |
| 3013 | + | func (f *Funcs) Xkb_compose_state_ref(a1 uintptr) uintptr { | |
| 3014 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_ref, a1, 0, 0, 0, 0, 0) | |
| 3015 | + | return r | |
| 3016 | + | } | |
| 3017 | + | ||
| 3018 | + | // Xkb_compose_state_unref calls xkb_compose_state_unref without allocating. | |
| 3019 | + | func (f *Funcs) Xkb_compose_state_unref(a1 uintptr) { | |
| 3020 | + | purego.Syscall6(f.xkb_compose_state_unref, a1, 0, 0, 0, 0, 0) | |
| 3021 | + | } | |
| 3022 | + | ||
| 3023 | + | // Xkb_compose_state_feed calls xkb_compose_state_feed without allocating. | |
| 3024 | + | func (f *Funcs) Xkb_compose_state_feed(a1 uintptr, a2 uint32) uint32 { | |
| 3025 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_feed, a1, uintptr(a2), 0, 0, 0, 0) | |
| 3026 | + | return uint32(r) | |
| 3027 | + | } | |
| 3028 | + | ||
| 3029 | + | // Xkb_compose_state_get_status calls xkb_compose_state_get_status without allocating. | |
| 3030 | + | func (f *Funcs) Xkb_compose_state_get_status(a1 uintptr) uint32 { | |
| 3031 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_status, a1, 0, 0, 0, 0, 0) | |
| 3032 | + | return uint32(r) | |
| 3033 | + | } | |
| 3034 | + | ||
| 3035 | + | // Xkb_compose_state_reset calls xkb_compose_state_reset without allocating. | |
| 3036 | + | func (f *Funcs) Xkb_compose_state_reset(a1 uintptr) { | |
| 3037 | + | purego.Syscall6(f.xkb_compose_state_reset, a1, 0, 0, 0, 0, 0) | |
| 3038 | + | } | |
| 3039 | + | ||
| 3040 | + | // Xkb_compose_state_get_utf8 calls xkb_compose_state_get_utf8 without allocating. | |
| 3041 | + | func (f *Funcs) Xkb_compose_state_get_utf8(a1 uintptr, a2 uintptr, a3 uintptr) int32 { | |
| 3042 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_utf8, a1, a2, a3, 0, 0, 0) | |
| 3043 | + | return int32(r) | |
| 3044 | + | } | |
| 3045 | + | ||
| 3046 | + | // Xkb_compose_state_get_one_sym calls xkb_compose_state_get_one_sym without allocating. | |
| 3047 | + | func (f *Funcs) Xkb_compose_state_get_one_sym(a1 uintptr) uint32 { | |
| 3048 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_one_sym, a1, 0, 0, 0, 0, 0) | |
| 3049 | + | return uint32(r) | |
| 2834 | 3050 | } | |
| @@ -1,6 +1,8 @@ | |||||
| 1 | // Code generated by go generate; DO NOT EDIT. | 1 | // Code generated by go generate; DO NOT EDIT. | ||
| 2 | package raw | 2 | package raw | ||
| 3 | 3 | ||||
| 4 | + | import "github.com/bnema/purego" | |||
| 5 | + | ||||
| 4 | // Opaque C handles and scalar typedefs. | 6 | // Opaque C handles and scalar typedefs. | ||
| 5 | type Context uintptr | 7 | type Context uintptr | ||
| 6 | type Keymap uintptr | 8 | type Keymap uintptr | ||
| @@ -2725,40 +2727,44 @@ const ( | |||||
| 2725 | XKB_LED_NAME_KANA = "Kana" | 2727 | XKB_LED_NAME_KANA = "Kana" | ||
| 2726 | ) | 2728 | ) | ||
| 2727 | 2729 | ||||
| 2728 | - | // Funcs holds resolved library functions. | 2730 | + | // Funcs holds resolved library function addresses. Each function is invoked |
| 2731 | + | // through purego.Syscall6/Syscall15 (fixed arity, no reflection, no allocation). | |||
| 2729 | type Funcs struct { | 2732 | type Funcs struct { | ||
| 2730 | - | Xkb_context_new func(uint32) uintptr | 2733 | + | xkb_context_new uintptr |
| 2731 | - | Xkb_context_ref func(uintptr) uintptr | 2734 | + | xkb_context_ref uintptr |
| 2732 | - | Xkb_context_unref func(uintptr) | 2735 | + | xkb_context_unref uintptr |
| 2733 | - | Xkb_keymap_new_from_names func(uintptr, uintptr, uint32) uintptr | 2736 | + | xkb_keymap_new_from_names uintptr |
| 2734 | - | Xkb_keymap_new_from_string func(uintptr, uintptr, uint32, uint32) uintptr | 2737 | + | xkb_keymap_new_from_string uintptr |
| 2735 | - | Xkb_keymap_new_from_buffer func(uintptr, uintptr, uintptr, uint32, uint32) uintptr | 2738 | + | xkb_keymap_new_from_buffer uintptr |
| 2736 | - | Xkb_keymap_ref func(uintptr) uintptr | 2739 | + | xkb_keymap_ref uintptr |
| 2737 | - | Xkb_keymap_unref func(uintptr) | 2740 | + | xkb_keymap_unref uintptr |
| 2738 | - | Xkb_keymap_get_as_string func(uintptr, uint32) uintptr | 2741 | + | xkb_keymap_get_as_string uintptr |
| 2739 | - | Xkb_keymap_mod_get_index func(uintptr, uintptr) uint32 | 2742 | + | xkb_keymap_mod_get_index uintptr |
| 2740 | - | Xkb_keymap_num_layouts func(uintptr) uint32 | 2743 | + | xkb_keymap_key_repeats uintptr |
| 2741 | - | Xkb_state_new func(uintptr) uintptr | 2744 | + | xkb_keymap_num_layouts uintptr |
| 2742 | - | Xkb_state_ref func(uintptr) uintptr | 2745 | + | xkb_state_new uintptr |
| 2743 | - | Xkb_state_unref func(uintptr) | 2746 | + | xkb_state_ref uintptr |
| 2744 | - | Xkb_state_update_mask func(uintptr, uint32, uint32, uint32, uint32, uint32, uint32) uint32 | 2747 | + | xkb_state_unref uintptr |
| 2745 | - | Xkb_state_serialize_layout func(uintptr, uint32) uint32 | 2748 | + | xkb_state_update_mask uintptr |
| 2746 | - | Xkb_state_serialize_mods func(uintptr, uint32) uint32 | 2749 | + | xkb_state_serialize_layout uintptr |
| 2747 | - | Xkb_state_key_get_one_sym func(uintptr, uint32) uint32 | 2750 | + | xkb_state_serialize_mods uintptr |
| 2748 | - | Xkb_state_key_get_utf8 func(uintptr, uint32, uintptr, uintptr) int32 | 2751 | + | xkb_state_mod_name_is_active uintptr |
| 2749 | - | Xkb_keysym_get_name func(uint32, uintptr, uintptr) int32 | 2752 | + | xkb_state_mod_index_is_active uintptr |
| 2750 | - | Xkb_keysym_from_name func(uintptr, uint32) uint32 | 2753 | + | xkb_state_key_get_one_sym uintptr |
| 2751 | - | Xkb_compose_table_new_from_locale func(uintptr, uintptr, uint32) uintptr | 2754 | + | xkb_state_key_get_utf8 uintptr |
| 2752 | - | Xkb_compose_table_ref func(uintptr) uintptr | 2755 | + | xkb_keysym_get_name uintptr |
| 2753 | - | Xkb_compose_table_unref func(uintptr) | 2756 | + | xkb_keysym_from_name uintptr |
| 2754 | - | Xkb_compose_state_new func(uintptr, uint32) uintptr | 2757 | + | xkb_compose_table_new_from_locale uintptr |
| 2755 | - | Xkb_compose_state_ref func(uintptr) uintptr | 2758 | + | xkb_compose_table_ref uintptr |
| 2756 | - | Xkb_compose_state_unref func(uintptr) | 2759 | + | xkb_compose_table_unref uintptr |
| 2757 | - | Xkb_compose_state_feed func(uintptr, uint32) uint32 | 2760 | + | xkb_compose_state_new uintptr |
| 2758 | - | Xkb_compose_state_get_status func(uintptr) uint32 | 2761 | + | xkb_compose_state_ref uintptr |
| 2759 | - | Xkb_compose_state_reset func(uintptr) | 2762 | + | xkb_compose_state_unref uintptr |
| 2760 | - | Xkb_compose_state_get_utf8 func(uintptr, uintptr, uintptr) int32 | 2763 | + | xkb_compose_state_feed uintptr |
| 2761 | - | Xkb_compose_state_get_one_sym func(uintptr) uint32 | 2764 | + | xkb_compose_state_get_status uintptr |
| 2765 | + | xkb_compose_state_reset uintptr | |||
| 2766 | + | xkb_compose_state_get_utf8 uintptr | |||
| 2767 | + | xkb_compose_state_get_one_sym uintptr | |||
| 2762 | } | 2768 | } | ||
| 2763 | 2769 | ||||
| 2764 | // Symbols is the complete required symbol set. | 2770 | // Symbols is the complete required symbol set. | ||
| @@ -2773,6 +2779,7 @@ var Symbols = []string{ | |||||
| 2773 | "xkb_keymap_unref", | 2779 | "xkb_keymap_unref", | ||
| 2774 | "xkb_keymap_get_as_string", | 2780 | "xkb_keymap_get_as_string", | ||
| 2775 | "xkb_keymap_mod_get_index", | 2781 | "xkb_keymap_mod_get_index", | ||
| 2782 | + | "xkb_keymap_key_repeats", | |||
| 2776 | "xkb_keymap_num_layouts", | 2783 | "xkb_keymap_num_layouts", | ||
| 2777 | "xkb_state_new", | 2784 | "xkb_state_new", | ||
| 2778 | "xkb_state_ref", | 2785 | "xkb_state_ref", | ||
| @@ -2780,6 +2787,8 @@ var Symbols = []string{ | |||||
| 2780 | "xkb_state_update_mask", | 2787 | "xkb_state_update_mask", | ||
| 2781 | "xkb_state_serialize_layout", | 2788 | "xkb_state_serialize_layout", | ||
| 2782 | "xkb_state_serialize_mods", | 2789 | "xkb_state_serialize_mods", | ||
| 2790 | + | "xkb_state_mod_name_is_active", | |||
| 2791 | + | "xkb_state_mod_index_is_active", | |||
| 2783 | "xkb_state_key_get_one_sym", | 2792 | "xkb_state_key_get_one_sym", | ||
| 2784 | "xkb_state_key_get_utf8", | 2793 | "xkb_state_key_get_utf8", | ||
| 2785 | "xkb_keysym_get_name", | 2794 | "xkb_keysym_get_name", | ||
| @@ -2797,38 +2806,245 @@ var Symbols = []string{ | |||||
| 2797 | "xkb_compose_state_get_one_sym", | 2806 | "xkb_compose_state_get_one_sym", | ||
| 2798 | } | 2807 | } | ||
| 2799 | 2808 | ||||
| 2800 | - | // Register registers prevalidated addresses in a Funcs value. | 2809 | + | // Register stores prevalidated symbol addresses in a Funcs value. |
| 2801 | - | func Register(f *Funcs, addresses map[string]uintptr, register func(any, uintptr)) { | 2810 | + | func Register(f *Funcs, addresses map[string]uintptr) { |
| 2802 | - | register(&f.Xkb_context_new, addresses["xkb_context_new"]) | 2811 | + | f.xkb_context_new = addresses["xkb_context_new"] |
| 2803 | - | register(&f.Xkb_context_ref, addresses["xkb_context_ref"]) | 2812 | + | f.xkb_context_ref = addresses["xkb_context_ref"] |
| 2804 | - | register(&f.Xkb_context_unref, addresses["xkb_context_unref"]) | 2813 | + | f.xkb_context_unref = addresses["xkb_context_unref"] |
| 2805 | - | register(&f.Xkb_keymap_new_from_names, addresses["xkb_keymap_new_from_names"]) | 2814 | + | f.xkb_keymap_new_from_names = addresses["xkb_keymap_new_from_names"] |
| 2806 | - | register(&f.Xkb_keymap_new_from_string, addresses["xkb_keymap_new_from_string"]) | 2815 | + | f.xkb_keymap_new_from_string = addresses["xkb_keymap_new_from_string"] |
| 2807 | - | register(&f.Xkb_keymap_new_from_buffer, addresses["xkb_keymap_new_from_buffer"]) | 2816 | + | f.xkb_keymap_new_from_buffer = addresses["xkb_keymap_new_from_buffer"] |
| 2808 | - | register(&f.Xkb_keymap_ref, addresses["xkb_keymap_ref"]) | 2817 | + | f.xkb_keymap_ref = addresses["xkb_keymap_ref"] |
| 2809 | - | register(&f.Xkb_keymap_unref, addresses["xkb_keymap_unref"]) | 2818 | + | f.xkb_keymap_unref = addresses["xkb_keymap_unref"] |
| 2810 | - | register(&f.Xkb_keymap_get_as_string, addresses["xkb_keymap_get_as_string"]) | 2819 | + | f.xkb_keymap_get_as_string = addresses["xkb_keymap_get_as_string"] |
| 2811 | - | register(&f.Xkb_keymap_mod_get_index, addresses["xkb_keymap_mod_get_index"]) | 2820 | + | f.xkb_keymap_mod_get_index = addresses["xkb_keymap_mod_get_index"] |
| 2812 | - | register(&f.Xkb_keymap_num_layouts, addresses["xkb_keymap_num_layouts"]) | 2821 | + | f.xkb_keymap_key_repeats = addresses["xkb_keymap_key_repeats"] |
| 2813 | - | register(&f.Xkb_state_new, addresses["xkb_state_new"]) | 2822 | + | f.xkb_keymap_num_layouts = addresses["xkb_keymap_num_layouts"] |
| 2814 | - | register(&f.Xkb_state_ref, addresses["xkb_state_ref"]) | 2823 | + | f.xkb_state_new = addresses["xkb_state_new"] |
| 2815 | - | register(&f.Xkb_state_unref, addresses["xkb_state_unref"]) | 2824 | + | f.xkb_state_ref = addresses["xkb_state_ref"] |
| 2816 | - | register(&f.Xkb_state_update_mask, addresses["xkb_state_update_mask"]) | 2825 | + | f.xkb_state_unref = addresses["xkb_state_unref"] |
| 2817 | - | register(&f.Xkb_state_serialize_layout, addresses["xkb_state_serialize_layout"]) | 2826 | + | f.xkb_state_update_mask = addresses["xkb_state_update_mask"] |
| 2818 | - | register(&f.Xkb_state_serialize_mods, addresses["xkb_state_serialize_mods"]) | 2827 | + | f.xkb_state_serialize_layout = addresses["xkb_state_serialize_layout"] |
| 2819 | - | register(&f.Xkb_state_key_get_one_sym, addresses["xkb_state_key_get_one_sym"]) | 2828 | + | f.xkb_state_serialize_mods = addresses["xkb_state_serialize_mods"] |
| 2820 | - | register(&f.Xkb_state_key_get_utf8, addresses["xkb_state_key_get_utf8"]) | 2829 | + | f.xkb_state_mod_name_is_active = addresses["xkb_state_mod_name_is_active"] |
| 2821 | - | register(&f.Xkb_keysym_get_name, addresses["xkb_keysym_get_name"]) | 2830 | + | f.xkb_state_mod_index_is_active = addresses["xkb_state_mod_index_is_active"] |
| 2822 | - | register(&f.Xkb_keysym_from_name, addresses["xkb_keysym_from_name"]) | 2831 | + | f.xkb_state_key_get_one_sym = addresses["xkb_state_key_get_one_sym"] |
| 2823 | - | register(&f.Xkb_compose_table_new_from_locale, addresses["xkb_compose_table_new_from_locale"]) | 2832 | + | f.xkb_state_key_get_utf8 = addresses["xkb_state_key_get_utf8"] |
| 2824 | - | register(&f.Xkb_compose_table_ref, addresses["xkb_compose_table_ref"]) | 2833 | + | f.xkb_keysym_get_name = addresses["xkb_keysym_get_name"] |
| 2825 | - | register(&f.Xkb_compose_table_unref, addresses["xkb_compose_table_unref"]) | 2834 | + | f.xkb_keysym_from_name = addresses["xkb_keysym_from_name"] |
| 2826 | - | register(&f.Xkb_compose_state_new, addresses["xkb_compose_state_new"]) | 2835 | + | f.xkb_compose_table_new_from_locale = addresses["xkb_compose_table_new_from_locale"] |
| 2827 | - | register(&f.Xkb_compose_state_ref, addresses["xkb_compose_state_ref"]) | 2836 | + | f.xkb_compose_table_ref = addresses["xkb_compose_table_ref"] |
| 2828 | - | register(&f.Xkb_compose_state_unref, addresses["xkb_compose_state_unref"]) | 2837 | + | f.xkb_compose_table_unref = addresses["xkb_compose_table_unref"] |
| 2829 | - | register(&f.Xkb_compose_state_feed, addresses["xkb_compose_state_feed"]) | 2838 | + | f.xkb_compose_state_new = addresses["xkb_compose_state_new"] |
| 2830 | - | register(&f.Xkb_compose_state_get_status, addresses["xkb_compose_state_get_status"]) | 2839 | + | f.xkb_compose_state_ref = addresses["xkb_compose_state_ref"] |
| 2831 | - | register(&f.Xkb_compose_state_reset, addresses["xkb_compose_state_reset"]) | 2840 | + | f.xkb_compose_state_unref = addresses["xkb_compose_state_unref"] |
| 2832 | - | register(&f.Xkb_compose_state_get_utf8, addresses["xkb_compose_state_get_utf8"]) | 2841 | + | f.xkb_compose_state_feed = addresses["xkb_compose_state_feed"] |
| 2833 | - | register(&f.Xkb_compose_state_get_one_sym, addresses["xkb_compose_state_get_one_sym"]) | 2842 | + | f.xkb_compose_state_get_status = addresses["xkb_compose_state_get_status"] |
| 2843 | + | f.xkb_compose_state_reset = addresses["xkb_compose_state_reset"] | |||
| 2844 | + | f.xkb_compose_state_get_utf8 = addresses["xkb_compose_state_get_utf8"] | |||
| 2845 | + | f.xkb_compose_state_get_one_sym = addresses["xkb_compose_state_get_one_sym"] | |||
| 2846 | + | } | |||
| 2847 | + | ||||
| 2848 | + | // Xkb_context_new calls xkb_context_new without allocating. | |||
| 2849 | + | func (f *Funcs) Xkb_context_new(a1 uint32) uintptr { | |||
| 2850 | + | r, _, _ := purego.Syscall6(f.xkb_context_new, uintptr(a1), 0, 0, 0, 0, 0) | |||
| 2851 | + | return r | |||
| 2852 | + | } | |||
| 2853 | + | ||||
| 2854 | + | // Xkb_context_ref calls xkb_context_ref without allocating. | |||
| 2855 | + | func (f *Funcs) Xkb_context_ref(a1 uintptr) uintptr { | |||
| 2856 | + | r, _, _ := purego.Syscall6(f.xkb_context_ref, a1, 0, 0, 0, 0, 0) | |||
| 2857 | + | return r | |||
| 2858 | + | } | |||
| 2859 | + | ||||
| 2860 | + | // Xkb_context_unref calls xkb_context_unref without allocating. | |||
| 2861 | + | func (f *Funcs) Xkb_context_unref(a1 uintptr) { | |||
| 2862 | + | purego.Syscall6(f.xkb_context_unref, a1, 0, 0, 0, 0, 0) | |||
| 2863 | + | } | |||
| 2864 | + | ||||
| 2865 | + | // Xkb_keymap_new_from_names calls xkb_keymap_new_from_names without allocating. | |||
| 2866 | + | func (f *Funcs) Xkb_keymap_new_from_names(a1 uintptr, a2 uintptr, a3 uint32) uintptr { | |||
| 2867 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_names, a1, a2, uintptr(a3), 0, 0, 0) | |||
| 2868 | + | return r | |||
| 2869 | + | } | |||
| 2870 | + | ||||
| 2871 | + | // Xkb_keymap_new_from_string calls xkb_keymap_new_from_string without allocating. | |||
| 2872 | + | func (f *Funcs) Xkb_keymap_new_from_string(a1 uintptr, a2 uintptr, a3 uint32, a4 uint32) uintptr { | |||
| 2873 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_string, a1, a2, uintptr(a3), uintptr(a4), 0, 0) | |||
| 2874 | + | return r | |||
| 2875 | + | } | |||
| 2876 | + | ||||
| 2877 | + | // Xkb_keymap_new_from_buffer calls xkb_keymap_new_from_buffer without allocating. | |||
| 2878 | + | func (f *Funcs) Xkb_keymap_new_from_buffer(a1 uintptr, a2 uintptr, a3 uintptr, a4 uint32, a5 uint32) uintptr { | |||
| 2879 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_new_from_buffer, a1, a2, a3, uintptr(a4), uintptr(a5), 0) | |||
| 2880 | + | return r | |||
| 2881 | + | } | |||
| 2882 | + | ||||
| 2883 | + | // Xkb_keymap_ref calls xkb_keymap_ref without allocating. | |||
| 2884 | + | func (f *Funcs) Xkb_keymap_ref(a1 uintptr) uintptr { | |||
| 2885 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_ref, a1, 0, 0, 0, 0, 0) | |||
| 2886 | + | return r | |||
| 2887 | + | } | |||
| 2888 | + | ||||
| 2889 | + | // Xkb_keymap_unref calls xkb_keymap_unref without allocating. | |||
| 2890 | + | func (f *Funcs) Xkb_keymap_unref(a1 uintptr) { | |||
| 2891 | + | purego.Syscall6(f.xkb_keymap_unref, a1, 0, 0, 0, 0, 0) | |||
| 2892 | + | } | |||
| 2893 | + | ||||
| 2894 | + | // Xkb_keymap_get_as_string calls xkb_keymap_get_as_string without allocating. | |||
| 2895 | + | func (f *Funcs) Xkb_keymap_get_as_string(a1 uintptr, a2 uint32) uintptr { | |||
| 2896 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_get_as_string, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2897 | + | return r | |||
| 2898 | + | } | |||
| 2899 | + | ||||
| 2900 | + | // Xkb_keymap_mod_get_index calls xkb_keymap_mod_get_index without allocating. | |||
| 2901 | + | func (f *Funcs) Xkb_keymap_mod_get_index(a1 uintptr, a2 uintptr) uint32 { | |||
| 2902 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_mod_get_index, a1, a2, 0, 0, 0, 0) | |||
| 2903 | + | return uint32(r) | |||
| 2904 | + | } | |||
| 2905 | + | ||||
| 2906 | + | // Xkb_keymap_key_repeats calls xkb_keymap_key_repeats without allocating. | |||
| 2907 | + | func (f *Funcs) Xkb_keymap_key_repeats(a1 uintptr, a2 uint32) int32 { | |||
| 2908 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_key_repeats, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2909 | + | return int32(r) | |||
| 2910 | + | } | |||
| 2911 | + | ||||
| 2912 | + | // Xkb_keymap_num_layouts calls xkb_keymap_num_layouts without allocating. | |||
| 2913 | + | func (f *Funcs) Xkb_keymap_num_layouts(a1 uintptr) uint32 { | |||
| 2914 | + | r, _, _ := purego.Syscall6(f.xkb_keymap_num_layouts, a1, 0, 0, 0, 0, 0) | |||
| 2915 | + | return uint32(r) | |||
| 2916 | + | } | |||
| 2917 | + | ||||
| 2918 | + | // Xkb_state_new calls xkb_state_new without allocating. | |||
| 2919 | + | func (f *Funcs) Xkb_state_new(a1 uintptr) uintptr { | |||
| 2920 | + | r, _, _ := purego.Syscall6(f.xkb_state_new, a1, 0, 0, 0, 0, 0) | |||
| 2921 | + | return r | |||
| 2922 | + | } | |||
| 2923 | + | ||||
| 2924 | + | // Xkb_state_ref calls xkb_state_ref without allocating. | |||
| 2925 | + | func (f *Funcs) Xkb_state_ref(a1 uintptr) uintptr { | |||
| 2926 | + | r, _, _ := purego.Syscall6(f.xkb_state_ref, a1, 0, 0, 0, 0, 0) | |||
| 2927 | + | return r | |||
| 2928 | + | } | |||
| 2929 | + | ||||
| 2930 | + | // Xkb_state_unref calls xkb_state_unref without allocating. | |||
| 2931 | + | func (f *Funcs) Xkb_state_unref(a1 uintptr) { | |||
| 2932 | + | purego.Syscall6(f.xkb_state_unref, a1, 0, 0, 0, 0, 0) | |||
| 2933 | + | } | |||
| 2934 | + | ||||
| 2935 | + | // Xkb_state_update_mask calls xkb_state_update_mask without allocating. | |||
| 2936 | + | func (f *Funcs) Xkb_state_update_mask(a1 uintptr, a2 uint32, a3 uint32, a4 uint32, a5 uint32, a6 uint32, a7 uint32) uint32 { | |||
| 2937 | + | r, _, _ := purego.Syscall15(f.xkb_state_update_mask, a1, uintptr(a2), uintptr(a3), uintptr(a4), uintptr(a5), uintptr(a6), uintptr(a7), 0, 0, 0, 0, 0, 0, 0, 0) | |||
| 2938 | + | return uint32(r) | |||
| 2939 | + | } | |||
| 2940 | + | ||||
| 2941 | + | // Xkb_state_serialize_layout calls xkb_state_serialize_layout without allocating. | |||
| 2942 | + | func (f *Funcs) Xkb_state_serialize_layout(a1 uintptr, a2 uint32) uint32 { | |||
| 2943 | + | r, _, _ := purego.Syscall6(f.xkb_state_serialize_layout, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2944 | + | return uint32(r) | |||
| 2945 | + | } | |||
| 2946 | + | ||||
| 2947 | + | // Xkb_state_serialize_mods calls xkb_state_serialize_mods without allocating. | |||
| 2948 | + | func (f *Funcs) Xkb_state_serialize_mods(a1 uintptr, a2 uint32) uint32 { | |||
| 2949 | + | r, _, _ := purego.Syscall6(f.xkb_state_serialize_mods, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2950 | + | return uint32(r) | |||
| 2951 | + | } | |||
| 2952 | + | ||||
| 2953 | + | // Xkb_state_mod_name_is_active calls xkb_state_mod_name_is_active without allocating. | |||
| 2954 | + | func (f *Funcs) Xkb_state_mod_name_is_active(a1 uintptr, a2 uintptr, a3 uint32) int32 { | |||
| 2955 | + | r, _, _ := purego.Syscall6(f.xkb_state_mod_name_is_active, a1, a2, uintptr(a3), 0, 0, 0) | |||
| 2956 | + | return int32(r) | |||
| 2957 | + | } | |||
| 2958 | + | ||||
| 2959 | + | // Xkb_state_mod_index_is_active calls xkb_state_mod_index_is_active without allocating. | |||
| 2960 | + | func (f *Funcs) Xkb_state_mod_index_is_active(a1 uintptr, a2 uint32, a3 uint32) int32 { | |||
| 2961 | + | r, _, _ := purego.Syscall6(f.xkb_state_mod_index_is_active, a1, uintptr(a2), uintptr(a3), 0, 0, 0) | |||
| 2962 | + | return int32(r) | |||
| 2963 | + | } | |||
| 2964 | + | ||||
| 2965 | + | // Xkb_state_key_get_one_sym calls xkb_state_key_get_one_sym without allocating. | |||
| 2966 | + | func (f *Funcs) Xkb_state_key_get_one_sym(a1 uintptr, a2 uint32) uint32 { | |||
| 2967 | + | r, _, _ := purego.Syscall6(f.xkb_state_key_get_one_sym, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2968 | + | return uint32(r) | |||
| 2969 | + | } | |||
| 2970 | + | ||||
| 2971 | + | // Xkb_state_key_get_utf8 calls xkb_state_key_get_utf8 without allocating. | |||
| 2972 | + | func (f *Funcs) Xkb_state_key_get_utf8(a1 uintptr, a2 uint32, a3 uintptr, a4 uintptr) int32 { | |||
| 2973 | + | r, _, _ := purego.Syscall6(f.xkb_state_key_get_utf8, a1, uintptr(a2), a3, a4, 0, 0) | |||
| 2974 | + | return int32(r) | |||
| 2975 | + | } | |||
| 2976 | + | ||||
| 2977 | + | // Xkb_keysym_get_name calls xkb_keysym_get_name without allocating. | |||
| 2978 | + | func (f *Funcs) Xkb_keysym_get_name(a1 uint32, a2 uintptr, a3 uintptr) int32 { | |||
| 2979 | + | r, _, _ := purego.Syscall6(f.xkb_keysym_get_name, uintptr(a1), a2, a3, 0, 0, 0) | |||
| 2980 | + | return int32(r) | |||
| 2981 | + | } | |||
| 2982 | + | ||||
| 2983 | + | // Xkb_keysym_from_name calls xkb_keysym_from_name without allocating. | |||
| 2984 | + | func (f *Funcs) Xkb_keysym_from_name(a1 uintptr, a2 uint32) uint32 { | |||
| 2985 | + | r, _, _ := purego.Syscall6(f.xkb_keysym_from_name, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 2986 | + | return uint32(r) | |||
| 2987 | + | } | |||
| 2988 | + | ||||
| 2989 | + | // Xkb_compose_table_new_from_locale calls xkb_compose_table_new_from_locale without allocating. | |||
| 2990 | + | func (f *Funcs) Xkb_compose_table_new_from_locale(a1 uintptr, a2 uintptr, a3 uint32) uintptr { | |||
| 2991 | + | r, _, _ := purego.Syscall6(f.xkb_compose_table_new_from_locale, a1, a2, uintptr(a3), 0, 0, 0) | |||
| 2992 | + | return r | |||
| 2993 | + | } | |||
| 2994 | + | ||||
| 2995 | + | // Xkb_compose_table_ref calls xkb_compose_table_ref without allocating. | |||
| 2996 | + | func (f *Funcs) Xkb_compose_table_ref(a1 uintptr) uintptr { | |||
| 2997 | + | r, _, _ := purego.Syscall6(f.xkb_compose_table_ref, a1, 0, 0, 0, 0, 0) | |||
| 2998 | + | return r | |||
| 2999 | + | } | |||
| 3000 | + | ||||
| 3001 | + | // Xkb_compose_table_unref calls xkb_compose_table_unref without allocating. | |||
| 3002 | + | func (f *Funcs) Xkb_compose_table_unref(a1 uintptr) { | |||
| 3003 | + | purego.Syscall6(f.xkb_compose_table_unref, a1, 0, 0, 0, 0, 0) | |||
| 3004 | + | } | |||
| 3005 | + | ||||
| 3006 | + | // Xkb_compose_state_new calls xkb_compose_state_new without allocating. | |||
| 3007 | + | func (f *Funcs) Xkb_compose_state_new(a1 uintptr, a2 uint32) uintptr { | |||
| 3008 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_new, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 3009 | + | return r | |||
| 3010 | + | } | |||
| 3011 | + | ||||
| 3012 | + | // Xkb_compose_state_ref calls xkb_compose_state_ref without allocating. | |||
| 3013 | + | func (f *Funcs) Xkb_compose_state_ref(a1 uintptr) uintptr { | |||
| 3014 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_ref, a1, 0, 0, 0, 0, 0) | |||
| 3015 | + | return r | |||
| 3016 | + | } | |||
| 3017 | + | ||||
| 3018 | + | // Xkb_compose_state_unref calls xkb_compose_state_unref without allocating. | |||
| 3019 | + | func (f *Funcs) Xkb_compose_state_unref(a1 uintptr) { | |||
| 3020 | + | purego.Syscall6(f.xkb_compose_state_unref, a1, 0, 0, 0, 0, 0) | |||
| 3021 | + | } | |||
| 3022 | + | ||||
| 3023 | + | // Xkb_compose_state_feed calls xkb_compose_state_feed without allocating. | |||
| 3024 | + | func (f *Funcs) Xkb_compose_state_feed(a1 uintptr, a2 uint32) uint32 { | |||
| 3025 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_feed, a1, uintptr(a2), 0, 0, 0, 0) | |||
| 3026 | + | return uint32(r) | |||
| 3027 | + | } | |||
| 3028 | + | ||||
| 3029 | + | // Xkb_compose_state_get_status calls xkb_compose_state_get_status without allocating. | |||
| 3030 | + | func (f *Funcs) Xkb_compose_state_get_status(a1 uintptr) uint32 { | |||
| 3031 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_status, a1, 0, 0, 0, 0, 0) | |||
| 3032 | + | return uint32(r) | |||
| 3033 | + | } | |||
| 3034 | + | ||||
| 3035 | + | // Xkb_compose_state_reset calls xkb_compose_state_reset without allocating. | |||
| 3036 | + | func (f *Funcs) Xkb_compose_state_reset(a1 uintptr) { | |||
| 3037 | + | purego.Syscall6(f.xkb_compose_state_reset, a1, 0, 0, 0, 0, 0) | |||
| 3038 | + | } | |||
| 3039 | + | ||||
| 3040 | + | // Xkb_compose_state_get_utf8 calls xkb_compose_state_get_utf8 without allocating. | |||
| 3041 | + | func (f *Funcs) Xkb_compose_state_get_utf8(a1 uintptr, a2 uintptr, a3 uintptr) int32 { | |||
| 3042 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_utf8, a1, a2, a3, 0, 0, 0) | |||
| 3043 | + | return int32(r) | |||
| 3044 | + | } | |||
| 3045 | + | ||||
| 3046 | + | // Xkb_compose_state_get_one_sym calls xkb_compose_state_get_one_sym without allocating. | |||
| 3047 | + | func (f *Funcs) Xkb_compose_state_get_one_sym(a1 uintptr) uint32 { | |||
| 3048 | + | r, _, _ := purego.Syscall6(f.xkb_compose_state_get_one_sym, a1, 0, 0, 0, 0, 0) | |||
| 3049 | + | return uint32(r) | |||
| 2834 | } | 3050 | } | ||