{-# LINE 1 "src/Text/Sundown/Html/Foreign.hsc" #-}
{-# Language EmptyDataDecls #-}
{-# Language ForeignFunctionInterface #-}
module Text.Sundown.Html.Foreign
    ( HtmlRenderMode (..)
    , sdhtml_renderer
    , sdhtml_smartypants
    ) where

import Foreign
import Foreign.C.String
import Foreign.C.Types

import Text.Sundown.Buffer.Foreign
import Text.Sundown.Flag
import Text.Sundown.Foreign



data HtmlRenderMode = HtmlRenderMode
    { HtmlRenderMode -> Bool
htmlSkipHtml   :: Bool -- ^ Drop in-line HTML tags from the output
    , HtmlRenderMode -> Bool
htmlSkipStyle  :: Bool -- ^ Don't add any style tags to the output
    , HtmlRenderMode -> Bool
htmlSkipImages :: Bool -- ^ Don't include images in the output
    , HtmlRenderMode -> Bool
htmlSkipLinks  :: Bool -- ^ Don't include links in the output
    , HtmlRenderMode -> Bool
htmlExpandTabs :: Bool
    , HtmlRenderMode -> Bool
htmlSafelink   :: Bool -- ^ Sanity check links for known URL schemes
    , HtmlRenderMode -> Bool
htmlToc        :: Bool -- ^ Include a table of contents in the output
    , HtmlRenderMode -> Bool
htmlHardWrap   :: Bool
    , HtmlRenderMode -> Bool
htmlUseXhtml   :: Bool -- ^ Produce XHTML output instead of HTML
    , HtmlRenderMode -> Bool
htmlEscape     :: Bool
    }


instance Flag HtmlRenderMode where
    flagIndexes :: HtmlRenderMode -> [(CUInt, Bool)]
flagIndexes HtmlRenderMode
mode = [ (CUInt
1,   HtmlRenderMode -> Bool
htmlSkipHtml HtmlRenderMode
mode)
{-# LINE 35 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
2,  HtmlRenderMode -> Bool
htmlSkipStyle HtmlRenderMode
mode)
{-# LINE 36 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
4, HtmlRenderMode -> Bool
htmlSkipImages HtmlRenderMode
mode)
{-# LINE 37 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
8,  HtmlRenderMode -> Bool
htmlSkipLinks HtmlRenderMode
mode)
{-# LINE 38 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
16, HtmlRenderMode -> Bool
htmlExpandTabs HtmlRenderMode
mode)
{-# LINE 39 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
32,    HtmlRenderMode -> Bool
htmlSafelink HtmlRenderMode
mode)
{-# LINE 40 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
64,         HtmlRenderMode -> Bool
htmlToc HtmlRenderMode
mode)
{-# LINE 41 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
128,   HtmlRenderMode -> Bool
htmlHardWrap HtmlRenderMode
mode)
{-# LINE 42 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
256,   HtmlRenderMode -> Bool
htmlUseXhtml HtmlRenderMode
mode)
{-# LINE 43 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       , (CUInt
512,      HtmlRenderMode -> Bool
htmlEscape HtmlRenderMode
mode)
{-# LINE 44 "src/Text/Sundown/Html/Foreign.hsc" #-}
                       ]

data HtmlRenderOptions

instance Storable HtmlRenderOptions where
    sizeOf :: HtmlRenderOptions -> Int
sizeOf HtmlRenderOptions
_    = ((Int
24))
{-# LINE 50 "src/Text/Sundown/Html/Foreign.hsc" #-}
    alignment _ = alignment (undefined :: Ptr ())
    peek :: Ptr HtmlRenderOptions -> IO HtmlRenderOptions
peek Ptr HtmlRenderOptions
_      = [Char] -> IO HtmlRenderOptions
forall a. HasCallStack => [Char] -> a
error [Char]
"HtmlRenderopt.peek is not implemented"
    poke :: Ptr HtmlRenderOptions -> HtmlRenderOptions -> IO ()
poke Ptr HtmlRenderOptions
_      = [Char] -> HtmlRenderOptions -> IO ()
forall a. HasCallStack => [Char] -> a
error [Char]
"HtmlRenderopt.poke is not implemented"

sdhtml_renderer
    :: Ptr Callbacks -> Ptr HtmlRenderOptions -> HtmlRenderMode -> IO ()
sdhtml_renderer :: Ptr Callbacks -> Ptr HtmlRenderOptions -> HtmlRenderMode -> IO ()
sdhtml_renderer Ptr Callbacks
rndr Ptr HtmlRenderOptions
options HtmlRenderMode
mode = Ptr Callbacks -> Ptr HtmlRenderOptions -> CUInt -> IO ()
sdhtml_renderer' Ptr Callbacks
rndr Ptr HtmlRenderOptions
options (HtmlRenderMode -> CUInt
forall a. Flag a => a -> CUInt
toCUInt HtmlRenderMode
mode)
foreign import ccall "html.h sdhtml_renderer"
    sdhtml_renderer' :: Ptr Callbacks -> Ptr HtmlRenderOptions -> CUInt -> IO ()

foreign import ccall "html.h sdhtml_smartypants"
    sdhtml_smartypants :: Ptr Buffer -> CString -> CSize -> IO ()