{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | Functionality to query the current SDL version, both as headers the app was compiled against, and a library the app is linked to. The current major version of SDL headers.
--
--     If this were SDL version 3.2.1, this value would be 3.
--
--     @since 3.2.0
module SDL3.Sys.Bindgen.Version (
  SDL3.Sys.Bindgen.Version.sDL_MAJOR_VERSION,
  SDL3.Sys.Bindgen.Version.sDL_MINOR_VERSION,
  SDL3.Sys.Bindgen.Version.sDL_MICRO_VERSION,
  SDL3.Sys.Bindgen.Version.sDL_VERSIONNUM,
  SDL3.Sys.Bindgen.Version.sDL_VERSIONNUM_MAJOR,
  SDL3.Sys.Bindgen.Version.sDL_VERSIONNUM_MINOR,
  SDL3.Sys.Bindgen.Version.sDL_VERSIONNUM_MICRO,
  SDL3.Sys.Bindgen.Version.sDL_VERSION,
  SDL3.Sys.Bindgen.Version.sDL_VERSION_ATLEAST,
)
where

import C.Expr.HostPlatform qualified
import HsBindgen.Runtime.Support qualified as BG

-- | [C declaration]: @macro SDL_MAJOR_VERSION@, defined at @SDL3\/SDL_version.h 47:9@
sDL_MAJOR_VERSION :: BG.CInt
sDL_MAJOR_VERSION :: CInt
sDL_MAJOR_VERSION = (CInt
3 :: BG.CInt)

-- | The current minor version of the SDL headers.
--
--     If this were SDL version 3.2.1, this value would be 2.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_MINOR_VERSION@, defined at @SDL3\/SDL_version.h 56:9@
sDL_MINOR_VERSION :: BG.CInt
sDL_MINOR_VERSION :: CInt
sDL_MINOR_VERSION = (CInt
4 :: BG.CInt)

-- | The current micro (or patchlevel) version of the SDL headers.
--
--     If this were SDL version 3.2.1, this value would be 1.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_MICRO_VERSION@, defined at @SDL3\/SDL_version.h 65:9@
sDL_MICRO_VERSION :: BG.CInt
sDL_MICRO_VERSION :: CInt
sDL_MICRO_VERSION = (CInt
18 :: BG.CInt)

-- | This macro turns the version numbers into a numeric value.
--
--     (1,2,3) becomes 1002003.
--
--     [@major@]: the major version number.
--
--     [@minor@]: the minorversion number.
--
--     [@patch@]: the patch version number.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_VERSIONNUM@, defined at @SDL3\/SDL_version.h 78:9@
sDL_VERSIONNUM
  :: forall a0 b1 c2
   . ( C.Expr.HostPlatform.Add
         (C.Expr.HostPlatform.MultRes a0 BG.CInt)
         (C.Expr.HostPlatform.MultRes b1 BG.CInt)
     )
  => ( C.Expr.HostPlatform.Add
         ( C.Expr.HostPlatform.AddRes
             (C.Expr.HostPlatform.MultRes a0 BG.CInt)
             (C.Expr.HostPlatform.MultRes b1 BG.CInt)
         )
         c2
     )
  => (C.Expr.HostPlatform.Mult b1 BG.CInt)
  => (C.Expr.HostPlatform.Mult a0 BG.CInt)
  => a0
  -> b1
  -> c2
  -> C.Expr.HostPlatform.AddRes
       ( C.Expr.HostPlatform.AddRes
           (C.Expr.HostPlatform.MultRes a0 BG.CInt)
           (C.Expr.HostPlatform.MultRes b1 BG.CInt)
       )
       c2
sDL_VERSIONNUM :: forall a0 b1 c2.
(Add (MultRes a0 CInt) (MultRes b1 CInt),
 Add (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2, Mult b1 CInt,
 Mult a0 CInt) =>
a0
-> b1
-> c2
-> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2
sDL_VERSIONNUM =
  \a0
major0 ->
    \b1
minor1 ->
      \c2
patch2 ->
        AddRes (MultRes a0 CInt) (MultRes b1 CInt)
-> c2 -> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2
forall a b. Add a b => a -> b -> AddRes a b
(C.Expr.HostPlatform.+)
          ( MultRes a0 CInt
-> MultRes b1 CInt -> AddRes (MultRes a0 CInt) (MultRes b1 CInt)
forall a b. Add a b => a -> b -> AddRes a b
(C.Expr.HostPlatform.+)
              (a0 -> CInt -> MultRes a0 CInt
forall a b. Mult a b => a -> b -> MultRes a b
(C.Expr.HostPlatform.*) a0
major0 (CInt
1000000 :: BG.CInt))
              (b1 -> CInt -> MultRes b1 CInt
forall a b. Mult a b => a -> b -> MultRes a b
(C.Expr.HostPlatform.*) b1
minor1 (CInt
1000 :: BG.CInt))
          )
          c2
patch2

-- | This macro extracts the major version from a version number
--
--     1002003 becomes 1.
--
--     [@version@]: the version number.
--
--     [Thread safety]: It is safe to call this macro from any thread.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_VERSIONNUM_MAJOR@, defined at @SDL3\/SDL_version.h 92:9@
sDL_VERSIONNUM_MAJOR
  :: forall a0. (C.Expr.HostPlatform.Div a0 BG.CInt) => a0 -> C.Expr.HostPlatform.DivRes a0 BG.CInt
sDL_VERSIONNUM_MAJOR :: forall a0. Div a0 CInt => a0 -> DivRes a0 CInt
sDL_VERSIONNUM_MAJOR =
  \a0
version0 ->
    a0 -> CInt -> DivRes a0 CInt
forall a b. Div a b => a -> b -> DivRes a b
(C.Expr.HostPlatform./) a0
version0 (CInt
1000000 :: BG.CInt)

-- | This macro extracts the minor version from a version number
--
--     1002003 becomes 2.
--
--     [@version@]: the version number.
--
--     [Thread safety]: It is safe to call this macro from any thread.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_VERSIONNUM_MINOR@, defined at @SDL3\/SDL_version.h 105:9@
sDL_VERSIONNUM_MINOR
  :: forall a0
   . (C.Expr.HostPlatform.Div a0 BG.CInt)
  => (C.Expr.HostPlatform.Rem (C.Expr.HostPlatform.DivRes a0 BG.CInt) BG.CInt)
  => a0 -> C.Expr.HostPlatform.RemRes (C.Expr.HostPlatform.DivRes a0 BG.CInt) BG.CInt
sDL_VERSIONNUM_MINOR :: forall a0.
(Div a0 CInt, Rem (DivRes a0 CInt) CInt) =>
a0 -> RemRes (DivRes a0 CInt) CInt
sDL_VERSIONNUM_MINOR =
  \a0
version0 ->
    DivRes a0 CInt -> CInt -> RemRes (DivRes a0 CInt) CInt
forall a b. Rem a b => a -> b -> RemRes a b
(C.Expr.HostPlatform.%) (a0 -> CInt -> DivRes a0 CInt
forall a b. Div a b => a -> b -> DivRes a b
(C.Expr.HostPlatform./) a0
version0 (CInt
1000 :: BG.CInt)) (CInt
1000 :: BG.CInt)

-- | This macro extracts the micro version from a version number
--
--     1002003 becomes 3.
--
--     [@version@]: the version number.
--
--     [Thread safety]: It is safe to call this macro from any thread.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_VERSIONNUM_MICRO@, defined at @SDL3\/SDL_version.h 118:9@
sDL_VERSIONNUM_MICRO
  :: forall a0. (C.Expr.HostPlatform.Rem a0 BG.CInt) => a0 -> C.Expr.HostPlatform.RemRes a0 BG.CInt
sDL_VERSIONNUM_MICRO :: forall a0. Rem a0 CInt => a0 -> RemRes a0 CInt
sDL_VERSIONNUM_MICRO =
  \a0
version0 ->
    a0 -> CInt -> RemRes a0 CInt
forall a b. Rem a b => a -> b -> RemRes a b
(C.Expr.HostPlatform.%) a0
version0 (CInt
1000 :: BG.CInt)

-- | This is the version number macro for the current SDL version.
--
--     [Thread safety]: It is safe to call this macro from any thread.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_GetVersion'
--
--     [C declaration]: @macro SDL_VERSION@, defined at @SDL3\/SDL_version.h 129:9@
sDL_VERSION :: BG.CInt
sDL_VERSION :: CInt
sDL_VERSION =
  CInt
-> CInt
-> CInt
-> AddRes (AddRes (MultRes CInt CInt) (MultRes CInt CInt)) CInt
forall a0 b1 c2.
(Add (MultRes a0 CInt) (MultRes b1 CInt),
 Add (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2, Mult b1 CInt,
 Mult a0 CInt) =>
a0
-> b1
-> c2
-> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2
sDL_VERSIONNUM CInt
sDL_MAJOR_VERSION CInt
sDL_MINOR_VERSION CInt
sDL_MICRO_VERSION

-- | This macro will evaluate to true if compiled with SDL at least X.Y.Z.
--
--     [Thread safety]: It is safe to call this macro from any thread.
--
--     @since 3.2.0
--
--     [C declaration]: @macro SDL_VERSION_ATLEAST@, defined at @SDL3\/SDL_version.h 139:9@
sDL_VERSION_ATLEAST
  :: forall a0 b1 c2
   . ( C.Expr.HostPlatform.RelOrd
         BG.CInt
         ( C.Expr.HostPlatform.AddRes
             ( C.Expr.HostPlatform.AddRes
                 (C.Expr.HostPlatform.MultRes a0 BG.CInt)
                 (C.Expr.HostPlatform.MultRes b1 BG.CInt)
             )
             c2
         )
     )
  => ( C.Expr.HostPlatform.Add
         ( C.Expr.HostPlatform.AddRes
             (C.Expr.HostPlatform.MultRes a0 BG.CInt)
             (C.Expr.HostPlatform.MultRes b1 BG.CInt)
         )
         c2
     )
  => ( C.Expr.HostPlatform.Add
         (C.Expr.HostPlatform.MultRes a0 BG.CInt)
         (C.Expr.HostPlatform.MultRes b1 BG.CInt)
     )
  => (C.Expr.HostPlatform.Mult a0 BG.CInt)
  => (C.Expr.HostPlatform.Mult b1 BG.CInt)
  => a0 -> b1 -> c2 -> BG.CInt
sDL_VERSION_ATLEAST :: forall a0 b1 c2.
(RelOrd
   CInt (AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2),
 Add (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2,
 Add (MultRes a0 CInt) (MultRes b1 CInt), Mult a0 CInt,
 Mult b1 CInt) =>
a0 -> b1 -> c2 -> CInt
sDL_VERSION_ATLEAST =
  \a0
x0 ->
    \b1
y1 ->
      \c2
z2 ->
        CInt
-> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2 -> CInt
forall a b. RelOrd a b => a -> b -> CInt
(C.Expr.HostPlatform.>=) CInt
sDL_VERSION (a0
-> b1
-> c2
-> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2
forall a0 b1 c2.
(Add (MultRes a0 CInt) (MultRes b1 CInt),
 Add (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2, Mult b1 CInt,
 Mult a0 CInt) =>
a0
-> b1
-> c2
-> AddRes (AddRes (MultRes a0 CInt) (MultRes b1 CInt)) c2
sDL_VERSIONNUM a0
x0 b1
y1 c2
z2)