{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}

{- |
Module: TREXIO.LowLevel
Description: Generated direct low-level bindings to the TREXIO library
Copyright: Phillip Seeber 2024
License: BSD-3-Clause
Maintainer: phillip.seeber@uni-jena.de
Stability: experimental
Portability: POSIX

These are the low-level bindings to the TREXIO library.
They are generated by the Template Haskell and provide direct access to the C functions in the TREXIO library.
Consequently, they are unsafe and require manual memory management.
-}
module TREXIO.LowLevel where

import Data.Map qualified as Map
import Foreign.C.ConstPtr
import Foreign.C.Types
import TREXIO.Internal.Base
import TREXIO.Internal.TH
import TREXIO.LowLevel.Scheme

$( do
    let TrexioScheme trexioScheme = scheme
        groups = Map.toList trexioScheme

    -- Import all C functions for all fields and operations
    concat <$> traverse (uncurry mkCBindings) groups
 )