+
+/* == Error handling and reporting (index/zebraapi.c) ====================== */
+
+/* last error code */
+%name(errCode)
+int zebra_errCode (ZebraHandle zh);
+
+/* string representatio of above */
+%name(errString)
+const char * zebra_errString (ZebraHandle zh);
+
+/* extra information associated with error */
+%name(errAdd)
+char * zebra_errAdd (ZebraHandle zh);
+
+
+/* == Zebra resources and database selection =============================== */
+
+/* set a resource */
+%name(set_resource)
+void zebra_set_resource(ZebraHandle zh, const char *name, const char *value);
+
+/* get a resource */
+%name(get_resource)
+const char *zebra_set_resource(ZebraHandle zh, const char *name,
+ const char *defaultvalue);
+
+/* select database for update purposes (zebraapi.c) */
+%name(select_database)
+int zebra_select_database (ZebraHandle zh, const char *basename);
+
+/* select databases for record retrieval (zebraapi.c) */
+%name(select_databases)
+int zebra_select_databases (ZebraHandle zh, int num_bases,
+ const char **basenames);
+
+
+/* == Transactions, locking, shadow register =============================== */
+
+/* begin transaction (add write lock) (zebraapi.c) */
+%name(begin_trans)
+int zebra_begin_trans (ZebraHandle zh, int rw);
+
+/* end transaction (remove write lock) (zebraapi.c) */
+%name(end_trans)
+void zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *stat);
+
+%name(trans_no)
+int zebra_trans_no (ZebraHandle zh);
+
+/* commit changes from shadow (zebraapi.c) */
+%name(commit)
+int zebra_commit (ZebraHandle zh);
+
+/* get shadow status (zebra_api_ext.c) */
+%name(get_shadow_enable)
+int zebra_get_shadow_enable (ZebraHandle zh);
+
+/* set shadow status (zebra_api_ext.c) */
+%name(set_shadow_enable)
+void zebra_set_shadow_enable (ZebraHandle zh, int value);
+
+
+/* == Repository actions (zebraapi.c) ====================================== */
+
+%name(init)
+int zebra_init (ZebraHandle zh);
+
+%name(compact)
+int zebra_compact (ZebraHandle zh);
+
+%name(repository_update)
+void zebra_repository_update (ZebraHandle zh, const char *path);
+
+%name(repository_delete)
+void zebra_repository_delete (ZebraHandle zh, const char *path);
+
+%name(repository_show)
+void zebra_repository_show (ZebraHandle zh, const char *path);
+
+
+/* == Record update/delete (zebra_api_ext.c) =============================== */
+
+/* If sysno is provided, then it's used to identify the reocord.
+ If not, and match_criteria is provided, then sysno is guessed
+ If not, and a record is provided, then sysno is got from there */
+
+%apply int *REFERENCE { long long *sysno };
+%name(insert_record)
+int zebra_insert_record (ZebraHandle zh,
+ const char *recordType,
+ long long *sysno,
+ const char *match,
+ const char *fname,
+ const char *buf,
+ int buf_size,
+ int force_update);
+
+%name(update_record)
+int zebra_update_record (ZebraHandle zh,
+ const char *recordType,
+ long long *sysno,
+ const char *match,
+ const char *fname,
+ const char *buf,
+ int buf_size,
+ int force_update);
+
+%name(delete_record)
+int zebra_delete_record (ZebraHandle zh,
+ const char *recordType,
+ long long *sysno,
+ const char *match,
+ const char *fname,
+ const char *buf,
+ int buf_size,
+ int force_update);
+
+/* == Search (zebraapi.c) ================================================== */
+%include "typemaps.i"
+%apply int *REFERENCE { int *hits };
+%name(search_PQF)
+int zebra_search_PQF (ZebraHandle zh,
+ const char *pqf_query,
+ const char *setname,
+ int *hits);
+
+/* == YAZ - query tools ==================================================== */
+
+
+cql_transform_t cql_transform_open_fname(const char *fname);
+void cql_transform_close(cql_transform_t ct);
+int cql_transform_error(cql_transform_t ct, const char **addinfo);
+
+%name(cql2pqf)
+int zebra_cql2pqf (cql_transform_t ct,
+ const char *query, char *res, int len);
+
+/* == Retrieval (zebra_api_ext.c) ========================================== */
+
+/* will get a 'retrieval obj' (simple enough to pass to perl), which can be
+ used to get the individual records. Elementset, schema and format strings
+ are threated the same way yaz-client does. */
+void records_retrieve(ZebraHandle zh,
+ ODR stream,
+ const char *setname, // resultset name
+ const char *a_eset, // optional elementset
+ const char *a_schema, // optional schema
+ const char *a_format, // optional record syntax
+ int from, // range, 1 based
+ int to,
+ RetrievalObj *res
+ );
+
+/* fetch a record from the retrieval object. pos is 1 based */
+void record_retrieve(RetrievalObj *ro,
+ ODR stream,
+ RetrievalRecord *res,
+ int pos);
+
+/* Delete Result Set(s) (zebraapi.c) */
+%name(deleteResultSet)