From 4a63c7e2ae7b99ac101ffa782cb82fef1375df8d Mon Sep 17 00:00:00 2001 From: Victor Bombi Date: Fri, 17 Apr 2020 20:27:01 +0200 Subject: [PATCH] clean_spaces with mult operator --- generator/cpp2ffi.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/generator/cpp2ffi.lua b/generator/cpp2ffi.lua index c84784f..35d005a 100644 --- a/generator/cpp2ffi.lua +++ b/generator/cpp2ffi.lua @@ -130,6 +130,8 @@ local function clean_spaces(cad) cad = strip(cad) cad = cad:gsub("%s+"," ") --not more than one space cad = cad:gsub("%s*([%(%),=:%+])%s*","%1") --not spaces with ( , ) or ( = ) or ( : ) or + + --clean %d * %d (could be done above but type*name should be treated different in other places) + cad = cad:gsub("(%d)%s*(%*)%s*(%d)","%1%2%3") return cad end @@ -1450,11 +1452,26 @@ M.location = location --[=[ -- tests -local line = [[void DockBuilderCopyDockSpace(ImGuiID src_dockspace_id, ImGuiID dst_dockspace_id, ImVector* in_window_remap_pairs);]] +local line = [[struct ImDrawListSharedData +{ + ImVec2 TexUvWhitePixel; + ImFont* Font; + float FontSize; + float CurveTessellationTol; + float CircleSegmentMaxError; + ImVec4 ClipRectFullscreen; + ImDrawListFlags InitialFlags; + ImVec2 ArcFastVtx[12 * 1]; + ImU8 CircleSegmentCounts[64]; + ImDrawListSharedData(); + void SetCircleSegmentMaxError(float max_error); +};]] local parser = M.Parser() parser:insert(line) parser:do_parse() -M.prtable(parser) +--M.prtable(parser) +M.prtable(parser:gen_structs_and_enums_table()) --]=] +--print(clean_spaces[[ImVec2 ArcFastVtx[12 * 1];]]) return M \ No newline at end of file