diff --git a/Bindings/Groonga.hs b/Bindings/Groonga.hs
new file mode 100644
--- /dev/null
+++ b/Bindings/Groonga.hs
@@ -0,0 +1,5 @@
+module Bindings.Groonga
+  ( module Bindings.Groonga.Raw )
+where
+
+import Bindings.Groonga.Raw
diff --git a/Bindings/Groonga/CommandAPI.hs b/Bindings/Groonga/CommandAPI.hs
new file mode 100644
--- /dev/null
+++ b/Bindings/Groonga/CommandAPI.hs
@@ -0,0 +1,69 @@
+module Bindings.Groonga.CommandAPI
+  ( grn_ctx_init
+  , grn_ctx_fin
+  , grn_database_open
+  , grn_database_create
+  , grn_execute_command
+  , grn_get_errbuf
+  , grn_get_version
+  , module Bindings.Groonga.Types ) where
+import Bindings.Groonga
+import Bindings.Groonga.Types
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Ptr
+import Foreign.Marshal.Alloc
+import Foreign.Storable
+import Control.Monad.Trans.Resource (allocate, release, runResourceT)
+import Control.Monad.Trans.Class (lift)
+
+grn_ctx_init :: IO (Ptr C'_grn_ctx)
+grn_ctx_init = do
+  rc <- c'grn_init
+  ctx <- c'grn_ctx_open rc
+  return ctx
+
+grn_ctx_fin :: Ptr C'_grn_ctx -> IO C'grn_rc
+grn_ctx_fin ctx = do
+  _ <- c'grn_ctx_fin ctx
+  rc <- c'grn_fin
+  return rc
+
+grn_database_open :: Ptr C'_grn_ctx -> Database -> IO (Ptr C'_grn_obj)
+grn_database_open ctx dbpath = do
+  dbname <- newCAString dbpath
+  db <- c'grn_db_open ctx dbname
+  return db
+
+grn_database_create :: Ptr C'_grn_ctx -> Database -> IO (Ptr C'_grn_obj)
+grn_database_create ctx dbpath = do
+  dbname <- newCAString dbpath
+  db <- c'grn_db_create ctx dbname nullPtr
+  return db
+
+grn_execute_command :: Ptr C'_grn_ctx -> Command -> IO String
+grn_execute_command ctx command = runResourceT $ do
+  let command_len = length command
+      flag        = 0
+  ccommand <- lift $ newCAString command
+  _ <- lift $ c'grn_ctx_send ctx ccommand (fromIntegral command_len) flag
+  (res_key,received_res)   <- allocate (malloc :: IO (Ptr CString)) free
+  (len_key,received_len)   <- allocate (malloc :: IO (Ptr CUInt)) free
+  (flag_key,received_flag) <- allocate (malloc :: IO (Ptr CInt)) free
+  _ <- lift $ c'grn_ctx_recv ctx received_res received_len received_flag
+  res_cstr <- lift $ peek received_res
+  res_str  <- lift $ peekCString res_cstr
+  lift $ mapM_ release [res_key, len_key, flag_key]
+  return res_str
+
+grn_get_errbuf :: Ptr C'_grn_ctx -> IO String
+grn_get_errbuf ctx = do
+  let char = p'_grn_ctx'errbuf ctx
+  errbuf <- peekCString char
+  return errbuf
+
+grn_get_version :: IO String
+grn_get_version = do
+  cversion <- c'grn_get_version
+  version <- peekCString cversion
+  return version
diff --git a/Bindings/Groonga/Raw.hsc b/Bindings/Groonga/Raw.hsc
new file mode 100644
--- /dev/null
+++ b/Bindings/Groonga/Raw.hsc
@@ -0,0 +1,1374 @@
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+{- generated by c2hsc with groonga.h of groonga 3.1.1. -}
+#include <bindings.dsl.h>
+#include <groonga.h>
+module Bindings.Groonga.Raw where
+import Foreign.Ptr
+#strict_import
+
+{- typedef unsigned int grn_id; -}
+#synonym_t grn_id , CUInt
+{- typedef unsigned char grn_bool; -}
+#synonym_t grn_bool , CUChar
+{- typedef enum {
+            GRN_SUCCESS = 0,
+            GRN_END_OF_DATA = 1,
+            GRN_UNKNOWN_ERROR = -1,
+            GRN_OPERATION_NOT_PERMITTED = -2,
+            GRN_NO_SUCH_FILE_OR_DIRECTORY = -3,
+            GRN_NO_SUCH_PROCESS = -4,
+            GRN_INTERRUPTED_FUNCTION_CALL = -5,
+            GRN_INPUT_OUTPUT_ERROR = -6,
+            GRN_NO_SUCH_DEVICE_OR_ADDRESS = -7,
+            GRN_ARG_LIST_TOO_LONG = -8,
+            GRN_EXEC_FORMAT_ERROR = -9,
+            GRN_BAD_FILE_DESCRIPTOR = -10,
+            GRN_NO_CHILD_PROCESSES = -11,
+            GRN_RESOURCE_TEMPORARILY_UNAVAILABLE = -12,
+            GRN_NOT_ENOUGH_SPACE = -13,
+            GRN_PERMISSION_DENIED = -14,
+            GRN_BAD_ADDRESS = -15,
+            GRN_RESOURCE_BUSY = -16,
+            GRN_FILE_EXISTS = -17,
+            GRN_IMPROPER_LINK = -18,
+            GRN_NO_SUCH_DEVICE = -19,
+            GRN_NOT_A_DIRECTORY = -20,
+            GRN_IS_A_DIRECTORY = -21,
+            GRN_INVALID_ARGUMENT = -22,
+            GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM = -23,
+            GRN_TOO_MANY_OPEN_FILES = -24,
+            GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION = -25,
+            GRN_FILE_TOO_LARGE = -26,
+            GRN_NO_SPACE_LEFT_ON_DEVICE = -27,
+            GRN_INVALID_SEEK = -28,
+            GRN_READ_ONLY_FILE_SYSTEM = -29,
+            GRN_TOO_MANY_LINKS = -30,
+            GRN_BROKEN_PIPE = -31,
+            GRN_DOMAIN_ERROR = -32,
+            GRN_RESULT_TOO_LARGE = -33,
+            GRN_RESOURCE_DEADLOCK_AVOIDED = -34,
+            GRN_NO_MEMORY_AVAILABLE = -35,
+            GRN_FILENAME_TOO_LONG = -36,
+            GRN_NO_LOCKS_AVAILABLE = -37,
+            GRN_FUNCTION_NOT_IMPLEMENTED = -38,
+            GRN_DIRECTORY_NOT_EMPTY = -39,
+            GRN_ILLEGAL_BYTE_SEQUENCE = -40,
+            GRN_SOCKET_NOT_INITIALIZED = -41,
+            GRN_OPERATION_WOULD_BLOCK = -42,
+            GRN_ADDRESS_IS_NOT_AVAILABLE = -43,
+            GRN_NETWORK_IS_DOWN = -44,
+            GRN_NO_BUFFER = -45,
+            GRN_SOCKET_IS_ALREADY_CONNECTED = -46,
+            GRN_SOCKET_IS_NOT_CONNECTED = -47,
+            GRN_SOCKET_IS_ALREADY_SHUTDOWNED = -48,
+            GRN_OPERATION_TIMEOUT = -49,
+            GRN_CONNECTION_REFUSED = -50,
+            GRN_RANGE_ERROR = -51,
+            GRN_TOKENIZER_ERROR = -52,
+            GRN_FILE_CORRUPT = -53,
+            GRN_INVALID_FORMAT = -54,
+            GRN_OBJECT_CORRUPT = -55,
+            GRN_TOO_MANY_SYMBOLIC_LINKS = -56,
+            GRN_NOT_SOCKET = -57,
+            GRN_OPERATION_NOT_SUPPORTED = -58,
+            GRN_ADDRESS_IS_IN_USE = -59,
+            GRN_ZLIB_ERROR = -60,
+            GRN_LZO_ERROR = -61,
+            GRN_STACK_OVER_FLOW = -62,
+            GRN_SYNTAX_ERROR = -63,
+            GRN_RETRY_MAX = -64,
+            GRN_INCOMPATIBLE_FILE_FORMAT = -65,
+            GRN_UPDATE_NOT_ALLOWED = -66,
+            GRN_TOO_SMALL_OFFSET = -67,
+            GRN_TOO_LARGE_OFFSET = -68,
+            GRN_TOO_SMALL_LIMIT = -69,
+            GRN_CAS_ERROR = -70,
+            GRN_UNSUPPORTED_COMMAND_VERSION = -71,
+            GRN_NORMALIZER_ERROR = -72
+        } grn_rc; -}
+#integral_t grn_rc
+#num GRN_SUCCESS
+#num GRN_END_OF_DATA
+#num GRN_UNKNOWN_ERROR
+#num GRN_OPERATION_NOT_PERMITTED
+#num GRN_NO_SUCH_FILE_OR_DIRECTORY
+#num GRN_NO_SUCH_PROCESS
+#num GRN_INTERRUPTED_FUNCTION_CALL
+#num GRN_INPUT_OUTPUT_ERROR
+#num GRN_NO_SUCH_DEVICE_OR_ADDRESS
+#num GRN_ARG_LIST_TOO_LONG
+#num GRN_EXEC_FORMAT_ERROR
+#num GRN_BAD_FILE_DESCRIPTOR
+#num GRN_NO_CHILD_PROCESSES
+#num GRN_RESOURCE_TEMPORARILY_UNAVAILABLE
+#num GRN_NOT_ENOUGH_SPACE
+#num GRN_PERMISSION_DENIED
+#num GRN_BAD_ADDRESS
+#num GRN_RESOURCE_BUSY
+#num GRN_FILE_EXISTS
+#num GRN_IMPROPER_LINK
+#num GRN_NO_SUCH_DEVICE
+#num GRN_NOT_A_DIRECTORY
+#num GRN_IS_A_DIRECTORY
+#num GRN_INVALID_ARGUMENT
+#num GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM
+#num GRN_TOO_MANY_OPEN_FILES
+#num GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION
+#num GRN_FILE_TOO_LARGE
+#num GRN_NO_SPACE_LEFT_ON_DEVICE
+#num GRN_INVALID_SEEK
+#num GRN_READ_ONLY_FILE_SYSTEM
+#num GRN_TOO_MANY_LINKS
+#num GRN_BROKEN_PIPE
+#num GRN_DOMAIN_ERROR
+#num GRN_RESULT_TOO_LARGE
+#num GRN_RESOURCE_DEADLOCK_AVOIDED
+#num GRN_NO_MEMORY_AVAILABLE
+#num GRN_FILENAME_TOO_LONG
+#num GRN_NO_LOCKS_AVAILABLE
+#num GRN_FUNCTION_NOT_IMPLEMENTED
+#num GRN_DIRECTORY_NOT_EMPTY
+#num GRN_ILLEGAL_BYTE_SEQUENCE
+#num GRN_SOCKET_NOT_INITIALIZED
+#num GRN_OPERATION_WOULD_BLOCK
+#num GRN_ADDRESS_IS_NOT_AVAILABLE
+#num GRN_NETWORK_IS_DOWN
+#num GRN_NO_BUFFER
+#num GRN_SOCKET_IS_ALREADY_CONNECTED
+#num GRN_SOCKET_IS_NOT_CONNECTED
+#num GRN_SOCKET_IS_ALREADY_SHUTDOWNED
+#num GRN_OPERATION_TIMEOUT
+#num GRN_CONNECTION_REFUSED
+#num GRN_RANGE_ERROR
+#num GRN_TOKENIZER_ERROR
+#num GRN_FILE_CORRUPT
+#num GRN_INVALID_FORMAT
+#num GRN_OBJECT_CORRUPT
+#num GRN_TOO_MANY_SYMBOLIC_LINKS
+#num GRN_NOT_SOCKET
+#num GRN_OPERATION_NOT_SUPPORTED
+#num GRN_ADDRESS_IS_IN_USE
+#num GRN_ZLIB_ERROR
+#num GRN_LZO_ERROR
+#num GRN_STACK_OVER_FLOW
+#num GRN_SYNTAX_ERROR
+#num GRN_RETRY_MAX
+#num GRN_INCOMPATIBLE_FILE_FORMAT
+#num GRN_UPDATE_NOT_ALLOWED
+#num GRN_TOO_SMALL_OFFSET
+#num GRN_TOO_LARGE_OFFSET
+#num GRN_TOO_SMALL_LIMIT
+#num GRN_CAS_ERROR
+#num GRN_UNSUPPORTED_COMMAND_VERSION
+#num GRN_NORMALIZER_ERROR
+#ccall grn_init , IO <grn_rc>
+#ccall grn_fin , IO <grn_rc>
+{- typedef enum {
+            GRN_ENC_DEFAULT = 0,
+            GRN_ENC_NONE,
+            GRN_ENC_EUC_JP,
+            GRN_ENC_UTF8,
+            GRN_ENC_SJIS,
+            GRN_ENC_LATIN1,
+            GRN_ENC_KOI8R
+        } grn_encoding; -}
+#integral_t grn_encoding
+#num GRN_ENC_DEFAULT
+#num GRN_ENC_NONE
+#num GRN_ENC_EUC_JP
+#num GRN_ENC_UTF8
+#num GRN_ENC_SJIS
+#num GRN_ENC_LATIN1
+#num GRN_ENC_KOI8R
+{- typedef enum {
+            GRN_COMMAND_VERSION_DEFAULT = 0,
+            GRN_COMMAND_VERSION_1,
+            GRN_COMMAND_VERSION_2
+        } grn_command_version; -}
+#integral_t grn_command_version
+#num GRN_COMMAND_VERSION_DEFAULT
+#num GRN_COMMAND_VERSION_1
+#num GRN_COMMAND_VERSION_2
+{- typedef enum {
+            GRN_LOG_NONE = 0,
+            GRN_LOG_EMERG,
+            GRN_LOG_ALERT,
+            GRN_LOG_CRIT,
+            GRN_LOG_ERROR,
+            GRN_LOG_WARNING,
+            GRN_LOG_NOTICE,
+            GRN_LOG_INFO,
+            GRN_LOG_DEBUG,
+            GRN_LOG_DUMP
+        } grn_log_level; -}
+#integral_t grn_log_level
+#num GRN_LOG_NONE
+#num GRN_LOG_EMERG
+#num GRN_LOG_ALERT
+#num GRN_LOG_CRIT
+#num GRN_LOG_ERROR
+#num GRN_LOG_WARNING
+#num GRN_LOG_NOTICE
+#num GRN_LOG_INFO
+#num GRN_LOG_DEBUG
+#num GRN_LOG_DUMP
+{- log flags -}
+#num GRN_QUERY_LOG_NONE
+#num GRN_QUERY_LOG_COMMAND
+#num GRN_QUERY_LOG_RESULT_CODE
+#num GRN_QUERY_LOG_DESTINATION
+#num GRN_QUERY_LOG_CACHE
+#num GRN_QUERY_LOG_SIZE
+#num GRN_QUERY_LOG_SCORE
+#num GRN_QUERY_LOG_ALL
+#num GRN_QUERY_LOG_DEFAULT
+{- typedef enum {
+            GRN_CONTENT_NONE = 0,
+            GRN_CONTENT_TSV,
+            GRN_CONTENT_JSON,
+            GRN_CONTENT_XML,
+            GRN_CONTENT_MSGPACK
+        } grn_content_type; -}
+#integral_t grn_content_type
+#num GRN_CONTENT_NONE
+#num GRN_CONTENT_TSV
+#num GRN_CONTENT_JSON
+#num GRN_CONTENT_XML
+#num GRN_CONTENT_MSGPACK
+{- typedef struct _grn_obj grn_obj; -}
+-- #opaque_t _grn_obj
+-- #synonym_t grn_obj , <_grn_obj>
+{- typedef struct _grn_ctx grn_ctx; -}
+-- #opaque_t _grn_ctx
+-- #synonym_t grn_ctx , <_grn_ctx>
+#num GRN_CTX_MSGSIZE
+#num GRN_CTX_FIN
+{- typedef union {
+            int int_value; grn_id id; void * ptr;
+        } grn_user_data; -}
+#starttype grn_user_data
+#union_field int_value , CInt
+#union_field id , CUInt
+#union_field ptr , Ptr ()
+#stoptype
+#callback_t grn_proc_func , Ptr <_grn_ctx> -> CInt -> Ptr (Ptr <_grn_obj>) -> Ptr <grn_user_data> -> IO (Ptr <_grn_obj>)
+{- struct _grn_ctx {
+    grn_rc rc;
+    int flags;
+    grn_encoding encoding;
+    unsigned char ntrace;
+    unsigned char errlvl;
+    unsigned char stat;
+    unsigned int seqno;
+    unsigned int subno;
+    unsigned int seqno2;
+    unsigned int errline;
+    grn_user_data user_data;
+    grn_ctx * prev;
+    grn_ctx * next;
+    const char * errfile;
+    const char * errfunc;
+    struct _grn_ctx_impl * impl;
+    void * trace[16];
+    char errbuf[0x80];
+}; -}
+#opaque_t _grn_ctx_impl
+#starttype struct _grn_ctx
+#field rc , <grn_rc>
+#field flags , CInt
+#field encoding , <grn_encoding>
+#field ntrace , CUChar
+#field errlvl , CUChar
+#field stat , CUChar
+#field seqno , CUInt
+#field subno , CUInt
+#field seqno2 , CUInt
+#field errline , CUInt
+#field user_data , <grn_user_data>
+#field prev , Ptr <_grn_ctx>
+#field next , Ptr <_grn_ctx>
+#field errfile , CString
+#field errfunc , CString
+#field impl , Ptr <_grn_ctx_impl>
+#array_field trace , Ptr ()
+#array_field errbuf , CChar
+#stoptype
+#num GRN_CTX_USE_QL
+#num GRN_CTX_BATCH_MODE
+#num GRN_CTX_PER_DB
+#ccall grn_ctx_init , Ptr <_grn_ctx> -> CInt -> IO <grn_rc>
+#ccall grn_ctx_fin , Ptr <_grn_ctx> -> IO <grn_rc>
+#ccall grn_ctx_open , CInt -> IO (Ptr <_grn_ctx>)
+#ccall grn_ctx_close , Ptr <_grn_ctx> -> IO <grn_rc>
+#ccall grn_ctx_set_finalizer , Ptr <_grn_ctx> -> Ptr <grn_proc_func> -> IO <grn_rc>
+#ccall grn_get_default_encoding , IO <grn_encoding>
+#ccall grn_set_default_encoding , <grn_encoding> -> IO <grn_rc>
+#ccall grn_get_version , IO CString
+#ccall grn_get_package , IO CString
+#ccall grn_get_default_command_version , IO <grn_command_version>
+#ccall grn_set_default_command_version , <grn_command_version> -> IO <grn_rc>
+#ccall grn_ctx_get_command_version , Ptr <_grn_ctx> -> IO <grn_command_version>
+#ccall grn_ctx_set_command_version , Ptr <_grn_ctx> -> <grn_command_version> -> IO <grn_rc>
+#ccall grn_ctx_get_match_escalation_threshold , Ptr <_grn_ctx> -> IO CLong
+#ccall grn_ctx_set_match_escalation_threshold , Ptr <_grn_ctx> -> CLong -> IO <grn_rc>
+#ccall grn_get_default_match_escalation_threshold , IO CLong
+#ccall grn_set_default_match_escalation_threshold , CLong -> IO <grn_rc>
+#ccall grn_get_lock_timeout , IO CInt
+#ccall grn_set_lock_timeout , CInt -> IO <grn_rc>
+{- typedef struct _grn_cache grn_cache; -}
+#opaque_t _grn_cache
+#synonym_t grn_cache , <_grn_cache>
+#ccall grn_cache_open , Ptr <_grn_ctx> -> IO (Ptr <_grn_cache>)
+#ccall grn_cache_close , Ptr <_grn_ctx> -> Ptr <_grn_cache> -> IO <grn_rc>
+#ccall grn_cache_current_set , Ptr <_grn_ctx> -> Ptr <_grn_cache> -> IO <grn_rc>
+#ccall grn_cache_current_get , Ptr <_grn_ctx> -> IO (Ptr <_grn_cache>)
+#ccall grn_cache_set_max_n_entries , Ptr <_grn_ctx> -> Ptr <_grn_cache> -> CUInt -> IO <grn_rc>
+#ccall grn_cache_get_max_n_entries , Ptr <_grn_ctx> -> Ptr <_grn_cache> -> IO CUInt
+#ccall grn_encoding_to_string , <grn_encoding> -> IO CString
+#ccall grn_encoding_parse , CString -> IO <grn_encoding>
+{- typedef unsigned short int grn_obj_flags; -}
+#synonym_t grn_obj_flags , CUShort
+{- typedef struct _grn_section grn_section; -}
+-- #opaque_t _grn_section
+-- #synonym_t grn_section , <_grn_section>
+{- typedef struct _grn_obj_header grn_obj_header; -}
+-- #opaque_t _grn_obj_header
+-- #synonym_t grn_obj_header , <_grn_obj_header>
+{- struct _grn_section {
+    unsigned int offset;
+    unsigned int length;
+    unsigned int weight;
+    grn_id domain;
+}; -}
+{- obj macros -}
+#num GRN_OBJ_TABLE_TYPE_MASK
+#num GRN_OBJ_TABLE_HASH_KEY
+#num GRN_OBJ_TABLE_PAT_KEY
+#num GRN_OBJ_TABLE_DAT_KEY
+#num GRN_OBJ_TABLE_NO_KEY
+
+#num GRN_OBJ_KEY_MASK
+#num GRN_OBJ_KEY_UINT
+#num GRN_OBJ_KEY_INT
+#num GRN_OBJ_KEY_FLOAT
+#num GRN_OBJ_KEY_GEO_POINT
+
+#num GRN_OBJ_KEY_WITH_SIS
+#num GRN_OBJ_KEY_NORMALIZE
+
+#num GRN_OBJ_COLUMN_TYPE_MASK
+#num GRN_OBJ_COLUMN_SCALAR
+#num GRN_OBJ_COLUMN_VECTOR
+#num GRN_OBJ_COLUMN_INDEX
+
+#num GRN_OBJ_COMPRESS_MASK
+#num GRN_OBJ_COMPRESS_NONE
+#num GRN_OBJ_COMPRESS_ZLIB
+#num GRN_OBJ_COMPRESS_LZO
+
+#num GRN_OBJ_WITH_SECTION
+#num GRN_OBJ_WITH_WEIGHT
+#num GRN_OBJ_WITH_POSITION
+#num GRN_OBJ_RING_BUFFER
+
+#num GRN_OBJ_UNIT_MASK
+#num GRN_OBJ_UNIT_DOCUMENT_NONE
+#num GRN_OBJ_UNIT_DOCUMENT_SECTION
+#num GRN_OBJ_UNIT_DOCUMENT_POSITION
+#num GRN_OBJ_UNIT_SECTION_NONE
+#num GRN_OBJ_UNIT_SECTION_POSITION
+#num GRN_OBJ_UNIT_POSITION_NONE
+#num GRN_OBJ_UNIT_USERDEF_DOCUMENT
+#num GRN_OBJ_UNIT_USERDEF_SECTION
+#num GRN_OBJ_UNIT_USERDEF_POSITION
+
+#num GRN_OBJ_NO_SUBREC
+#num GRN_OBJ_WITH_SUBREC
+
+#num GRN_OBJ_KEY_VAR_SIZE
+
+#num GRN_OBJ_TEMPORARY
+#num GRN_OBJ_PERSISTENT
+
+{- obj types -}
+
+#num GRN_VOID
+#num GRN_BULK
+#num GRN_PTR
+#num GRN_UVECTOR
+#num GRN_PVECTOR
+#num GRN_VECTOR
+#num GRN_MSG
+#num GRN_QUERY
+#num GRN_ACCESSOR
+#num GRN_SNIP
+#num GRN_PATSNIP
+#num GRN_STRING
+#num GRN_CURSOR_TABLE_HASH_KEY
+#num GRN_CURSOR_TABLE_PAT_KEY
+#num GRN_CURSOR_TABLE_DAT_KEY
+#num GRN_CURSOR_TABLE_NO_KEY
+#num GRN_CURSOR_COLUMN_INDEX
+#num GRN_CURSOR_COLUMN_GEO_INDEX
+#num GRN_TYPE
+#num GRN_PROC
+#num GRN_EXPR
+#num GRN_TABLE_HASH_KEY
+#num GRN_TABLE_PAT_KEY
+#num GRN_TABLE_DAT_KEY
+#num GRN_TABLE_NO_KEY
+#num GRN_DB
+#num GRN_COLUMN_FIX_SIZE
+#num GRN_COLUMN_VAR_SIZE
+#num GRN_COLUMN_INDEX
+#starttype struct _grn_section
+#field offset , CUInt
+#field length , CUInt
+#field weight , CUInt
+#field domain , CUInt
+#stoptype
+{- struct _grn_obj_header {
+    unsigned char type;
+    unsigned char impl_flags;
+    grn_obj_flags flags;
+    grn_id domain;
+}; -}
+#starttype struct _grn_obj_header
+#field type , CUChar
+#field impl_flags , CUChar
+#field flags , CUShort
+#field domain , CUInt
+#stoptype
+{- struct _grn_obj {
+    grn_obj_header header;
+    union {
+        struct {
+            char * head; char * curr; char * tail;
+        } b;
+        struct {
+            grn_obj * body; grn_section * sections; int n_sections;
+        } v;
+    } u;
+}; -}
+{- FIXME?: perhaps, /struct _grn_obj/'s field don't need to reach. -}
+#starttype struct _grn_obj
+#stoptype
+{- typedef struct _grn_db_create_optarg grn_db_create_optarg; -}
+{- typedef struct _grn_db_create_optarg grn_db_create_optarg; -}
+-- #opaque_t _grn_db_create_optarg
+-- #synonym_t grn_db_create_optarg , <_grn_db_create_optarg>
+{- struct _grn_db_create_optarg {
+    char ** builtin_type_names; int n_builtin_type_names;
+}; -}
+#starttype struct _grn_db_create_optarg
+#field builtin_type_names , Ptr CString
+#field n_builtin_type_names , CInt
+#stoptype
+#ccall grn_db_create , Ptr <_grn_ctx> -> CString -> Ptr <_grn_db_create_optarg> -> IO (Ptr <_grn_obj>)
+#ccall grn_db_open , Ptr <_grn_ctx> -> CString -> IO (Ptr <_grn_obj>)
+#ccall grn_db_touch , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO ()
+#ccall grn_ctx_use , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_ctx_db , Ptr <_grn_ctx> -> IO (Ptr <_grn_obj>)
+#ccall grn_ctx_get , Ptr <_grn_ctx> -> CString -> CInt -> IO (Ptr <_grn_obj>)
+{- typedef enum {
+            GRN_DB_VOID = 0,
+            GRN_DB_DB,
+            GRN_DB_OBJECT,
+            GRN_DB_BOOL,
+            GRN_DB_INT8,
+            GRN_DB_UINT8,
+            GRN_DB_INT16,
+            GRN_DB_UINT16,
+            GRN_DB_INT32,
+            GRN_DB_UINT32,
+            GRN_DB_INT64,
+            GRN_DB_UINT64,
+            GRN_DB_FLOAT,
+            GRN_DB_TIME,
+            GRN_DB_SHORT_TEXT,
+            GRN_DB_TEXT,
+            GRN_DB_LONG_TEXT,
+            GRN_DB_TOKYO_GEO_POINT,
+            GRN_DB_WGS84_GEO_POINT
+        } grn_builtin_type; -}
+#integral_t grn_builtin_type
+#num GRN_DB_VOID
+#num GRN_DB_DB
+#num GRN_DB_OBJECT
+#num GRN_DB_BOOL
+#num GRN_DB_INT8
+#num GRN_DB_UINT8
+#num GRN_DB_INT16
+#num GRN_DB_UINT16
+#num GRN_DB_INT32
+#num GRN_DB_UINT32
+#num GRN_DB_INT64
+#num GRN_DB_UINT64
+#num GRN_DB_FLOAT
+#num GRN_DB_TIME
+#num GRN_DB_SHORT_TEXT
+#num GRN_DB_TEXT
+#num GRN_DB_LONG_TEXT
+#num GRN_DB_TOKYO_GEO_POINT
+#num GRN_DB_WGS84_GEO_POINT
+{- typedef enum {
+            GRN_DB_MECAB = 64,
+            GRN_DB_DELIMIT,
+            GRN_DB_UNIGRAM,
+            GRN_DB_BIGRAM,
+            GRN_DB_TRIGRAM
+        } grn_builtin_tokenizer; -}
+#integral_t grn_builtin_tokenizer
+#num GRN_DB_MECAB
+#num GRN_DB_DELIMIT
+#num GRN_DB_UNIGRAM
+#num GRN_DB_BIGRAM
+#num GRN_DB_TRIGRAM
+#ccall grn_ctx_at , Ptr <_grn_ctx> -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_type_create , Ptr <_grn_ctx> -> CString -> CUInt -> CUShort -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_plugin_register , Ptr <_grn_ctx> -> CString -> IO <grn_rc>
+#ccall grn_plugin_register_by_path , Ptr <_grn_ctx> -> CString -> IO <grn_rc>
+#ccall grn_plugin_get_system_plugins_dir , IO CString
+#ccall grn_plugin_get_suffix , IO CString
+{- typedef struct {
+            const char * name; unsigned int name_size; grn_obj value;
+        } grn_expr_var; -}
+#starttype grn_expr_var
+#field name , CString
+#field name_size , CUInt
+#field value , <_grn_obj>
+#stoptype
+#callback_t grn_plugin_func , Ptr <_grn_ctx> -> IO <grn_rc>
+{- typedef enum {
+            GRN_PROC_TOKENIZER = 1,
+            GRN_PROC_COMMAND,
+            GRN_PROC_FUNCTION,
+            GRN_PROC_HOOK,
+            GRN_PROC_NORMALIZER
+        } grn_proc_type; -}
+#integral_t grn_proc_type
+#num GRN_PROC_TOKENIZER
+#num GRN_PROC_COMMAND
+#num GRN_PROC_FUNCTION
+#num GRN_PROC_HOOK
+#num GRN_PROC_NORMALIZER
+#ccall grn_proc_create , Ptr <_grn_ctx> -> CString -> CInt -> <grn_proc_type> -> Ptr <grn_proc_func> -> Ptr <grn_proc_func> -> Ptr <grn_proc_func> -> CUInt -> Ptr <grn_expr_var> -> IO (Ptr <_grn_obj>)
+#ccall grn_proc_get_info , Ptr <_grn_ctx> -> Ptr <grn_user_data> -> Ptr (Ptr <grn_expr_var>) -> Ptr CUInt -> Ptr (Ptr <_grn_obj>) -> IO (Ptr <_grn_obj>)
+#ccall grn_table_create , Ptr <_grn_ctx> -> CString -> CUInt -> CString -> CUShort -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_table_add , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> Ptr CInt -> IO CUInt
+#ccall grn_table_get , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> IO CUInt
+#ccall grn_table_at , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO CUInt
+#ccall grn_table_lcp_search , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> IO CUInt
+#ccall grn_table_get_key , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr () -> CInt -> IO CInt
+#ccall grn_table_delete , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> IO <grn_rc>
+#ccall grn_table_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_table_update_by_id , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr () -> CUInt -> IO <grn_rc>
+#ccall grn_table_update , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> Ptr () -> CUInt -> IO <grn_rc>
+#ccall grn_table_truncate , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+{- typedef grn_obj grn_table_cursor; -}
+#synonym_t grn_table_cursor , <_grn_obj>
+{- grn cursor -}
+#num GRN_CURSOR_ASCENDING
+#num GRN_CURSOR_DESCENDING
+#num GRN_CURSOR_GE
+#num GRN_CURSOR_GT
+#num GRN_CURSOR_LE
+#num GRN_CURSOR_LT
+#num GRN_CURSOR_BY_KEY
+#num GRN_CURSOR_BY_ID
+#num GRN_CURSOR_PREFIX
+#num GRN_CURSOR_SIZE_BY_BIT
+#num GRN_CURSOR_RK
+#ccall grn_table_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CUInt -> Ptr () -> CUInt -> CInt -> CInt -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_table_cursor_close , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_table_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_table_cursor_get_key , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_table_cursor_get_value , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_table_cursor_set_value , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_table_cursor_delete , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_table_cursor_table , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+{- typedef struct {
+            grn_id rid;
+            grn_id sid;
+            unsigned int pos;
+            unsigned int tf;
+            unsigned int weight;
+            unsigned int rest;
+        } grn_posting; -}
+#starttype grn_posting
+#field rid , CUInt
+#field sid , CUInt
+#field pos , CUInt
+#field tf , CUInt
+#field weight , CUInt
+#field rest , CUInt
+#stoptype
+#ccall grn_index_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> CUInt -> CUInt -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_index_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr CUInt -> IO (Ptr <grn_posting>)
+{- typedef struct _grn_table_sort_key grn_table_sort_key; -}
+-- #opaque_t _grn_table_sort_key
+-- #synonym_t grn_table_sort_key , <_grn_table_sort_key>
+{- typedef unsigned char grn_table_sort_flags; -}
+#synonym_t grn_table_sort_flags , CUChar
+{- struct _grn_table_sort_key {
+    grn_obj * key; grn_table_sort_flags flags; int offset;
+}; -}
+#starttype struct _grn_table_sort_key
+#field key , Ptr <_grn_obj>
+#field flags , CUChar
+#field offset , CInt
+#stoptype
+#ccall grn_table_sort , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> CInt -> Ptr <_grn_obj> -> Ptr <_grn_table_sort_key> -> CInt -> IO CInt
+{- typedef struct _grn_table_group_result grn_table_group_result; -}
+-- #opaque_t _grn_table_group_result
+-- #synonym_t grn_table_group_result , <_grn_table_group_result>
+{- typedef unsigned int grn_table_group_flags; -}
+#synonym_t grn_table_group_flags , CUInt
+{- typedef enum {
+            GRN_OP_PUSH = 0,
+            GRN_OP_POP,
+            GRN_OP_NOP,
+            GRN_OP_CALL,
+            GRN_OP_INTERN,
+            GRN_OP_GET_REF,
+            GRN_OP_GET_VALUE,
+            GRN_OP_AND,
+            GRN_OP_AND_NOT,
+            GRN_OP_OR,
+            GRN_OP_ASSIGN,
+            GRN_OP_STAR_ASSIGN,
+            GRN_OP_SLASH_ASSIGN,
+            GRN_OP_MOD_ASSIGN,
+            GRN_OP_PLUS_ASSIGN,
+            GRN_OP_MINUS_ASSIGN,
+            GRN_OP_SHIFTL_ASSIGN,
+            GRN_OP_SHIFTR_ASSIGN,
+            GRN_OP_SHIFTRR_ASSIGN,
+            GRN_OP_AND_ASSIGN,
+            GRN_OP_XOR_ASSIGN,
+            GRN_OP_OR_ASSIGN,
+            GRN_OP_JUMP,
+            GRN_OP_CJUMP,
+            GRN_OP_COMMA,
+            GRN_OP_BITWISE_OR,
+            GRN_OP_BITWISE_XOR,
+            GRN_OP_BITWISE_AND,
+            GRN_OP_BITWISE_NOT,
+            GRN_OP_EQUAL,
+            GRN_OP_NOT_EQUAL,
+            GRN_OP_LESS,
+            GRN_OP_GREATER,
+            GRN_OP_LESS_EQUAL,
+            GRN_OP_GREATER_EQUAL,
+            GRN_OP_IN,
+            GRN_OP_MATCH,
+            GRN_OP_NEAR,
+            GRN_OP_NEAR2,
+            GRN_OP_SIMILAR,
+            GRN_OP_TERM_EXTRACT,
+            GRN_OP_SHIFTL,
+            GRN_OP_SHIFTR,
+            GRN_OP_SHIFTRR,
+            GRN_OP_PLUS,
+            GRN_OP_MINUS,
+            GRN_OP_STAR,
+            GRN_OP_SLASH,
+            GRN_OP_MOD,
+            GRN_OP_DELETE,
+            GRN_OP_INCR,
+            GRN_OP_DECR,
+            GRN_OP_INCR_POST,
+            GRN_OP_DECR_POST,
+            GRN_OP_NOT,
+            GRN_OP_ADJUST,
+            GRN_OP_EXACT,
+            GRN_OP_LCP,
+            GRN_OP_PARTIAL,
+            GRN_OP_UNSPLIT,
+            GRN_OP_PREFIX,
+            GRN_OP_SUFFIX,
+            GRN_OP_GEO_DISTANCE1,
+            GRN_OP_GEO_DISTANCE2,
+            GRN_OP_GEO_DISTANCE3,
+            GRN_OP_GEO_DISTANCE4,
+            GRN_OP_GEO_WITHINP5,
+            GRN_OP_GEO_WITHINP6,
+            GRN_OP_GEO_WITHINP8,
+            GRN_OP_OBJ_SEARCH,
+            GRN_OP_EXPR_GET_VAR,
+            GRN_OP_TABLE_CREATE,
+            GRN_OP_TABLE_SELECT,
+            GRN_OP_TABLE_SORT,
+            GRN_OP_TABLE_GROUP,
+            GRN_OP_JSON_PUT,
+            GRN_OP_GET_MEMBER
+        } grn_operator; -}
+#integral_t grn_operator
+#num GRN_OP_PUSH
+#num GRN_OP_POP
+#num GRN_OP_NOP
+#num GRN_OP_CALL
+#num GRN_OP_INTERN
+#num GRN_OP_GET_REF
+#num GRN_OP_GET_VALUE
+#num GRN_OP_AND
+#num GRN_OP_AND_NOT
+#num GRN_OP_OR
+#num GRN_OP_ASSIGN
+#num GRN_OP_STAR_ASSIGN
+#num GRN_OP_SLASH_ASSIGN
+#num GRN_OP_MOD_ASSIGN
+#num GRN_OP_PLUS_ASSIGN
+#num GRN_OP_MINUS_ASSIGN
+#num GRN_OP_SHIFTL_ASSIGN
+#num GRN_OP_SHIFTR_ASSIGN
+#num GRN_OP_SHIFTRR_ASSIGN
+#num GRN_OP_AND_ASSIGN
+#num GRN_OP_XOR_ASSIGN
+#num GRN_OP_OR_ASSIGN
+#num GRN_OP_JUMP
+#num GRN_OP_CJUMP
+#num GRN_OP_COMMA
+#num GRN_OP_BITWISE_OR
+#num GRN_OP_BITWISE_XOR
+#num GRN_OP_BITWISE_AND
+#num GRN_OP_BITWISE_NOT
+#num GRN_OP_EQUAL
+#num GRN_OP_NOT_EQUAL
+#num GRN_OP_LESS
+#num GRN_OP_GREATER
+#num GRN_OP_LESS_EQUAL
+#num GRN_OP_GREATER_EQUAL
+#num GRN_OP_IN
+#num GRN_OP_MATCH
+#num GRN_OP_NEAR
+#num GRN_OP_NEAR2
+#num GRN_OP_SIMILAR
+#num GRN_OP_TERM_EXTRACT
+#num GRN_OP_SHIFTL
+#num GRN_OP_SHIFTR
+#num GRN_OP_SHIFTRR
+#num GRN_OP_PLUS
+#num GRN_OP_MINUS
+#num GRN_OP_STAR
+#num GRN_OP_SLASH
+#num GRN_OP_MOD
+#num GRN_OP_DELETE
+#num GRN_OP_INCR
+#num GRN_OP_DECR
+#num GRN_OP_INCR_POST
+#num GRN_OP_DECR_POST
+#num GRN_OP_NOT
+#num GRN_OP_ADJUST
+#num GRN_OP_EXACT
+#num GRN_OP_LCP
+#num GRN_OP_PARTIAL
+#num GRN_OP_UNSPLIT
+#num GRN_OP_PREFIX
+#num GRN_OP_SUFFIX
+#num GRN_OP_GEO_DISTANCE1
+#num GRN_OP_GEO_DISTANCE2
+#num GRN_OP_GEO_DISTANCE3
+#num GRN_OP_GEO_DISTANCE4
+#num GRN_OP_GEO_WITHINP5
+#num GRN_OP_GEO_WITHINP6
+#num GRN_OP_GEO_WITHINP8
+#num GRN_OP_OBJ_SEARCH
+#num GRN_OP_EXPR_GET_VAR
+#num GRN_OP_TABLE_CREATE
+#num GRN_OP_TABLE_SELECT
+#num GRN_OP_TABLE_SORT
+#num GRN_OP_TABLE_GROUP
+#num GRN_OP_JSON_PUT
+#num GRN_OP_GET_MEMBER
+{- struct _grn_table_group_result {
+    grn_obj * table;
+    unsigned char key_begin;
+    unsigned char key_end;
+    int limit;
+    grn_table_group_flags flags;
+    grn_operator op;
+}; -}
+#starttype struct _grn_table_group_result
+#field table , Ptr <_grn_obj>
+#field key_begin , CUChar
+#field key_end , CUChar
+#field limit , CInt
+#field flags , CUInt
+#field op , <grn_operator>
+#stoptype
+#ccall grn_table_group , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_table_sort_key> -> CInt -> Ptr <_grn_table_group_result> -> CInt -> IO <grn_rc>
+#ccall grn_table_setoperation , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> IO <grn_rc>
+#ccall grn_table_difference , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_table_columns , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_obj_column , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_table_size , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_column_create , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> CString -> CUShort -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_column_index_update , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CUInt -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_column_table , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+{- typedef enum {
+            GRN_INFO_ENCODING = 0,
+            GRN_INFO_SOURCE,
+            GRN_INFO_DEFAULT_TOKENIZER,
+            GRN_INFO_ELEMENT_SIZE,
+            GRN_INFO_CURR_MAX,
+            GRN_INFO_MAX_ELEMENT_SIZE,
+            GRN_INFO_SEG_SIZE,
+            GRN_INFO_CHUNK_SIZE,
+            GRN_INFO_MAX_SECTION,
+            GRN_INFO_HOOK_LOCAL_DATA,
+            GRN_INFO_ELEMENT_A,
+            GRN_INFO_ELEMENT_CHUNK,
+            GRN_INFO_ELEMENT_CHUNK_SIZE,
+            GRN_INFO_ELEMENT_BUFFER_FREE,
+            GRN_INFO_ELEMENT_NTERMS,
+            GRN_INFO_ELEMENT_NTERMS_VOID,
+            GRN_INFO_ELEMENT_SIZE_IN_CHUNK,
+            GRN_INFO_ELEMENT_POS_IN_CHUNK,
+            GRN_INFO_ELEMENT_SIZE_IN_BUFFER,
+            GRN_INFO_ELEMENT_POS_IN_BUFFER,
+            GRN_INFO_ELEMENT_ESTIMATE_SIZE,
+            GRN_INFO_NGRAM_UNIT_SIZE,
+            GRN_INFO_PARTIAL_MATCH_THRESHOLD,
+            GRN_INFO_II_SPLIT_THRESHOLD,
+            GRN_INFO_SUPPORT_ZLIB,
+            GRN_INFO_SUPPORT_LZO,
+            GRN_INFO_NORMALIZER
+        } grn_info_type; -}
+#integral_t grn_info_type
+#num GRN_INFO_ENCODING
+#num GRN_INFO_SOURCE
+#num GRN_INFO_DEFAULT_TOKENIZER
+#num GRN_INFO_ELEMENT_SIZE
+#num GRN_INFO_CURR_MAX
+#num GRN_INFO_MAX_ELEMENT_SIZE
+#num GRN_INFO_SEG_SIZE
+#num GRN_INFO_CHUNK_SIZE
+#num GRN_INFO_MAX_SECTION
+#num GRN_INFO_HOOK_LOCAL_DATA
+#num GRN_INFO_ELEMENT_A
+#num GRN_INFO_ELEMENT_CHUNK
+#num GRN_INFO_ELEMENT_CHUNK_SIZE
+#num GRN_INFO_ELEMENT_BUFFER_FREE
+#num GRN_INFO_ELEMENT_NTERMS
+#num GRN_INFO_ELEMENT_NTERMS_VOID
+#num GRN_INFO_ELEMENT_SIZE_IN_CHUNK
+#num GRN_INFO_ELEMENT_POS_IN_CHUNK
+#num GRN_INFO_ELEMENT_SIZE_IN_BUFFER
+#num GRN_INFO_ELEMENT_POS_IN_BUFFER
+#num GRN_INFO_ELEMENT_ESTIMATE_SIZE
+#num GRN_INFO_NGRAM_UNIT_SIZE
+#num GRN_INFO_PARTIAL_MATCH_THRESHOLD
+#num GRN_INFO_II_SPLIT_THRESHOLD
+#num GRN_INFO_SUPPORT_ZLIB
+#num GRN_INFO_SUPPORT_LZO
+#num GRN_INFO_NORMALIZER
+#ccall grn_obj_get_info , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_info_type> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_set_info , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_info_type> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_get_element_info , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> <grn_info_type> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_set_element_info , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> <grn_info_type> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_is_builtin , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUChar
+#ccall grn_obj_get_value , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_get_values , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_obj_set_value , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr <_grn_obj> -> CInt -> IO <grn_rc>
+#ccall grn_obj_remove , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_rename , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_table_rename , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_column_rename , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_obj_close , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_reinit , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CUChar -> IO <grn_rc>
+#ccall grn_obj_unlink , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO ()
+#ccall grn_obj_user_data , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <grn_user_data>)
+#ccall grn_obj_set_finalizer , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <grn_proc_func> -> IO <grn_rc>
+#ccall grn_obj_path , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CString
+#ccall grn_obj_name , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CInt -> IO CInt
+#ccall grn_column_name , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CInt -> IO CInt
+#ccall grn_obj_get_range , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_obj_expire , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> IO CInt
+#ccall grn_obj_check , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_obj_lock , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CInt -> IO <grn_rc>
+#ccall grn_obj_unlock , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_obj_clear_lock , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_is_locked , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_obj_defrag , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> IO CInt
+#ccall grn_obj_db , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_id , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+{- typedef struct _grn_search_optarg grn_search_optarg; -}
+-- #opaque_t _grn_search_optarg
+-- #synonym_t grn_search_optarg , <_grn_search_optarg>
+{- struct _grn_search_optarg {
+    grn_operator mode;
+    int similarity_threshold;
+    int max_interval;
+    int * weight_vector;
+    int vector_size;
+    grn_obj * proc;
+    int max_size;
+}; -}
+#starttype struct _grn_search_optarg
+#field mode , <grn_operator>
+#field similarity_threshold , CInt
+#field max_interval , CInt
+#field weight_vector , Ptr CInt
+#field vector_size , CInt
+#field proc , Ptr <_grn_obj>
+#field max_size , CInt
+#stoptype
+#ccall grn_obj_search , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> Ptr <_grn_search_optarg> -> IO <grn_rc>
+#ccall grn_vector_size , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_vector_add_element , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> CUInt -> CUInt -> IO <grn_rc>
+#ccall grn_vector_get_element , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr CString -> Ptr CUInt -> Ptr CUInt -> IO CUInt
+#ccall grn_proc_call_next , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_proc_get_ctx_local_data , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr ())
+#ccall grn_proc_get_hook_local_data , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr ())
+{- typedef enum {
+            GRN_HOOK_SET = 0,
+            GRN_HOOK_GET,
+            GRN_HOOK_INSERT,
+            GRN_HOOK_DELETE,
+            GRN_HOOK_SELECT
+        } grn_hook_entry; -}
+#integral_t grn_hook_entry
+#num GRN_HOOK_SET
+#num GRN_HOOK_GET
+#num GRN_HOOK_INSERT
+#num GRN_HOOK_DELETE
+#num GRN_HOOK_SELECT
+#ccall grn_obj_add_hook , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_hook_entry> -> CInt -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_obj_get_nhooks , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_hook_entry> -> IO CInt
+#ccall grn_obj_get_hook , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_hook_entry> -> CInt -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_delete_hook , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_hook_entry> -> CInt -> IO <grn_rc>
+#ccall grn_obj_open , Ptr <_grn_ctx> -> CUChar -> CUShort -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_column_index , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_operator> -> Ptr (Ptr <_grn_obj>) -> CInt -> Ptr CInt -> IO CInt
+#ccall grn_obj_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CUChar -> IO <grn_rc>
+#ccall grn_obj_path_by_id , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CString -> IO <grn_rc>
+{- typedef struct {
+            int latitude; int longitude;
+        } grn_geo_point; -}
+#starttype grn_geo_point
+#field latitude , CInt
+#field longitude , CInt
+#stoptype
+#ccall grn_geo_select_in_rectangle , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> IO <grn_rc>
+#ccall grn_geo_estimate_in_rectangle , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_geo_cursor_open_in_rectangle , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> CInt -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_geo_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <grn_posting>)
+{- typedef struct _grn_snip grn_snip; -}
+#opaque_t _grn_snip
+#synonym_t grn_snip , <_grn_snip>
+{- typedef struct _grn_snip_mapping grn_snip_mapping; -}
+-- #opaque_t _grn_snip_mapping
+-- #synonym_t grn_snip_mapping , <_grn_snip_mapping>
+{- struct _grn_snip_mapping {
+    void * dummy;
+}; -}
+#starttype struct _grn_snip_mapping
+#field dummy , Ptr ()
+#stoptype
+#ccall grn_snip_open , Ptr <_grn_ctx> -> CInt -> CUInt -> CUInt -> CString -> CUInt -> CString -> CUInt -> Ptr <_grn_snip_mapping> -> IO (Ptr <_grn_snip>)
+#ccall grn_snip_add_cond , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> CString -> CUInt -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_snip_set_normalizer , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_snip_get_normalizer , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr <_grn_obj>)
+#ccall grn_snip_exec , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> Ptr CUInt -> Ptr CUInt -> IO <grn_rc>
+#ccall grn_snip_get_result , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CString -> Ptr CUInt -> IO <grn_rc>
+
+{- typedef struct _grn_logger_info grn_logger_info; -}
+-- #opaque_t _grn_logger_info
+-- #synonym_t grn_logger_info , <_grn_logger_info>
+{- struct _grn_logger_info {
+    grn_log_level max_level;
+    int flags;
+    void (* func)(int,
+                  const char *,
+                  const char *,
+                  const char *,
+                  const char *,
+                  void *);
+    void * func_arg;
+}; -}
+#starttype struct _grn_logger_info
+#field max_level , <grn_log_level>
+#field flags , CInt
+#field func , FunPtr (CInt -> CString -> CString -> CString -> CString -> Ptr () -> IO ())
+#field func_arg , Ptr ()
+#stoptype
+#ccall grn_logger_info_set , Ptr <_grn_ctx> -> Ptr <_grn_logger_info> -> IO <grn_rc>
+{- typedef struct _grn_logger grn_logger; -}
+-- #opaque_t _grn_logger
+-- #synonym_t grn_logger , <_grn_logger>
+{- struct _grn_logger {
+    grn_log_level max_level;
+    int flags;
+    void * user_data;
+    void (* log)(grn_ctx * ctx,
+                 grn_log_level level,
+                 const char * timestamp,
+                 const char * title,
+                 const char * message,
+                 const char * location,
+                 void * user_data);
+    void (* reopen)(grn_ctx * ctx, void * user_data);
+    void (* fin)(grn_ctx * ctx, void * user_data);
+}; -}
+#starttype struct _grn_logger
+#field max_level , <grn_log_level>
+#field flags , CInt
+#field user_data , Ptr ()
+#field log , FunPtr (Ptr <_grn_ctx> -> <grn_log_level> -> CString -> CString -> CString -> CString -> Ptr () -> IO ())
+#field reopen , FunPtr (Ptr <_grn_ctx> -> Ptr () -> IO ())
+#field fin , FunPtr (Ptr <_grn_ctx> -> Ptr () -> IO ())
+#stoptype
+#ccall grn_logger_set , Ptr <_grn_ctx> -> Ptr <_grn_logger> -> IO <grn_rc>
+#ccall grn_logger_set_max_level , Ptr <_grn_ctx> -> <grn_log_level> -> IO ()
+#ccall grn_logger_get_max_level , Ptr <_grn_ctx> -> IO <grn_log_level>
+#ccall grn_logger_put , Ptr <_grn_ctx> -> <grn_log_level> -> CString -> CInt -> CString -> CString -> IO ()
+#ccall grn_logger_reopen , Ptr <_grn_ctx> -> IO ()
+#ccall grn_logger_pass , Ptr <_grn_ctx> -> <grn_log_level> -> IO CUChar
+#ccall grn_default_logger_set_max_level , <grn_log_level> -> IO ()
+#ccall grn_default_logger_get_max_level , IO <grn_log_level>
+#ccall grn_default_logger_set_path , CString -> IO ()
+#ccall grn_default_logger_get_path , IO CString
+{- typedef struct _grn_query_logger grn_query_logger; -}
+-- #opaque_t _grn_query_logger
+-- #synonym_t grn_query_logger , <_grn_query_logger>
+{- struct _grn_query_logger {
+    unsigned int flags;
+    void * user_data;
+    void (* log)(grn_ctx * ctx,
+                 unsigned int flag,
+                 const char * timestamp,
+                 const char * info,
+                 const char * message,
+                 void * user_data);
+    void (* reopen)(grn_ctx * ctx, void * user_data);
+    void (* fin)(grn_ctx * ctx, void * user_data);
+}; -}
+#starttype struct _grn_query_logger
+#field flags , CUInt
+#field user_data , Ptr ()
+#field log , FunPtr (Ptr <_grn_ctx> -> CUInt -> CString -> CString -> CString -> Ptr () -> IO ())
+#field reopen , FunPtr (Ptr <_grn_ctx> -> Ptr () -> IO ())
+#field fin , FunPtr (Ptr <_grn_ctx> -> Ptr () -> IO ())
+#stoptype
+#ccall grn_query_logger_set , Ptr <_grn_ctx> -> Ptr <_grn_query_logger> -> IO <grn_rc>
+#ccall grn_query_logger_put , Ptr <_grn_ctx> -> CUInt -> CString -> CString -> IO ()
+#ccall grn_query_logger_reopen , Ptr <_grn_ctx> -> IO ()
+#ccall grn_query_logger_pass , Ptr <_grn_ctx> -> CUInt -> IO CUChar
+#ccall grn_default_query_logger_set_flags , CUInt -> IO ()
+#ccall grn_default_query_logger_get_flags , IO CUInt
+#ccall grn_default_query_logger_set_path , CString -> IO ()
+#ccall grn_default_query_logger_get_path , IO CString
+#ccall grn_bulk_reinit , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_resize , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_write , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_write_from , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_reserve , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_space , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_truncate , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_bulk_fin , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_text_itoa , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> IO <grn_rc>
+#ccall grn_text_itoa_padded , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> CChar -> CUInt -> IO <grn_rc>
+#ccall grn_text_lltoa , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CLong -> IO <grn_rc>
+#ccall grn_text_ftoa , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CDouble -> IO <grn_rc>
+#ccall grn_text_itoh , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> CUInt -> IO <grn_rc>
+#ccall grn_text_itob , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_text_lltob32h , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CLong -> IO <grn_rc>
+#ccall grn_text_benc , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO <grn_rc>
+#ccall grn_text_esc , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_text_urlenc , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_text_urldec , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CString -> CChar -> IO CString
+#ccall grn_text_escape_xml , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_text_time2rfc1123 , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> IO <grn_rc>
+{- typedef struct _grn_obj_format grn_obj_format; -}
+-- #opaque_t _grn_obj_format
+-- #synonym_t grn_obj_format , <_grn_obj_format>
+{- struct _grn_obj_format {
+    grn_obj columns;
+    const void * min;
+    const void * max;
+    unsigned int min_size;
+    unsigned int max_size;
+    int nhits;
+    int offset;
+    int limit;
+    int hits_offset;
+    int flags;
+    grn_obj * expression;
+}; -}
+#starttype struct _grn_obj_format
+#field columns , <_grn_obj>
+#field min , Ptr ()
+#field max , Ptr ()
+#field min_size , CUInt
+#field max_size , CUInt
+#field nhits , CInt
+#field offset , CInt
+#field limit , CInt
+#field hits_offset , CInt
+#field flags , CInt
+#field expression , Ptr <_grn_obj>
+#stoptype
+#ccall grn_output_obj , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_content_type> -> Ptr <_grn_obj> -> Ptr <_grn_obj_format> -> IO ()
+#ccall grn_output_envelope , Ptr <_grn_ctx> -> <grn_rc> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> CString -> CInt -> IO ()
+#ccall grn_ctx_output_array_open , Ptr <_grn_ctx> -> CString -> CInt -> IO ()
+#ccall grn_ctx_output_array_close , Ptr <_grn_ctx> -> IO ()
+#ccall grn_ctx_output_map_open , Ptr <_grn_ctx> -> CString -> CInt -> IO ()
+#ccall grn_ctx_output_map_close , Ptr <_grn_ctx> -> IO ()
+#ccall grn_ctx_output_int32 , Ptr <_grn_ctx> -> CInt -> IO ()
+#ccall grn_ctx_output_int64 , Ptr <_grn_ctx> -> CLong -> IO ()
+#ccall grn_ctx_output_float , Ptr <_grn_ctx> -> CDouble -> IO ()
+#ccall grn_ctx_output_cstr , Ptr <_grn_ctx> -> CString -> IO ()
+#ccall grn_ctx_output_str , Ptr <_grn_ctx> -> CString -> CUInt -> IO ()
+#ccall grn_ctx_output_bool , Ptr <_grn_ctx> -> CUChar -> IO ()
+#ccall grn_ctx_output_obj , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj_format> -> IO ()
+#ccall grn_ctx_get_mime_type , Ptr <_grn_ctx> -> IO CString
+#ccall grn_ctx_recv_handler_set , Ptr <_grn_ctx> -> FunPtr (Ptr <_grn_ctx> -> CInt -> Ptr () -> IO ()) -> Ptr () -> IO ()
+#ccall grn_text_otoj , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj_format> -> IO <grn_rc>
+#ccall grn_time_now , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO ()
+{- typedef struct {
+            const char * orig;
+            char * norm;
+            short * checks;
+            unsigned char * ctypes;
+            int flags;
+            unsigned int orig_blen;
+            unsigned int norm_blen;
+            unsigned int length;
+            grn_encoding encoding;
+        } grn_str; -}
+#starttype grn_str
+#field orig , CString
+#field norm , CString
+#field checks , Ptr CShort
+#field ctypes , Ptr CUChar
+#field flags , CInt
+#field orig_blen , CUInt
+#field norm_blen , CUInt
+#field length , CUInt
+#field encoding , <grn_encoding>
+#stoptype
+#ccall grn_str_open , Ptr <_grn_ctx> -> CString -> CUInt -> CInt -> IO (Ptr <grn_str>)
+#ccall grn_str_close , Ptr <_grn_ctx> -> Ptr <grn_str> -> IO <grn_rc>
+{- typedef enum {
+            GRN_CHAR_NULL = 0,
+            GRN_CHAR_ALPHA,
+            GRN_CHAR_DIGIT,
+            GRN_CHAR_SYMBOL,
+            GRN_CHAR_HIRAGANA,
+            GRN_CHAR_KATAKANA,
+            GRN_CHAR_KANJI,
+            GRN_CHAR_OTHERS
+        } grn_char_type; -}
+#integral_t grn_char_type
+#num GRN_CHAR_NULL
+#num GRN_CHAR_ALPHA
+#num GRN_CHAR_DIGIT
+#num GRN_CHAR_SYMBOL
+#num GRN_CHAR_HIRAGANA
+#num GRN_CHAR_KATAKANA
+#num GRN_CHAR_KANJI
+#num GRN_CHAR_OTHERS
+#ccall grn_string_open , Ptr <_grn_ctx> -> CString -> CUInt -> Ptr <_grn_obj> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_string_get_original , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr CString -> Ptr CUInt -> IO <grn_rc>
+#ccall grn_string_get_flags , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_string_get_normalized , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr CString -> Ptr CUInt -> Ptr CUInt -> IO <grn_rc>
+#ccall grn_string_set_normalized , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> CUInt -> IO <grn_rc>
+#ccall grn_string_get_checks , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr CShort)
+#ccall grn_string_set_checks , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr CShort -> IO <grn_rc>
+#ccall grn_string_get_types , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO (Ptr CUChar)
+#ccall grn_string_set_types , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr CUChar -> IO <grn_rc>
+#ccall grn_string_get_encoding , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_encoding>
+#ccall grn_charlen , Ptr <_grn_ctx> -> CString -> CString -> IO CInt
+#ccall grn_expr_create , Ptr <_grn_ctx> -> CString -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_close , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_expr_add_var , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_get_var , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_get_var_by_offset , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_append_obj , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_append_const , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_append_const_str , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> <grn_operator> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_append_const_int , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> <grn_operator> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_append_op , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> <grn_operator> -> CInt -> IO <grn_rc>
+#ccall grn_expr_syntax_escape , Ptr <_grn_ctx> -> CString -> CInt -> CString -> CChar -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_expr_syntax_escape_query , Ptr <_grn_ctx> -> CString -> CInt -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_expr_compile , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_expr_exec , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> IO (Ptr <_grn_obj>)
+#ccall grn_ctx_push , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_ctx_pop , Ptr <_grn_ctx> -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_alloc , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> CUShort -> IO (Ptr <_grn_obj>)
+#ccall grn_table_select , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> <grn_operator> -> IO (Ptr <_grn_obj>)
+#ccall grn_obj_columns , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> Ptr <_grn_obj> -> IO CInt
+{- typedef unsigned int grn_expr_flags; -}
+#synonym_t grn_expr_flags , CUInt
+#ccall grn_expr_parse , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> Ptr <_grn_obj> -> <grn_operator> -> <grn_operator> -> CUInt -> IO <grn_rc>
+#ccall grn_expr_snip , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CInt -> CUInt -> CUInt -> CUInt -> Ptr CString -> Ptr CUInt -> Ptr CString -> Ptr CUInt -> Ptr <_grn_snip_mapping> -> IO (Ptr <_grn_obj>)
+#ccall grn_expr_snip_add_conditions , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> CUInt -> Ptr CString -> Ptr CUInt -> Ptr CString -> Ptr CUInt -> IO <grn_rc>
+#ccall grn_table_sort_key_from_str , Ptr <_grn_ctx> -> CString -> CUInt -> Ptr <_grn_obj> -> Ptr CUInt -> IO (Ptr <_grn_table_sort_key>)
+#ccall grn_table_sort_key_close , Ptr <_grn_ctx> -> Ptr <_grn_table_sort_key> -> CUInt -> IO <grn_rc>
+#ccall grn_table_is_grouped , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUChar
+#ccall grn_table_max_n_subrecs , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> IO CUInt
+#ccall grn_table_create_for_group , Ptr <_grn_ctx> -> CString -> CUInt -> CString -> Ptr <_grn_obj> -> Ptr <_grn_obj> -> CUInt -> IO (Ptr <_grn_obj>)
+#ccall grn_table_get_subrecs , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr CUInt -> Ptr CInt -> CInt -> IO CUInt
+#ccall grn_table_tokenize , Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CString -> CUInt -> Ptr <_grn_obj> -> CUChar -> IO (Ptr <_grn_obj>)
+#ccall grn_load , Ptr <_grn_ctx> -> <grn_content_type> -> CString -> CUInt -> CString -> CUInt -> CString -> CUInt -> CString -> CUInt -> CString -> CUInt -> IO <grn_rc>
+#ccall grn_ctx_connect , Ptr <_grn_ctx> -> CString -> CInt -> CInt -> IO <grn_rc>
+#ccall grn_ctx_send , Ptr <_grn_ctx> -> CString -> CUInt -> CInt -> IO CUInt
+#ccall grn_ctx_recv , Ptr <_grn_ctx> -> Ptr CString -> Ptr CUInt -> Ptr CInt -> IO CUInt
+{- typedef struct _grn_ctx_info grn_ctx_info; -}
+-- #opaque_t _grn_ctx_info
+#synonym_t grn_ctx_info , <_grn_ctx_info>
+{- struct _grn_ctx_info {
+    int fd;
+    unsigned int com_status;
+    grn_obj * outbuf;
+    unsigned char stat;
+}; -}
+#starttype struct _grn_ctx_info
+#field fd , CInt
+#field com_status , CUInt
+#field outbuf , Ptr <_grn_obj>
+#field stat , CUChar
+#stoptype
+#ccall grn_ctx_info_get , Ptr <_grn_ctx> -> Ptr <_grn_ctx_info> -> IO <grn_rc>
+#ccall grn_set_segv_handler , IO <grn_rc>
+#ccall grn_set_int_handler , IO <grn_rc>
+#ccall grn_set_term_handler , IO <grn_rc>
+{- typedef struct _grn_hash grn_hash; -}
+#opaque_t _grn_hash
+#synonym_t grn_hash , <_grn_hash>
+{- typedef struct _grn_hash_cursor grn_hash_cursor; -}
+#opaque_t _grn_hash_cursor
+#synonym_t grn_hash_cursor , <_grn_hash_cursor>
+#ccall grn_hash_create , Ptr <_grn_ctx> -> CString -> CUInt -> CUInt -> CUInt -> IO (Ptr <_grn_hash>)
+#ccall grn_hash_open , Ptr <_grn_ctx> -> CString -> IO (Ptr <_grn_hash>)
+#ccall grn_hash_close , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> IO <grn_rc>
+#ccall grn_hash_add , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> Ptr CInt -> IO CUInt
+#ccall grn_hash_get , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> IO CUInt
+#ccall grn_hash_get_key , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> CUInt -> Ptr () -> CInt -> IO CInt
+#ccall grn_hash_get_key2 , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> CUInt -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_hash_get_value , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> CUInt -> Ptr () -> IO CInt
+#ccall grn_hash_set_value , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> CUInt -> Ptr () -> CInt -> IO <grn_rc>
+{- typedef struct _grn_table_delete_optarg grn_table_delete_optarg; -}
+-- #opaque_t _grn_table_delete_optarg
+-- #synonym_t grn_table_delete_optarg , <_grn_table_delete_optarg>
+{- struct _grn_table_delete_optarg {
+    int flags;
+    int (* func)(grn_ctx * ctx, grn_obj *, grn_id, void *);
+    void * func_arg;
+}; -}
+#starttype struct _grn_table_delete_optarg
+#field flags , CInt
+#field func , FunPtr (Ptr <_grn_ctx> -> Ptr <_grn_obj> -> CUInt -> Ptr () -> CInt)
+#field func_arg , Ptr ()
+#stoptype
+#ccall grn_hash_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_hash_delete , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> Ptr () -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_hash_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_hash> -> Ptr () -> CUInt -> Ptr () -> CUInt -> CInt -> CInt -> CInt -> IO (Ptr <_grn_hash_cursor>)
+#ccall grn_hash_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> IO CUInt
+#ccall grn_hash_cursor_close , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> IO ()
+#ccall grn_hash_cursor_get_key , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_hash_cursor_get_value , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_hash_cursor_set_value , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_hash_cursor_get_key_value , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> Ptr (Ptr ()) -> Ptr CUInt -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_hash_cursor_delete , Ptr <_grn_ctx> -> Ptr <_grn_hash_cursor> -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+{- typedef struct _grn_array grn_array; -}
+#opaque_t _grn_array
+#synonym_t grn_array , <_grn_array>
+{- typedef struct _grn_array_cursor grn_array_cursor; -}
+#opaque_t _grn_array_cursor
+#synonym_t grn_array_cursor , <_grn_array_cursor>
+#ccall grn_array_create , Ptr <_grn_ctx> -> CString -> CUInt -> CUInt -> IO (Ptr <_grn_array>)
+#ccall grn_array_open , Ptr <_grn_ctx> -> CString -> IO (Ptr <_grn_array>)
+#ccall grn_array_close , Ptr <_grn_ctx> -> Ptr <_grn_array> -> IO <grn_rc>
+#ccall grn_array_add , Ptr <_grn_ctx> -> Ptr <_grn_array> -> Ptr (Ptr ()) -> IO CUInt
+#ccall grn_array_push , Ptr <_grn_ctx> -> Ptr <_grn_array> -> FunPtr (Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> Ptr () -> IO ()) -> Ptr () -> IO CUInt
+#ccall grn_array_pull , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUChar -> FunPtr (Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> Ptr () -> IO ()) -> Ptr () -> IO CUInt
+#ccall grn_array_unblock , Ptr <_grn_ctx> -> Ptr <_grn_array> -> IO ()
+#ccall grn_array_get_value , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> Ptr () -> IO CInt
+#ccall grn_array_set_value , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_array_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> CUInt -> CInt -> CInt -> CInt -> IO (Ptr <_grn_array_cursor>)
+#ccall grn_array_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_array_cursor> -> IO CUInt
+#ccall grn_array_cursor_get_value , Ptr <_grn_ctx> -> Ptr <_grn_array_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_array_cursor_set_value , Ptr <_grn_ctx> -> Ptr <_grn_array_cursor> -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_array_cursor_delete , Ptr <_grn_ctx> -> Ptr <_grn_array_cursor> -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_array_cursor_close , Ptr <_grn_ctx> -> Ptr <_grn_array_cursor> -> IO ()
+#ccall grn_array_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_array_next , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> IO CUInt
+#ccall _grn_array_get_value , Ptr <_grn_ctx> -> Ptr <_grn_array> -> CUInt -> IO (Ptr ())
+{- typedef struct _grn_pat grn_pat; -}
+#opaque_t _grn_pat
+#synonym_t grn_pat , <_grn_pat>
+{- typedef struct _grn_pat_cursor grn_pat_cursor; -}
+#opaque_t _grn_pat_cursor
+#synonym_t grn_pat_cursor , <_grn_pat_cursor>
+#ccall grn_pat_create , Ptr <_grn_ctx> -> CString -> CUInt -> CUInt -> CUInt -> IO (Ptr <_grn_pat>)
+#ccall grn_pat_open , Ptr <_grn_ctx> -> CString -> IO (Ptr <_grn_pat>)
+#ccall grn_pat_close , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> IO <grn_rc>
+#ccall grn_pat_remove , Ptr <_grn_ctx> -> CString -> IO <grn_rc>
+#ccall grn_pat_get , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> IO CUInt
+#ccall grn_pat_add , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> Ptr CInt -> IO CUInt
+#ccall grn_pat_get_key , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr () -> CInt -> IO CInt
+#ccall grn_pat_get_key2 , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_pat_get_value , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr () -> IO CInt
+#ccall grn_pat_set_value , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_pat_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_pat_delete , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_pat_delete_with_sis , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO CInt
+{- typedef struct _grn_pat_scan_hit grn_pat_scan_hit; -}
+-- #opaque_t _grn_pat_scan_hit
+-- #synonym_t grn_pat_scan_hit , <_grn_pat_scan_hit>
+{- struct _grn_pat_scan_hit {
+    grn_id id; unsigned int offset; unsigned int length;
+}; -}
+#starttype struct _grn_pat_scan_hit
+#field id , CUInt
+#field offset , CUInt
+#field length , CUInt
+#stoptype
+#ccall grn_pat_scan , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> CString -> CUInt -> Ptr <_grn_pat_scan_hit> -> CUInt -> Ptr CString -> IO CInt
+#ccall grn_pat_prefix_search , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr <_grn_hash> -> IO <grn_rc>
+#ccall grn_pat_suffix_search , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr <_grn_hash> -> IO <grn_rc>
+#ccall grn_pat_lcp_search , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> IO CUInt
+#ccall grn_pat_size , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> IO CUInt
+#ccall grn_pat_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_pat> -> Ptr () -> CUInt -> Ptr () -> CUInt -> CInt -> CInt -> CInt -> IO (Ptr <_grn_pat_cursor>)
+#ccall grn_pat_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> IO CUInt
+#ccall grn_pat_cursor_close , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> IO ()
+#ccall grn_pat_cursor_get_key , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_pat_cursor_get_value , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_pat_cursor_get_key_value , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> Ptr (Ptr ()) -> Ptr CUInt -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_pat_cursor_set_value , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> Ptr () -> CInt -> IO <grn_rc>
+#ccall grn_pat_cursor_delete , Ptr <_grn_ctx> -> Ptr <_grn_pat_cursor> -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+{- typedef struct _grn_dat grn_dat; -}
+#opaque_t _grn_dat
+#synonym_t grn_dat , <_grn_dat>
+{- typedef struct _grn_dat_cursor grn_dat_cursor; -}
+#opaque_t _grn_dat_cursor
+#synonym_t grn_dat_cursor , <_grn_dat_cursor>
+#ccall grn_dat_create , Ptr <_grn_ctx> -> CString -> CUInt -> CUInt -> CUInt -> IO (Ptr <_grn_dat>)
+#ccall grn_dat_open , Ptr <_grn_ctx> -> CString -> IO (Ptr <_grn_dat>)
+#ccall grn_dat_close , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> IO <grn_rc>
+#ccall grn_dat_remove , Ptr <_grn_ctx> -> CString -> IO <grn_rc>
+#ccall grn_dat_get , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> IO CUInt
+#ccall grn_dat_add , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> Ptr () -> CUInt -> Ptr (Ptr ()) -> Ptr CInt -> IO CUInt
+#ccall grn_dat_get_key , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> CUInt -> Ptr () -> CInt -> IO CInt
+#ccall grn_dat_get_key2 , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> CUInt -> Ptr <_grn_obj> -> IO CInt
+#ccall grn_dat_delete_by_id , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_dat_delete , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> Ptr () -> CUInt -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+#ccall grn_dat_update_by_id , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> CUInt -> Ptr () -> CUInt -> IO <grn_rc>
+#ccall grn_dat_update , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> Ptr () -> CUInt -> Ptr () -> CUInt -> IO <grn_rc>
+#ccall grn_dat_size , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> IO CUInt
+#ccall grn_dat_cursor_open , Ptr <_grn_ctx> -> Ptr <_grn_dat> -> Ptr () -> CUInt -> Ptr () -> CUInt -> CInt -> CInt -> CInt -> IO (Ptr <_grn_dat_cursor>)
+#ccall grn_dat_cursor_next , Ptr <_grn_ctx> -> Ptr <_grn_dat_cursor> -> IO CUInt
+#ccall grn_dat_cursor_close , Ptr <_grn_ctx> -> Ptr <_grn_dat_cursor> -> IO ()
+#ccall grn_dat_cursor_get_key , Ptr <_grn_ctx> -> Ptr <_grn_dat_cursor> -> Ptr (Ptr ()) -> IO CInt
+#ccall grn_dat_cursor_delete , Ptr <_grn_ctx> -> Ptr <_grn_dat_cursor> -> Ptr <_grn_table_delete_optarg> -> IO <grn_rc>
+{- typedef struct _grn_ii grn_ii; -}
+#opaque_t _grn_ii
+#synonym_t grn_ii , <_grn_ii>
+{- typedef struct _grn_ii_buffer grn_ii_buffer; -}
+#opaque_t _grn_ii_buffer
+#synonym_t grn_ii_buffer , <_grn_ii_buffer>
+#ccall grn_ii_buffer_open , Ptr <_grn_ctx> -> Ptr <_grn_ii> -> CLong -> IO (Ptr <_grn_ii_buffer>)
+#ccall grn_ii_buffer_append , Ptr <_grn_ctx> -> Ptr <_grn_ii_buffer> -> CUInt -> CUInt -> Ptr <_grn_obj> -> IO <grn_rc>
+#ccall grn_ii_buffer_commit , Ptr <_grn_ctx> -> Ptr <_grn_ii_buffer> -> IO <grn_rc>
+#ccall grn_ii_buffer_close , Ptr <_grn_ctx> -> Ptr <_grn_ii_buffer> -> IO <grn_rc>
diff --git a/Bindings/Groonga/Types.hs b/Bindings/Groonga/Types.hs
new file mode 100644
--- /dev/null
+++ b/Bindings/Groonga/Types.hs
@@ -0,0 +1,11 @@
+module Bindings.Groonga.Types where
+
+{-|
+  Groonga Command.
+
+  Currently, /Command/ = /String/
+-}
+type Command = String
+
+{-| Groonga Database name -}
+type Database = String
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+Haroonga
+===
+
+[![Build Status](https://travis-ci.org/cosmo0920/haroonga.png?branch=master)](https://travis-ci.org/cosmo0920/haroonga)
+
+Low level Haskell binding for Groonga.
+
+## dependencies
+
+* groonga 4.0.0+
+* hsc2hs
+* and some cabal packages
+
+## export module(s)
+
+* Bindings.Groonga
+* Bindings.Groonga.Raw
+* Bindings.Groonga.SimpleAPI
+* Bindings.Groonga.Types
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/haroonga.cabal b/haroonga.cabal
new file mode 100644
--- /dev/null
+++ b/haroonga.cabal
@@ -0,0 +1,35 @@
+-- Initial hs-Groonga.cabal generated by cabal init.  For further
+-- documentation, see http://haskell.org/cabal/users-guide/
+
+name:                  haroonga
+version:               0.1.0.0
+synopsis:              Low level bindings for Groonga.
+description:           Bindings to Groonga  <http://groonga.org/>.
+license:               LGPL-2.1
+license-file:          LICENSE
+author:                cosmo0920
+maintainer:            cosmo0920.wp@gmail.com
+category:              FFI
+build-type:            Simple
+stability:             Experimental
+extra-source-files:    README.md
+cabal-version:         >=1.10
+
+library
+  exposed-modules:     Bindings.Groonga
+                       Bindings.Groonga.Raw
+                       Bindings.Groonga.CommandAPI
+                       Bindings.Groonga.Types
+  build-depends:       base          >= 4.5 && < 5
+                     , bindings-DSL  >= 1.0 && < 1.2
+                     , resourcet     >= 0.4
+                     , transformers  >= 0.3
+                     , monad-control >= 0.3 && < 0.4
+  hs-source-dirs:      .
+  build-tools:         hsc2hs
+  default-language:    Haskell2010
+  pkgconfig-depends:   groonga >= 4.0.0
+
+source-repository head
+  type: git
+  location: git://github.com/cosmo0920/haroonga.git
