mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
upgraded imgui to v1.89.7; Downstream-breakage **possible**
This commit is contained in:
parent
8368192370
commit
6195b32afd
@ -243,7 +243,7 @@ library
|
|||||||
build-depends:
|
build-depends:
|
||||||
sdl2
|
sdl2
|
||||||
cxx-sources:
|
cxx-sources:
|
||||||
imgui/backends/imgui_impl_sdl.cpp
|
imgui/backends/imgui_impl_sdl2.cpp
|
||||||
|
|
||||||
if os(windows) || os(darwin)
|
if os(windows) || os(darwin)
|
||||||
extra-libraries:
|
extra-libraries:
|
||||||
|
@ -60,7 +60,7 @@ import Data.Text
|
|||||||
( Text )
|
( Text )
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
( all, any, breakOn, drop, dropWhile, dropWhileEnd
|
( all, any, breakOn, drop, dropWhile, dropWhileEnd
|
||||||
, length, stripPrefix, unlines, unpack
|
, length, stripPrefix, unlines, unpack, pack
|
||||||
)
|
)
|
||||||
|
|
||||||
-- transformers
|
-- transformers
|
||||||
@ -81,6 +81,8 @@ import DearImGui.Generator.Tokeniser
|
|||||||
import DearImGui.Generator.Types
|
import DearImGui.Generator.Types
|
||||||
( Comment(..), Enumeration(..), Headers(..) )
|
( Comment(..), Enumeration(..), Headers(..) )
|
||||||
|
|
||||||
|
import qualified Text.Show as Text
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Parse error type.
|
-- Parse error type.
|
||||||
|
|
||||||
@ -90,7 +92,9 @@ data CustomParseError
|
|||||||
, problems :: ![Text]
|
, problems :: ![Text]
|
||||||
}
|
}
|
||||||
| MissingForwardDeclaration
|
| MissingForwardDeclaration
|
||||||
{ enumName :: !Text }
|
{ enumName :: !Text
|
||||||
|
, library :: HashMap Text ( TH.Name, Comment )
|
||||||
|
}
|
||||||
| UnexpectedSection
|
| UnexpectedSection
|
||||||
{ sectionName :: !Text
|
{ sectionName :: !Text
|
||||||
, problem :: ![Text]
|
, problem :: ![Text]
|
||||||
@ -101,8 +105,9 @@ instance ShowErrorComponent CustomParseError where
|
|||||||
showErrorComponent ( Couldn'tLookupEnumValues { enumName, problems } ) = Text.unpack $
|
showErrorComponent ( Couldn'tLookupEnumValues { enumName, problems } ) = Text.unpack $
|
||||||
"Couldn't lookup the following values in enum " <> enumName <> ":\n"
|
"Couldn't lookup the following values in enum " <> enumName <> ":\n"
|
||||||
<> Text.unlines ( map ( " - " <> ) problems )
|
<> Text.unlines ( map ( " - " <> ) problems )
|
||||||
showErrorComponent ( MissingForwardDeclaration { enumName } ) = Text.unpack $
|
showErrorComponent ( MissingForwardDeclaration { enumName, library } ) = Text.unpack $
|
||||||
"Missing forward declaration for enum named " <> enumName
|
"Missing forward declaration for enum named " <> enumName <> "\n"
|
||||||
|
<> "In Library: " <> Text.pack ( Text.show library)
|
||||||
showErrorComponent ( UnexpectedSection { sectionName, problem } ) = Text.unpack $
|
showErrorComponent ( UnexpectedSection { sectionName, problem } ) = Text.unpack $
|
||||||
"Unexpected section name.\n\
|
"Unexpected section name.\n\
|
||||||
\Expected: " <> sectionName <> "\n\
|
\Expected: " <> sectionName <> "\n\
|
||||||
@ -124,6 +129,7 @@ headers = do
|
|||||||
( _defines, basicEnums ) <- partitionEithers <$>
|
( _defines, basicEnums ) <- partitionEithers <$>
|
||||||
manyTill
|
manyTill
|
||||||
( ( Left <$> try ignoreDefine )
|
( ( Left <$> try ignoreDefine )
|
||||||
|
<|> ( Left <$> try cppConditional )
|
||||||
<|> ( Right <$> enumeration enumNamesAndTypes )
|
<|> ( Right <$> enumeration enumNamesAndTypes )
|
||||||
)
|
)
|
||||||
( namedSection "Helpers: Memory allocations macros, ImVector<>" )
|
( namedSection "Helpers: Memory allocations macros, ImVector<>" )
|
||||||
@ -134,7 +140,7 @@ headers = do
|
|||||||
|
|
||||||
_ <- skipManyTill anySingle ( namedSection "Misc data structures" )
|
_ <- skipManyTill anySingle ( namedSection "Misc data structures" )
|
||||||
|
|
||||||
_ <- skipManyTill anySingle ( namedSection "Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)" )
|
_ <- skipManyTill anySingle ( namedSection "Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor)" )
|
||||||
|
|
||||||
_ <- skipManyTill anySingle ( namedSection "Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)" )
|
_ <- skipManyTill anySingle ( namedSection "Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)" )
|
||||||
skipManyTill anySingle ( try . lookAhead $ many comment *> keyword "enum" )
|
skipManyTill anySingle ( try . lookAhead $ many comment *> keyword "enum" )
|
||||||
@ -171,14 +177,24 @@ forwardDeclarations = do
|
|||||||
pure ( structName, doc )
|
pure ( structName, doc )
|
||||||
_ <- many comment
|
_ <- many comment
|
||||||
enums <- many do
|
enums <- many do
|
||||||
|
keyword "enum"
|
||||||
|
enumName <- identifier
|
||||||
|
symbol ":"
|
||||||
|
ty <- cTypeName
|
||||||
|
reservedSymbol ';'
|
||||||
|
doc <- commentText <$> comment
|
||||||
|
pure ( enumName, ( ty, CommentText <$> Text.drop 2 . snd $ Text.breakOn "//" doc ) )
|
||||||
|
_ <- many comment
|
||||||
|
typedefs <- many do
|
||||||
keyword "typedef"
|
keyword "typedef"
|
||||||
ty <- cTypeName
|
ty <- cTypeName
|
||||||
enumName <- identifier
|
enumName <- identifier
|
||||||
reservedSymbol ';'
|
reservedSymbol ';'
|
||||||
doc <- commentText <$> comment
|
doc <- commentText <$> comment
|
||||||
|
_ <- many comment
|
||||||
pure ( enumName, ( ty, CommentText <$> Text.drop 2 . snd $ Text.breakOn "//" doc ) )
|
pure ( enumName, ( ty, CommentText <$> Text.drop 2 . snd $ Text.breakOn "//" doc ) )
|
||||||
-- Stopping after simple structs and enums for now.
|
-- Stopping after simple structs and enums for now.
|
||||||
pure ( HashMap.fromList structs, HashMap.fromList enums )
|
pure ( HashMap.fromList structs, HashMap.fromList (enums <> typedefs) )
|
||||||
|
|
||||||
cTypeName :: MonadParsec e [Tok] m => m TH.Name
|
cTypeName :: MonadParsec e [Tok] m => m TH.Name
|
||||||
cTypeName = keyword "int" $> ''CInt
|
cTypeName = keyword "int" $> ''CInt
|
||||||
@ -200,6 +216,7 @@ enumeration enumNamesAndTypes = do
|
|||||||
keyword "enum"
|
keyword "enum"
|
||||||
pure inlineDocs
|
pure inlineDocs
|
||||||
fullEnumName <- identifier
|
fullEnumName <- identifier
|
||||||
|
_ <- try $ (symbol ":" >> cTypeName >> pure ()) <|> pure ()
|
||||||
let
|
let
|
||||||
enumName :: Text
|
enumName :: Text
|
||||||
enumName = Text.dropWhileEnd ( == '_' ) fullEnumName
|
enumName = Text.dropWhileEnd ( == '_' ) fullEnumName
|
||||||
@ -207,7 +224,7 @@ enumeration enumNamesAndTypes = do
|
|||||||
enumTypeName = ()
|
enumTypeName = ()
|
||||||
( underlyingType, forwardDoc ) <- case HashMap.lookup enumName enumNamesAndTypes of
|
( underlyingType, forwardDoc ) <- case HashMap.lookup enumName enumNamesAndTypes of
|
||||||
Just res -> pure res
|
Just res -> pure res
|
||||||
Nothing -> customFailure ( MissingForwardDeclaration { enumName } )
|
Nothing -> customFailure ( MissingForwardDeclaration { enumName, library=enumNamesAndTypes } )
|
||||||
let
|
let
|
||||||
docs :: [Comment]
|
docs :: [Comment]
|
||||||
docs = forwardDoc : CommentText "" : inlineDocs
|
docs = forwardDoc : CommentText "" : inlineDocs
|
||||||
|
2
imgui
2
imgui
@ -1 +1 @@
|
|||||||
Subproject commit 9aae45eb4a05a5a1f96be1ef37eb503a12ceb889
|
Subproject commit d4ddc46e7773e9a9b68f965d007968f35ca4e09a
|
@ -50,7 +50,7 @@ import Control.Monad.IO.Class
|
|||||||
|
|
||||||
C.context (Cpp.cppCtx <> C.bsCtx)
|
C.context (Cpp.cppCtx <> C.bsCtx)
|
||||||
C.include "imgui.h"
|
C.include "imgui.h"
|
||||||
C.include "backends/imgui_impl_sdl.h"
|
C.include "backends/imgui_impl_sdl2.h"
|
||||||
C.include "SDL.h"
|
C.include "SDL.h"
|
||||||
Cpp.using "namespace ImGui"
|
Cpp.using "namespace ImGui"
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import Control.Monad.IO.Class
|
|||||||
C.context (Cpp.cppCtx <> C.bsCtx)
|
C.context (Cpp.cppCtx <> C.bsCtx)
|
||||||
C.include "imgui.h"
|
C.include "imgui.h"
|
||||||
C.include "backends/imgui_impl_opengl2.h"
|
C.include "backends/imgui_impl_opengl2.h"
|
||||||
C.include "backends/imgui_impl_sdl.h"
|
C.include "backends/imgui_impl_sdl2.h"
|
||||||
C.include "SDL.h"
|
C.include "SDL.h"
|
||||||
C.include "SDL_opengl.h"
|
C.include "SDL_opengl.h"
|
||||||
Cpp.using "namespace ImGui"
|
Cpp.using "namespace ImGui"
|
||||||
|
@ -33,7 +33,7 @@ import Control.Monad.IO.Class ( MonadIO, liftIO )
|
|||||||
C.context Cpp.cppCtx
|
C.context Cpp.cppCtx
|
||||||
C.include "imgui.h"
|
C.include "imgui.h"
|
||||||
C.include "backends/imgui_impl_vulkan.h"
|
C.include "backends/imgui_impl_vulkan.h"
|
||||||
C.include "backends/imgui_impl_sdl.h"
|
C.include "backends/imgui_impl_sdl2.h"
|
||||||
C.include "SDL.h"
|
C.include "SDL.h"
|
||||||
C.include "SDL_vulkan.h"
|
C.include "SDL_vulkan.h"
|
||||||
Cpp.using "namespace ImGui"
|
Cpp.using "namespace ImGui"
|
||||||
|
Loading…
Reference in New Issue
Block a user