{-# LINE 1 "src/Lua/Constants.hsc" #-}
{-# LANGUAGE PatternSynonyms #-}
{-|
Module      : Lua.Constants
Copyright   : © 2007–2012 Gracjan Polak;
              © 2012–2016 Ömer Sinan Ağacan;
              © 2017-2022 Albert Krewinkel
License     : MIT
Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>
Stability   : beta
Portability : ForeignFunctionInterface

Lua constants
-}
module Lua.Constants
  ( -- * Special values
    pattern LUA_MULTRET
    -- * Pseudo-indices
  , pattern LUA_REGISTRYINDEX
    -- * Basic types
  , pattern LUA_TNONE
  , pattern LUA_TNIL
  , pattern LUA_TBOOLEAN
  , pattern LUA_TLIGHTUSERDATA
  , pattern LUA_TNUMBER
  , pattern LUA_TSTRING
  , pattern LUA_TTABLE
  , pattern LUA_TFUNCTION
  , pattern LUA_TUSERDATA
  , pattern LUA_TTHREAD
    -- * Status codes
  , pattern LUA_OK
  , pattern LUA_YIELD
  , pattern LUA_ERRRUN
  , pattern LUA_ERRSYNTAX
  , pattern LUA_ERRMEM
  , pattern LUA_ERRGCMM
  , pattern LUA_ERRERR
  , pattern LUA_ERRFILE
    -- * Relational operator codes
  , pattern LUA_OPEQ
  , pattern LUA_OPLT
  , pattern LUA_OPLE
    -- * Codes for arithmetic operations
  , pattern LUA_OPADD
  , pattern LUA_OPSUB
  , pattern LUA_OPMUL
  , pattern LUA_OPDIV
  , pattern LUA_OPIDIV
  , pattern LUA_OPMOD
  , pattern LUA_OPPOW
  , pattern LUA_OPUNM
  , pattern LUA_OPBNOT
  , pattern LUA_OPBAND
  , pattern LUA_OPBOR
  , pattern LUA_OPBXOR
  , pattern LUA_OPSHL
  , pattern LUA_OPSHR
    -- * Garbage-collection options
  , pattern LUA_GCSTOP
  , pattern LUA_GCRESTART
  , pattern LUA_GCCOLLECT
  , pattern LUA_GCCOUNT
  , pattern LUA_GCCOUNTB
  , pattern LUA_GCSTEP
  , pattern LUA_GCSETPAUSE
  , pattern LUA_GCSETSTEPMUL
  , pattern LUA_GCISRUNNING
    -- * Predefined references
  , pattern LUA_REFNIL
  , pattern LUA_NOREF
    -- * Boolean
  , pattern TRUE
  , pattern FALSE
  ) where

import Foreign.C (CInt (..))
import Lua.Types




--
-- Special values
--

-- | Option for multiple returns in @'Lua.lua_pcall'@.
pattern LUA_MULTRET :: NumResults
pattern $bLUA_MULTRET :: NumResults
$mLUA_MULTRET :: forall r. NumResults -> (Void# -> r) -> (Void# -> r) -> r
LUA_MULTRET = NumResults (-1)
{-# LINE 89 "src/Lua/Constants.hsc" #-}

-- | Stack index of the Lua registry.
pattern LUA_REGISTRYINDEX :: StackIndex
pattern $bLUA_REGISTRYINDEX :: StackIndex
$mLUA_REGISTRYINDEX :: forall r. StackIndex -> (Void# -> r) -> (Void# -> r) -> r
LUA_REGISTRYINDEX = StackIndex (-1001000)
{-# LINE 93 "src/Lua/Constants.hsc" #-}

--
-- Type of Lua values
--
-- | Non-valid stack index
pattern LUA_TNONE :: TypeCode
pattern $bLUA_TNONE :: TypeCode
$mLUA_TNONE :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TNONE = TypeCode (-1)
{-# LINE 100 "src/Lua/Constants.hsc" #-}

-- | Type of Lua's @nil@ value
pattern LUA_TNIL :: TypeCode
pattern $bLUA_TNIL :: TypeCode
$mLUA_TNIL :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TNIL = TypeCode (0)
{-# LINE 104 "src/Lua/Constants.hsc" #-}

-- | Type of Lua booleans
pattern LUA_TBOOLEAN :: TypeCode
pattern $bLUA_TBOOLEAN :: TypeCode
$mLUA_TBOOLEAN :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TBOOLEAN = TypeCode (1)
{-# LINE 108 "src/Lua/Constants.hsc" #-}

-- | Type of light userdata
pattern LUA_TLIGHTUSERDATA :: TypeCode
pattern $bLUA_TLIGHTUSERDATA :: TypeCode
$mLUA_TLIGHTUSERDATA :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TLIGHTUSERDATA = TypeCode (2)
{-# LINE 112 "src/Lua/Constants.hsc" #-}

-- | Type of Lua numbers. See @'Lua.Number'@
pattern LUA_TNUMBER :: TypeCode
pattern $bLUA_TNUMBER :: TypeCode
$mLUA_TNUMBER :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TNUMBER = TypeCode (3)
{-# LINE 116 "src/Lua/Constants.hsc" #-}

-- | Type of Lua string values
pattern LUA_TSTRING :: TypeCode
pattern $bLUA_TSTRING :: TypeCode
$mLUA_TSTRING :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TSTRING = TypeCode (4)
{-# LINE 120 "src/Lua/Constants.hsc" #-}

-- | Type of Lua tables
pattern LUA_TTABLE :: TypeCode
pattern $bLUA_TTABLE :: TypeCode
$mLUA_TTABLE :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TTABLE = TypeCode (5)
{-# LINE 124 "src/Lua/Constants.hsc" #-}

-- | Type of functions, either normal or @'CFunction'@
pattern LUA_TFUNCTION :: TypeCode
pattern $bLUA_TFUNCTION :: TypeCode
$mLUA_TFUNCTION :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TFUNCTION = TypeCode (6)
{-# LINE 128 "src/Lua/Constants.hsc" #-}

-- | Type of full user data
pattern LUA_TUSERDATA :: TypeCode
pattern $bLUA_TUSERDATA :: TypeCode
$mLUA_TUSERDATA :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TUSERDATA = TypeCode (7)
{-# LINE 132 "src/Lua/Constants.hsc" #-}

-- | Type of Lua threads
pattern LUA_TTHREAD :: TypeCode
pattern $bLUA_TTHREAD :: TypeCode
$mLUA_TTHREAD :: forall r. TypeCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_TTHREAD = TypeCode (8)
{-# LINE 136 "src/Lua/Constants.hsc" #-}

--
-- Status codes
--

-- | Success.
pattern LUA_OK :: StatusCode
pattern $bLUA_OK :: StatusCode
$mLUA_OK :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OK = StatusCode 0
{-# LINE 144 "src/Lua/Constants.hsc" #-}

-- | Yielding / suspended coroutine.
pattern LUA_YIELD :: StatusCode
pattern $bLUA_YIELD :: StatusCode
$mLUA_YIELD :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_YIELD = StatusCode 1
{-# LINE 148 "src/Lua/Constants.hsc" #-}

-- | A runtime error.
pattern LUA_ERRRUN :: StatusCode
pattern $bLUA_ERRRUN :: StatusCode
$mLUA_ERRRUN :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRRUN = StatusCode 2
{-# LINE 152 "src/Lua/Constants.hsc" #-}

-- | A syntax error.
pattern LUA_ERRSYNTAX :: StatusCode
pattern $bLUA_ERRSYNTAX :: StatusCode
$mLUA_ERRSYNTAX :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRSYNTAX = StatusCode 3
{-# LINE 156 "src/Lua/Constants.hsc" #-}

-- | Memory allocation error. For such errors, Lua does not call the
-- message handler.
pattern LUA_ERRMEM :: StatusCode
pattern $bLUA_ERRMEM :: StatusCode
$mLUA_ERRMEM :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRMEM = StatusCode 4
{-# LINE 161 "src/Lua/Constants.hsc" #-}

-- | Error while running a @__gc@ metamethod. For such errors, Lua does
-- not call the message handler (as this kind of error typically has no
-- relation with the function being called).
pattern LUA_ERRGCMM :: StatusCode
pattern $bLUA_ERRGCMM :: StatusCode
$mLUA_ERRGCMM :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRGCMM = StatusCode 5
{-# LINE 167 "src/Lua/Constants.hsc" #-}

-- | Error while running the message handler.
pattern LUA_ERRERR :: StatusCode
pattern $bLUA_ERRERR :: StatusCode
$mLUA_ERRERR :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRERR = StatusCode 6
{-# LINE 171 "src/Lua/Constants.hsc" #-}

-- | File related error (e.g., the file cannot be opened or read).
pattern LUA_ERRFILE :: StatusCode
pattern $bLUA_ERRFILE :: StatusCode
$mLUA_ERRFILE :: forall r. StatusCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_ERRFILE = StatusCode 7
{-# LINE 175 "src/Lua/Constants.hsc" #-}

--
-- Comparison operators
--

-- | Compares for equality (==)
pattern LUA_OPEQ :: OPCode
pattern $bLUA_OPEQ :: OPCode
$mLUA_OPEQ :: forall r. OPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPEQ = OPCode 0
{-# LINE 183 "src/Lua/Constants.hsc" #-}

-- | Compares for less than (<)
pattern LUA_OPLT :: OPCode
pattern $bLUA_OPLT :: OPCode
$mLUA_OPLT :: forall r. OPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPLT = OPCode 1
{-# LINE 187 "src/Lua/Constants.hsc" #-}

-- | Compares for less or equal (<=)
pattern LUA_OPLE :: OPCode
pattern $bLUA_OPLE :: OPCode
$mLUA_OPLE :: forall r. OPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPLE = OPCode 2
{-# LINE 191 "src/Lua/Constants.hsc" #-}

--
-- Arithmetic and bitwise operators
--

-- | Performs addition (@+@).
pattern LUA_OPADD :: ArithOPCode
pattern $bLUA_OPADD :: ArithOPCode
$mLUA_OPADD :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPADD = ArithOPCode 0
{-# LINE 199 "src/Lua/Constants.hsc" #-}

-- | Performs subtraction (@-@)
pattern LUA_OPSUB :: ArithOPCode
pattern $bLUA_OPSUB :: ArithOPCode
$mLUA_OPSUB :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPSUB = ArithOPCode 1
{-# LINE 203 "src/Lua/Constants.hsc" #-}

-- | Performs multiplication (@*@)
pattern LUA_OPMUL :: ArithOPCode
pattern $bLUA_OPMUL :: ArithOPCode
$mLUA_OPMUL :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPMUL = ArithOPCode 2
{-# LINE 207 "src/Lua/Constants.hsc" #-}

-- | Performs float division (@\/@)
pattern LUA_OPDIV :: ArithOPCode
pattern $bLUA_OPDIV :: ArithOPCode
$mLUA_OPDIV :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPDIV = ArithOPCode 5
{-# LINE 211 "src/Lua/Constants.hsc" #-}

-- | Performs floor division (@\/\/@)
pattern LUA_OPIDIV :: ArithOPCode
pattern $bLUA_OPIDIV :: ArithOPCode
$mLUA_OPIDIV :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPIDIV = ArithOPCode 6
{-# LINE 215 "src/Lua/Constants.hsc" #-}

-- | Performs modulo (@%@)
pattern LUA_OPMOD :: ArithOPCode
pattern $bLUA_OPMOD :: ArithOPCode
$mLUA_OPMOD :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPMOD = ArithOPCode 3
{-# LINE 219 "src/Lua/Constants.hsc" #-}

-- | Performs exponentiation (@^@)
pattern LUA_OPPOW :: ArithOPCode
pattern $bLUA_OPPOW :: ArithOPCode
$mLUA_OPPOW :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPPOW = ArithOPCode 4
{-# LINE 223 "src/Lua/Constants.hsc" #-}

-- | Performs mathematical negation (unary @-@)
pattern LUA_OPUNM :: ArithOPCode
pattern $bLUA_OPUNM :: ArithOPCode
$mLUA_OPUNM :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPUNM = ArithOPCode 12
{-# LINE 227 "src/Lua/Constants.hsc" #-}

-- | Performs bitwise NOT (@~@)
pattern LUA_OPBNOT :: ArithOPCode
pattern $bLUA_OPBNOT :: ArithOPCode
$mLUA_OPBNOT :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPBNOT = ArithOPCode 13
{-# LINE 231 "src/Lua/Constants.hsc" #-}

-- | Performs bitwise AND (@&@)
pattern LUA_OPBAND :: ArithOPCode
pattern $bLUA_OPBAND :: ArithOPCode
$mLUA_OPBAND :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPBAND = ArithOPCode 7
{-# LINE 235 "src/Lua/Constants.hsc" #-}

-- | Performs bitwise OR (@|@)
pattern LUA_OPBOR :: ArithOPCode
pattern $bLUA_OPBOR :: ArithOPCode
$mLUA_OPBOR :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPBOR = ArithOPCode 8
{-# LINE 239 "src/Lua/Constants.hsc" #-}

-- | Performs bitwise exclusive OR (@~@)
pattern LUA_OPBXOR :: ArithOPCode
pattern $bLUA_OPBXOR :: ArithOPCode
$mLUA_OPBXOR :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPBXOR = ArithOPCode 9
{-# LINE 243 "src/Lua/Constants.hsc" #-}

-- | Performs left shift (@\<\<@)
pattern LUA_OPSHL :: ArithOPCode
pattern $bLUA_OPSHL :: ArithOPCode
$mLUA_OPSHL :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPSHL = ArithOPCode 10
{-# LINE 247 "src/Lua/Constants.hsc" #-}

-- | Performs right shift (@>>@)
pattern LUA_OPSHR :: ArithOPCode
pattern $bLUA_OPSHR :: ArithOPCode
$mLUA_OPSHR :: forall r. ArithOPCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_OPSHR = ArithOPCode 11
{-# LINE 251 "src/Lua/Constants.hsc" #-}

--
-- Garbage-collection options
--

-- | Stops the garbage collector.
pattern LUA_GCSTOP :: GCCode
pattern $bLUA_GCSTOP :: GCCode
$mLUA_GCSTOP :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCSTOP = GCCode 0
{-# LINE 259 "src/Lua/Constants.hsc" #-}

-- | Restarts the garbage collector.
pattern LUA_GCRESTART :: GCCode
pattern $bLUA_GCRESTART :: GCCode
$mLUA_GCRESTART :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCRESTART = GCCode 1
{-# LINE 263 "src/Lua/Constants.hsc" #-}

-- | Performs a full garbage-collection cycle.
pattern LUA_GCCOLLECT :: GCCode
pattern $bLUA_GCCOLLECT :: GCCode
$mLUA_GCCOLLECT :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCCOLLECT = GCCode 2
{-# LINE 267 "src/Lua/Constants.hsc" #-}

-- | Returns the current amount of memory (in Kbytes) in use by Lua.
pattern LUA_GCCOUNT :: GCCode
pattern $bLUA_GCCOUNT :: GCCode
$mLUA_GCCOUNT :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCCOUNT = GCCode 3
{-# LINE 271 "src/Lua/Constants.hsc" #-}

-- | Returns the remainder of dividing the current amount of bytes of
-- memory in use by Lua by 1024.
pattern LUA_GCCOUNTB :: GCCode
pattern $bLUA_GCCOUNTB :: GCCode
$mLUA_GCCOUNTB :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCCOUNTB = GCCode 4
{-# LINE 276 "src/Lua/Constants.hsc" #-}

-- | Performs an incremental step of garbage collection.
pattern LUA_GCSTEP :: GCCode
pattern $bLUA_GCSTEP :: GCCode
$mLUA_GCSTEP :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCSTEP = GCCode 5
{-# LINE 280 "src/Lua/Constants.hsc" #-}

-- | Sets data as the new value for the pause of the collector (see
-- §2.5) and returns the previous value of the pause.
pattern LUA_GCSETPAUSE :: GCCode
pattern $bLUA_GCSETPAUSE :: GCCode
$mLUA_GCSETPAUSE :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCSETPAUSE = GCCode 6
{-# LINE 285 "src/Lua/Constants.hsc" #-}

-- | Sets data as the new value for the step multiplier of the collector
-- (see §2.5) and returns the previous value of the step multiplier.
pattern LUA_GCSETSTEPMUL :: GCCode
pattern $bLUA_GCSETSTEPMUL :: GCCode
$mLUA_GCSETSTEPMUL :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCSETSTEPMUL = GCCode 7
{-# LINE 290 "src/Lua/Constants.hsc" #-}

-- | Returns a boolean that tells whether the collector is running
-- (i.e., not stopped).
pattern LUA_GCISRUNNING :: GCCode
pattern $bLUA_GCISRUNNING :: GCCode
$mLUA_GCISRUNNING :: forall r. GCCode -> (Void# -> r) -> (Void# -> r) -> r
LUA_GCISRUNNING = GCCode 9
{-# LINE 295 "src/Lua/Constants.hsc" #-}

--
-- Special registry values
--

-- | Value signaling that no reference was created.
pattern LUA_REFNIL :: CInt
pattern $bLUA_REFNIL :: CInt
$mLUA_REFNIL :: forall r. CInt -> (Void# -> r) -> (Void# -> r) -> r
LUA_REFNIL = -2
{-# LINE 303 "src/Lua/Constants.hsc" #-}

-- | Value signaling that no reference was found.
pattern LUA_NOREF :: CInt
pattern $bLUA_NOREF :: CInt
$mLUA_NOREF :: forall r. CInt -> (Void# -> r) -> (Void# -> r) -> r
LUA_NOREF = -2
{-# LINE 307 "src/Lua/Constants.hsc" #-}

--
-- Booleans
--

-- | Value which Lua usually uses as 'True'.
pattern TRUE :: LuaBool
pattern $bTRUE :: LuaBool
$mTRUE :: forall r. LuaBool -> (Void# -> r) -> (Void# -> r) -> r
TRUE = LuaBool 1

-- | Value which Lua usually uses as 'False'.
pattern FALSE :: LuaBool
pattern $bFALSE :: LuaBool
$mFALSE :: forall r. LuaBool -> (Void# -> r) -> (Void# -> r) -> r
FALSE = LuaBool 0