packages feed

augeas-0.2.0: System/AugeasHsc.hsc

-- file: Augeas.hsc

-- Haskell bindings for the Augeas library
-- Copyright (c) 2009, Jude Nagurney
--
-- This program is free software; you can redistribute it and/or modify it 
-- under the terms of the GNU General Public License as published by the Free 
-- Software Foundation; either version 2 of the License, or (at your option) 
-- any later version.
--
-- This program is distributed in the hope that it will be useful, but 
-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with this program; 
-- if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
-- MA 02111-1307 USA
-- 
-- Contact the author at 
-- jude@pwan.org 

{-# LANGUAGE CPP, ForeignFunctionInterface #-}

module System.AugeasHsc where

import Foreign.C.Types

#include "augeas.h"


-- ----------------------------------
-- Maps to aug_flags enum in augeas.h
-- ----------------------------------

newtype AugFlag = AugFlag { unAugFlag :: CInt }
        deriving (Eq, Show)

#{enum AugFlag, AugFlag
       , none = AUG_NONE
       , save_backup = AUG_SAVE_BACKUP
       , save_newfile = AUG_SAVE_NEWFILE
       , type_check = AUG_TYPE_CHECK
       , no_stdinc = AUG_NO_STDINC
       , save_noop = AUG_SAVE_NOOP
       , no_load = AUG_NO_LOAD
       , no_modl_autoload = AUG_NO_MODL_AUTOLOAD
}

-- ---------------------------------
-- Maps to auf_errcode_t in augeas.h
-- ---------------------------------

newtype AugErrCode = AugErrCode { unAugErrCode :: CInt }
        deriving (Eq, Show)

#{enum AugErrCode, AugErrCode
       , no_error = AUG_NOERROR
       , err_no_memory = AUG_ENOMEM
       , err_internal = AUG_EINTERNAL
       , err_bad_path = AUG_EPATHX
       , err_no_match = AUG_ENOMATCH
       , err_multi_matches = AUG_EMMATCH
       , err_syntax = AUG_ESYNTAX
       , err_no_lens = AUG_ENOLENS
       , err_multi_xfm = AUG_EMXFM
}