From 29987079151199d22d23b99f9d461ccedf573b0c Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Tue, 18 Jul 2023 00:47:16 +0200 Subject: [PATCH] lifted to imgui 1.89.7 & implot master (1.89.7 fixes) --- .gitmodules | 2 +- dear-imgui.hs | 2 +- dear-implot.cabal | 6 +++--- implot | 2 +- src/DearImGui/Context.hs | 1 - src/DearImGui/Plot/Generator.hs | 6 ++++-- src/DearImGui/Plot/Generator/Parser.hs | 6 ++++-- src/DearImGui/Raw/Context.hs | 1 + src/DearImGui/Raw/Plot.hs | 2 +- 9 files changed, 16 insertions(+), 12 deletions(-) delete mode 120000 src/DearImGui/Context.hs create mode 120000 src/DearImGui/Raw/Context.hs diff --git a/.gitmodules b/.gitmodules index 2898f37..752edc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,4 +4,4 @@ branch = v0.13 [submodule "dear-imgui.hs"] path = dear-imgui.hs - url = https://github.com/drezil/dear-imgui.hs + url = https://github.com/haskell-game/dear-imgui.hs diff --git a/dear-imgui.hs b/dear-imgui.hs index cf166ac..6ccb09a 160000 --- a/dear-imgui.hs +++ b/dear-imgui.hs @@ -1 +1 @@ -Subproject commit cf166acda9c207f59e57799875570b6529cf42fc +Subproject commit 6ccb09a7daa915d41ee0d751eb49b0653435a207 diff --git a/dear-implot.cabal b/dear-implot.cabal index b8a945b..a1159e2 100644 --- a/dear-implot.cabal +++ b/dear-implot.cabal @@ -46,7 +46,7 @@ library DearImGui.Generator.Types DearImGui.Structs DearImGui.Enums - DearImGui.Context + DearImGui.Raw.Context hs-source-dirs: src default-language: @@ -65,7 +65,7 @@ library implot/implot_demo.cpp implot/implot_items.cpp cxx-options: - -std=c++11 + -std=c++11 -DIMGUI_DEFINE_MATH_OPERATORS extra-libraries: stdc++ include-dirs: @@ -83,7 +83,7 @@ library build-depends: base , StateVar , containers - , dear-imgui == 2.1.0 + , dear-imgui == 2.1.3 , inline-c , inline-c-cpp , managed diff --git a/implot b/implot index e80e42e..cc5e1da 160000 --- a/implot +++ b/implot @@ -1 +1 @@ -Subproject commit e80e42e8b4136ddb84ccfe04fa28d0c745828952 +Subproject commit cc5e1daa5c7f2335a9460ae79c829011dc5cef2d diff --git a/src/DearImGui/Context.hs b/src/DearImGui/Context.hs deleted file mode 120000 index 8c285c1..0000000 --- a/src/DearImGui/Context.hs +++ /dev/null @@ -1 +0,0 @@ -../../dear-imgui.hs/src/DearImGui/Context.hs \ No newline at end of file diff --git a/src/DearImGui/Plot/Generator.hs b/src/DearImGui/Plot/Generator.hs index 26c052d..eebe9c3 100644 --- a/src/DearImGui/Plot/Generator.hs +++ b/src/DearImGui/Plot/Generator.hs @@ -24,6 +24,8 @@ import Data.Traversable ( for ) import Foreign.Storable ( Storable ) +import Data.Coerce + ( coerce ) -- containers import Data.Map.Strict @@ -165,7 +167,7 @@ declareEnumeration finiteEnumName countName ( Enumeration {..} ) = do pure ( finiteEnumInst : ) else pure id - synonyms <- for patterns \ ( patternName, patternValue, CommentText _patDoc ) -> do + synonyms <- for patterns \ ( patternName, patternValue, CommentText patDoc ) -> do let patNameStr :: String patNameStr = Text.unpack patternName @@ -173,7 +175,7 @@ declareEnumeration finiteEnumName countName ( Enumeration {..} ) = do patSynSig <- TH.patSynSigD patName ( TH.conT tyName ) pat <- #if MIN_VERSION_template_haskell(2,18,0) - ( if Text.null _patDoc + ( if Text.null patDoc then TH.patSynD else \ nm args dir pat -> diff --git a/src/DearImGui/Plot/Generator/Parser.hs b/src/DearImGui/Plot/Generator/Parser.hs index 11861a2..49c414f 100644 --- a/src/DearImGui/Plot/Generator/Parser.hs +++ b/src/DearImGui/Plot/Generator/Parser.hs @@ -98,7 +98,7 @@ plotHeaders = do manyTill ( ( Left <$> try ignoreDefine) <|> ( Right <$> enumeration enumNamesAndTypes) - <|> ( Left <$> ignoreStruct) + <|> ( Left <$> try ignoreStruct) <|> ( Left <$> cppConditionalIgnore) ) ( namedSection "Callbacks" ) @@ -210,7 +210,7 @@ enumeration enumNamesAndTypes = do enumTypeName = () ( underlyingType, forwardDoc ) <- case HashMap.lookup enumName enumNamesAndTypes of Just res -> pure res - Nothing -> customFailure ( MissingForwardDeclaration { enumName } ) + Nothing -> customFailure ( MissingForwardDeclaration { enumName, library = enumNamesAndTypes } ) let docs :: [Comment] docs = forwardDoc : CommentText "" : inlineDocs @@ -438,6 +438,7 @@ cppDirective f = token ( \case { BeginCPP a -> f a; _ -> Nothing } ) mempty cppConditional :: MonadParsec e [Tok] m => m () cppConditional = do + void $ many comment void $ cppDirective ( \case { "ifdef" -> Just True; "ifndef" -> Just False; _ -> Nothing } ) -- assumes no nesting void $ skipManyTill anySingle ( cppDirective ( \case { "endif" -> Just (); _ -> Nothing } ) ) @@ -445,6 +446,7 @@ cppConditional = do cppConditionalIgnore :: MonadParsec e [Tok] m => m () cppConditionalIgnore = do + void $ many comment void $ cppDirective ( \case { "ifdef" -> Just (); "ifndef" -> Just (); "if" -> Just (); _ -> Nothing } ) -- assumes no nesting void $ skipManyTill anySingle ( cppDirective ( \case { "endif" -> Just (); _ -> Nothing } ) ) diff --git a/src/DearImGui/Raw/Context.hs b/src/DearImGui/Raw/Context.hs new file mode 120000 index 0000000..d7fdfb9 --- /dev/null +++ b/src/DearImGui/Raw/Context.hs @@ -0,0 +1 @@ +../../../dear-imgui.hs/src/DearImGui/Raw/Context.hs \ No newline at end of file diff --git a/src/DearImGui/Raw/Plot.hs b/src/DearImGui/Raw/Plot.hs index 96a664e..e2eaaf1 100644 --- a/src/DearImGui/Raw/Plot.hs +++ b/src/DearImGui/Raw/Plot.hs @@ -40,7 +40,7 @@ import System.IO.Unsafe -- dear-imgui import DearImGui -import DearImGui.Context +import DearImGui.Raw.Context import DearImGui.Plot.Context ( implotContext ) import DearImGui.Plot.Enums