From fc6c30309e869c1b984329b02722814dcce98f57 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:44:45 +0100 Subject: [PATCH 01/17] codegen/enums: remove prefix parameter (not used) --- cmd/codegen/gengo_enums.go | 2 +- cmd/codegen/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gengo_enums.go b/cmd/codegen/gengo_enums.go index 3a43502e..e4c79a07 100644 --- a/cmd/codegen/gengo_enums.go +++ b/cmd/codegen/gengo_enums.go @@ -7,7 +7,7 @@ import ( ) // Generate enums and return enum type names -func generateGoEnums(prefix string, enums []EnumDef, ctx *Context) ([]CIdentifier, error) { +func generateGoEnums(enums []EnumDef, ctx *Context) ([]CIdentifier, error) { var sb strings.Builder sb.WriteString(getGoPackageHeader(ctx)) diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index a03934ca..0f38b564 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -228,7 +228,7 @@ func main() { // 1. Generate code // 1.1. Generate Go Enums - enumNames, err := generateGoEnums(flags.prefix, context.enums, context) + enumNames, err := generateGoEnums(context.enums, context) if err != nil { glg.Fatalf("Generating enum names: %v", err) } From 9eca37d4119fb25d6fd5d9d0f4ee37ac17c46566 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:46:00 +0100 Subject: [PATCH 02/17] gencpp: remove another prefix arg --- cmd/codegen/gencpp.go | 2 +- cmd/codegen/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 1ba4d232..bfd60a0b 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -376,7 +376,7 @@ extern "C" { return validFuncs, nil } -func generateCppStructsAccessor(prefix string, validFuncs []FuncDef, structs []StructDef, context *Context) (accessors []FuncDef, err error) { +func generateCppStructsAccessor(validFuncs []FuncDef, structs []StructDef, context *Context) (accessors []FuncDef, err error) { var structAccessorFuncs []FuncDef // makes a setsum with context.preset.SkipFUncs diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index 0f38b564..8b1a9cd9 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -257,7 +257,7 @@ func main() { } // 1.3.1. Generate Struct accessors in C - structAccessorFuncs, err := generateCppStructsAccessor(flags.prefix, validFuncs, context.structs, context) + structAccessorFuncs, err := generateCppStructsAccessor(validFuncs, context.structs, context) if err != nil { glg.Fatalf("Cannot generate CPP Struct Accessors: %v", err) } From ff0534f4139bf74e860cd4bddf9e6b7a4f6aaed6 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:48:45 +0100 Subject: [PATCH 03/17] clearify flag usage --- cmd/codegen/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/codegen/flags.go b/cmd/codegen/flags.go index 12e3eb8d..ae38efc8 100644 --- a/cmd/codegen/flags.go +++ b/cmd/codegen/flags.go @@ -31,7 +31,7 @@ func parse() *flags { flag.StringVar(&flags.presetJsonPath, "preset", "", "Preset of custom (manual) generator rules. See go doc github.com/AllenDang/cimgui-go/cmd/codegen.Preset for more details.") flag.StringVar(&flags.refPackageName, "refPkg", "imgui", "name for refTypedefs package name") flag.StringVar(&flags.packageName, "pkg", "", "name for current package") - flag.StringVar(&flags.prefix, "p", "", "prefix for the generated file") + flag.StringVar(&flags.prefix, "p", "", "prefix for the generated code (used for internal C functions)") flag.StringVar(&flags.include, "i", "", "include header file") flag.Parse() From 7e60e683db305ffb8a1187bfc9d87979aa0b043e Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:50:10 +0100 Subject: [PATCH 04/17] gengo_funcs: remove prefix reference (not used) --- cmd/codegen/gengo_funcs.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index 02e25b3b..55e10730 100644 --- a/cmd/codegen/gengo_funcs.go +++ b/cmd/codegen/gengo_funcs.go @@ -39,7 +39,6 @@ func GenerateGoFuncs( context *Context, ) error { generator := &goFuncsGenerator{ - prefix: context.prefix, typedefsNames: context.typedefsNames, enumNames: context.enumNames, refTypedefs: context.refTypedefs, @@ -101,7 +100,6 @@ func GenerateGoFuncs( // goFuncsGenerator is an internal state of GO funcs' generator type goFuncsGenerator struct { - prefix string typedefsNames map[CIdentifier]bool enumNames map[CIdentifier]bool refTypedefs map[CIdentifier]bool From 2b783841ca557cc6d5fb5f59839b63d3df5cfca0 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:56:11 +0100 Subject: [PATCH 05/17] codegen: completely remove -p (prefix) flag --- cmd/codegen/flags.go | 4 +--- cmd/codegen/gencpp.go | 4 ++-- cmd/codegen/main.go | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/codegen/flags.go b/cmd/codegen/flags.go index ae38efc8..dccb2243 100644 --- a/cmd/codegen/flags.go +++ b/cmd/codegen/flags.go @@ -14,7 +14,6 @@ type flags struct { presetJsonPath, refPackageName, // name for refTypedefs (default: imgui) packageName, // name for current package (e.g. imgui, implot) - prefix, include string } @@ -31,8 +30,7 @@ func parse() *flags { flag.StringVar(&flags.presetJsonPath, "preset", "", "Preset of custom (manual) generator rules. See go doc github.com/AllenDang/cimgui-go/cmd/codegen.Preset for more details.") flag.StringVar(&flags.refPackageName, "refPkg", "imgui", "name for refTypedefs package name") flag.StringVar(&flags.packageName, "pkg", "", "name for current package") - flag.StringVar(&flags.prefix, "p", "", "prefix for the generated code (used for internal C functions)") - flag.StringVar(&flags.include, "i", "", "include header file") + flag.StringVar(&flags.include, "i", "", "include header file (source project's header)") flag.Parse() return flags diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index bfd60a0b..42ca5bb9 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -14,7 +14,7 @@ import ( const textLenRegisteredName = "text_len" // Generate cpp wrapper and return valid functions -func generateCppWrapper(prefix, includePath string, funcDefs []FuncDef, ctx *Context) ([]FuncDef, error) { +func generateCppWrapper(includePath string, funcDefs []FuncDef, ctx *Context) ([]FuncDef, error) { var validFuncs []FuncDef // Generate header @@ -583,7 +583,7 @@ func getPtrIfSize(size int) string { func AddArrayIndexGetter(t CIdentifier, sbHeader, sbCpp *strings.Builder, context *Context) { tStr := ReplaceAll(ReplaceAll(t, " ", "_"), "*", "Ptr") - getterFuncName := CIdentifier(context.prefix) + "_" + tStr + "_GetAtIdx" + getterFuncName := CIdentifier(context.flags.packageName) + "_" + tStr + "_GetAtIdx" context.arrayIndexGetters[t] = getterFuncName fmt.Fprintf( diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index 8b1a9cd9..fb89cafa 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -113,9 +113,6 @@ func loadData(f *flags) (*jsonData, error) { // this will store json data processed by appropiate pre-rocessors type Context struct { - // prefix for generated files (prefix_fileType.go) - prefix string - // plain idata loaded from json funcs []FuncDef structs []StructDef @@ -223,7 +220,6 @@ func main() { glg.Fatalf("cannot parse json: %v", err) } - context.prefix = flags.prefix context.flags = flags // 1. Generate code @@ -251,7 +247,7 @@ func main() { context.typedefsNames = MergeMaps(context.typedefsNames, SliceToMap(validCallbacks)) // 1.3. Generate C wrapper - validFuncs, err := generateCppWrapper(flags.prefix, flags.include, context.funcs, context) + validFuncs, err := generateCppWrapper(flags.include, context.funcs, context) if err != nil { glg.Fatalf("Cannot generate CPP Wrapper: %v", err) } From e59ae07a6dc8234577203a486a6651e5999447a6 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:56:18 +0100 Subject: [PATCH 06/17] update makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0409e415..e5461ba1 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ define generate mkdir -p $(2) cat templates/cflags.go |sed -e "s/^package.*/package $(2)/g" > $(2)/cflags.go cd $(2); \ - ../codegen -preset ../cmd/codegen/cimgui-go-preset.json -p $(1) -pkg $(2) -i ../$(3) -d ../$(4) -e ../$(5) -t ../$(6) $(7) + ../codegen -preset ../cmd/codegen/cimgui-go-preset.json -pkg $(2) -i ../$(3) -d ../$(4) -e ../$(5) -t ../$(6) $(7) endef define imgui From 8698235a21940415b76ce1bd57961bff64294e4e Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:58:34 +0100 Subject: [PATCH 07/17] regenerate code unfortunately we had to change a whole lot of internal stuff but it doesn't affect public API --- imgui/funcs.go | 86 ++++++++++++++++----------------- imgui/structs_accessor.cpp | 42 ++++++++-------- imgui/structs_accessor.h | 42 ++++++++-------- imguizmo/funcs.go | 2 +- imguizmo/structs_accessor.cpp | 2 +- imguizmo/structs_accessor.h | 2 +- immarkdown/funcs.go | 2 +- immarkdown/structs_accessor.cpp | 2 +- immarkdown/structs_accessor.h | 2 +- imnodes/funcs.go | 2 +- imnodes/structs_accessor.cpp | 2 +- imnodes/structs_accessor.h | 2 +- implot/funcs.go | 22 ++++----- implot/structs_accessor.cpp | 16 +++--- implot/structs_accessor.h | 16 +++--- 15 files changed, 121 insertions(+), 121 deletions(-) diff --git a/imgui/funcs.go b/imgui/funcs.go index 5cf8c183..3509f1d0 100644 --- a/imgui/funcs.go +++ b/imgui/funcs.go @@ -14482,7 +14482,7 @@ func (self *DrawListSharedData) ArcFastVtx() [48]Vec2 { resultMirr := C.wrap_ImDrawListSharedData_GetArcFastVtx(internal.ReinterpretCast[*C.ImDrawListSharedData](selfArg)) for i := range result { result[i] = func() Vec2 { - out := C.cimgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) return *(&Vec2{}).FromC(unsafe.Pointer(&out)) }() } @@ -14531,7 +14531,7 @@ func (self *DrawListSharedData) CircleSegmentCounts() [64](byte) { result := [64](byte){} resultMirr := C.wrap_ImDrawListSharedData_GetCircleSegmentCounts(internal.ReinterpretCast[*C.ImDrawListSharedData](selfArg)) for i := range result { - result[i] = (byte)(C.cimgui_ImU8_GetAtIdx(resultMirr, C.int(i))) + result[i] = (byte)(C.imgui_ImU8_GetAtIdx(resultMirr, C.int(i))) } return result @@ -14999,7 +14999,7 @@ func (self *Font) Used4kPagesMap() [34](byte) { result := [34](byte){} resultMirr := C.wrap_ImFont_GetUsed4kPagesMap(internal.ReinterpretCast[*C.ImFont](selfArg)) for i := range result { - result[i] = (byte)(C.cimgui_ImU8_GetAtIdx(resultMirr, C.int(i))) + result[i] = (byte)(C.imgui_ImU8_GetAtIdx(resultMirr, C.int(i))) } return result @@ -15283,7 +15283,7 @@ func (self *FontAtlas) TexUvLines() [64]Vec4 { resultMirr := C.wrap_ImFontAtlas_GetTexUvLines(internal.ReinterpretCast[*C.ImFontAtlas](selfArg)) for i := range result { result[i] = func() Vec4 { - out := C.cimgui_ImVec4_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec4_GetAtIdx(resultMirr, C.int(i)) return *(&Vec4{}).FromC(unsafe.Pointer(&out)) }() } @@ -15780,7 +15780,7 @@ func (self *FontConfig) Name() [40]rune { result := [40]rune{} resultMirr := C.wrap_ImFontConfig_GetName(internal.ReinterpretCast[*C.ImFontConfig](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -16798,7 +16798,7 @@ func (self *Context) ContextName() [16]rune { result := [16]rune{} resultMirr := C.wrap_ImGuiContext_GetContextName(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -17737,7 +17737,7 @@ func (self *Context) KeysOwnerData() [154]KeyOwnerData { resultMirr := C.wrap_ImGuiContext_GetKeysOwnerData(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { result[i] = *NewKeyOwnerDataFromC(func() *C.ImGuiKeyOwnerData { - result := C.cimgui_ImGuiKeyOwnerData_GetAtIdx(resultMirr, C.int(i)) + result := C.imgui_ImGuiKeyOwnerData_GetAtIdx(resultMirr, C.int(i)) return &result }()) } @@ -19589,7 +19589,7 @@ func (self *Context) DragDropPayloadBufLocal() [16]uint { result := [16]uint{} resultMirr := C.wrap_ImGuiContext_GetDragDropPayloadBufLocal(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { - result[i] = uint(C.cimgui_unsigned_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = uint(C.imgui_unsigned_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -20801,7 +20801,7 @@ func (self *Context) LocalizationTable() [13]string { result := [13]string{} resultMirr := C.wrap_ImGuiContext_GetLocalizationTable(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { - result[i] = C.GoString(C.cimgui_const_charPtr_GetAtIdx(resultMirr, C.int(i))) + result[i] = C.GoString(C.imgui_const_charPtr_GetAtIdx(resultMirr, C.int(i))) } return result @@ -21442,7 +21442,7 @@ func (self *Context) FramerateSecPerFrame() [60]float32 { result := [60]float32{} resultMirr := C.wrap_ImGuiContext_GetFramerateSecPerFrame(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { - result[i] = float32(C.cimgui_float_GetAtIdx(resultMirr, C.int(i))) + result[i] = float32(C.imgui_float_GetAtIdx(resultMirr, C.int(i))) } return result @@ -21587,7 +21587,7 @@ func (self *Context) TempKeychordName() [64]rune { result := [64]rune{} resultMirr := C.wrap_ImGuiContext_GetTempKeychordName(internal.ReinterpretCast[*C.ImGuiContext](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -21772,7 +21772,7 @@ func (self *DataTypeStorage) Data() [8](byte) { result := [8](byte){} resultMirr := C.wrap_ImGuiDataTypeStorage_GetData(internal.ReinterpretCast[*C.ImGuiDataTypeStorage](selfArg)) for i := range result { - result[i] = (byte)(C.cimgui_ImU8_GetAtIdx(resultMirr, C.int(i))) + result[i] = (byte)(C.imgui_ImU8_GetAtIdx(resultMirr, C.int(i))) } return result @@ -21941,7 +21941,7 @@ func (self *DebugAllocInfo) LastEntriesBuf() [6]DebugAllocEntry { resultMirr := C.wrap_ImGuiDebugAllocInfo_GetLastEntriesBuf(internal.ReinterpretCast[*C.ImGuiDebugAllocInfo](selfArg)) for i := range result { result[i] = *NewDebugAllocEntryFromC(func() *C.ImGuiDebugAllocEntry { - result := C.cimgui_ImGuiDebugAllocEntry_GetAtIdx(resultMirr, C.int(i)) + result := C.imgui_ImGuiDebugAllocEntry_GetAtIdx(resultMirr, C.int(i)) return &result }()) } @@ -22152,7 +22152,7 @@ func (self *DockNode) ChildNodes() [2]*DockNode { result := [2]*DockNode{} resultMirr := C.wrap_ImGuiDockNode_GetChildNodes(internal.ReinterpretCast[*C.ImGuiDockNode](selfArg)) for i := range result { - result[i] = NewDockNodeFromC(C.cimgui_ImGuiDockNodePtr_GetAtIdx(resultMirr, C.int(i))) + result[i] = NewDockNodeFromC(C.imgui_ImGuiDockNodePtr_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24367,7 +24367,7 @@ func (self *IO) MouseDown() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseDown(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24543,7 +24543,7 @@ func (self *IO) KeysData() [154]KeyData { result := [154]KeyData{} resultMirr := C.wrap_ImGuiIO_GetKeysData(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = *NewKeyDataFromC(func() *C.ImGuiKeyData { result := C.cimgui_ImGuiKeyData_GetAtIdx(resultMirr, C.int(i)); return &result }()) + result[i] = *NewKeyDataFromC(func() *C.ImGuiKeyData { result := C.imgui_ImGuiKeyData_GetAtIdx(resultMirr, C.int(i)); return &result }()) } return result @@ -24609,7 +24609,7 @@ func (self *IO) MouseClickedPos() [5]Vec2 { resultMirr := C.wrap_ImGuiIO_GetMouseClickedPos(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { result[i] = func() Vec2 { - out := C.cimgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) return *(&Vec2{}).FromC(unsafe.Pointer(&out)) }() } @@ -24643,7 +24643,7 @@ func (self *IO) MouseClickedTime() [5]float64 { result := [5]float64{} resultMirr := C.wrap_ImGuiIO_GetMouseClickedTime(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = float64(C.cimgui_double_GetAtIdx(resultMirr, C.int(i))) + result[i] = float64(C.imgui_double_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24675,7 +24675,7 @@ func (self *IO) MouseClicked() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseClicked(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24707,7 +24707,7 @@ func (self *IO) MouseDoubleClicked() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseDoubleClicked(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24739,7 +24739,7 @@ func (self *IO) MouseClickedCount() [5](uint16) { result := [5](uint16){} resultMirr := C.wrap_ImGuiIO_GetMouseClickedCount(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = (uint16)(C.cimgui_ImU16_GetAtIdx(resultMirr, C.int(i))) + result[i] = (uint16)(C.imgui_ImU16_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24771,7 +24771,7 @@ func (self *IO) MouseClickedLastCount() [5](uint16) { result := [5](uint16){} resultMirr := C.wrap_ImGuiIO_GetMouseClickedLastCount(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = (uint16)(C.cimgui_ImU16_GetAtIdx(resultMirr, C.int(i))) + result[i] = (uint16)(C.imgui_ImU16_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24803,7 +24803,7 @@ func (self *IO) MouseReleased() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseReleased(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24835,7 +24835,7 @@ func (self *IO) MouseDownOwned() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseDownOwned(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24867,7 +24867,7 @@ func (self *IO) MouseDownOwnedUnlessPopupClose() [5]bool { result := [5]bool{} resultMirr := C.wrap_ImGuiIO_GetMouseDownOwnedUnlessPopupClose(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = C.cimgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.imgui_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -24929,7 +24929,7 @@ func (self *IO) MouseDownDuration() [5]float32 { result := [5]float32{} resultMirr := C.wrap_ImGuiIO_GetMouseDownDuration(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = float32(C.cimgui_float_GetAtIdx(resultMirr, C.int(i))) + result[i] = float32(C.imgui_float_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24961,7 +24961,7 @@ func (self *IO) MouseDownDurationPrev() [5]float32 { result := [5]float32{} resultMirr := C.wrap_ImGuiIO_GetMouseDownDurationPrev(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = float32(C.cimgui_float_GetAtIdx(resultMirr, C.int(i))) + result[i] = float32(C.imgui_float_GetAtIdx(resultMirr, C.int(i))) } return result @@ -24994,7 +24994,7 @@ func (self *IO) MouseDragMaxDistanceAbs() [5]Vec2 { resultMirr := C.wrap_ImGuiIO_GetMouseDragMaxDistanceAbs(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { result[i] = func() Vec2 { - out := C.cimgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) return *(&Vec2{}).FromC(unsafe.Pointer(&out)) }() } @@ -25028,7 +25028,7 @@ func (self *IO) MouseDragMaxDistanceSqr() [5]float32 { result := [5]float32{} resultMirr := C.wrap_ImGuiIO_GetMouseDragMaxDistanceSqr(internal.ReinterpretCast[*C.ImGuiIO](selfArg)) for i := range result { - result[i] = float32(C.cimgui_float_GetAtIdx(resultMirr, C.int(i))) + result[i] = float32(C.imgui_float_GetAtIdx(resultMirr, C.int(i))) } return result @@ -26195,7 +26195,7 @@ func (self *KeyRoutingTable) Index() [154]KeyRoutingIndex { resultMirr := C.wrap_ImGuiKeyRoutingTable_GetIndex(internal.ReinterpretCast[*C.ImGuiKeyRoutingTable](selfArg)) for i := range result { result[i] = *NewKeyRoutingIndexFromC(func() *C.ImGuiKeyRoutingIndex { - result := C.cimgui_ImGuiKeyRoutingIndex_GetAtIdx(resultMirr, C.int(i)) + result := C.imgui_ImGuiKeyRoutingIndex_GetAtIdx(resultMirr, C.int(i)) return &result }()) } @@ -26834,7 +26834,7 @@ func (self *MenuColumns) Widths() [4](uint16) { result := [4](uint16){} resultMirr := C.wrap_ImGuiMenuColumns_GetWidths(internal.ReinterpretCast[*C.ImGuiMenuColumns](selfArg)) for i := range result { - result[i] = (uint16)(C.cimgui_ImU16_GetAtIdx(resultMirr, C.int(i))) + result[i] = (uint16)(C.imgui_ImU16_GetAtIdx(resultMirr, C.int(i))) } return result @@ -28733,7 +28733,7 @@ func (self *Payload) DataType() [33]rune { result := [33]rune{} resultMirr := C.wrap_ImGuiPayload_GetDataType(internal.ReinterpretCast[*C.ImGuiPayload](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -29617,7 +29617,7 @@ func (self *StackLevelInfo) Desc() [57]rune { result := [57]rune{} resultMirr := C.wrap_ImGuiStackLevelInfo_GetDesc(internal.ReinterpretCast[*C.ImGuiStackLevelInfo](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -30457,7 +30457,7 @@ func (self *Style) Colors() [58]Vec4 { resultMirr := C.wrap_ImGuiStyle_GetColors(internal.ReinterpretCast[*C.ImGuiStyle](selfArg)) for i := range result { result[i] = func() Vec4 { - out := C.cimgui_ImVec4_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec4_GetAtIdx(resultMirr, C.int(i)) return *(&Vec4{}).FromC(unsafe.Pointer(&out)) }() } @@ -31713,7 +31713,7 @@ func (self *Table) RowBgColor() [2](uint32) { result := [2](uint32){} resultMirr := C.wrap_ImGuiTable_GetRowBgColor(internal.ReinterpretCast[*C.ImGuiTable](selfArg)) for i := range result { - result[i] = (uint32)(C.cimgui_ImU32_GetAtIdx(resultMirr, C.int(i))) + result[i] = (uint32)(C.imgui_ImU32_GetAtIdx(resultMirr, C.int(i))) } return result @@ -34655,7 +34655,7 @@ func (self *TextFilter) InputBuf() [256]rune { result := [256]rune{} resultMirr := C.wrap_ImGuiTextFilter_GetInputBuf(internal.ReinterpretCast[*C.ImGuiTextFilter](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -34975,7 +34975,7 @@ func (self *TypingSelectState) SearchBuffer() [64]rune { result := [64]rune{} resultMirr := C.wrap_ImGuiTypingSelectState_GetSearchBuffer(internal.ReinterpretCast[*C.ImGuiTypingSelectState](selfArg)) for i := range result { - result[i] = rune(C.cimgui_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.imgui_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -35544,7 +35544,7 @@ func (self *ViewportP) BgFgDrawListsLastFrame() [2]int32 { result := [2]int32{} resultMirr := C.wrap_ImGuiViewportP_GetBgFgDrawListsLastFrame(internal.ReinterpretCast[*C.ImGuiViewportP](selfArg)) for i := range result { - result[i] = int32(C.cimgui_int_GetAtIdx(resultMirr, C.int(i))) + result[i] = int32(C.imgui_int_GetAtIdx(resultMirr, C.int(i))) } return result @@ -35577,7 +35577,7 @@ func (self *ViewportP) BgFgDrawLists() [2]*DrawList { result := [2]*DrawList{} resultMirr := C.wrap_ImGuiViewportP_GetBgFgDrawLists(internal.ReinterpretCast[*C.ImGuiViewportP](selfArg)) for i := range result { - result[i] = NewDrawListFromC(C.cimgui_ImDrawListPtr_GetAtIdx(resultMirr, C.int(i))) + result[i] = NewDrawListFromC(C.imgui_ImDrawListPtr_GetAtIdx(resultMirr, C.int(i))) } return result @@ -37455,7 +37455,7 @@ func (self *Window) NavLastIds() [2]ID { result := [2]ID{} resultMirr := C.wrap_ImGuiWindow_GetNavLastIds(internal.ReinterpretCast[*C.ImGuiWindow](selfArg)) for i := range result { - result[i] = *NewIDFromC(func() *C.ImGuiID { result := C.cimgui_ImGuiID_GetAtIdx(resultMirr, C.int(i)); return &result }()) + result[i] = *NewIDFromC(func() *C.ImGuiID { result := C.imgui_ImGuiID_GetAtIdx(resultMirr, C.int(i)); return &result }()) } return result @@ -37488,7 +37488,7 @@ func (self *Window) NavRectRel() [2]Rect { resultMirr := C.wrap_ImGuiWindow_GetNavRectRel(internal.ReinterpretCast[*C.ImGuiWindow](selfArg)) for i := range result { result[i] = func() Rect { - out := C.cimgui_ImRect_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImRect_GetAtIdx(resultMirr, C.int(i)) return *(&Rect{}).FromC(unsafe.Pointer(&out)) }() } @@ -37522,7 +37522,7 @@ func (self *Window) NavPreferredScoringPosRel() [2]Vec2 { resultMirr := C.wrap_ImGuiWindow_GetNavPreferredScoringPosRel(internal.ReinterpretCast[*C.ImGuiWindow](selfArg)) for i := range result { result[i] = func() Vec2 { - out := C.cimgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) + out := C.imgui_ImVec2_GetAtIdx(resultMirr, C.int(i)) return *(&Vec2{}).FromC(unsafe.Pointer(&out)) }() } @@ -37947,7 +37947,7 @@ func (self *WindowDockStyle) Colors() [8](uint32) { result := [8](uint32){} resultMirr := C.wrap_ImGuiWindowDockStyle_GetColors(internal.ReinterpretCast[*C.ImGuiWindowDockStyle](selfArg)) for i := range result { - result[i] = (uint32)(C.cimgui_ImU32_GetAtIdx(resultMirr, C.int(i))) + result[i] = (uint32)(C.imgui_ImU32_GetAtIdx(resultMirr, C.int(i))) } return result diff --git a/imgui/structs_accessor.cpp b/imgui/structs_accessor.cpp index c25f0917..7fda576e 100644 --- a/imgui/structs_accessor.cpp +++ b/imgui/structs_accessor.cpp @@ -58,7 +58,7 @@ void wrap_ImDrawData_SetOwnerViewport(ImDrawData *ImDrawDataPtr, ImGuiViewport* ImGuiViewport* wrap_ImDrawData_GetOwnerViewport(ImDrawData *self) { return self->OwnerViewport; } void wrap_ImDrawDataBuilder_SetLayers(ImDrawDataBuilder *ImDrawDataBuilderPtr, ImVector_ImDrawListPtr** v) { memcpy(ImDrawDataBuilderPtr->Layers, v, sizeof(ImVector_ImDrawListPtr*)*2); } ImVector_ImDrawListPtr** wrap_ImDrawDataBuilder_GetLayers(ImDrawDataBuilder *self) { return self->Layers; } -ImVector_ImDrawListPtr* cimgui_ImVector_ImDrawListPtrPtr_GetAtIdx(ImVector_ImDrawListPtr* *self, int index) { return self[index]; } +ImVector_ImDrawListPtr* imgui_ImVector_ImDrawListPtrPtr_GetAtIdx(ImVector_ImDrawListPtr* *self, int index) { return self[index]; } void wrap_ImDrawDataBuilder_SetLayerData1(ImDrawDataBuilder *ImDrawDataBuilderPtr, ImVector_ImDrawListPtr v) { ImDrawDataBuilderPtr->LayerData1 = v; } ImVector_ImDrawListPtr wrap_ImDrawDataBuilder_GetLayerData1(ImDrawDataBuilder *self) { return self->LayerData1; } void wrap_ImDrawList_SetCmdBuffer(ImDrawList *ImDrawListPtr, ImVector_ImDrawCmd v) { ImDrawListPtr->CmdBuffer = v; } @@ -113,12 +113,12 @@ void wrap_ImDrawListSharedData_SetTempBuffer(ImDrawListSharedData *ImDrawListSha ImVector_ImVec2 wrap_ImDrawListSharedData_GetTempBuffer(ImDrawListSharedData *self) { return self->TempBuffer; } void wrap_ImDrawListSharedData_SetArcFastVtx(ImDrawListSharedData *ImDrawListSharedDataPtr, ImVec2* v) { memcpy(ImDrawListSharedDataPtr->ArcFastVtx, v, sizeof(ImVec2)*48); } ImVec2* wrap_ImDrawListSharedData_GetArcFastVtx(ImDrawListSharedData *self) { return self->ArcFastVtx; } -ImVec2 cimgui_ImVec2_GetAtIdx(ImVec2 *self, int index) { return self[index]; } +ImVec2 imgui_ImVec2_GetAtIdx(ImVec2 *self, int index) { return self[index]; } void wrap_ImDrawListSharedData_SetArcFastRadiusCutoff(ImDrawListSharedData *ImDrawListSharedDataPtr, float v) { ImDrawListSharedDataPtr->ArcFastRadiusCutoff = v; } float wrap_ImDrawListSharedData_GetArcFastRadiusCutoff(ImDrawListSharedData *self) { return self->ArcFastRadiusCutoff; } void wrap_ImDrawListSharedData_SetCircleSegmentCounts(ImDrawListSharedData *ImDrawListSharedDataPtr, ImU8* v) { memcpy(ImDrawListSharedDataPtr->CircleSegmentCounts, v, sizeof(ImU8)*64); } ImU8* wrap_ImDrawListSharedData_GetCircleSegmentCounts(ImDrawListSharedData *self) { return self->CircleSegmentCounts; } -ImU8 cimgui_ImU8_GetAtIdx(ImU8 *self, int index) { return self[index]; } +ImU8 imgui_ImU8_GetAtIdx(ImU8 *self, int index) { return self[index]; } void wrap_ImDrawListSharedData_SetTexUvLines(ImDrawListSharedData *ImDrawListSharedDataPtr, const ImVec4* v) { ImDrawListSharedDataPtr->TexUvLines = v; } const ImVec4* wrap_ImDrawListSharedData_GetTexUvLines(ImDrawListSharedData *self) { return self->TexUvLines; } void wrap_ImDrawListSplitter_Set_Current(ImDrawListSplitter *ImDrawListSplitterPtr, int v) { ImDrawListSplitterPtr->_Current = v; } @@ -207,7 +207,7 @@ void wrap_ImFontAtlas_SetConfigData(ImFontAtlas *ImFontAtlasPtr, ImVector_ImFont ImVector_ImFontConfig wrap_ImFontAtlas_GetConfigData(ImFontAtlas *self) { return self->ConfigData; } void wrap_ImFontAtlas_SetTexUvLines(ImFontAtlas *ImFontAtlasPtr, ImVec4* v) { memcpy(ImFontAtlasPtr->TexUvLines, v, sizeof(ImVec4)*64); } ImVec4* wrap_ImFontAtlas_GetTexUvLines(ImFontAtlas *self) { return self->TexUvLines; } -ImVec4 cimgui_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } +ImVec4 imgui_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } void wrap_ImFontAtlas_SetFontBuilderIO(ImFontAtlas *ImFontAtlasPtr, const ImFontBuilderIO* v) { ImFontAtlasPtr->FontBuilderIO = v; } const ImFontBuilderIO* wrap_ImFontAtlas_GetFontBuilderIO(ImFontAtlas *self) { return self->FontBuilderIO; } void wrap_ImFontAtlas_SetFontBuilderFlags(ImFontAtlas *ImFontAtlasPtr, unsigned int v) { ImFontAtlasPtr->FontBuilderFlags = v; } @@ -270,7 +270,7 @@ void wrap_ImFontConfig_SetEllipsisChar(ImFontConfig *ImFontConfigPtr, ImWchar v) ImWchar wrap_ImFontConfig_GetEllipsisChar(ImFontConfig *self) { return self->EllipsisChar; } void wrap_ImFontConfig_SetName(ImFontConfig *ImFontConfigPtr, char* v) { memcpy(ImFontConfigPtr->Name, v, sizeof(char)*40); } char* wrap_ImFontConfig_GetName(ImFontConfig *self) { return self->Name; } -char cimgui_char_GetAtIdx(char *self, int index) { return self[index]; } +char imgui_char_GetAtIdx(char *self, int index) { return self[index]; } void wrap_ImFontConfig_SetDstFont(ImFontConfig *ImFontConfigPtr, ImFont* v) { ImFontConfigPtr->DstFont = v; } ImFont* wrap_ImFontConfig_GetDstFont(ImFontConfig *self) { return self->DstFont; } void wrap_ImFontGlyph_SetColored(ImFontGlyph *ImFontGlyphPtr, unsigned int v) { ImFontGlyphPtr->Colored = v; } @@ -513,7 +513,7 @@ void wrap_ImGuiContext_SetKeysMayBeCharInput(ImGuiContext *ImGuiContextPtr, ImBi ImBitArrayForNamedKeys wrap_ImGuiContext_GetKeysMayBeCharInput(ImGuiContext *self) { return self->KeysMayBeCharInput; } void wrap_ImGuiContext_SetKeysOwnerData(ImGuiContext *ImGuiContextPtr, ImGuiKeyOwnerData* v) { memcpy(ImGuiContextPtr->KeysOwnerData, v, sizeof(ImGuiKeyOwnerData)*154); } ImGuiKeyOwnerData* wrap_ImGuiContext_GetKeysOwnerData(ImGuiContext *self) { return self->KeysOwnerData; } -ImGuiKeyOwnerData cimgui_ImGuiKeyOwnerData_GetAtIdx(ImGuiKeyOwnerData *self, int index) { return self[index]; } +ImGuiKeyOwnerData imgui_ImGuiKeyOwnerData_GetAtIdx(ImGuiKeyOwnerData *self, int index) { return self[index]; } void wrap_ImGuiContext_SetKeysRoutingTable(ImGuiContext *ImGuiContextPtr, ImGuiKeyRoutingTable v) { ImGuiContextPtr->KeysRoutingTable = v; } ImGuiKeyRoutingTable wrap_ImGuiContext_GetKeysRoutingTable(ImGuiContext *self) { return self->KeysRoutingTable; } void wrap_ImGuiContext_SetActiveIdUsingNavDirMask(ImGuiContext *ImGuiContextPtr, ImU32 v) { ImGuiContextPtr->ActiveIdUsingNavDirMask = v; } @@ -732,7 +732,7 @@ void wrap_ImGuiContext_SetDragDropPayloadBufHeap(ImGuiContext *ImGuiContextPtr, ImVector_unsigned_char wrap_ImGuiContext_GetDragDropPayloadBufHeap(ImGuiContext *self) { return self->DragDropPayloadBufHeap; } void wrap_ImGuiContext_SetDragDropPayloadBufLocal(ImGuiContext *ImGuiContextPtr, unsigned char* v) { memcpy(ImGuiContextPtr->DragDropPayloadBufLocal, v, sizeof(unsigned char)*16); } unsigned char* wrap_ImGuiContext_GetDragDropPayloadBufLocal(ImGuiContext *self) { return self->DragDropPayloadBufLocal; } -unsigned char cimgui_unsigned_char_GetAtIdx(unsigned char *self, int index) { return self[index]; } +unsigned char imgui_unsigned_char_GetAtIdx(unsigned char *self, int index) { return self[index]; } void wrap_ImGuiContext_SetClipperTempDataStacked(ImGuiContext *ImGuiContextPtr, int v) { ImGuiContextPtr->ClipperTempDataStacked = v; } int wrap_ImGuiContext_GetClipperTempDataStacked(ImGuiContext *self) { return self->ClipperTempDataStacked; } void wrap_ImGuiContext_SetClipperTempData(ImGuiContext *ImGuiContextPtr, ImVector_ImGuiListClipperData v) { ImGuiContextPtr->ClipperTempData = v; } @@ -877,7 +877,7 @@ void wrap_ImGuiContext_SetHookIdNext(ImGuiContext *ImGuiContextPtr, ImGuiID v) { ImGuiID wrap_ImGuiContext_GetHookIdNext(ImGuiContext *self) { return self->HookIdNext; } void wrap_ImGuiContext_SetLocalizationTable(ImGuiContext *ImGuiContextPtr, const char** v) { memcpy(ImGuiContextPtr->LocalizationTable, v, sizeof(const char*)*13); } const char** wrap_ImGuiContext_GetLocalizationTable(ImGuiContext *self) { return self->LocalizationTable; } -const char* cimgui_const_charPtr_GetAtIdx(const char* *self, int index) { return self[index]; } +const char* imgui_const_charPtr_GetAtIdx(const char* *self, int index) { return self[index]; } void wrap_ImGuiContext_SetLogEnabled(ImGuiContext *ImGuiContextPtr, bool v) { ImGuiContextPtr->LogEnabled = v; } bool wrap_ImGuiContext_GetLogEnabled(ImGuiContext *self) { return self->LogEnabled; } void wrap_ImGuiContext_SetLogType(ImGuiContext *ImGuiContextPtr, ImGuiLogType v) { ImGuiContextPtr->LogType = v; } @@ -956,7 +956,7 @@ void wrap_ImGuiContext_SetDebugHoveredDockNode(ImGuiContext *ImGuiContextPtr, Im ImGuiDockNode* wrap_ImGuiContext_GetDebugHoveredDockNode(ImGuiContext *self) { return self->DebugHoveredDockNode; } void wrap_ImGuiContext_SetFramerateSecPerFrame(ImGuiContext *ImGuiContextPtr, float* v) { memcpy(ImGuiContextPtr->FramerateSecPerFrame, v, sizeof(float)*60); } float* wrap_ImGuiContext_GetFramerateSecPerFrame(ImGuiContext *self) { return self->FramerateSecPerFrame; } -float cimgui_float_GetAtIdx(float *self, int index) { return self[index]; } +float imgui_float_GetAtIdx(float *self, int index) { return self[index]; } void wrap_ImGuiContext_SetFramerateSecPerFrameIdx(ImGuiContext *ImGuiContextPtr, int v) { ImGuiContextPtr->FramerateSecPerFrameIdx = v; } int wrap_ImGuiContext_GetFramerateSecPerFrameIdx(ImGuiContext *self) { return self->FramerateSecPerFrameIdx; } void wrap_ImGuiContext_SetFramerateSecPerFrameCount(ImGuiContext *ImGuiContextPtr, int v) { ImGuiContextPtr->FramerateSecPerFrameCount = v; } @@ -1013,7 +1013,7 @@ void wrap_ImGuiDebugAllocInfo_SetLastEntriesIdx(ImGuiDebugAllocInfo *ImGuiDebugA ImS16 wrap_ImGuiDebugAllocInfo_GetLastEntriesIdx(ImGuiDebugAllocInfo *self) { return self->LastEntriesIdx; } void wrap_ImGuiDebugAllocInfo_SetLastEntriesBuf(ImGuiDebugAllocInfo *ImGuiDebugAllocInfoPtr, ImGuiDebugAllocEntry* v) { memcpy(ImGuiDebugAllocInfoPtr->LastEntriesBuf, v, sizeof(ImGuiDebugAllocEntry)*6); } ImGuiDebugAllocEntry* wrap_ImGuiDebugAllocInfo_GetLastEntriesBuf(ImGuiDebugAllocInfo *self) { return self->LastEntriesBuf; } -ImGuiDebugAllocEntry cimgui_ImGuiDebugAllocEntry_GetAtIdx(ImGuiDebugAllocEntry *self, int index) { return self[index]; } +ImGuiDebugAllocEntry imgui_ImGuiDebugAllocEntry_GetAtIdx(ImGuiDebugAllocEntry *self, int index) { return self[index]; } void wrap_ImGuiDockContext_SetNodes(ImGuiDockContext *ImGuiDockContextPtr, ImGuiStorage v) { ImGuiDockContextPtr->Nodes = v; } ImGuiStorage wrap_ImGuiDockContext_GetNodes(ImGuiDockContext *self) { return self->Nodes; } void wrap_ImGuiDockContext_SetRequests(ImGuiDockContext *ImGuiDockContextPtr, ImVector_ImGuiDockRequest v) { ImGuiDockContextPtr->Requests = v; } @@ -1036,7 +1036,7 @@ void wrap_ImGuiDockNode_SetParentNode(ImGuiDockNode *ImGuiDockNodePtr, ImGuiDock ImGuiDockNode* wrap_ImGuiDockNode_GetParentNode(ImGuiDockNode *self) { return self->ParentNode; } void wrap_ImGuiDockNode_SetChildNodes(ImGuiDockNode *ImGuiDockNodePtr, ImGuiDockNode** v) { memcpy(ImGuiDockNodePtr->ChildNodes, v, sizeof(ImGuiDockNode*)*2); } ImGuiDockNode** wrap_ImGuiDockNode_GetChildNodes(ImGuiDockNode *self) { return self->ChildNodes; } -ImGuiDockNode* cimgui_ImGuiDockNodePtr_GetAtIdx(ImGuiDockNode* *self, int index) { return self[index]; } +ImGuiDockNode* imgui_ImGuiDockNodePtr_GetAtIdx(ImGuiDockNode* *self, int index) { return self[index]; } void wrap_ImGuiDockNode_SetWindows(ImGuiDockNode *ImGuiDockNodePtr, ImVector_ImGuiWindowPtr v) { ImGuiDockNodePtr->Windows = v; } ImVector_ImGuiWindowPtr wrap_ImGuiDockNode_GetWindows(ImGuiDockNode *self) { return self->Windows; } void wrap_ImGuiDockNode_SetTabBar(ImGuiDockNode *ImGuiDockNodePtr, ImGuiTabBar* v) { ImGuiDockNodePtr->TabBar = v; } @@ -1317,7 +1317,7 @@ void wrap_ImGuiIO_SetMousePos(ImGuiIO *ImGuiIOPtr, ImVec2 v) { ImGuiIOPtr->Mouse ImVec2 wrap_ImGuiIO_GetMousePos(ImGuiIO *self) { return self->MousePos; } void wrap_ImGuiIO_SetMouseDown(ImGuiIO *ImGuiIOPtr, bool* v) { memcpy(ImGuiIOPtr->MouseDown, v, sizeof(bool)*5); } bool* wrap_ImGuiIO_GetMouseDown(ImGuiIO *self) { return self->MouseDown; } -bool cimgui_bool_GetAtIdx(bool *self, int index) { return self[index]; } +bool imgui_bool_GetAtIdx(bool *self, int index) { return self[index]; } void wrap_ImGuiIO_SetMouseWheel(ImGuiIO *ImGuiIOPtr, float v) { ImGuiIOPtr->MouseWheel = v; } float wrap_ImGuiIO_GetMouseWheel(ImGuiIO *self) { return self->MouseWheel; } void wrap_ImGuiIO_SetMouseWheelH(ImGuiIO *ImGuiIOPtr, float v) { ImGuiIOPtr->MouseWheelH = v; } @@ -1338,7 +1338,7 @@ void wrap_ImGuiIO_SetKeyMods(ImGuiIO *ImGuiIOPtr, ImGuiKeyChord v) { ImGuiIOPtr- ImGuiKeyChord wrap_ImGuiIO_GetKeyMods(ImGuiIO *self) { return self->KeyMods; } void wrap_ImGuiIO_SetKeysData(ImGuiIO *ImGuiIOPtr, ImGuiKeyData* v) { memcpy(ImGuiIOPtr->KeysData, v, sizeof(ImGuiKeyData)*154); } ImGuiKeyData* wrap_ImGuiIO_GetKeysData(ImGuiIO *self) { return self->KeysData; } -ImGuiKeyData cimgui_ImGuiKeyData_GetAtIdx(ImGuiKeyData *self, int index) { return self[index]; } +ImGuiKeyData imgui_ImGuiKeyData_GetAtIdx(ImGuiKeyData *self, int index) { return self[index]; } void wrap_ImGuiIO_SetWantCaptureMouseUnlessPopupClose(ImGuiIO *ImGuiIOPtr, bool v) { ImGuiIOPtr->WantCaptureMouseUnlessPopupClose = v; } bool wrap_ImGuiIO_GetWantCaptureMouseUnlessPopupClose(ImGuiIO *self) { return self->WantCaptureMouseUnlessPopupClose; } void wrap_ImGuiIO_SetMousePosPrev(ImGuiIO *ImGuiIOPtr, ImVec2 v) { ImGuiIOPtr->MousePosPrev = v; } @@ -1347,14 +1347,14 @@ void wrap_ImGuiIO_SetMouseClickedPos(ImGuiIO *ImGuiIOPtr, ImVec2* v) { memcpy(Im ImVec2* wrap_ImGuiIO_GetMouseClickedPos(ImGuiIO *self) { return self->MouseClickedPos; } void wrap_ImGuiIO_SetMouseClickedTime(ImGuiIO *ImGuiIOPtr, double* v) { memcpy(ImGuiIOPtr->MouseClickedTime, v, sizeof(double)*5); } double* wrap_ImGuiIO_GetMouseClickedTime(ImGuiIO *self) { return self->MouseClickedTime; } -double cimgui_double_GetAtIdx(double *self, int index) { return self[index]; } +double imgui_double_GetAtIdx(double *self, int index) { return self[index]; } void wrap_ImGuiIO_SetMouseClicked(ImGuiIO *ImGuiIOPtr, bool* v) { memcpy(ImGuiIOPtr->MouseClicked, v, sizeof(bool)*5); } bool* wrap_ImGuiIO_GetMouseClicked(ImGuiIO *self) { return self->MouseClicked; } void wrap_ImGuiIO_SetMouseDoubleClicked(ImGuiIO *ImGuiIOPtr, bool* v) { memcpy(ImGuiIOPtr->MouseDoubleClicked, v, sizeof(bool)*5); } bool* wrap_ImGuiIO_GetMouseDoubleClicked(ImGuiIO *self) { return self->MouseDoubleClicked; } void wrap_ImGuiIO_SetMouseClickedCount(ImGuiIO *ImGuiIOPtr, ImU16* v) { memcpy(ImGuiIOPtr->MouseClickedCount, v, sizeof(ImU16)*5); } ImU16* wrap_ImGuiIO_GetMouseClickedCount(ImGuiIO *self) { return self->MouseClickedCount; } -ImU16 cimgui_ImU16_GetAtIdx(ImU16 *self, int index) { return self[index]; } +ImU16 imgui_ImU16_GetAtIdx(ImU16 *self, int index) { return self[index]; } void wrap_ImGuiIO_SetMouseClickedLastCount(ImGuiIO *ImGuiIOPtr, ImU16* v) { memcpy(ImGuiIOPtr->MouseClickedLastCount, v, sizeof(ImU16)*5); } ImU16* wrap_ImGuiIO_GetMouseClickedLastCount(ImGuiIO *self) { return self->MouseClickedLastCount; } void wrap_ImGuiIO_SetMouseReleased(ImGuiIO *ImGuiIOPtr, bool* v) { memcpy(ImGuiIOPtr->MouseReleased, v, sizeof(bool)*5); } @@ -1519,7 +1519,7 @@ void wrap_ImGuiKeyRoutingData_SetRoutingNext(ImGuiKeyRoutingData *ImGuiKeyRoutin ImGuiID wrap_ImGuiKeyRoutingData_GetRoutingNext(ImGuiKeyRoutingData *self) { return self->RoutingNext; } void wrap_ImGuiKeyRoutingTable_SetIndex(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImGuiKeyRoutingIndex* v) { memcpy(ImGuiKeyRoutingTablePtr->Index, v, sizeof(ImGuiKeyRoutingIndex)*154); } ImGuiKeyRoutingIndex* wrap_ImGuiKeyRoutingTable_GetIndex(ImGuiKeyRoutingTable *self) { return self->Index; } -ImGuiKeyRoutingIndex cimgui_ImGuiKeyRoutingIndex_GetAtIdx(ImGuiKeyRoutingIndex *self, int index) { return self[index]; } +ImGuiKeyRoutingIndex imgui_ImGuiKeyRoutingIndex_GetAtIdx(ImGuiKeyRoutingIndex *self, int index) { return self[index]; } void wrap_ImGuiKeyRoutingTable_SetEntries(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImVector_ImGuiKeyRoutingData v) { ImGuiKeyRoutingTablePtr->Entries = v; } ImVector_ImGuiKeyRoutingData wrap_ImGuiKeyRoutingTable_GetEntries(ImGuiKeyRoutingTable *self) { return self->Entries; } void wrap_ImGuiKeyRoutingTable_SetEntriesNext(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImVector_ImGuiKeyRoutingData v) { ImGuiKeyRoutingTablePtr->EntriesNext = v; } @@ -2196,7 +2196,7 @@ void wrap_ImGuiTable_SetRowBgColorCounter(ImGuiTable *ImGuiTablePtr, int v) { Im int wrap_ImGuiTable_GetRowBgColorCounter(ImGuiTable *self) { return self->RowBgColorCounter; } void wrap_ImGuiTable_SetRowBgColor(ImGuiTable *ImGuiTablePtr, ImU32* v) { memcpy(ImGuiTablePtr->RowBgColor, v, sizeof(ImU32)*2); } ImU32* wrap_ImGuiTable_GetRowBgColor(ImGuiTable *self) { return self->RowBgColor; } -ImU32 cimgui_ImU32_GetAtIdx(ImU32 *self, int index) { return self[index]; } +ImU32 imgui_ImU32_GetAtIdx(ImU32 *self, int index) { return self[index]; } void wrap_ImGuiTable_SetBorderColorStrong(ImGuiTable *ImGuiTablePtr, ImU32 v) { ImGuiTablePtr->BorderColorStrong = v; } ImU32 wrap_ImGuiTable_GetBorderColorStrong(ImGuiTable *self) { return self->BorderColorStrong; } void wrap_ImGuiTable_SetBorderColorLight(ImGuiTable *ImGuiTablePtr, ImU32 v) { ImGuiTablePtr->BorderColorLight = v; } @@ -2651,10 +2651,10 @@ void wrap_ImGuiViewportP_SetPlatformMonitor(ImGuiViewportP *ImGuiViewportPPtr, s short wrap_ImGuiViewportP_GetPlatformMonitor(ImGuiViewportP *self) { return self->PlatformMonitor; } void wrap_ImGuiViewportP_SetBgFgDrawListsLastFrame(ImGuiViewportP *ImGuiViewportPPtr, int* v) { memcpy(ImGuiViewportPPtr->BgFgDrawListsLastFrame, v, sizeof(int)*2); } int* wrap_ImGuiViewportP_GetBgFgDrawListsLastFrame(ImGuiViewportP *self) { return self->BgFgDrawListsLastFrame; } -int cimgui_int_GetAtIdx(int *self, int index) { return self[index]; } +int imgui_int_GetAtIdx(int *self, int index) { return self[index]; } void wrap_ImGuiViewportP_SetBgFgDrawLists(ImGuiViewportP *ImGuiViewportPPtr, ImDrawList** v) { memcpy(ImGuiViewportPPtr->BgFgDrawLists, v, sizeof(ImDrawList*)*2); } ImDrawList** wrap_ImGuiViewportP_GetBgFgDrawLists(ImGuiViewportP *self) { return self->BgFgDrawLists; } -ImDrawList* cimgui_ImDrawListPtr_GetAtIdx(ImDrawList* *self, int index) { return self[index]; } +ImDrawList* imgui_ImDrawListPtr_GetAtIdx(ImDrawList* *self, int index) { return self[index]; } void wrap_ImGuiViewportP_SetDrawDataP(ImGuiViewportP *ImGuiViewportPPtr, ImDrawData v) { ImGuiViewportPPtr->DrawDataP = v; } ImDrawData wrap_ImGuiViewportP_GetDrawDataP(ImGuiViewportP *self) { return self->DrawDataP; } void wrap_ImGuiViewportP_SetDrawDataBuilder(ImGuiViewportP *ImGuiViewportPPtr, ImDrawDataBuilder v) { ImGuiViewportPPtr->DrawDataBuilder = v; } @@ -2887,10 +2887,10 @@ void wrap_ImGuiWindow_SetNavLastChildNavWindow(ImGuiWindow *ImGuiWindowPtr, ImGu ImGuiWindow* wrap_ImGuiWindow_GetNavLastChildNavWindow(ImGuiWindow *self) { return self->NavLastChildNavWindow; } void wrap_ImGuiWindow_SetNavLastIds(ImGuiWindow *ImGuiWindowPtr, ImGuiID* v) { memcpy(ImGuiWindowPtr->NavLastIds, v, sizeof(ImGuiID)*2); } ImGuiID* wrap_ImGuiWindow_GetNavLastIds(ImGuiWindow *self) { return self->NavLastIds; } -ImGuiID cimgui_ImGuiID_GetAtIdx(ImGuiID *self, int index) { return self[index]; } +ImGuiID imgui_ImGuiID_GetAtIdx(ImGuiID *self, int index) { return self[index]; } void wrap_ImGuiWindow_SetNavRectRel(ImGuiWindow *ImGuiWindowPtr, ImRect* v) { memcpy(ImGuiWindowPtr->NavRectRel, v, sizeof(ImRect)*2); } ImRect* wrap_ImGuiWindow_GetNavRectRel(ImGuiWindow *self) { return self->NavRectRel; } -ImRect cimgui_ImRect_GetAtIdx(ImRect *self, int index) { return self[index]; } +ImRect imgui_ImRect_GetAtIdx(ImRect *self, int index) { return self[index]; } void wrap_ImGuiWindow_SetNavPreferredScoringPosRel(ImGuiWindow *ImGuiWindowPtr, ImVec2* v) { memcpy(ImGuiWindowPtr->NavPreferredScoringPosRel, v, sizeof(ImVec2)*2); } ImVec2* wrap_ImGuiWindow_GetNavPreferredScoringPosRel(ImGuiWindow *self) { return self->NavPreferredScoringPosRel; } void wrap_ImGuiWindow_SetNavRootFocusScopeId(ImGuiWindow *ImGuiWindowPtr, ImGuiID v) { ImGuiWindowPtr->NavRootFocusScopeId = v; } diff --git a/imgui/structs_accessor.h b/imgui/structs_accessor.h index 86bd02a2..ac4d46a9 100644 --- a/imgui/structs_accessor.h +++ b/imgui/structs_accessor.h @@ -61,7 +61,7 @@ extern void wrap_ImDrawData_SetOwnerViewport(ImDrawData *ImDrawDataPtr, ImGuiVie extern ImGuiViewport* wrap_ImDrawData_GetOwnerViewport(ImDrawData *self); extern void wrap_ImDrawDataBuilder_SetLayers(ImDrawDataBuilder *ImDrawDataBuilderPtr, ImVector_ImDrawListPtr** v); extern ImVector_ImDrawListPtr** wrap_ImDrawDataBuilder_GetLayers(ImDrawDataBuilder *self); -extern ImVector_ImDrawListPtr* cimgui_ImVector_ImDrawListPtrPtr_GetAtIdx(ImVector_ImDrawListPtr* *self, int index); +extern ImVector_ImDrawListPtr* imgui_ImVector_ImDrawListPtrPtr_GetAtIdx(ImVector_ImDrawListPtr* *self, int index); extern void wrap_ImDrawDataBuilder_SetLayerData1(ImDrawDataBuilder *ImDrawDataBuilderPtr, ImVector_ImDrawListPtr v); extern ImVector_ImDrawListPtr wrap_ImDrawDataBuilder_GetLayerData1(ImDrawDataBuilder *self); extern void wrap_ImDrawList_SetCmdBuffer(ImDrawList *ImDrawListPtr, ImVector_ImDrawCmd v); @@ -116,12 +116,12 @@ extern void wrap_ImDrawListSharedData_SetTempBuffer(ImDrawListSharedData *ImDraw extern ImVector_ImVec2 wrap_ImDrawListSharedData_GetTempBuffer(ImDrawListSharedData *self); extern void wrap_ImDrawListSharedData_SetArcFastVtx(ImDrawListSharedData *ImDrawListSharedDataPtr, ImVec2* v); extern ImVec2* wrap_ImDrawListSharedData_GetArcFastVtx(ImDrawListSharedData *self); -extern ImVec2 cimgui_ImVec2_GetAtIdx(ImVec2 *self, int index); +extern ImVec2 imgui_ImVec2_GetAtIdx(ImVec2 *self, int index); extern void wrap_ImDrawListSharedData_SetArcFastRadiusCutoff(ImDrawListSharedData *ImDrawListSharedDataPtr, float v); extern float wrap_ImDrawListSharedData_GetArcFastRadiusCutoff(ImDrawListSharedData *self); extern void wrap_ImDrawListSharedData_SetCircleSegmentCounts(ImDrawListSharedData *ImDrawListSharedDataPtr, ImU8* v); extern ImU8* wrap_ImDrawListSharedData_GetCircleSegmentCounts(ImDrawListSharedData *self); -extern ImU8 cimgui_ImU8_GetAtIdx(ImU8 *self, int index); +extern ImU8 imgui_ImU8_GetAtIdx(ImU8 *self, int index); extern void wrap_ImDrawListSharedData_SetTexUvLines(ImDrawListSharedData *ImDrawListSharedDataPtr, const ImVec4* v); extern const ImVec4* wrap_ImDrawListSharedData_GetTexUvLines(ImDrawListSharedData *self); extern void wrap_ImDrawListSplitter_Set_Current(ImDrawListSplitter *ImDrawListSplitterPtr, int v); @@ -210,7 +210,7 @@ extern void wrap_ImFontAtlas_SetConfigData(ImFontAtlas *ImFontAtlasPtr, ImVector extern ImVector_ImFontConfig wrap_ImFontAtlas_GetConfigData(ImFontAtlas *self); extern void wrap_ImFontAtlas_SetTexUvLines(ImFontAtlas *ImFontAtlasPtr, ImVec4* v); extern ImVec4* wrap_ImFontAtlas_GetTexUvLines(ImFontAtlas *self); -extern ImVec4 cimgui_ImVec4_GetAtIdx(ImVec4 *self, int index); +extern ImVec4 imgui_ImVec4_GetAtIdx(ImVec4 *self, int index); extern void wrap_ImFontAtlas_SetFontBuilderIO(ImFontAtlas *ImFontAtlasPtr, const ImFontBuilderIO* v); extern const ImFontBuilderIO* wrap_ImFontAtlas_GetFontBuilderIO(ImFontAtlas *self); extern void wrap_ImFontAtlas_SetFontBuilderFlags(ImFontAtlas *ImFontAtlasPtr, unsigned int v); @@ -273,7 +273,7 @@ extern void wrap_ImFontConfig_SetEllipsisChar(ImFontConfig *ImFontConfigPtr, ImW extern ImWchar wrap_ImFontConfig_GetEllipsisChar(ImFontConfig *self); extern void wrap_ImFontConfig_SetName(ImFontConfig *ImFontConfigPtr, char* v); extern char* wrap_ImFontConfig_GetName(ImFontConfig *self); -extern char cimgui_char_GetAtIdx(char *self, int index); +extern char imgui_char_GetAtIdx(char *self, int index); extern void wrap_ImFontConfig_SetDstFont(ImFontConfig *ImFontConfigPtr, ImFont* v); extern ImFont* wrap_ImFontConfig_GetDstFont(ImFontConfig *self); extern void wrap_ImFontGlyph_SetColored(ImFontGlyph *ImFontGlyphPtr, unsigned int v); @@ -516,7 +516,7 @@ extern void wrap_ImGuiContext_SetKeysMayBeCharInput(ImGuiContext *ImGuiContextPt extern ImBitArrayForNamedKeys wrap_ImGuiContext_GetKeysMayBeCharInput(ImGuiContext *self); extern void wrap_ImGuiContext_SetKeysOwnerData(ImGuiContext *ImGuiContextPtr, ImGuiKeyOwnerData* v); extern ImGuiKeyOwnerData* wrap_ImGuiContext_GetKeysOwnerData(ImGuiContext *self); -extern ImGuiKeyOwnerData cimgui_ImGuiKeyOwnerData_GetAtIdx(ImGuiKeyOwnerData *self, int index); +extern ImGuiKeyOwnerData imgui_ImGuiKeyOwnerData_GetAtIdx(ImGuiKeyOwnerData *self, int index); extern void wrap_ImGuiContext_SetKeysRoutingTable(ImGuiContext *ImGuiContextPtr, ImGuiKeyRoutingTable v); extern ImGuiKeyRoutingTable wrap_ImGuiContext_GetKeysRoutingTable(ImGuiContext *self); extern void wrap_ImGuiContext_SetActiveIdUsingNavDirMask(ImGuiContext *ImGuiContextPtr, ImU32 v); @@ -735,7 +735,7 @@ extern void wrap_ImGuiContext_SetDragDropPayloadBufHeap(ImGuiContext *ImGuiConte extern ImVector_unsigned_char wrap_ImGuiContext_GetDragDropPayloadBufHeap(ImGuiContext *self); extern void wrap_ImGuiContext_SetDragDropPayloadBufLocal(ImGuiContext *ImGuiContextPtr, unsigned char* v); extern unsigned char* wrap_ImGuiContext_GetDragDropPayloadBufLocal(ImGuiContext *self); -extern unsigned char cimgui_unsigned_char_GetAtIdx(unsigned char *self, int index); +extern unsigned char imgui_unsigned_char_GetAtIdx(unsigned char *self, int index); extern void wrap_ImGuiContext_SetClipperTempDataStacked(ImGuiContext *ImGuiContextPtr, int v); extern int wrap_ImGuiContext_GetClipperTempDataStacked(ImGuiContext *self); extern void wrap_ImGuiContext_SetClipperTempData(ImGuiContext *ImGuiContextPtr, ImVector_ImGuiListClipperData v); @@ -880,7 +880,7 @@ extern void wrap_ImGuiContext_SetHookIdNext(ImGuiContext *ImGuiContextPtr, ImGui extern ImGuiID wrap_ImGuiContext_GetHookIdNext(ImGuiContext *self); extern void wrap_ImGuiContext_SetLocalizationTable(ImGuiContext *ImGuiContextPtr, const char** v); extern const char** wrap_ImGuiContext_GetLocalizationTable(ImGuiContext *self); -extern const char* cimgui_const_charPtr_GetAtIdx(const char* *self, int index); +extern const char* imgui_const_charPtr_GetAtIdx(const char* *self, int index); extern void wrap_ImGuiContext_SetLogEnabled(ImGuiContext *ImGuiContextPtr, bool v); extern bool wrap_ImGuiContext_GetLogEnabled(ImGuiContext *self); extern void wrap_ImGuiContext_SetLogType(ImGuiContext *ImGuiContextPtr, ImGuiLogType v); @@ -959,7 +959,7 @@ extern void wrap_ImGuiContext_SetDebugHoveredDockNode(ImGuiContext *ImGuiContext extern ImGuiDockNode* wrap_ImGuiContext_GetDebugHoveredDockNode(ImGuiContext *self); extern void wrap_ImGuiContext_SetFramerateSecPerFrame(ImGuiContext *ImGuiContextPtr, float* v); extern float* wrap_ImGuiContext_GetFramerateSecPerFrame(ImGuiContext *self); -extern float cimgui_float_GetAtIdx(float *self, int index); +extern float imgui_float_GetAtIdx(float *self, int index); extern void wrap_ImGuiContext_SetFramerateSecPerFrameIdx(ImGuiContext *ImGuiContextPtr, int v); extern int wrap_ImGuiContext_GetFramerateSecPerFrameIdx(ImGuiContext *self); extern void wrap_ImGuiContext_SetFramerateSecPerFrameCount(ImGuiContext *ImGuiContextPtr, int v); @@ -1016,7 +1016,7 @@ extern void wrap_ImGuiDebugAllocInfo_SetLastEntriesIdx(ImGuiDebugAllocInfo *ImGu extern ImS16 wrap_ImGuiDebugAllocInfo_GetLastEntriesIdx(ImGuiDebugAllocInfo *self); extern void wrap_ImGuiDebugAllocInfo_SetLastEntriesBuf(ImGuiDebugAllocInfo *ImGuiDebugAllocInfoPtr, ImGuiDebugAllocEntry* v); extern ImGuiDebugAllocEntry* wrap_ImGuiDebugAllocInfo_GetLastEntriesBuf(ImGuiDebugAllocInfo *self); -extern ImGuiDebugAllocEntry cimgui_ImGuiDebugAllocEntry_GetAtIdx(ImGuiDebugAllocEntry *self, int index); +extern ImGuiDebugAllocEntry imgui_ImGuiDebugAllocEntry_GetAtIdx(ImGuiDebugAllocEntry *self, int index); extern void wrap_ImGuiDockContext_SetNodes(ImGuiDockContext *ImGuiDockContextPtr, ImGuiStorage v); extern ImGuiStorage wrap_ImGuiDockContext_GetNodes(ImGuiDockContext *self); extern void wrap_ImGuiDockContext_SetRequests(ImGuiDockContext *ImGuiDockContextPtr, ImVector_ImGuiDockRequest v); @@ -1039,7 +1039,7 @@ extern void wrap_ImGuiDockNode_SetParentNode(ImGuiDockNode *ImGuiDockNodePtr, Im extern ImGuiDockNode* wrap_ImGuiDockNode_GetParentNode(ImGuiDockNode *self); extern void wrap_ImGuiDockNode_SetChildNodes(ImGuiDockNode *ImGuiDockNodePtr, ImGuiDockNode** v); extern ImGuiDockNode** wrap_ImGuiDockNode_GetChildNodes(ImGuiDockNode *self); -extern ImGuiDockNode* cimgui_ImGuiDockNodePtr_GetAtIdx(ImGuiDockNode* *self, int index); +extern ImGuiDockNode* imgui_ImGuiDockNodePtr_GetAtIdx(ImGuiDockNode* *self, int index); extern void wrap_ImGuiDockNode_SetWindows(ImGuiDockNode *ImGuiDockNodePtr, ImVector_ImGuiWindowPtr v); extern ImVector_ImGuiWindowPtr wrap_ImGuiDockNode_GetWindows(ImGuiDockNode *self); extern void wrap_ImGuiDockNode_SetTabBar(ImGuiDockNode *ImGuiDockNodePtr, ImGuiTabBar* v); @@ -1320,7 +1320,7 @@ extern void wrap_ImGuiIO_SetMousePos(ImGuiIO *ImGuiIOPtr, ImVec2 v); extern ImVec2 wrap_ImGuiIO_GetMousePos(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseDown(ImGuiIO *ImGuiIOPtr, bool* v); extern bool* wrap_ImGuiIO_GetMouseDown(ImGuiIO *self); -extern bool cimgui_bool_GetAtIdx(bool *self, int index); +extern bool imgui_bool_GetAtIdx(bool *self, int index); extern void wrap_ImGuiIO_SetMouseWheel(ImGuiIO *ImGuiIOPtr, float v); extern float wrap_ImGuiIO_GetMouseWheel(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseWheelH(ImGuiIO *ImGuiIOPtr, float v); @@ -1341,7 +1341,7 @@ extern void wrap_ImGuiIO_SetKeyMods(ImGuiIO *ImGuiIOPtr, ImGuiKeyChord v); extern ImGuiKeyChord wrap_ImGuiIO_GetKeyMods(ImGuiIO *self); extern void wrap_ImGuiIO_SetKeysData(ImGuiIO *ImGuiIOPtr, ImGuiKeyData* v); extern ImGuiKeyData* wrap_ImGuiIO_GetKeysData(ImGuiIO *self); -extern ImGuiKeyData cimgui_ImGuiKeyData_GetAtIdx(ImGuiKeyData *self, int index); +extern ImGuiKeyData imgui_ImGuiKeyData_GetAtIdx(ImGuiKeyData *self, int index); extern void wrap_ImGuiIO_SetWantCaptureMouseUnlessPopupClose(ImGuiIO *ImGuiIOPtr, bool v); extern bool wrap_ImGuiIO_GetWantCaptureMouseUnlessPopupClose(ImGuiIO *self); extern void wrap_ImGuiIO_SetMousePosPrev(ImGuiIO *ImGuiIOPtr, ImVec2 v); @@ -1350,14 +1350,14 @@ extern void wrap_ImGuiIO_SetMouseClickedPos(ImGuiIO *ImGuiIOPtr, ImVec2* v); extern ImVec2* wrap_ImGuiIO_GetMouseClickedPos(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseClickedTime(ImGuiIO *ImGuiIOPtr, double* v); extern double* wrap_ImGuiIO_GetMouseClickedTime(ImGuiIO *self); -extern double cimgui_double_GetAtIdx(double *self, int index); +extern double imgui_double_GetAtIdx(double *self, int index); extern void wrap_ImGuiIO_SetMouseClicked(ImGuiIO *ImGuiIOPtr, bool* v); extern bool* wrap_ImGuiIO_GetMouseClicked(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseDoubleClicked(ImGuiIO *ImGuiIOPtr, bool* v); extern bool* wrap_ImGuiIO_GetMouseDoubleClicked(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseClickedCount(ImGuiIO *ImGuiIOPtr, ImU16* v); extern ImU16* wrap_ImGuiIO_GetMouseClickedCount(ImGuiIO *self); -extern ImU16 cimgui_ImU16_GetAtIdx(ImU16 *self, int index); +extern ImU16 imgui_ImU16_GetAtIdx(ImU16 *self, int index); extern void wrap_ImGuiIO_SetMouseClickedLastCount(ImGuiIO *ImGuiIOPtr, ImU16* v); extern ImU16* wrap_ImGuiIO_GetMouseClickedLastCount(ImGuiIO *self); extern void wrap_ImGuiIO_SetMouseReleased(ImGuiIO *ImGuiIOPtr, bool* v); @@ -1522,7 +1522,7 @@ extern void wrap_ImGuiKeyRoutingData_SetRoutingNext(ImGuiKeyRoutingData *ImGuiKe extern ImGuiID wrap_ImGuiKeyRoutingData_GetRoutingNext(ImGuiKeyRoutingData *self); extern void wrap_ImGuiKeyRoutingTable_SetIndex(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImGuiKeyRoutingIndex* v); extern ImGuiKeyRoutingIndex* wrap_ImGuiKeyRoutingTable_GetIndex(ImGuiKeyRoutingTable *self); -extern ImGuiKeyRoutingIndex cimgui_ImGuiKeyRoutingIndex_GetAtIdx(ImGuiKeyRoutingIndex *self, int index); +extern ImGuiKeyRoutingIndex imgui_ImGuiKeyRoutingIndex_GetAtIdx(ImGuiKeyRoutingIndex *self, int index); extern void wrap_ImGuiKeyRoutingTable_SetEntries(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImVector_ImGuiKeyRoutingData v); extern ImVector_ImGuiKeyRoutingData wrap_ImGuiKeyRoutingTable_GetEntries(ImGuiKeyRoutingTable *self); extern void wrap_ImGuiKeyRoutingTable_SetEntriesNext(ImGuiKeyRoutingTable *ImGuiKeyRoutingTablePtr, ImVector_ImGuiKeyRoutingData v); @@ -2199,7 +2199,7 @@ extern void wrap_ImGuiTable_SetRowBgColorCounter(ImGuiTable *ImGuiTablePtr, int extern int wrap_ImGuiTable_GetRowBgColorCounter(ImGuiTable *self); extern void wrap_ImGuiTable_SetRowBgColor(ImGuiTable *ImGuiTablePtr, ImU32* v); extern ImU32* wrap_ImGuiTable_GetRowBgColor(ImGuiTable *self); -extern ImU32 cimgui_ImU32_GetAtIdx(ImU32 *self, int index); +extern ImU32 imgui_ImU32_GetAtIdx(ImU32 *self, int index); extern void wrap_ImGuiTable_SetBorderColorStrong(ImGuiTable *ImGuiTablePtr, ImU32 v); extern ImU32 wrap_ImGuiTable_GetBorderColorStrong(ImGuiTable *self); extern void wrap_ImGuiTable_SetBorderColorLight(ImGuiTable *ImGuiTablePtr, ImU32 v); @@ -2654,10 +2654,10 @@ extern void wrap_ImGuiViewportP_SetPlatformMonitor(ImGuiViewportP *ImGuiViewport extern short wrap_ImGuiViewportP_GetPlatformMonitor(ImGuiViewportP *self); extern void wrap_ImGuiViewportP_SetBgFgDrawListsLastFrame(ImGuiViewportP *ImGuiViewportPPtr, int* v); extern int* wrap_ImGuiViewportP_GetBgFgDrawListsLastFrame(ImGuiViewportP *self); -extern int cimgui_int_GetAtIdx(int *self, int index); +extern int imgui_int_GetAtIdx(int *self, int index); extern void wrap_ImGuiViewportP_SetBgFgDrawLists(ImGuiViewportP *ImGuiViewportPPtr, ImDrawList** v); extern ImDrawList** wrap_ImGuiViewportP_GetBgFgDrawLists(ImGuiViewportP *self); -extern ImDrawList* cimgui_ImDrawListPtr_GetAtIdx(ImDrawList* *self, int index); +extern ImDrawList* imgui_ImDrawListPtr_GetAtIdx(ImDrawList* *self, int index); extern void wrap_ImGuiViewportP_SetDrawDataP(ImGuiViewportP *ImGuiViewportPPtr, ImDrawData v); extern ImDrawData wrap_ImGuiViewportP_GetDrawDataP(ImGuiViewportP *self); extern void wrap_ImGuiViewportP_SetDrawDataBuilder(ImGuiViewportP *ImGuiViewportPPtr, ImDrawDataBuilder v); @@ -2890,10 +2890,10 @@ extern void wrap_ImGuiWindow_SetNavLastChildNavWindow(ImGuiWindow *ImGuiWindowPt extern ImGuiWindow* wrap_ImGuiWindow_GetNavLastChildNavWindow(ImGuiWindow *self); extern void wrap_ImGuiWindow_SetNavLastIds(ImGuiWindow *ImGuiWindowPtr, ImGuiID* v); extern ImGuiID* wrap_ImGuiWindow_GetNavLastIds(ImGuiWindow *self); -extern ImGuiID cimgui_ImGuiID_GetAtIdx(ImGuiID *self, int index); +extern ImGuiID imgui_ImGuiID_GetAtIdx(ImGuiID *self, int index); extern void wrap_ImGuiWindow_SetNavRectRel(ImGuiWindow *ImGuiWindowPtr, ImRect* v); extern ImRect* wrap_ImGuiWindow_GetNavRectRel(ImGuiWindow *self); -extern ImRect cimgui_ImRect_GetAtIdx(ImRect *self, int index); +extern ImRect imgui_ImRect_GetAtIdx(ImRect *self, int index); extern void wrap_ImGuiWindow_SetNavPreferredScoringPosRel(ImGuiWindow *ImGuiWindowPtr, ImVec2* v); extern ImVec2* wrap_ImGuiWindow_GetNavPreferredScoringPosRel(ImGuiWindow *self); extern void wrap_ImGuiWindow_SetNavRootFocusScopeId(ImGuiWindow *ImGuiWindowPtr, ImGuiID v); diff --git a/imguizmo/funcs.go b/imguizmo/funcs.go index 3e6efec4..0302c816 100644 --- a/imguizmo/funcs.go +++ b/imguizmo/funcs.go @@ -439,7 +439,7 @@ func (self *Style) Colors() [15]imgui.Vec4 { resultMirr := C.wrap_Style_GetColors(internal.ReinterpretCast[*C.Style](selfArg)) for i := range result { result[i] = func() imgui.Vec4 { - out := C.cimguizmo_ImVec4_GetAtIdx(resultMirr, C.int(i)) + out := C.imguizmo_ImVec4_GetAtIdx(resultMirr, C.int(i)) return *(&imgui.Vec4{}).FromC(unsafe.Pointer(&out)) }() } diff --git a/imguizmo/structs_accessor.cpp b/imguizmo/structs_accessor.cpp index dedb6132..60ebe3ad 100644 --- a/imguizmo/structs_accessor.cpp +++ b/imguizmo/structs_accessor.cpp @@ -24,4 +24,4 @@ void wrap_Style_SetCenterCircleSize(Style *StylePtr, float v) { StylePtr->Center float wrap_Style_GetCenterCircleSize(Style *self) { return self->CenterCircleSize; } void wrap_Style_SetColors(Style *StylePtr, ImVec4* v) { memcpy(StylePtr->Colors, v, sizeof(ImVec4)*15); } ImVec4* wrap_Style_GetColors(Style *self) { return self->Colors; } -ImVec4 cimguizmo_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } +ImVec4 imguizmo_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } diff --git a/imguizmo/structs_accessor.h b/imguizmo/structs_accessor.h index d85a7750..f5323ac6 100644 --- a/imguizmo/structs_accessor.h +++ b/imguizmo/structs_accessor.h @@ -27,7 +27,7 @@ extern void wrap_Style_SetCenterCircleSize(Style *StylePtr, float v); extern float wrap_Style_GetCenterCircleSize(Style *self); extern void wrap_Style_SetColors(Style *StylePtr, ImVec4* v); extern ImVec4* wrap_Style_GetColors(Style *self); -extern ImVec4 cimguizmo_ImVec4_GetAtIdx(ImVec4 *self, int index); +extern ImVec4 imguizmo_ImVec4_GetAtIdx(ImVec4 *self, int index); #ifdef __cplusplus } diff --git a/immarkdown/funcs.go b/immarkdown/funcs.go index b88b0b79..121755d9 100644 --- a/immarkdown/funcs.go +++ b/immarkdown/funcs.go @@ -547,7 +547,7 @@ func (self *MarkdownConfig) HeadingFormats() [3]MarkdownHeadingFormat { resultMirr := C.wrap_MarkdownConfig_GetHeadingFormats(internal.ReinterpretCast[*C.MarkdownConfig](selfArg)) for i := range result { result[i] = *NewMarkdownHeadingFormatFromC(func() *C.MarkdownHeadingFormat { - result := C.cimmarkdown_MarkdownHeadingFormat_GetAtIdx(resultMirr, C.int(i)) + result := C.immarkdown_MarkdownHeadingFormat_GetAtIdx(resultMirr, C.int(i)) return &result }()) } diff --git a/immarkdown/structs_accessor.cpp b/immarkdown/structs_accessor.cpp index 2953de25..02bf7784 100644 --- a/immarkdown/structs_accessor.cpp +++ b/immarkdown/structs_accessor.cpp @@ -52,7 +52,7 @@ void wrap_MarkdownConfig_SetLinkIcon(MarkdownConfig *MarkdownConfigPtr, const ch const char* wrap_MarkdownConfig_GetLinkIcon(MarkdownConfig *self) { return self->linkIcon; } void wrap_MarkdownConfig_SetHeadingFormats(MarkdownConfig *MarkdownConfigPtr, MarkdownHeadingFormat* v) { memcpy(MarkdownConfigPtr->headingFormats, v, sizeof(MarkdownHeadingFormat)*3); } MarkdownHeadingFormat* wrap_MarkdownConfig_GetHeadingFormats(MarkdownConfig *self) { return self->headingFormats; } -MarkdownHeadingFormat cimmarkdown_MarkdownHeadingFormat_GetAtIdx(MarkdownHeadingFormat *self, int index) { return self[index]; } +MarkdownHeadingFormat immarkdown_MarkdownHeadingFormat_GetAtIdx(MarkdownHeadingFormat *self, int index) { return self[index]; } void wrap_MarkdownConfig_SetUserData(MarkdownConfig *MarkdownConfigPtr, uintptr_t v) { MarkdownConfigPtr->userData = (void*)v; } uintptr_t wrap_MarkdownConfig_GetUserData(MarkdownConfig *self) { return (uintptr_t)self->userData; } void wrap_MarkdownConfig_SetFormatCallback(MarkdownConfig *MarkdownConfigPtr, MarkdownFormalCallback* v) { MarkdownConfigPtr->formatCallback = v; } diff --git a/immarkdown/structs_accessor.h b/immarkdown/structs_accessor.h index b7503bf6..850cbac7 100644 --- a/immarkdown/structs_accessor.h +++ b/immarkdown/structs_accessor.h @@ -55,7 +55,7 @@ extern void wrap_MarkdownConfig_SetLinkIcon(MarkdownConfig *MarkdownConfigPtr, c extern const char* wrap_MarkdownConfig_GetLinkIcon(MarkdownConfig *self); extern void wrap_MarkdownConfig_SetHeadingFormats(MarkdownConfig *MarkdownConfigPtr, MarkdownHeadingFormat* v); extern MarkdownHeadingFormat* wrap_MarkdownConfig_GetHeadingFormats(MarkdownConfig *self); -extern MarkdownHeadingFormat cimmarkdown_MarkdownHeadingFormat_GetAtIdx(MarkdownHeadingFormat *self, int index); +extern MarkdownHeadingFormat immarkdown_MarkdownHeadingFormat_GetAtIdx(MarkdownHeadingFormat *self, int index); extern void wrap_MarkdownConfig_SetUserData(MarkdownConfig *MarkdownConfigPtr, uintptr_t v); extern uintptr_t wrap_MarkdownConfig_GetUserData(MarkdownConfig *self); extern void wrap_MarkdownConfig_SetFormatCallback(MarkdownConfig *MarkdownConfigPtr, MarkdownFormalCallback* v); diff --git a/imnodes/funcs.go b/imnodes/funcs.go index 9712a9ff..c8812251 100644 --- a/imnodes/funcs.go +++ b/imnodes/funcs.go @@ -1023,7 +1023,7 @@ func (self *Style) Colors() [29]uint32 { result := [29]uint32{} resultMirr := C.wrap_ImNodesStyle_GetColors(internal.ReinterpretCast[*C.ImNodesStyle](selfArg)) for i := range result { - result[i] = uint32(C.cimnodes_unsigned_int_GetAtIdx(resultMirr, C.int(i))) + result[i] = uint32(C.imnodes_unsigned_int_GetAtIdx(resultMirr, C.int(i))) } return result diff --git a/imnodes/structs_accessor.cpp b/imnodes/structs_accessor.cpp index 69144003..5961496d 100644 --- a/imnodes/structs_accessor.cpp +++ b/imnodes/structs_accessor.cpp @@ -52,7 +52,7 @@ void wrap_ImNodesStyle_SetFlags(ImNodesStyle *ImNodesStylePtr, ImNodesStyleFlags ImNodesStyleFlags wrap_ImNodesStyle_GetFlags(ImNodesStyle *self) { return self->Flags; } void wrap_ImNodesStyle_SetColors(ImNodesStyle *ImNodesStylePtr, unsigned int* v) { memcpy(ImNodesStylePtr->Colors, v, sizeof(unsigned int)*29); } unsigned int* wrap_ImNodesStyle_GetColors(ImNodesStyle *self) { return self->Colors; } -unsigned int cimnodes_unsigned_int_GetAtIdx(unsigned int *self, int index) { return self[index]; } +unsigned int imnodes_unsigned_int_GetAtIdx(unsigned int *self, int index) { return self[index]; } void wrap_LinkDetachWithModifierClick_SetModifier(LinkDetachWithModifierClick *LinkDetachWithModifierClickPtr, const bool* v) { LinkDetachWithModifierClickPtr->Modifier = v; } const bool* wrap_LinkDetachWithModifierClick_GetModifier(LinkDetachWithModifierClick *self) { return self->Modifier; } void wrap_MultipleSelectModifier_SetModifier(MultipleSelectModifier *MultipleSelectModifierPtr, const bool* v) { MultipleSelectModifierPtr->Modifier = v; } diff --git a/imnodes/structs_accessor.h b/imnodes/structs_accessor.h index 5b342401..7d4cdb65 100644 --- a/imnodes/structs_accessor.h +++ b/imnodes/structs_accessor.h @@ -55,7 +55,7 @@ extern void wrap_ImNodesStyle_SetFlags(ImNodesStyle *ImNodesStylePtr, ImNodesSty extern ImNodesStyleFlags wrap_ImNodesStyle_GetFlags(ImNodesStyle *self); extern void wrap_ImNodesStyle_SetColors(ImNodesStyle *ImNodesStylePtr, unsigned int* v); extern unsigned int* wrap_ImNodesStyle_GetColors(ImNodesStyle *self); -extern unsigned int cimnodes_unsigned_int_GetAtIdx(unsigned int *self, int index); +extern unsigned int imnodes_unsigned_int_GetAtIdx(unsigned int *self, int index); extern void wrap_LinkDetachWithModifierClick_SetModifier(LinkDetachWithModifierClick *LinkDetachWithModifierClickPtr, const bool* v); extern const bool* wrap_LinkDetachWithModifierClick_GetModifier(LinkDetachWithModifierClick *self); extern void wrap_MultipleSelectModifier_SetModifier(MultipleSelectModifier *MultipleSelectModifierPtr, const bool* v); diff --git a/implot/funcs.go b/implot/funcs.go index d3095c9d..e2dc1a25 100644 --- a/implot/funcs.go +++ b/implot/funcs.go @@ -10918,7 +10918,7 @@ func (self *Axis) FormatSpec() [16]rune { result := [16]rune{} resultMirr := C.wrap_ImPlotAxis_GetFormatSpec(internal.ReinterpretCast[*C.ImPlotAxis](selfArg)) for i := range result { - result[i] = rune(C.cimplot_char_GetAtIdx(resultMirr, C.int(i))) + result[i] = rune(C.implot_char_GetAtIdx(resultMirr, C.int(i))) } return result @@ -12815,7 +12815,7 @@ func (self *NextItemData) Colors() [5]imgui.Vec4 { resultMirr := C.wrap_ImPlotNextItemData_GetColors(internal.ReinterpretCast[*C.ImPlotNextItemData](selfArg)) for i := range result { result[i] = func() imgui.Vec4 { - out := C.cimplot_ImVec4_GetAtIdx(resultMirr, C.int(i)) + out := C.implot_ImVec4_GetAtIdx(resultMirr, C.int(i)) return *(&imgui.Vec4{}).FromC(unsafe.Pointer(&out)) }() } @@ -13089,7 +13089,7 @@ func (self *NextPlotData) RangeCond() [6]Cond { result := [6]Cond{} resultMirr := C.wrap_ImPlotNextPlotData_GetRangeCond(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = Cond(C.cimplot_ImPlotCond_GetAtIdx(resultMirr, C.int(i))) + result[i] = Cond(C.implot_ImPlotCond_GetAtIdx(resultMirr, C.int(i))) } return result @@ -13122,7 +13122,7 @@ func (self *NextPlotData) Range() [6]Range { result := [6]Range{} resultMirr := C.wrap_ImPlotNextPlotData_GetRange(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = *NewRangeFromC(func() *C.ImPlotRange { result := C.cimplot_ImPlotRange_GetAtIdx(resultMirr, C.int(i)); return &result }()) + result[i] = *NewRangeFromC(func() *C.ImPlotRange { result := C.implot_ImPlotRange_GetAtIdx(resultMirr, C.int(i)); return &result }()) } return result @@ -13154,7 +13154,7 @@ func (self *NextPlotData) HasRange() [6]bool { result := [6]bool{} resultMirr := C.wrap_ImPlotNextPlotData_GetHasRange(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = C.cimplot_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.implot_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -13186,7 +13186,7 @@ func (self *NextPlotData) Fit() [6]bool { result := [6]bool{} resultMirr := C.wrap_ImPlotNextPlotData_GetFit(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = C.cimplot_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) + result[i] = C.implot_bool_GetAtIdx(resultMirr, C.int(i)) == C.bool(true) } return result @@ -13219,7 +13219,7 @@ func (self *NextPlotData) LinkedMin() [6]*float64 { result := [6]*float64{} resultMirr := C.wrap_ImPlotNextPlotData_GetLinkedMin(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = (*float64)(C.cimplot_doublePtr_GetAtIdx(resultMirr, C.int(i))) + result[i] = (*float64)(C.implot_doublePtr_GetAtIdx(resultMirr, C.int(i))) } return result @@ -13252,7 +13252,7 @@ func (self *NextPlotData) LinkedMax() [6]*float64 { result := [6]*float64{} resultMirr := C.wrap_ImPlotNextPlotData_GetLinkedMax(internal.ReinterpretCast[*C.ImPlotNextPlotData](selfArg)) for i := range result { - result[i] = (*float64)(C.cimplot_doublePtr_GetAtIdx(resultMirr, C.int(i))) + result[i] = (*float64)(C.implot_doublePtr_GetAtIdx(resultMirr, C.int(i))) } return result @@ -13365,7 +13365,7 @@ func (self *Plot) Axes() [6]Axis { result := [6]Axis{} resultMirr := C.wrap_ImPlotPlot_GetAxes(internal.ReinterpretCast[*C.ImPlotPlot](selfArg)) for i := range result { - result[i] = *NewAxisFromC(func() *C.ImPlotAxis { result := C.cimplot_ImPlotAxis_GetAtIdx(resultMirr, C.int(i)); return &result }()) + result[i] = *NewAxisFromC(func() *C.ImPlotAxis { result := C.implot_ImPlotAxis_GetAtIdx(resultMirr, C.int(i)); return &result }()) } return result @@ -14306,7 +14306,7 @@ func (self *Style) Colors() [21]imgui.Vec4 { resultMirr := C.wrap_ImPlotStyle_GetColors(internal.ReinterpretCast[*C.ImPlotStyle](selfArg)) for i := range result { result[i] = func() imgui.Vec4 { - out := C.cimplot_ImVec4_GetAtIdx(resultMirr, C.int(i)) + out := C.implot_ImVec4_GetAtIdx(resultMirr, C.int(i)) return *(&imgui.Vec4{}).FromC(unsafe.Pointer(&out)) }() } @@ -14706,7 +14706,7 @@ func (self *Subplot) TempSizes() [2]float32 { result := [2]float32{} resultMirr := C.wrap_ImPlotSubplot_GetTempSizes(internal.ReinterpretCast[*C.ImPlotSubplot](selfArg)) for i := range result { - result[i] = float32(C.cimplot_float_GetAtIdx(resultMirr, C.int(i))) + result[i] = float32(C.implot_float_GetAtIdx(resultMirr, C.int(i))) } return result diff --git a/implot/structs_accessor.cpp b/implot/structs_accessor.cpp index 777839b6..72b3db26 100644 --- a/implot/structs_accessor.cpp +++ b/implot/structs_accessor.cpp @@ -70,7 +70,7 @@ void wrap_ImPlotAxis_SetFormatterData(ImPlotAxis *ImPlotAxisPtr, uintptr_t v) { uintptr_t wrap_ImPlotAxis_GetFormatterData(ImPlotAxis *self) { return (uintptr_t)self->FormatterData; } void wrap_ImPlotAxis_SetFormatSpec(ImPlotAxis *ImPlotAxisPtr, char* v) { memcpy(ImPlotAxisPtr->FormatSpec, v, sizeof(char)*16); } char* wrap_ImPlotAxis_GetFormatSpec(ImPlotAxis *self) { return self->FormatSpec; } -char cimplot_char_GetAtIdx(char *self, int index) { return self[index]; } +char implot_char_GetAtIdx(char *self, int index) { return self[index]; } void wrap_ImPlotAxis_SetLocator(ImPlotAxis *ImPlotAxisPtr, ImPlotLocator v) { ImPlotAxisPtr->Locator = v; } ImPlotLocator wrap_ImPlotAxis_GetLocator(ImPlotAxis *self) { return self->Locator; } void wrap_ImPlotAxis_SetLinkedMin(ImPlotAxis *ImPlotAxisPtr, double* v) { ImPlotAxisPtr->LinkedMin = v; } @@ -300,7 +300,7 @@ void wrap_ImPlotLegend_SetCanGoInside(ImPlotLegend *ImPlotLegendPtr, bool v) { I bool wrap_ImPlotLegend_GetCanGoInside(ImPlotLegend *self) { return self->CanGoInside; } void wrap_ImPlotNextItemData_SetColors(ImPlotNextItemData *ImPlotNextItemDataPtr, ImVec4* v) { memcpy(ImPlotNextItemDataPtr->Colors, v, sizeof(ImVec4)*5); } ImVec4* wrap_ImPlotNextItemData_GetColors(ImPlotNextItemData *self) { return self->Colors; } -ImVec4 cimplot_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } +ImVec4 implot_ImVec4_GetAtIdx(ImVec4 *self, int index) { return self[index]; } void wrap_ImPlotNextItemData_SetLineWeight(ImPlotNextItemData *ImPlotNextItemDataPtr, float v) { ImPlotNextItemDataPtr->LineWeight = v; } float wrap_ImPlotNextItemData_GetLineWeight(ImPlotNextItemData *self) { return self->LineWeight; } void wrap_ImPlotNextItemData_SetMarker(ImPlotNextItemData *ImPlotNextItemDataPtr, ImPlotMarker v) { ImPlotNextItemDataPtr->Marker = v; } @@ -335,18 +335,18 @@ void wrap_ImPlotNextItemData_SetHiddenCond(ImPlotNextItemData *ImPlotNextItemDat ImPlotCond wrap_ImPlotNextItemData_GetHiddenCond(ImPlotNextItemData *self) { return self->HiddenCond; } void wrap_ImPlotNextPlotData_SetRangeCond(ImPlotNextPlotData *ImPlotNextPlotDataPtr, ImPlotCond* v) { memcpy(ImPlotNextPlotDataPtr->RangeCond, v, sizeof(ImPlotCond)*6); } ImPlotCond* wrap_ImPlotNextPlotData_GetRangeCond(ImPlotNextPlotData *self) { return self->RangeCond; } -ImPlotCond cimplot_ImPlotCond_GetAtIdx(ImPlotCond *self, int index) { return self[index]; } +ImPlotCond implot_ImPlotCond_GetAtIdx(ImPlotCond *self, int index) { return self[index]; } void wrap_ImPlotNextPlotData_SetRange(ImPlotNextPlotData *ImPlotNextPlotDataPtr, ImPlotRange* v) { memcpy(ImPlotNextPlotDataPtr->Range, v, sizeof(ImPlotRange)*6); } ImPlotRange* wrap_ImPlotNextPlotData_GetRange(ImPlotNextPlotData *self) { return self->Range; } -ImPlotRange cimplot_ImPlotRange_GetAtIdx(ImPlotRange *self, int index) { return self[index]; } +ImPlotRange implot_ImPlotRange_GetAtIdx(ImPlotRange *self, int index) { return self[index]; } void wrap_ImPlotNextPlotData_SetHasRange(ImPlotNextPlotData *ImPlotNextPlotDataPtr, bool* v) { memcpy(ImPlotNextPlotDataPtr->HasRange, v, sizeof(bool)*6); } bool* wrap_ImPlotNextPlotData_GetHasRange(ImPlotNextPlotData *self) { return self->HasRange; } -bool cimplot_bool_GetAtIdx(bool *self, int index) { return self[index]; } +bool implot_bool_GetAtIdx(bool *self, int index) { return self[index]; } void wrap_ImPlotNextPlotData_SetFit(ImPlotNextPlotData *ImPlotNextPlotDataPtr, bool* v) { memcpy(ImPlotNextPlotDataPtr->Fit, v, sizeof(bool)*6); } bool* wrap_ImPlotNextPlotData_GetFit(ImPlotNextPlotData *self) { return self->Fit; } void wrap_ImPlotNextPlotData_SetLinkedMin(ImPlotNextPlotData *ImPlotNextPlotDataPtr, double** v) { memcpy(ImPlotNextPlotDataPtr->LinkedMin, v, sizeof(double*)*6); } double** wrap_ImPlotNextPlotData_GetLinkedMin(ImPlotNextPlotData *self) { return self->LinkedMin; } -double* cimplot_doublePtr_GetAtIdx(double* *self, int index) { return self[index]; } +double* implot_doublePtr_GetAtIdx(double* *self, int index) { return self[index]; } void wrap_ImPlotNextPlotData_SetLinkedMax(ImPlotNextPlotData *ImPlotNextPlotDataPtr, double** v) { memcpy(ImPlotNextPlotDataPtr->LinkedMax, v, sizeof(double*)*6); } double** wrap_ImPlotNextPlotData_GetLinkedMax(ImPlotNextPlotData *self) { return self->LinkedMax; } void wrap_ImPlotPlot_SetID(ImPlotPlot *ImPlotPlotPtr, ImGuiID v) { ImPlotPlotPtr->ID = v; } @@ -361,7 +361,7 @@ void wrap_ImPlotPlot_SetMouseTextFlags(ImPlotPlot *ImPlotPlotPtr, ImPlotMouseTex ImPlotMouseTextFlags wrap_ImPlotPlot_GetMouseTextFlags(ImPlotPlot *self) { return self->MouseTextFlags; } void wrap_ImPlotPlot_SetAxes(ImPlotPlot *ImPlotPlotPtr, ImPlotAxis* v) { memcpy(ImPlotPlotPtr->Axes, v, sizeof(ImPlotAxis)*6); } ImPlotAxis* wrap_ImPlotPlot_GetAxes(ImPlotPlot *self) { return self->Axes; } -ImPlotAxis cimplot_ImPlotAxis_GetAtIdx(ImPlotAxis *self, int index) { return self[index]; } +ImPlotAxis implot_ImPlotAxis_GetAtIdx(ImPlotAxis *self, int index) { return self[index]; } void wrap_ImPlotPlot_SetTextBuffer(ImPlotPlot *ImPlotPlotPtr, ImGuiTextBuffer v) { ImPlotPlotPtr->TextBuffer = v; } ImGuiTextBuffer wrap_ImPlotPlot_GetTextBuffer(ImPlotPlot *self) { return self->TextBuffer; } void wrap_ImPlotPlot_SetItems(ImPlotPlot *ImPlotPlotPtr, ImPlotItemGroup v) { ImPlotPlotPtr->Items = v; } @@ -516,7 +516,7 @@ void wrap_ImPlotSubplot_SetColLinkData(ImPlotSubplot *ImPlotSubplotPtr, ImVector ImVector_ImPlotRange wrap_ImPlotSubplot_GetColLinkData(ImPlotSubplot *self) { return self->ColLinkData; } void wrap_ImPlotSubplot_SetTempSizes(ImPlotSubplot *ImPlotSubplotPtr, float* v) { memcpy(ImPlotSubplotPtr->TempSizes, v, sizeof(float)*2); } float* wrap_ImPlotSubplot_GetTempSizes(ImPlotSubplot *self) { return self->TempSizes; } -float cimplot_float_GetAtIdx(float *self, int index) { return self[index]; } +float implot_float_GetAtIdx(float *self, int index) { return self[index]; } void wrap_ImPlotSubplot_SetFrameHovered(ImPlotSubplot *ImPlotSubplotPtr, bool v) { ImPlotSubplotPtr->FrameHovered = v; } bool wrap_ImPlotSubplot_GetFrameHovered(ImPlotSubplot *self) { return self->FrameHovered; } void wrap_ImPlotSubplot_SetHasTitle(ImPlotSubplot *ImPlotSubplotPtr, bool v) { ImPlotSubplotPtr->HasTitle = v; } diff --git a/implot/structs_accessor.h b/implot/structs_accessor.h index 7d95eeb3..ba68fb8b 100644 --- a/implot/structs_accessor.h +++ b/implot/structs_accessor.h @@ -73,7 +73,7 @@ extern void wrap_ImPlotAxis_SetFormatterData(ImPlotAxis *ImPlotAxisPtr, uintptr_ extern uintptr_t wrap_ImPlotAxis_GetFormatterData(ImPlotAxis *self); extern void wrap_ImPlotAxis_SetFormatSpec(ImPlotAxis *ImPlotAxisPtr, char* v); extern char* wrap_ImPlotAxis_GetFormatSpec(ImPlotAxis *self); -extern char cimplot_char_GetAtIdx(char *self, int index); +extern char implot_char_GetAtIdx(char *self, int index); extern void wrap_ImPlotAxis_SetLocator(ImPlotAxis *ImPlotAxisPtr, ImPlotLocator v); extern ImPlotLocator wrap_ImPlotAxis_GetLocator(ImPlotAxis *self); extern void wrap_ImPlotAxis_SetLinkedMin(ImPlotAxis *ImPlotAxisPtr, double* v); @@ -303,7 +303,7 @@ extern void wrap_ImPlotLegend_SetCanGoInside(ImPlotLegend *ImPlotLegendPtr, bool extern bool wrap_ImPlotLegend_GetCanGoInside(ImPlotLegend *self); extern void wrap_ImPlotNextItemData_SetColors(ImPlotNextItemData *ImPlotNextItemDataPtr, ImVec4* v); extern ImVec4* wrap_ImPlotNextItemData_GetColors(ImPlotNextItemData *self); -extern ImVec4 cimplot_ImVec4_GetAtIdx(ImVec4 *self, int index); +extern ImVec4 implot_ImVec4_GetAtIdx(ImVec4 *self, int index); extern void wrap_ImPlotNextItemData_SetLineWeight(ImPlotNextItemData *ImPlotNextItemDataPtr, float v); extern float wrap_ImPlotNextItemData_GetLineWeight(ImPlotNextItemData *self); extern void wrap_ImPlotNextItemData_SetMarker(ImPlotNextItemData *ImPlotNextItemDataPtr, ImPlotMarker v); @@ -338,18 +338,18 @@ extern void wrap_ImPlotNextItemData_SetHiddenCond(ImPlotNextItemData *ImPlotNext extern ImPlotCond wrap_ImPlotNextItemData_GetHiddenCond(ImPlotNextItemData *self); extern void wrap_ImPlotNextPlotData_SetRangeCond(ImPlotNextPlotData *ImPlotNextPlotDataPtr, ImPlotCond* v); extern ImPlotCond* wrap_ImPlotNextPlotData_GetRangeCond(ImPlotNextPlotData *self); -extern ImPlotCond cimplot_ImPlotCond_GetAtIdx(ImPlotCond *self, int index); +extern ImPlotCond implot_ImPlotCond_GetAtIdx(ImPlotCond *self, int index); extern void wrap_ImPlotNextPlotData_SetRange(ImPlotNextPlotData *ImPlotNextPlotDataPtr, ImPlotRange* v); extern ImPlotRange* wrap_ImPlotNextPlotData_GetRange(ImPlotNextPlotData *self); -extern ImPlotRange cimplot_ImPlotRange_GetAtIdx(ImPlotRange *self, int index); +extern ImPlotRange implot_ImPlotRange_GetAtIdx(ImPlotRange *self, int index); extern void wrap_ImPlotNextPlotData_SetHasRange(ImPlotNextPlotData *ImPlotNextPlotDataPtr, bool* v); extern bool* wrap_ImPlotNextPlotData_GetHasRange(ImPlotNextPlotData *self); -extern bool cimplot_bool_GetAtIdx(bool *self, int index); +extern bool implot_bool_GetAtIdx(bool *self, int index); extern void wrap_ImPlotNextPlotData_SetFit(ImPlotNextPlotData *ImPlotNextPlotDataPtr, bool* v); extern bool* wrap_ImPlotNextPlotData_GetFit(ImPlotNextPlotData *self); extern void wrap_ImPlotNextPlotData_SetLinkedMin(ImPlotNextPlotData *ImPlotNextPlotDataPtr, double** v); extern double** wrap_ImPlotNextPlotData_GetLinkedMin(ImPlotNextPlotData *self); -extern double* cimplot_doublePtr_GetAtIdx(double* *self, int index); +extern double* implot_doublePtr_GetAtIdx(double* *self, int index); extern void wrap_ImPlotNextPlotData_SetLinkedMax(ImPlotNextPlotData *ImPlotNextPlotDataPtr, double** v); extern double** wrap_ImPlotNextPlotData_GetLinkedMax(ImPlotNextPlotData *self); extern void wrap_ImPlotPlot_SetID(ImPlotPlot *ImPlotPlotPtr, ImGuiID v); @@ -364,7 +364,7 @@ extern void wrap_ImPlotPlot_SetMouseTextFlags(ImPlotPlot *ImPlotPlotPtr, ImPlotM extern ImPlotMouseTextFlags wrap_ImPlotPlot_GetMouseTextFlags(ImPlotPlot *self); extern void wrap_ImPlotPlot_SetAxes(ImPlotPlot *ImPlotPlotPtr, ImPlotAxis* v); extern ImPlotAxis* wrap_ImPlotPlot_GetAxes(ImPlotPlot *self); -extern ImPlotAxis cimplot_ImPlotAxis_GetAtIdx(ImPlotAxis *self, int index); +extern ImPlotAxis implot_ImPlotAxis_GetAtIdx(ImPlotAxis *self, int index); extern void wrap_ImPlotPlot_SetTextBuffer(ImPlotPlot *ImPlotPlotPtr, ImGuiTextBuffer v); extern ImGuiTextBuffer wrap_ImPlotPlot_GetTextBuffer(ImPlotPlot *self); extern void wrap_ImPlotPlot_SetItems(ImPlotPlot *ImPlotPlotPtr, ImPlotItemGroup v); @@ -519,7 +519,7 @@ extern void wrap_ImPlotSubplot_SetColLinkData(ImPlotSubplot *ImPlotSubplotPtr, I extern ImVector_ImPlotRange wrap_ImPlotSubplot_GetColLinkData(ImPlotSubplot *self); extern void wrap_ImPlotSubplot_SetTempSizes(ImPlotSubplot *ImPlotSubplotPtr, float* v); extern float* wrap_ImPlotSubplot_GetTempSizes(ImPlotSubplot *self); -extern float cimplot_float_GetAtIdx(float *self, int index); +extern float implot_float_GetAtIdx(float *self, int index); extern void wrap_ImPlotSubplot_SetFrameHovered(ImPlotSubplot *ImPlotSubplotPtr, bool v); extern bool wrap_ImPlotSubplot_GetFrameHovered(ImPlotSubplot *self); extern void wrap_ImPlotSubplot_SetHasTitle(ImPlotSubplot *ImPlotSubplotPtr, bool v); From 6b5e904b95790427f7252c29654461aa3edb0aca Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:59:47 +0100 Subject: [PATCH 08/17] makefile: cleanup --- Makefile | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e5461ba1..5bfc5ffc 100644 --- a/Makefile +++ b/Makefile @@ -12,23 +12,22 @@ setup: go build -o ../../codegen . # Parameters: -# $1: prefix -# $2: go package name -# $3: include path (of header file) -# $4: definitions.json filepath -# $5: structs_and_enums.json filepath -# $6: typedefs_dict.json filepath -# $7: additional agruments to codegen call (e.g. -r option) +# $1: go package name +# $2: include path (of header file) +# $3: definitions.json filepath +# $4: structs_and_enums.json filepath +# $5: typedefs_dict.json filepath +# $6: additional agruments to codegen call (e.g. -r option) define generate @echo "Generating for $(1)" - mkdir -p $(2) - cat templates/cflags.go |sed -e "s/^package.*/package $(2)/g" > $(2)/cflags.go - cd $(2); \ - ../codegen -preset ../cmd/codegen/cimgui-go-preset.json -pkg $(2) -i ../$(3) -d ../$(4) -e ../$(5) -t ../$(6) $(7) + mkdir -p $(1) + cat templates/cflags.go |sed -e "s/^package.*/package $(1)/g" > $(1)/cflags.go + cd $(1); \ + ../codegen -preset ../cmd/codegen/cimgui-go-preset.json -pkg $(1) -i ../$(2) -d ../$(3) -e ../$(4) -t ../$(5) $(6) endef define imgui - $(call generate,cimgui,imgui,cwrappers/cimgui.h,cwrappers/cimgui_templates/definitions.json,cwrappers/cimgui_templates/structs_and_enums.json,cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,imgui,cwrappers/cimgui.h,cwrappers/cimgui_templates/definitions.json,cwrappers/cimgui_templates/structs_and_enums.json,cwrappers/cimgui_templates/typedefs_dict.json) endef ## cimgui: generate imgui binding @@ -37,7 +36,7 @@ imgui: setup $(call imgui) define implot - $(call generate,cimplot,implot,cwrappers/cimplot.h,cwrappers/cimplot_templates/definitions.json,cwrappers/cimplot_templates/structs_and_enums.json,cwrappers/cimplot_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,implot,cwrappers/cimplot.h,cwrappers/cimplot_templates/definitions.json,cwrappers/cimplot_templates/structs_and_enums.json,cwrappers/cimplot_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## implot: generate implot binding @@ -46,7 +45,7 @@ implot: setup $(call implot) define imnodes - $(call generate,cimnodes,imnodes,cwrappers/cimnodes.h,cwrappers/cimnodes_templates/definitions.json,cwrappers/cimnodes_templates/structs_and_enums.json,cwrappers/cimnodes_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,imnodes,cwrappers/cimnodes.h,cwrappers/cimnodes_templates/definitions.json,cwrappers/cimnodes_templates/structs_and_enums.json,cwrappers/cimnodes_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imnodes: generate imnodes binding @@ -55,7 +54,7 @@ imnodes: setup $(call imnodes) define immarkdown - $(call generate,cimmarkdown,immarkdown,cwrappers/cimmarkdown.h,cwrappers/cimmarkdown_templates/definitions.json,cwrappers/cimmarkdown_templates/structs_and_enums.json,cwrappers/cimmarkdown_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,immarkdown,cwrappers/cimmarkdown.h,cwrappers/cimmarkdown_templates/definitions.json,cwrappers/cimmarkdown_templates/structs_and_enums.json,cwrappers/cimmarkdown_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## immarkdown: generate immarkdown binding @@ -64,7 +63,7 @@ immarkdown: setup $(call immarkdown) define imguizmo - $(call generate,cimguizmo,imguizmo,cwrappers/cimguizmo.h,cwrappers/cimguizmo_templates/definitions.json,cwrappers/cimguizmo_templates/structs_and_enums.json,cwrappers/cimguizmo_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,imguizmo,cwrappers/cimguizmo.h,cwrappers/cimguizmo_templates/definitions.json,cwrappers/cimguizmo_templates/structs_and_enums.json,cwrappers/cimguizmo_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imguizmo: generate imguizmo binding @@ -73,7 +72,7 @@ imguizmo: setup $(call imguizmo) define imcte - $(call generate,cimcte,ImGuiColorTextEdit,cwrappers/cimCTE.h,cwrappers/cimCTE_templates/definitions.json,cwrappers/cimCTE_templates/structs_and_enums.json,cwrappers/cimCTE_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,ImGuiColorTextEdit,cwrappers/cimCTE.h,cwrappers/cimCTE_templates/definitions.json,cwrappers/cimCTE_templates/structs_and_enums.json,cwrappers/cimCTE_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imcte: generate ImGuiColorTextEdit binding From cd6d4add683f5c9ab71cfb7f50195479d8225a51 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:58:36 +0100 Subject: [PATCH 09/17] flags: rewrite to use external flags module it is easier to use and allows to use long flags --- cmd/codegen/arguments_wrapper.go | 8 +++--- cmd/codegen/flags.go | 45 ++++++++++++++------------------ cmd/codegen/gencpp.go | 16 ++++++------ cmd/codegen/gengo_callbacks.go | 12 ++++----- cmd/codegen/gengo_funcs.go | 8 +++--- cmd/codegen/gengo_typedefs.go | 36 ++++++++++++------------- cmd/codegen/go.mod | 1 + cmd/codegen/go.sum | 3 +++ cmd/codegen/main.go | 34 ++++++++++++------------ cmd/codegen/presets.go | 4 +-- cmd/codegen/return_wrapper.go | 4 +-- 11 files changed, 84 insertions(+), 87 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 343e7675..781759e5 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -137,9 +137,9 @@ func getArgWrapper( _, isRefEnum := context.refEnumNames[pureType] if isEnum || isRefEnum { - srcPkg := context.flags.packageName + srcPkg := context.flags.PackageName if isRefTypedef { - srcPkg = context.flags.refPackageName + srcPkg = context.flags.RefPackageName } goType := prefixGoPackage(pureType.renameGoIdentifier(context), GoIdentifier(srcPkg), context) @@ -268,9 +268,9 @@ for i, %[1]sV := range %[1]sArg { _, shouldSkipRefTypedef := context.preset.SkipTypedefs[pureType] if context.typedefsNames[pureType] || (isRefTypedef && !shouldSkipRefTypedef) { - srcPkg := context.flags.packageName + srcPkg := context.flags.PackageName if isRefTypedef { - srcPkg = context.flags.refPackageName + srcPkg = context.flags.RefPackageName } goType := prefixGoPackage(pureType.renameGoIdentifier(context), GoIdentifier(srcPkg), context) diff --git a/cmd/codegen/flags.go b/cmd/codegen/flags.go index dccb2243..2d4b5970 100644 --- a/cmd/codegen/flags.go +++ b/cmd/codegen/flags.go @@ -1,37 +1,30 @@ package main -import "flag" +import "github.com/cosiner/flag" type flags struct { - showGenerated bool - showNotGenerated bool - - defJsonPath, - enumsJsonpath, - typedefsJsonpath, - refEnumsJsonPath, - refTypedefsJsonPath, - presetJsonPath, - refPackageName, // name for refTypedefs (default: imgui) - packageName, // name for current package (e.g. imgui, implot) - include string + ShowGenerated bool `names:"-lg, --log-generated" usage:"Log about functions that was generated." default:"false"` + ShowNotGenerated bool `names:"-lng, --log-not-generated" usage:"Log about functions that was NOT generated." default:"false"` + + DefJsonPath string `names:"-d, --definitions" usage:"definitions.json file path"` + EnumsJsonpath string `names:"-e, --enums" usage:"structs_and_enums.json file path"` + TypedefsJsonpath string `names:"-t, --typedefs" usage:"typedefs_dict.json file path"` + + RefEnumsJsonPath string `names:"-re, --ref-enums" usage:"structs_and_enums.json file path for reference package (see README.md)."` + RefTypedefsJsonPath string `names:"-rt, --ref-typedefs" usage:"typedefs_dict.json file path for reference package (see README.md)."` + + PresetJsonPath string `names:"-p, --preset" usage:"Preset of custom (manual) generator rules. See go doc github.com/AllenDang/cimgui-go/cmd/codegen.Preset for more details. (in form of json file)"` + + // name for refTypedefs (default: imgui) + RefPackageName string `names:"-rp, --ref-pkg" usage:"name for refTypedefs package name" default:"imgui"` + // name for current package (e.g. imgui, implot) + PackageName string `names:"-pkg, --package" usage:"name for current package"` + Include string `names:"-i, --Include" usage:"Include header file (source project's header)"` } func parse() *flags { flags := &flags{} - flag.BoolVar(&flags.showGenerated, "generated", false, "Log about functions that was generated.") - flag.BoolVar(&flags.showNotGenerated, "not-generated", true, "Log about functions that was NOT generated.") - - flag.StringVar(&flags.defJsonPath, "d", "", "definitions json file path") - flag.StringVar(&flags.enumsJsonpath, "e", "", "structs and enums json file path") - flag.StringVar(&flags.typedefsJsonpath, "t", "", "typedefs dict json file path") - flag.StringVar(&flags.refEnumsJsonPath, "r", "", "reference structs and enums json file path") - flag.StringVar(&flags.refTypedefsJsonPath, "rt", "", "reference typedefs_dict.json file path") - flag.StringVar(&flags.presetJsonPath, "preset", "", "Preset of custom (manual) generator rules. See go doc github.com/AllenDang/cimgui-go/cmd/codegen.Preset for more details.") - flag.StringVar(&flags.refPackageName, "refPkg", "imgui", "name for refTypedefs package name") - flag.StringVar(&flags.packageName, "pkg", "", "name for current package") - flag.StringVar(&flags.include, "i", "", "include header file (source project's header)") - flag.Parse() + flag.ParseStruct(flags) return flags } diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 42ca5bb9..45f31281 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -22,7 +22,7 @@ func generateCppWrapper(includePath string, funcDefs []FuncDef, ctx *Context) ([ headerSb.WriteString(cppFileHeader) headerSb.WriteString(fmt.Sprintf(`#pragma once -#include "%s" +#Include "%s" #ifdef __cplusplus extern "C" { @@ -32,8 +32,8 @@ extern "C" { cppSb := &strings.Builder{} cppSb.WriteString(cppFileHeader) - fmt.Fprintf(cppSb, `#include "wrapper.h" -#include "%s" + fmt.Fprintf(cppSb, `#Include "wrapper.h" +#Include "%s" `, includePath) @@ -394,7 +394,7 @@ func generateCppStructsAccessor(validFuncs []FuncDef, structs []StructDef, conte sbHeader.WriteString(`#pragma once -#include "wrapper.h" +#Include "wrapper.h" #ifdef __cplusplus extern "C" { @@ -403,9 +403,9 @@ extern "C" { `) sbCpp.WriteString(` -#include -#include "wrapper.h" -#include "structs_accessor.h" +#Include +#Include "wrapper.h" +#Include "structs_accessor.h" `) @@ -583,7 +583,7 @@ func getPtrIfSize(size int) string { func AddArrayIndexGetter(t CIdentifier, sbHeader, sbCpp *strings.Builder, context *Context) { tStr := ReplaceAll(ReplaceAll(t, " ", "_"), "*", "Ptr") - getterFuncName := CIdentifier(context.flags.packageName) + "_" + tStr + "_GetAtIdx" + getterFuncName := CIdentifier(context.flags.PackageName) + "_" + tStr + "_GetAtIdx" context.arrayIndexGetters[t] = getterFuncName fmt.Fprintf( diff --git a/cmd/codegen/gengo_callbacks.go b/cmd/codegen/gengo_callbacks.go index 2990ea01..91d168e9 100644 --- a/cmd/codegen/gengo_callbacks.go +++ b/cmd/codegen/gengo_callbacks.go @@ -44,7 +44,7 @@ func GenerateCallbacks(callbacks []CIdentifier, context *Context) (validTypes [] for _, typedefName := range callbacks { if err := result.writeCallback(typedefName, result.ctx.typedefs.data[typedefName]); err != nil { if errors.Is(err, callbackNotGeneratedError) { - if context.flags.showNotGenerated { + if context.flags.ShowNotGenerated { glg.Warnf("Callback \"%s\" was not generated: %v", typedefName, err) } @@ -180,7 +180,7 @@ func (g *callbacksGenerator) writeCallback(typedefName CIdentifier, def string) }) } } else { - if g.ctx.flags.showNotGenerated { + if g.ctx.flags.ShowNotGenerated { return fmt.Errorf("cannot parse callback typedef: %w", callbackNotGeneratedError) } } @@ -455,10 +455,10 @@ func (g *callbacksGenerator) saveToDisk() error { result := &strings.Builder{} result.WriteString(getGoPackageHeader(g.ctx)) fmt.Fprintf(result, - `// #include -// #include -// #include "wrapper.h" -// #include "typedefs.h" + `// #Include +// #Include +// #Include "wrapper.h" +// #Include "typedefs.h" %s `, g.ctx.preset.MergeCGoPreamble()) diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index 55e10730..e435a1f0 100644 --- a/cmd/codegen/gengo_funcs.go +++ b/cmd/codegen/gengo_funcs.go @@ -62,12 +62,12 @@ func GenerateGoFuncs( // stop, when the function should not be generated if !generator.shouldGenerate { - if context.flags.showNotGenerated { + if context.flags.ShowNotGenerated { glg.Errorf("not generated: %s%s", f.FuncName, f.Args) } continue } else { - if context.flags.showGenerated { + if context.flags.ShowGenerated { glg.Successf("generated: %s%s", f.FuncName, f.Args) } } @@ -116,8 +116,8 @@ func (g *goFuncsGenerator) writeFuncsFileHeader() { g.sb.WriteString(getGoPackageHeader(g.context)) fmt.Fprintf(g.sb, - `// #include "structs_accessor.h" -// #include "wrapper.h" + `// #Include "structs_accessor.h" +// #Include "wrapper.h" %s import "C" import "unsafe" diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 8b5db129..e606fa11 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -48,7 +48,7 @@ func GenerateTypedefs( for _, k := range keys { typedef := typedefs.data[k] if shouldSkip, ok := ctx.preset.SkipTypedefs[k]; ok && shouldSkip { - if ctx.flags.showNotGenerated { + if ctx.flags.ShowNotGenerated { glg.Infof("Arbitrarly skipping typedef %s", k) } @@ -57,7 +57,7 @@ func GenerateTypedefs( } if _, exists := ctx.refTypedefs[k]; exists { - if ctx.flags.showNotGenerated { + if ctx.flags.ShowNotGenerated { glg.Infof("Duplicate of %s in reference typedefs. Skipping.", k) } @@ -66,7 +66,7 @@ func GenerateTypedefs( } if shouldSkipStruct := ctx.preset.SkipStructs[k]; shouldSkipStruct { - if ctx.flags.showNotGenerated { + if ctx.flags.ShowNotGenerated { glg.Infof("Arbitrarly skipping struct %s", k) } @@ -77,7 +77,7 @@ func GenerateTypedefs( _, isEnum := ctx.enumNames[k] _, isRefEnum := ctx.refEnumNames[k] if isEnum || isRefEnum { - if ctx.flags.showGenerated { + if ctx.flags.ShowGenerated { glg.Infof("typedef %s has extended deffinition in structs_and_enums.json. Will generate later", k) } @@ -86,7 +86,7 @@ func GenerateTypedefs( } if IsTemplateTypedef(typedef) { - if ctx.flags.showNotGenerated { + if ctx.flags.ShowNotGenerated { glg.Warnf("typedef %s is a template. not implemented yet", k) } @@ -99,7 +99,7 @@ func GenerateTypedefs( switch { case typedefs.data[k] == "void*": - if ctx.flags.showGenerated { + if ctx.flags.ShowGenerated { glg.Successf("typedef %s is an alias to void*.", k) } @@ -111,7 +111,7 @@ func GenerateTypedefs( known.ptrReturnTypeErr == nil && known.argTypeErr == nil && known.ptrArgTypeErr == nil: - if ctx.flags.showGenerated { + if ctx.flags.ShowGenerated { glg.Successf("typedef %s is an alias typedef.", k) } @@ -132,7 +132,7 @@ func GenerateTypedefs( callbacks = append(callbacks, k) case HasPrefix(typedefs.data[k], "struct"): isOpaque := !IsStructName(k, ctx) - if ctx.flags.showGenerated { + if ctx.flags.ShowGenerated { glg.Successf("typedef %s is a struct (is opaque? %v).", k, isOpaque) } @@ -140,7 +140,7 @@ func GenerateTypedefs( generatedTypedefs++ validTypeNames = append(validTypeNames, k) default: - if ctx.flags.showNotGenerated { + if ctx.flags.ShowNotGenerated { glg.Errorf("unknown situation happened for type %s; not implemented. Probably unknown Arg (err: %v), Ret (err; %v) PtrArg (err: %v) or PtrRet (err: %v) type wrappers for isPointer: %v for %s. Check out source code for more details", k, known.argTypeErr, known.returnTypeErr, known.ptrArgTypeErr, known.ptrReturnTypeErr, isPtr, typedefs.data[k]) } @@ -209,25 +209,25 @@ func (g *typedefsGenerator) writeHeaders() { ` #pragma once -#include "%s" +#Include "%s" #ifdef __cplusplus extern "C" { #endif -`, g.ctx.flags.include) +`, g.ctx.flags.Include) g.CppSb.WriteString(cppFileHeader) fmt.Fprintf(g.CppSb, ` -#include "typedefs.h" -#include "%[1]s" -`, g.ctx.flags.include) +#Include "typedefs.h" +#Include "%[1]s" +`, g.ctx.flags.Include) g.GoSb.WriteString(getGoPackageHeader(g.ctx)) fmt.Fprintf(g.GoSb, - `// #include -// #include -// #include "wrapper.h" -// #include "typedefs.h" + `// #Include +// #Include +// #Include "wrapper.h" +// #Include "typedefs.h" %s import "C" import "unsafe" diff --git a/cmd/codegen/go.mod b/cmd/codegen/go.mod index 77cd02d7..8d474d00 100644 --- a/cmd/codegen/go.mod +++ b/cmd/codegen/go.mod @@ -10,6 +10,7 @@ require ( ) require ( + github.com/cosiner/flag v0.5.2 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/kpango/fastime v1.1.9 // indirect diff --git a/cmd/codegen/go.sum b/cmd/codegen/go.sum index 75c0dcff..34143b0f 100644 --- a/cmd/codegen/go.sum +++ b/cmd/codegen/go.sum @@ -1,3 +1,6 @@ +github.com/cosiner/argv v0.0.1/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ= +github.com/cosiner/flag v0.5.2 h1:dcI3ExLwrYt/wgg1RXZBn7FFFn3Mi5Lyremoa7Tt5ts= +github.com/cosiner/flag v0.5.2/go.mod h1:+zDQNSDNnkR7CGUlSrw2d/5S26bL91amx0FVUbnmLrU= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index fb89cafa..07c8aa57 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -39,19 +39,19 @@ func getEnumAndStructNames(enumJsonBytes []byte, context *Context) (enumNames [] } func validateFiles(f *flags) { - stat, err := os.Stat(f.defJsonPath) + stat, err := os.Stat(f.DefJsonPath) if err != nil || stat.IsDir() { glg.Fatal("Invalid definitions json file path") } - stat, err = os.Stat(f.enumsJsonpath) + stat, err = os.Stat(f.EnumsJsonpath) if err != nil || stat.IsDir() { glg.Fatal("Invalid enum json file path") } - stat, err = os.Stat(f.typedefsJsonpath) + stat, err = os.Stat(f.TypedefsJsonpath) if err != nil || stat.IsDir() { - glg.Fatalf("Invalid typedefs json file path: %s", f.typedefsJsonpath) + glg.Fatalf("Invalid typedefs json file path: %s", f.TypedefsJsonpath) } } @@ -72,37 +72,37 @@ func loadData(f *flags) (*jsonData, error) { result := &jsonData{} - result.defs, err = os.ReadFile(f.defJsonPath) + result.defs, err = os.ReadFile(f.DefJsonPath) if err != nil { return nil, fmt.Errorf("cannot read definitions json file: %w", err) } - result.typedefs, err = os.ReadFile(f.typedefsJsonpath) + result.typedefs, err = os.ReadFile(f.TypedefsJsonpath) if err != nil { return nil, fmt.Errorf("cannot read typedefs json file: %w", err) } - result.structAndEnums, err = os.ReadFile(f.enumsJsonpath) + result.structAndEnums, err = os.ReadFile(f.EnumsJsonpath) if err != nil { glg.Fatalf("cannot read struct and enums json file: %v", err) } - if len(f.refEnumsJsonPath) > 0 { - result.refStructAndEnums, err = os.ReadFile(f.refEnumsJsonPath) + if len(f.RefEnumsJsonPath) > 0 { + result.refStructAndEnums, err = os.ReadFile(f.RefEnumsJsonPath) if err != nil { return nil, fmt.Errorf("cannot read reference struct and enums json file: %w", err) } } - if len(f.refTypedefsJsonPath) > 0 { - result.refTypedefs, err = os.ReadFile(f.refTypedefsJsonPath) + if len(f.RefTypedefsJsonPath) > 0 { + result.refTypedefs, err = os.ReadFile(f.RefTypedefsJsonPath) if err != nil { return nil, fmt.Errorf("cannot read reference typedefs json file: %w", err) } } - if len(f.presetJsonPath) > 0 { - result.preset, err = os.ReadFile(f.presetJsonPath) + if len(f.PresetJsonPath) > 0 { + result.preset, err = os.ReadFile(f.PresetJsonPath) if err != nil { glg.Fatalf("cannot read preset json file: %v", err) } @@ -247,7 +247,7 @@ func main() { context.typedefsNames = MergeMaps(context.typedefsNames, SliceToMap(validCallbacks)) // 1.3. Generate C wrapper - validFuncs, err := generateCppWrapper(flags.include, context.funcs, context) + validFuncs, err := generateCppWrapper(flags.Include, context.funcs, context) if err != nil { glg.Fatalf("Cannot generate CPP Wrapper: %v", err) } @@ -277,14 +277,14 @@ import ( ) `, generatorInfo, - ctx.flags.packageName, - ctx.flags.refPackageName, + ctx.flags.PackageName, + ctx.flags.RefPackageName, ctx.preset.PackagePath, ) } func prefixGoPackage(t, sourcePackage GoIdentifier, ctx *Context) GoIdentifier { - if sourcePackage == GoIdentifier(ctx.flags.packageName) || sourcePackage == "" { + if sourcePackage == GoIdentifier(ctx.flags.PackageName) || sourcePackage == "" { return t } diff --git a/cmd/codegen/presets.go b/cmd/codegen/presets.go index 13c21edf..51292b29 100644 --- a/cmd/codegen/presets.go +++ b/cmd/codegen/presets.go @@ -44,7 +44,7 @@ type Preset struct { // cimgui-go uses this to set text_end to 0 DefaultArgArbitraryValue map[CIdentifier]CIdentifier // ExtraCGOPreamble allows to specify additional C code elements in Go files. - // For example could be used to include extra files. + // For example could be used to Include extra files. // For ease of use, its in form of []string. These lines will be merged and prefixed (if appliable) with '//' ExtraCGOPreamble []string // InternalFiles allows to specify files that are considered Internal. @@ -54,7 +54,7 @@ type Preset struct { // InternalPrefix is a prefix for identifiers from InternalFiles. InternalPrefix string // PackagePath is an import path of the package. - // This is base path. flags.packageName will be added. + // This is base path. flags.PackageName will be added. // Example: // "github.com/AllenDang/cimgui-go" // If enerated with -pkg imgui, import path diff --git a/cmd/codegen/return_wrapper.go b/cmd/codegen/return_wrapper.go index 394b5bd8..fb407784 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -80,9 +80,9 @@ func getReturnWrapper( glg.Fatalf("Error in regex: %s", err) } - srcPackage := GoIdentifier(context.flags.packageName) + srcPackage := GoIdentifier(context.flags.PackageName) if isRefTypedef { - srcPackage = GoIdentifier(context.flags.refPackageName) + srcPackage = GoIdentifier(context.flags.RefPackageName) } _, shouldSkipStruct := context.preset.SkipStructs[pureType] From 110d069adee225daa31d61e9b87311983c33d4f1 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:08:53 +0100 Subject: [PATCH 10/17] makefile: use new flags --- Makefile | 12 ++++++------ cmd/codegen/flags.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5bfc5ffc..def4a456 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ define generate mkdir -p $(1) cat templates/cflags.go |sed -e "s/^package.*/package $(1)/g" > $(1)/cflags.go cd $(1); \ - ../codegen -preset ../cmd/codegen/cimgui-go-preset.json -pkg $(1) -i ../$(2) -d ../$(3) -e ../$(4) -t ../$(5) $(6) + ../codegen --preset ../cmd/codegen/cimgui-go-preset.json --package $(1) --include ../$(2) --definitions ../$(3) --enums ../$(4) --typedefs ../$(5) $(6) endef define imgui @@ -36,7 +36,7 @@ imgui: setup $(call imgui) define implot - $(call generate,implot,cwrappers/cimplot.h,cwrappers/cimplot_templates/definitions.json,cwrappers/cimplot_templates/structs_and_enums.json,cwrappers/cimplot_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,implot,cwrappers/cimplot.h,cwrappers/cimplot_templates/definitions.json,cwrappers/cimplot_templates/structs_and_enums.json,cwrappers/cimplot_templates/typedefs_dict.json,--ref-enums ../cwrappers/cimgui_templates/structs_and_enums.json --ref-typedefs ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## implot: generate implot binding @@ -45,7 +45,7 @@ implot: setup $(call implot) define imnodes - $(call generate,imnodes,cwrappers/cimnodes.h,cwrappers/cimnodes_templates/definitions.json,cwrappers/cimnodes_templates/structs_and_enums.json,cwrappers/cimnodes_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,imnodes,cwrappers/cimnodes.h,cwrappers/cimnodes_templates/definitions.json,cwrappers/cimnodes_templates/structs_and_enums.json,cwrappers/cimnodes_templates/typedefs_dict.json,--ref-enums ../cwrappers/cimgui_templates/structs_and_enums.json --ref-typedefs ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imnodes: generate imnodes binding @@ -54,7 +54,7 @@ imnodes: setup $(call imnodes) define immarkdown - $(call generate,immarkdown,cwrappers/cimmarkdown.h,cwrappers/cimmarkdown_templates/definitions.json,cwrappers/cimmarkdown_templates/structs_and_enums.json,cwrappers/cimmarkdown_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,immarkdown,cwrappers/cimmarkdown.h,cwrappers/cimmarkdown_templates/definitions.json,cwrappers/cimmarkdown_templates/structs_and_enums.json,cwrappers/cimmarkdown_templates/typedefs_dict.json,--ref-enums ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## immarkdown: generate immarkdown binding @@ -63,7 +63,7 @@ immarkdown: setup $(call immarkdown) define imguizmo - $(call generate,imguizmo,cwrappers/cimguizmo.h,cwrappers/cimguizmo_templates/definitions.json,cwrappers/cimguizmo_templates/structs_and_enums.json,cwrappers/cimguizmo_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,imguizmo,cwrappers/cimguizmo.h,cwrappers/cimguizmo_templates/definitions.json,cwrappers/cimguizmo_templates/structs_and_enums.json,cwrappers/cimguizmo_templates/typedefs_dict.json,-re ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imguizmo: generate imguizmo binding @@ -72,7 +72,7 @@ imguizmo: setup $(call imguizmo) define imcte - $(call generate,ImGuiColorTextEdit,cwrappers/cimCTE.h,cwrappers/cimCTE_templates/definitions.json,cwrappers/cimCTE_templates/structs_and_enums.json,cwrappers/cimCTE_templates/typedefs_dict.json,-r ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) + $(call generate,ImGuiColorTextEdit,cwrappers/cimCTE.h,cwrappers/cimCTE_templates/definitions.json,cwrappers/cimCTE_templates/structs_and_enums.json,cwrappers/cimCTE_templates/typedefs_dict.json,-re ../cwrappers/cimgui_templates/structs_and_enums.json -rt ../cwrappers/cimgui_templates/typedefs_dict.json) endef ## imcte: generate ImGuiColorTextEdit binding diff --git a/cmd/codegen/flags.go b/cmd/codegen/flags.go index 2d4b5970..415efa11 100644 --- a/cmd/codegen/flags.go +++ b/cmd/codegen/flags.go @@ -19,7 +19,7 @@ type flags struct { RefPackageName string `names:"-rp, --ref-pkg" usage:"name for refTypedefs package name" default:"imgui"` // name for current package (e.g. imgui, implot) PackageName string `names:"-pkg, --package" usage:"name for current package"` - Include string `names:"-i, --Include" usage:"Include header file (source project's header)"` + Include string `names:"-i, --include" usage:"Include header file (source project's header)"` } func parse() *flags { From 6bd44f728ae7388b3a44a94de122d5b2310d3ad0 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:10:56 +0100 Subject: [PATCH 11/17] codegen: fix #Include --- cmd/codegen/gencpp.go | 14 +++++++------- cmd/codegen/gengo_callbacks.go | 8 ++++---- cmd/codegen/gengo_funcs.go | 4 ++-- cmd/codegen/gengo_typedefs.go | 14 +++++++------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 45f31281..7647597d 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -22,7 +22,7 @@ func generateCppWrapper(includePath string, funcDefs []FuncDef, ctx *Context) ([ headerSb.WriteString(cppFileHeader) headerSb.WriteString(fmt.Sprintf(`#pragma once -#Include "%s" +#include "%s" #ifdef __cplusplus extern "C" { @@ -32,8 +32,8 @@ extern "C" { cppSb := &strings.Builder{} cppSb.WriteString(cppFileHeader) - fmt.Fprintf(cppSb, `#Include "wrapper.h" -#Include "%s" + fmt.Fprintf(cppSb, `#include "wrapper.h" +#include "%s" `, includePath) @@ -394,7 +394,7 @@ func generateCppStructsAccessor(validFuncs []FuncDef, structs []StructDef, conte sbHeader.WriteString(`#pragma once -#Include "wrapper.h" +#include "wrapper.h" #ifdef __cplusplus extern "C" { @@ -403,9 +403,9 @@ extern "C" { `) sbCpp.WriteString(` -#Include -#Include "wrapper.h" -#Include "structs_accessor.h" +#include +#include "wrapper.h" +#include "structs_accessor.h" `) diff --git a/cmd/codegen/gengo_callbacks.go b/cmd/codegen/gengo_callbacks.go index 91d168e9..dd87d0dd 100644 --- a/cmd/codegen/gengo_callbacks.go +++ b/cmd/codegen/gengo_callbacks.go @@ -455,10 +455,10 @@ func (g *callbacksGenerator) saveToDisk() error { result := &strings.Builder{} result.WriteString(getGoPackageHeader(g.ctx)) fmt.Fprintf(result, - `// #Include -// #Include -// #Include "wrapper.h" -// #Include "typedefs.h" + `// #include +// #include +// #include "wrapper.h" +// #include "typedefs.h" %s `, g.ctx.preset.MergeCGoPreamble()) diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index e435a1f0..14a183f2 100644 --- a/cmd/codegen/gengo_funcs.go +++ b/cmd/codegen/gengo_funcs.go @@ -116,8 +116,8 @@ func (g *goFuncsGenerator) writeFuncsFileHeader() { g.sb.WriteString(getGoPackageHeader(g.context)) fmt.Fprintf(g.sb, - `// #Include "structs_accessor.h" -// #Include "wrapper.h" + `// #include "structs_accessor.h" +// #include "wrapper.h" %s import "C" import "unsafe" diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index e606fa11..9ffd31fb 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -209,7 +209,7 @@ func (g *typedefsGenerator) writeHeaders() { ` #pragma once -#Include "%s" +#include "%s" #ifdef __cplusplus extern "C" { @@ -218,16 +218,16 @@ extern "C" { g.CppSb.WriteString(cppFileHeader) fmt.Fprintf(g.CppSb, ` -#Include "typedefs.h" -#Include "%[1]s" +#include "typedefs.h" +#include "%[1]s" `, g.ctx.flags.Include) g.GoSb.WriteString(getGoPackageHeader(g.ctx)) fmt.Fprintf(g.GoSb, - `// #Include -// #Include -// #Include "wrapper.h" -// #Include "typedefs.h" + `// #include +// #include +// #include "wrapper.h" +// #include "typedefs.h" %s import "C" import "unsafe" From 392bd5e7f930e8287e052a956df4981691b78ff1 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 19:28:36 +0100 Subject: [PATCH 12/17] func defs: remove unnecessary json tags --- cmd/codegen/function_deffiniton.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/codegen/function_deffiniton.go b/cmd/codegen/function_deffiniton.go index 0c7ebc73..220d7b5a 100644 --- a/cmd/codegen/function_deffiniton.go +++ b/cmd/codegen/function_deffiniton.go @@ -10,7 +10,7 @@ import ( type FuncDef struct { // FuncName is a cimgui name of the function FuncName CIdentifier `json:"ov_cimguiname"` - // FuncName is an original Dear ImGui's name of the function + // OriginalFuncName is an original Dear ImGui's name of the function OriginalFuncName CIdentifier `json:"original_func_name"` // Args represents a plain string list of function arguments Args string `json:"args"` @@ -24,12 +24,12 @@ type FuncDef struct { // Comment on function Comment string `json:"comment"` - Constructor bool `json:"constructor"` - Destructor bool `json:"destructor"` - StructSetter bool `json:"struct_setter"` - StructGetter bool `json:"struct_getter"` + Constructor bool + Destructor bool + StructSetter bool + StructGetter bool - InvocationStmt string `json:"invocation_stmt"` + InvocationStmt string // Ret determines a type of returned value Ret CIdentifier `json:"ret"` From 14c865ee4d7d2a191d72f20ba1ec291ff1279bc8 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:36:45 +0100 Subject: [PATCH 13/17] improve logging and debugs --- cmd/codegen/flags.go | 1 + cmd/codegen/format.go | 11 +++++++++++ cmd/codegen/gengo_enums.go | 6 ++++++ cmd/codegen/main.go | 22 +++++++++++++++++----- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/cmd/codegen/flags.go b/cmd/codegen/flags.go index 415efa11..b0b7960d 100644 --- a/cmd/codegen/flags.go +++ b/cmd/codegen/flags.go @@ -5,6 +5,7 @@ import "github.com/cosiner/flag" type flags struct { ShowGenerated bool `names:"-lg, --log-generated" usage:"Log about functions that was generated." default:"false"` ShowNotGenerated bool `names:"-lng, --log-not-generated" usage:"Log about functions that was NOT generated." default:"false"` + Verbose bool `names:"--verbose" usage:"Verbose output (dump literally everything it could dump)." default:"false` DefJsonPath string `names:"-d, --definitions" usage:"definitions.json file path"` EnumsJsonpath string `names:"-e, --enums" usage:"structs_and_enums.json file path"` diff --git a/cmd/codegen/format.go b/cmd/codegen/format.go index 9a295549..f4a6f76f 100644 --- a/cmd/codegen/format.go +++ b/cmd/codegen/format.go @@ -15,6 +15,10 @@ func FormatGo(s string, ctx *Context) string { ExtraRules: true, }) if err != nil { + if ctx.flags.Verbose { + glg.Debugf(string(s)) + } + glg.Fatalf("Unable to format go code: %v", err) } @@ -26,6 +30,13 @@ func FormatGo(s string, ctx *Context) string { TabWidth: 8, FormatOnly: false, }) + if err != nil { + if ctx.flags.Verbose { + glg.Debugf(string(s)) + } + + glg.Fatalf("Unable to goimports code: %v", err) + } return string(sBytes) } diff --git a/cmd/codegen/gengo_enums.go b/cmd/codegen/gengo_enums.go index e4c79a07..f69b315c 100644 --- a/cmd/codegen/gengo_enums.go +++ b/cmd/codegen/gengo_enums.go @@ -4,6 +4,8 @@ import ( "fmt" "os" "strings" + + "github.com/kpango/glg" ) // Generate enums and return enum type names @@ -33,6 +35,10 @@ func generateGoEnums(enums []EnumDef, ctx *Context) ([]CIdentifier, error) { } sb.WriteString(")\n\n") + + if ctx.flags.ShowGenerated { + glg.Successf("Generated enum: %s", eName) + } } enumFile, err := os.Create("enums.go") diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index 07c8aa57..2ca8ac7f 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -106,6 +106,7 @@ func loadData(f *flags) (*jsonData, error) { if err != nil { glg.Fatalf("cannot read preset json file: %v", err) } + } return result, nil @@ -138,16 +139,23 @@ type Context struct { preset *Preset } -func parseJson(jsonData *jsonData) (*Context, error) { +func parseJson(jsonData *jsonData, f *flags) (*Context, error) { var err error result := &Context{ arrayIndexGetters: make(map[CIdentifier]CIdentifier), preset: &Preset{}, + flags: f, } if len(jsonData.preset) > 0 { - json.Unmarshal(jsonData.preset, result.preset) + if err := json.Unmarshal(jsonData.preset, result.preset); err != nil { + glg.Warnf("Unable to load preset: %v", err) + } + + if result.flags.Verbose { + glg.Debugf("Preset loaded: %v", result.preset) + } } // get definitions from json file @@ -215,15 +223,14 @@ func main() { glg.Fatalf("cannot load data: %v", err) } - context, err := parseJson(jsonData) + context, err := parseJson(jsonData, flags) if err != nil { glg.Fatalf("cannot parse json: %v", err) } - context.flags = flags - // 1. Generate code // 1.1. Generate Go Enums + glg.Info("Generating Go Enums") enumNames, err := generateGoEnums(context.enums, context) if err != nil { glg.Fatalf("Generating enum names: %v", err) @@ -232,6 +239,7 @@ func main() { context.enumNames = SliceToMap(enumNames) // 1.2. Generate Go typedefs + glg.Info("Generating Go Typedefs") typedefsNames, callbacksToGenerate, err := GenerateTypedefs(context.typedefs, context.structs, context) if err != nil { glg.Fatalf("Cannot generate typedefs: %v", err) @@ -247,12 +255,14 @@ func main() { context.typedefsNames = MergeMaps(context.typedefsNames, SliceToMap(validCallbacks)) // 1.3. Generate C wrapper + glg.Info("Generating C Wrapper") validFuncs, err := generateCppWrapper(flags.Include, context.funcs, context) if err != nil { glg.Fatalf("Cannot generate CPP Wrapper: %v", err) } // 1.3.1. Generate Struct accessors in C + glg.Info("Generating C Struct Accessors") structAccessorFuncs, err := generateCppStructsAccessor(validFuncs, context.structs, context) if err != nil { glg.Fatalf("Cannot generate CPP Struct Accessors: %v", err) @@ -261,6 +271,8 @@ func main() { // This variable stores funcs that needs to be written to GO now. validFuncs = append(validFuncs, structAccessorFuncs...) + // 1.4. Generate Go functions + glg.Info("Generating Go Functions") if err := GenerateGoFuncs(validFuncs, context); err != nil { glg.Fatalf("Cannot generate Go functions: %v", err) } From d053079fc699558888a4de4508723a755bfdf823 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:37:11 +0100 Subject: [PATCH 14/17] codegen: add testdata with a minimalistic working setup --- cmd/codegen/testdata/Makefile | 4 ++ cmd/codegen/testdata/deffinitions.json | 21 ++++++++++ cmd/codegen/testdata/output/callbacks.go | 11 ++++++ cmd/codegen/testdata/output/enums.go | 14 +++++++ cmd/codegen/testdata/output/funcs.go | 39 +++++++++++++++++++ .../testdata/output/structs_accessor.cpp | 12 ++++++ .../testdata/output/structs_accessor.h | 19 +++++++++ cmd/codegen/testdata/output/typedefs.cpp | 6 +++ cmd/codegen/testdata/output/typedefs.go | 37 ++++++++++++++++++ cmd/codegen/testdata/output/typedefs.h | 15 +++++++ cmd/codegen/testdata/output/wrapper.cpp | 6 +++ cmd/codegen/testdata/output/wrapper.h | 15 +++++++ cmd/codegen/testdata/preset.json | 13 +++++++ cmd/codegen/testdata/structs_and_enums.json | 39 +++++++++++++++++++ cmd/codegen/testdata/typedefs_dict.json | 4 ++ 15 files changed, 255 insertions(+) create mode 100644 cmd/codegen/testdata/Makefile create mode 100644 cmd/codegen/testdata/deffinitions.json create mode 100644 cmd/codegen/testdata/output/callbacks.go create mode 100644 cmd/codegen/testdata/output/enums.go create mode 100644 cmd/codegen/testdata/output/funcs.go create mode 100644 cmd/codegen/testdata/output/structs_accessor.cpp create mode 100644 cmd/codegen/testdata/output/structs_accessor.h create mode 100644 cmd/codegen/testdata/output/typedefs.cpp create mode 100644 cmd/codegen/testdata/output/typedefs.go create mode 100644 cmd/codegen/testdata/output/typedefs.h create mode 100644 cmd/codegen/testdata/output/wrapper.cpp create mode 100644 cmd/codegen/testdata/output/wrapper.h create mode 100644 cmd/codegen/testdata/preset.json create mode 100644 cmd/codegen/testdata/structs_and_enums.json create mode 100644 cmd/codegen/testdata/typedefs_dict.json diff --git a/cmd/codegen/testdata/Makefile b/cmd/codegen/testdata/Makefile new file mode 100644 index 00000000..5506544b --- /dev/null +++ b/cmd/codegen/testdata/Makefile @@ -0,0 +1,4 @@ +all: + mkdir -p output + cd output; \ + go run ../.. --verbose --package mypkg --include header.h --preset ..//preset.json -lng -lg -d ../deffinitions.json -e ../structs_and_enums.json -t ../typedefs_dict.json diff --git a/cmd/codegen/testdata/deffinitions.json b/cmd/codegen/testdata/deffinitions.json new file mode 100644 index 00000000..9f418590 --- /dev/null +++ b/cmd/codegen/testdata/deffinitions.json @@ -0,0 +1,21 @@ +{ + "FuncName": { + "ov_cimguiname": "Foo", + "original_func_name": "OrgFoo", + "args": "(A a)", + "argsT": [ + { + "name": "a", + "type": "A", + "custom_type": "" + } + ], + "defaults": { + "a": "1" + }, + "nonUDT": 0, + "comment": "function comment (optional)", + "location": 15 + } +} + diff --git a/cmd/codegen/testdata/output/callbacks.go b/cmd/codegen/testdata/output/callbacks.go new file mode 100644 index 00000000..21031669 --- /dev/null +++ b/cmd/codegen/testdata/output/callbacks.go @@ -0,0 +1,11 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package mypkg + +// #include +// #include +// #include "wrapper.h" +// #include "typedefs.h" + +import "C" diff --git a/cmd/codegen/testdata/output/enums.go b/cmd/codegen/testdata/output/enums.go new file mode 100644 index 00000000..0b88b123 --- /dev/null +++ b/cmd/codegen/testdata/output/enums.go @@ -0,0 +1,14 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package mypkg + +// this is an example enum +// original name: A_ +type A int32 + +const ( + // A default value of A + ADefault A = 0 + AOne A = 1 +) diff --git a/cmd/codegen/testdata/output/funcs.go b/cmd/codegen/testdata/output/funcs.go new file mode 100644 index 00000000..fdadb4b2 --- /dev/null +++ b/cmd/codegen/testdata/output/funcs.go @@ -0,0 +1,39 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package mypkg + +// #include "structs_accessor.h" +// #include "wrapper.h" + +import "C" + +func (self B) SetField1(v int32) { + selfArg, selfFin := self.Handle() + defer selfFin() + C.wrap_B_SetField1(selfArg, C.int(v)) +} + +func (self *B) Field1() int32 { + selfArg, selfFin := self.Handle() + + defer func() { + selfFin() + }() + return int32(C.wrap_B_GetField1(internal.ReinterpretCast[*C.B](selfArg))) +} + +func (self B) SetField2(v A) { + selfArg, selfFin := self.Handle() + defer selfFin() + C.wrap_B_SetField2(selfArg, C.A(v)) +} + +func (self *B) Field2() A { + selfArg, selfFin := self.Handle() + + defer func() { + selfFin() + }() + return A(C.wrap_B_GetField2(internal.ReinterpretCast[*C.B](selfArg))) +} diff --git a/cmd/codegen/testdata/output/structs_accessor.cpp b/cmd/codegen/testdata/output/structs_accessor.cpp new file mode 100644 index 00000000..9c7d16f4 --- /dev/null +++ b/cmd/codegen/testdata/output/structs_accessor.cpp @@ -0,0 +1,12 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include +#include "wrapper.h" +#include "structs_accessor.h" + +void wrap_B_SetField1(B *BPtr, int v) { BPtr->Field1 = v; } +int wrap_B_GetField1(B *self) { return self->Field1; } +void wrap_B_SetField2(B *BPtr, A v) { BPtr->Field2 = v; } +A wrap_B_GetField2(B *self) { return self->Field2; } diff --git a/cmd/codegen/testdata/output/structs_accessor.h b/cmd/codegen/testdata/output/structs_accessor.h new file mode 100644 index 00000000..3f263c0c --- /dev/null +++ b/cmd/codegen/testdata/output/structs_accessor.h @@ -0,0 +1,19 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +#pragma once + +#include "wrapper.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern void wrap_B_SetField1(B *BPtr, int v); +extern int wrap_B_GetField1(B *self); +extern void wrap_B_SetField2(B *BPtr, A v); +extern A wrap_B_GetField2(B *self); + +#ifdef __cplusplus +} +#endif diff --git a/cmd/codegen/testdata/output/typedefs.cpp b/cmd/codegen/testdata/output/typedefs.cpp new file mode 100644 index 00000000..c84473a3 --- /dev/null +++ b/cmd/codegen/testdata/output/typedefs.cpp @@ -0,0 +1,6 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include "typedefs.h" +#include "header.h" diff --git a/cmd/codegen/testdata/output/typedefs.go b/cmd/codegen/testdata/output/typedefs.go new file mode 100644 index 00000000..1170dd9b --- /dev/null +++ b/cmd/codegen/testdata/output/typedefs.go @@ -0,0 +1,37 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package mypkg + +// #include +// #include +// #include "wrapper.h" +// #include "typedefs.h" + +import "C" + +type B struct { + CData *C.B +} + +// Handle returns C version of B and its finalizer func. +func (self *B) Handle() (result *C.B, fin func()) { + return self.CData, func() {} +} + +// C is like Handle but returns plain type instead of pointer. +func (self B) C() (C.B, func()) { + result, fn := self.Handle() + return *result, fn +} + +// NewEmptyB creates B with its 0 value. +func NewEmptyB() *B { + return &B{CData: new(C.B)} +} + +// NewBFromC creates B from its C pointer. +// SRC ~= *C.B +func NewBFromC[SRC any](cvalue SRC) *B { + return &B{CData: internal.ReinterpretCast[*C.B](cvalue)} +} diff --git a/cmd/codegen/testdata/output/typedefs.h b/cmd/codegen/testdata/output/typedefs.h new file mode 100644 index 00000000..24b6730a --- /dev/null +++ b/cmd/codegen/testdata/output/typedefs.h @@ -0,0 +1,15 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#pragma once + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/cmd/codegen/testdata/output/wrapper.cpp b/cmd/codegen/testdata/output/wrapper.cpp new file mode 100644 index 00000000..836615cf --- /dev/null +++ b/cmd/codegen/testdata/output/wrapper.cpp @@ -0,0 +1,6 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +#include "wrapper.h" +#include "header.h" + diff --git a/cmd/codegen/testdata/output/wrapper.h b/cmd/codegen/testdata/output/wrapper.h new file mode 100644 index 00000000..f3f1a260 --- /dev/null +++ b/cmd/codegen/testdata/output/wrapper.h @@ -0,0 +1,15 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +#pragma once + +#include "header.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif diff --git a/cmd/codegen/testdata/preset.json b/cmd/codegen/testdata/preset.json new file mode 100644 index 00000000..db57a49c --- /dev/null +++ b/cmd/codegen/testdata/preset.json @@ -0,0 +1,13 @@ +{ + "PackagePath": "example.com/mypkg", + "TypedefsPoolSize": 32, + "DefaultArgReplace": { + "nullptr": "0", + "NULL": "0", + "((void*)0)": "0" + }, + "DefaultArgArbitraryValue": { + "text_end": "0", + "text_end_": "0" + } +} diff --git a/cmd/codegen/testdata/structs_and_enums.json b/cmd/codegen/testdata/structs_and_enums.json new file mode 100644 index 00000000..46b025ad --- /dev/null +++ b/cmd/codegen/testdata/structs_and_enums.json @@ -0,0 +1,39 @@ +{ + "structs":{ + "B":[ + { + "name": "Field1", + "type": "int" + }, + { + "name": "Field2", + "type": "A" + } + ] + }, + "struct_comments": { + "B": { + "above": "// this is an example struct" + } + }, + "enums": { + "A_": [ + { + "calc_value": 0, + "comment": "// A default value of A", + "name": "A_Default", + "value": "0" + }, + { + "calc_value": 1, + "name": "A_One", + "value": "1 << 0" + } + ] + }, + "enum_comments": { + "A_": { + "above": "// this is an example enum" + } + } +} diff --git a/cmd/codegen/testdata/typedefs_dict.json b/cmd/codegen/testdata/typedefs_dict.json new file mode 100644 index 00000000..01008955 --- /dev/null +++ b/cmd/codegen/testdata/typedefs_dict.json @@ -0,0 +1,4 @@ +{ + "A": "int", + "B": "struct B" +} From cf1e15e1a9a7ff1f894b534a8cf3d989fbdb503b Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:37:20 +0100 Subject: [PATCH 15/17] codegen: add readme --- cmd/codegen/README.md | 149 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 cmd/codegen/README.md diff --git a/cmd/codegen/README.md b/cmd/codegen/README.md new file mode 100644 index 00000000..8a1c0f98 --- /dev/null +++ b/cmd/codegen/README.md @@ -0,0 +1,149 @@ +# codegen + +Codegen is a cimgui-go-featured GO code generator. + +Cod is generated basing on several JSON config files and refers to a shared library compiled from C source. + +# Usage + +```console +[codegen (0) ]$ go run . --help +Usage: codegen [FLAG]... + +Flags: + -lg, --log-generated Log about functions that was generated. (type: bool; default: false) + -lng, --log-not-generated Log about functions that was NOT generated. (type: bool; default: false) + -d, --definitions definitions.json file path (type: string) + -e, --enums structs_and_enums.json file path (type: string) + -t, --typedefs typedefs_dict.json file path (type: string) + -re, --ref-enums structs_and_enums.json file path for reference package (see README.md). (type: string) + -rt, --ref-typedefs typedefs_dict.json file path for reference package (see README.md). (type: string) + -p, --preset Preset of custom (manual) generator rules. See go doc github.com/AllenDang/cimgui-go/cmd/codegen.Preset for more details. (in form of json file) (type: string) + -rp, --ref-pkg name for refTypedefs package name (type: string; default: imgui) + -pkg, --package name for current package (type: string) + -i, --include Include header file (source project's header) (type: string) + -h, --help show help (type: bool) +``` + +# Configuration + +```console +[codegen (0) ]$ go doc Preset +type Preset struct { + // SkipFuncs functions (from definitions.json) to be skipped + // e.g. they are temporarily hard-coded + SkipFuncs map[CIdentifier]bool + // SkipStructs allows to specify struct names that will be skipped. + SkipStructs map[CIdentifier]bool + // SkipMethods struct names from structs_and_enums.json. + // structures that's METHODS should be skipped + SkipMethods map[CIdentifier]bool + // SkipTypedefs typedefs from typedefs_dict.json to be skipped + // e.g. for hardcoded typedefs or typedefs which are obvious (e.g. ImU16 becomes uint16 without extra type information) + SkipTypedefs map[CIdentifier]bool + // TypedefsPoolSize sets a default size for callbacks pool. + // Rembmber to set this as it defaults to 0 and you'll get no callbacks! + TypedefsPoolSize int + // TypedefsCustomPoolSizes allows to override TypedefsPoolSize for certain types. + TypedefsCustomPoolSizes map[CIdentifier]int + // Replace is a map for C -> Go names conversion. + // It allows you to force-rename anything (including functions and enums) + Replace map[CIdentifier]GoIdentifier + // TrimPrefix allows to remove unwanted prefixes from everything during C->Go renaming. + // NOTE: order sensitive! + // NOTE: Case sensitive + TrimPrefix []string + // OriginReplace allows to force-replace function name with some other name. + // Introduced to replace TextEditor_GetText -> TextEditor_GetText_alloc + // but could be re-used to force use of another function than json tells us to use. + // + // It differs from Replace - Replace renames an identifier in general (changes its name but refers to the same function). + // This allows to absolutely abandon the source C function and use some OTHER C function. + OriginReplace map[CIdentifier]CIdentifier + // DefaultArgReplace is used in C-side default args generation (gencpp.go). + // cimgui-go uses this to change FLT_MIN with igGet_FLT_MIN() + // NOTE: Iterated randomly! + DefaultArgReplace map[CIdentifier]CIdentifier + // DefaultArgArbitraryValue is similar to the above DefaultArgReplace, but + // associates default arg name with any arbitrary value. + // cimgui-go uses this to set text_end to 0 + DefaultArgArbitraryValue map[CIdentifier]CIdentifier + // ExtraCGOPreamble allows to specify additional C code elements in Go files. + // For example could be used to Include extra files. + // For ease of use, its in form of []string. These lines will be merged and prefixed (if appliable) with '//' + ExtraCGOPreamble []string + // InternalFiles allows to specify files that are considered Internal. + // If an identifier is found in such a file, it will be generated but its + // name will be prefixed with InternalPrefix + InternalFiles []string + // InternalPrefix is a prefix for identifiers from InternalFiles. + InternalPrefix string + // PackagePath is an import path of the package. + // This is base path. flags.PackageName will be added. + // Example: + // "github.com/AllenDang/cimgui-go" + // If enerated with -pkg imgui, import path + // is supposed to be "github.com/AllenDang/cimgui-go/imgui" + PackagePath string + // SimpleTypes are used for simple (go-convertable) custom types (wrappers will be generated by simpleW/simpleR). + // Example: + // ImS16 is defined as short in C code, so Go can easily convert it via int16() + // Expected format is: + // "ImS16": ["int16", "C.ImS16", "pkgname"] + // where: + // - ImS16 is a C type name + // - int16 is a Go-friendly type name + // - C.ImS16 is a cgo compatible type name + // - pkgname is a source package for the type (in this case int16 is a builtin so it should be empty) + // See also: simpleW + SimpleTypes map[CIdentifier][3]GoIdentifier + // SimplePtrTypes are just like SimpleTypes but for pointer types. + // Example: + // "ImS16": ["int16", "C.ImS16", "pkgname"] + SimplePtrTypes map[CIdentifier][3]GoIdentifier + // WrappableTypes are types that implement a special interface + // github.com/AllenDang/cimgui-go/internal.WrappableType[CTYPE, SELF] + // In short they are supposed to have 2 methods: + // - ToC() CTYPE which returns SELF converted to CTYPE + // - FromC(CTYPE) SELF which restores SELF from CTYPE. + // + // Key is a C type name, value is a list: + // - Go name + // - C name + // - package where the type is defined + // Example syntax: + // "ImVec2": ["Vec2", "C.ImVec2", "imgui"] + WrappableTypes map[CIdentifier][3]GoIdentifier +} + Preset is a set of rules iperative to XXX_templates/ json files. They are + used to manually set some properties of the generator. +``` + +# How it works? + +Assume you have a C project which exports its public API in a header (`.h`) file. +What this module does not cover is the first step: +1. You need JSON files describing functions in your C project. This is at the moment done by https://github.com/cimgui lua cpp2ffi.lua script which +however is highly single-purpose and you probably will not be able to use it for your project. You need to handle this yourself for now. +Let us know if you find/create an universal solution for that. For specification of the JSON files see [here](#C-Configuration) +2. Then you need a another JSON file called "preset" (see [here](#Configuration)) which will tell the generator more about your project. +e.g. its github path, ids you want to exclude (if you're need for some reason - we do for imgui), prefixes to remove, etc. +3. Execute codegen. Do `codegen -lng --preset your_preset.json -e structs_and_enums.json -t typedefs_dict.json -d definitions.json -i your_header.h -pkg your_package_name`. +This will create several files in your current directory that should contain operational code. + +## Reference packages + +Sometimes you may want to generate one package basing on another package wrapped by this +(I mean imgui plugin for example). +Example: +`header.h` contains symbol `A`. Then you have `header2.h` with a function using this symbol `A`. +On go sied you have `package1.A` and you want to generate `header2.h` in `package2` and +use `package1.A` in it. This is where `--ref*` flags comes in. You specify header1's json files as reference files +and package1 as reference package. Then you generate package2 and it will use package1's symbols. + +# C Configuration + +:warning: Disclaimer: this is NOT our design and we are not able to modify this. +The layout of these files is enforced by https://github.com/cimgui which we're using for generation. + +The minimalistic working configuration is present in [here](./testdata) review it yourself. From 0041d5d876f0f44705ee07fbc8b42b707574dcfd Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:37:47 +0100 Subject: [PATCH 16/17] remove testdata/output --- cmd/codegen/testdata/output/callbacks.go | 11 ------ cmd/codegen/testdata/output/enums.go | 14 ------- cmd/codegen/testdata/output/funcs.go | 39 ------------------- .../testdata/output/structs_accessor.cpp | 12 ------ .../testdata/output/structs_accessor.h | 19 --------- cmd/codegen/testdata/output/typedefs.cpp | 6 --- cmd/codegen/testdata/output/typedefs.go | 37 ------------------ cmd/codegen/testdata/output/typedefs.h | 15 ------- cmd/codegen/testdata/output/wrapper.cpp | 6 --- cmd/codegen/testdata/output/wrapper.h | 15 ------- 10 files changed, 174 deletions(-) delete mode 100644 cmd/codegen/testdata/output/callbacks.go delete mode 100644 cmd/codegen/testdata/output/enums.go delete mode 100644 cmd/codegen/testdata/output/funcs.go delete mode 100644 cmd/codegen/testdata/output/structs_accessor.cpp delete mode 100644 cmd/codegen/testdata/output/structs_accessor.h delete mode 100644 cmd/codegen/testdata/output/typedefs.cpp delete mode 100644 cmd/codegen/testdata/output/typedefs.go delete mode 100644 cmd/codegen/testdata/output/typedefs.h delete mode 100644 cmd/codegen/testdata/output/wrapper.cpp delete mode 100644 cmd/codegen/testdata/output/wrapper.h diff --git a/cmd/codegen/testdata/output/callbacks.go b/cmd/codegen/testdata/output/callbacks.go deleted file mode 100644 index 21031669..00000000 --- a/cmd/codegen/testdata/output/callbacks.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package mypkg - -// #include -// #include -// #include "wrapper.h" -// #include "typedefs.h" - -import "C" diff --git a/cmd/codegen/testdata/output/enums.go b/cmd/codegen/testdata/output/enums.go deleted file mode 100644 index 0b88b123..00000000 --- a/cmd/codegen/testdata/output/enums.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package mypkg - -// this is an example enum -// original name: A_ -type A int32 - -const ( - // A default value of A - ADefault A = 0 - AOne A = 1 -) diff --git a/cmd/codegen/testdata/output/funcs.go b/cmd/codegen/testdata/output/funcs.go deleted file mode 100644 index fdadb4b2..00000000 --- a/cmd/codegen/testdata/output/funcs.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package mypkg - -// #include "structs_accessor.h" -// #include "wrapper.h" - -import "C" - -func (self B) SetField1(v int32) { - selfArg, selfFin := self.Handle() - defer selfFin() - C.wrap_B_SetField1(selfArg, C.int(v)) -} - -func (self *B) Field1() int32 { - selfArg, selfFin := self.Handle() - - defer func() { - selfFin() - }() - return int32(C.wrap_B_GetField1(internal.ReinterpretCast[*C.B](selfArg))) -} - -func (self B) SetField2(v A) { - selfArg, selfFin := self.Handle() - defer selfFin() - C.wrap_B_SetField2(selfArg, C.A(v)) -} - -func (self *B) Field2() A { - selfArg, selfFin := self.Handle() - - defer func() { - selfFin() - }() - return A(C.wrap_B_GetField2(internal.ReinterpretCast[*C.B](selfArg))) -} diff --git a/cmd/codegen/testdata/output/structs_accessor.cpp b/cmd/codegen/testdata/output/structs_accessor.cpp deleted file mode 100644 index 9c7d16f4..00000000 --- a/cmd/codegen/testdata/output/structs_accessor.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - - -#include -#include "wrapper.h" -#include "structs_accessor.h" - -void wrap_B_SetField1(B *BPtr, int v) { BPtr->Field1 = v; } -int wrap_B_GetField1(B *self) { return self->Field1; } -void wrap_B_SetField2(B *BPtr, A v) { BPtr->Field2 = v; } -A wrap_B_GetField2(B *self) { return self->Field2; } diff --git a/cmd/codegen/testdata/output/structs_accessor.h b/cmd/codegen/testdata/output/structs_accessor.h deleted file mode 100644 index 3f263c0c..00000000 --- a/cmd/codegen/testdata/output/structs_accessor.h +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -#pragma once - -#include "wrapper.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern void wrap_B_SetField1(B *BPtr, int v); -extern int wrap_B_GetField1(B *self); -extern void wrap_B_SetField2(B *BPtr, A v); -extern A wrap_B_GetField2(B *self); - -#ifdef __cplusplus -} -#endif diff --git a/cmd/codegen/testdata/output/typedefs.cpp b/cmd/codegen/testdata/output/typedefs.cpp deleted file mode 100644 index c84473a3..00000000 --- a/cmd/codegen/testdata/output/typedefs.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - - -#include "typedefs.h" -#include "header.h" diff --git a/cmd/codegen/testdata/output/typedefs.go b/cmd/codegen/testdata/output/typedefs.go deleted file mode 100644 index 1170dd9b..00000000 --- a/cmd/codegen/testdata/output/typedefs.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package mypkg - -// #include -// #include -// #include "wrapper.h" -// #include "typedefs.h" - -import "C" - -type B struct { - CData *C.B -} - -// Handle returns C version of B and its finalizer func. -func (self *B) Handle() (result *C.B, fin func()) { - return self.CData, func() {} -} - -// C is like Handle but returns plain type instead of pointer. -func (self B) C() (C.B, func()) { - result, fn := self.Handle() - return *result, fn -} - -// NewEmptyB creates B with its 0 value. -func NewEmptyB() *B { - return &B{CData: new(C.B)} -} - -// NewBFromC creates B from its C pointer. -// SRC ~= *C.B -func NewBFromC[SRC any](cvalue SRC) *B { - return &B{CData: internal.ReinterpretCast[*C.B](cvalue)} -} diff --git a/cmd/codegen/testdata/output/typedefs.h b/cmd/codegen/testdata/output/typedefs.h deleted file mode 100644 index 24b6730a..00000000 --- a/cmd/codegen/testdata/output/typedefs.h +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - - -#pragma once - -#include "header.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/cmd/codegen/testdata/output/wrapper.cpp b/cmd/codegen/testdata/output/wrapper.cpp deleted file mode 100644 index 836615cf..00000000 --- a/cmd/codegen/testdata/output/wrapper.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -#include "wrapper.h" -#include "header.h" - diff --git a/cmd/codegen/testdata/output/wrapper.h b/cmd/codegen/testdata/output/wrapper.h deleted file mode 100644 index f3f1a260..00000000 --- a/cmd/codegen/testdata/output/wrapper.h +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -#pragma once - -#include "header.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef __cplusplus -} -#endif From 83af1670e8af2687ac698566cf5a8f72749683e1 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sun, 22 Dec 2024 20:38:17 +0100 Subject: [PATCH 17/17] gitignore testdata/output --- cmd/codegen/testdata/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 cmd/codegen/testdata/.gitignore diff --git a/cmd/codegen/testdata/.gitignore b/cmd/codegen/testdata/.gitignore new file mode 100644 index 00000000..53752db2 --- /dev/null +++ b/cmd/codegen/testdata/.gitignore @@ -0,0 +1 @@ +output