Skip to content

Commit

Permalink
fixup! Automatically dereference struct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWrigley committed Aug 20, 2024
1 parent 1a22b6c commit a176cb9
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 68 deletions.
18 changes: 9 additions & 9 deletions examples/demo_window.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ global function ShowJuliaDemoWindow(p_open::Ref{Bool})
if CImGui.CollapsingHeader("Configuration")
io = CImGui.GetIO()
if CImGui.TreeNode("Configuration##2")
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableKeyboard)
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableGamepad", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableGamepad)
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableKeyboard)
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableGamepad", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableGamepad)
CImGui.SameLine()
CImGui.HelpMarker("Required back-end to feed in gamepad inputs in io.NavInputs[] and set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details.");
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", io.ConfigFlags, CImGui.ImGuiConfigFlags_NavEnableSetMousePos)
CImGui.CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NavEnableSetMousePos)
CImGui.SameLine()
CImGui.HelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.")
CImGui.CheckboxFlags("io.ConfigFlags: NoMouse", io.ConfigFlags, CImGui.ImGuiConfigFlags_NoMouse)
CImGui.CheckboxFlags("io.ConfigFlags: NoMouse", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NoMouse)
if io.ConfigFlags & CImGui.ImGuiConfigFlags_NoMouse != 0 # create a way to restore this flag otherwise we could be stuck completely!
if mod(CImGui.GetTime(), 0.4) < 0.2
CImGui.SameLine()
Expand All @@ -165,17 +165,17 @@ global function ShowJuliaDemoWindow(p_open::Ref{Bool})
io.ConfigFlags = io.ConfigFlags & ~Cuint(CImGui.ImGuiConfigFlags_NoMouse)
end
end
CImGui.CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", io.ConfigFlags, CImGui.ImGuiConfigFlags_NoMouseCursorChange)
CImGui.CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", @ptr(io.ConfigFlags), CImGui.ImGuiConfigFlags_NoMouseCursorChange)
CImGui.SameLine()
CImGui.HelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.")
CImGui.Checkbox("io.ConfigInputTextCursorBlink", io.ConfigInputTextCursorBlink)
CImGui.Checkbox("io.ConfigInputTextCursorBlink", @ptr(io.ConfigInputTextCursorBlink))
CImGui.SameLine()
CImGui.HelpMarker("Set to false to disable blinking cursor, for users who consider it distracting")
CImGui.Checkbox("io.ConfigWindowsResizeFromEdges", io.ConfigWindowsResizeFromEdges)
CImGui.Checkbox("io.ConfigWindowsResizeFromEdges", @ptr(io.ConfigWindowsResizeFromEdges))
CImGui.SameLine()
CImGui.HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.")
CImGui.Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", io.ConfigWindowsMoveFromTitleBarOnly)
CImGui.Checkbox("io.MouseDrawCursor", io.MouseDrawCursor)
CImGui.Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", @ptr(io.ConfigWindowsMoveFromTitleBarOnly))
CImGui.Checkbox("io.MouseDrawCursor", @ptr(io.MouseDrawCursor))
CImGui.SameLine()
CImGui.HelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).")
CImGui.TreePop()
Expand Down
4 changes: 2 additions & 2 deletions examples/makie_demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function makie_demo(; engine=nothing, spawn=1)

ctx = ig.CreateContext()
io = ig.GetIO()
io.ConfigFlags = unsafe_load(io.ConfigFlags) | ig.lib.ImGuiConfigFlags_DockingEnable
io.ConfigFlags = unsafe_load(io.ConfigFlags) | ig.lib.ImGuiConfigFlags_ViewportsEnable
io.ConfigFlags = io.ConfigFlags | ig.lib.ImGuiConfigFlags_DockingEnable
io.ConfigFlags = io.ConfigFlags | ig.lib.ImGuiConfigFlags_ViewportsEnable

auto_resize_x = true
auto_resize_y = false
Expand Down
8 changes: 4 additions & 4 deletions lib/aarch64-apple-darwin20.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/aarch64-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/aarch64-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/armv7l-linux-gnueabihf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/armv7l-linux-musleabihf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/i686-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/i686-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/i686-w64-mingw32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/powerpc64le-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/x86_64-apple-darwin14.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/x86_64-linux-gnu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/x86_64-linux-musl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/x86_64-unknown-freebsd13.2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/x86_64-w64-mingw32.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function setbitfieldproperty!(bitfield_info, value)
end

macro ptr(expr)
if !isa(expr, Expr) || expr.head != :.
error("Expression is not a property access")
if !Meta.isexpr(expr, :.)
error("Expression is not a property access, cannot use @ptr on it.")
end

quote
local penultimate_obj = $(esc(expr.args[1]))
(@__MODULE__).getptr(penultimate_obj, $(esc(expr.args[2])))
getptr(penultimate_obj, $(esc(expr.args[2])))
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function igLogText(text)
end

# exports
const PREFIXES = ["ig", "Im", "IMGUI_", "imnodes_", "ImPlot_", "ImVector_"]
const PREFIXES = ["ig", "Im", "IMGUI_", "imnodes_", "ImPlot_", "ImVector_", "@ptr"]
for name in names(@__MODULE__; all=true), prefix in PREFIXES
if startswith(string(name), prefix)
@eval export $name
Expand Down

0 comments on commit a176cb9

Please sign in to comment.