mirror of
				https://github.com/Drezil/dear-imgui.hs.git
				synced 2025-11-03 22:51:07 +01:00 
			
		
		
		
	upgraded imgui to v1.89.7; Downstream-breakage **possible**
This commit is contained in:
		@@ -243,7 +243,7 @@ library
 | 
			
		||||
    build-depends:
 | 
			
		||||
      sdl2
 | 
			
		||||
    cxx-sources:
 | 
			
		||||
      imgui/backends/imgui_impl_sdl.cpp
 | 
			
		||||
      imgui/backends/imgui_impl_sdl2.cpp
 | 
			
		||||
 | 
			
		||||
    if os(windows) || os(darwin)
 | 
			
		||||
      extra-libraries:
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@ import Data.Text
 | 
			
		||||
  ( Text )
 | 
			
		||||
import qualified Data.Text as Text
 | 
			
		||||
  ( all, any, breakOn, drop, dropWhile, dropWhileEnd
 | 
			
		||||
  , length, stripPrefix, unlines, unpack
 | 
			
		||||
  , length, stripPrefix, unlines, unpack, pack
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
-- transformers
 | 
			
		||||
@@ -81,6 +81,8 @@ import DearImGui.Generator.Tokeniser
 | 
			
		||||
import DearImGui.Generator.Types
 | 
			
		||||
  ( Comment(..), Enumeration(..), Headers(..) )
 | 
			
		||||
 | 
			
		||||
import qualified Text.Show as Text
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
-- Parse error type.
 | 
			
		||||
 | 
			
		||||
@@ -90,7 +92,9 @@ data CustomParseError
 | 
			
		||||
    , problems :: ![Text]
 | 
			
		||||
    }
 | 
			
		||||
  | MissingForwardDeclaration
 | 
			
		||||
    { enumName :: !Text }
 | 
			
		||||
    { enumName :: !Text
 | 
			
		||||
    , library :: HashMap Text ( TH.Name, Comment )
 | 
			
		||||
    }
 | 
			
		||||
  | UnexpectedSection
 | 
			
		||||
    { sectionName :: !Text
 | 
			
		||||
    , problem     :: ![Text]
 | 
			
		||||
@@ -101,8 +105,9 @@ instance ShowErrorComponent CustomParseError where
 | 
			
		||||
  showErrorComponent ( Couldn'tLookupEnumValues { enumName, problems } ) = Text.unpack $
 | 
			
		||||
    "Couldn't lookup the following values in enum " <> enumName <> ":\n"
 | 
			
		||||
    <> Text.unlines ( map ( " - "  <> ) problems )
 | 
			
		||||
  showErrorComponent ( MissingForwardDeclaration { enumName } ) = Text.unpack $
 | 
			
		||||
    "Missing forward declaration for enum named " <> enumName
 | 
			
		||||
  showErrorComponent ( MissingForwardDeclaration { enumName, library } ) = Text.unpack $
 | 
			
		||||
    "Missing forward declaration for enum named " <> enumName <> "\n"
 | 
			
		||||
    <> "In Library: " <> Text.pack ( Text.show library)
 | 
			
		||||
  showErrorComponent ( UnexpectedSection { sectionName, problem } ) = Text.unpack $
 | 
			
		||||
    "Unexpected section name.\n\
 | 
			
		||||
    \Expected: " <> sectionName <> "\n\
 | 
			
		||||
@@ -124,6 +129,7 @@ headers = do
 | 
			
		||||
  ( _defines, basicEnums ) <- partitionEithers <$>
 | 
			
		||||
    manyTill
 | 
			
		||||
      (   ( Left  <$> try ignoreDefine )
 | 
			
		||||
      <|> ( Left  <$> try cppConditional )
 | 
			
		||||
      <|> ( Right <$> enumeration enumNamesAndTypes )
 | 
			
		||||
      )
 | 
			
		||||
      ( namedSection "Helpers: Memory allocations macros, ImVector<>" )
 | 
			
		||||
@@ -134,7 +140,7 @@ headers = do
 | 
			
		||||
 | 
			
		||||
  _ <- 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 ( try . lookAhead $ many comment *> keyword "enum" )
 | 
			
		||||
@@ -171,14 +177,24 @@ forwardDeclarations = do
 | 
			
		||||
    pure ( structName, doc )
 | 
			
		||||
  _ <- many comment
 | 
			
		||||
  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"
 | 
			
		||||
    ty <- cTypeName
 | 
			
		||||
    enumName <- identifier
 | 
			
		||||
    reservedSymbol ';'
 | 
			
		||||
    doc <- commentText <$> comment
 | 
			
		||||
    _ <- many comment
 | 
			
		||||
    pure ( enumName, ( ty, CommentText <$> Text.drop 2 . snd $ Text.breakOn "//" doc ) )
 | 
			
		||||
  -- 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 = keyword "int" $> ''CInt
 | 
			
		||||
@@ -200,6 +216,7 @@ enumeration enumNamesAndTypes = do
 | 
			
		||||
    keyword "enum"
 | 
			
		||||
    pure inlineDocs
 | 
			
		||||
  fullEnumName <- identifier
 | 
			
		||||
  _ <- try $ (symbol ":" >> cTypeName >> pure ()) <|> pure ()
 | 
			
		||||
  let
 | 
			
		||||
    enumName :: Text
 | 
			
		||||
    enumName = Text.dropWhileEnd ( == '_' ) fullEnumName
 | 
			
		||||
@@ -207,7 +224,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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								imgui
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								imgui
									
									
									
									
									
								
							 Submodule imgui updated: 9aae45eb4a...d4ddc46e77
									
								
							@@ -50,7 +50,7 @@ import Control.Monad.IO.Class
 | 
			
		||||
 | 
			
		||||
C.context (Cpp.cppCtx <> C.bsCtx)
 | 
			
		||||
C.include "imgui.h"
 | 
			
		||||
C.include "backends/imgui_impl_sdl.h"
 | 
			
		||||
C.include "backends/imgui_impl_sdl2.h"
 | 
			
		||||
C.include "SDL.h"
 | 
			
		||||
Cpp.using "namespace ImGui"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ import Control.Monad.IO.Class
 | 
			
		||||
C.context (Cpp.cppCtx <> C.bsCtx)
 | 
			
		||||
C.include "imgui.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_opengl.h"
 | 
			
		||||
Cpp.using "namespace ImGui"
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ import Control.Monad.IO.Class ( MonadIO, liftIO )
 | 
			
		||||
C.context Cpp.cppCtx
 | 
			
		||||
C.include "imgui.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_vulkan.h"
 | 
			
		||||
Cpp.using "namespace ImGui"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user