Include idzebra-2.0-examples in RPM package
[idzebra-moved-to-github.git] / include / idzebra / api_swig.h
index 5d24224..55b8b9d 100644 (file)
@@ -1,16 +1,20 @@
-#ifndef API_SWIG_H
-#define API_SWIG_H
+/* This file is part of the Zebra server.
+   Copyright (C) 1995-2008 Index Data
 
-#include <idzebra/res.h>
-#include <idzebra/api.h>
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-typedef short IDZEBRA_RES;
-#define RES_LIST char** res_args                                 
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* 
--------------------------------------------------------------------------------
- API Calls
--------------------------------------------------------------------------------
 */
 void idzebra_api_init(void);
 
@@ -21,16 +25,16 @@ int api_check_error(void);
 void api_clear_error(void);
 
 
-ZebraService idzebra_start (RES_LIST);
+IDZebraService idzebra_start (RES_LIST);
 
-IDZEBRA_RES idzebra_stop(ZebraService zs);
+IDZEBRA_RES idzebra_stop(IDZebraService srv);
 
 
-ZebraHandle idzebra_open (ZebraService zs, RES_LIST);
+IDZebraSession idzebra_open (IDZebraService srv, RES_LIST);
 
-IDZEBRA_RES idzebra_close(ZebraHandle zh);
+IDZEBRA_RES idzebra_close(IDZebraSession sess);
 
-IDZEBRA_RES idzebra_samplefunc(ZebraHandle zh, RES_LIST);
+IDZEBRA_RES idzebra_samplefunc(IDZebraSession sess, RES_LIST);
 
 
 /* 
@@ -54,7 +58,7 @@ void args_parse_res (Res r,
                     Res skip,
                     char **args);
 
-void args_use (ZebraHandle zh,
+void args_use (IDZebraSession sess,
               Res r,
               Res rr,
               int mandatory,
@@ -82,12 +86,12 @@ void args_use (ZebraHandle zh,
   }                                                              \
 
 #define ARGS_APPLY                                               \
-  temp_res = res_add_over(zh->session_res, func_res);            \
+  temp_res = res_add_over(sess->res, func_res);                  \
 
 #define ARGS_PROCESS(mode, ...)                                  \
   {                                                              \
   const char *vargs[] = { __VA_ARGS__ , 0 };                     \
-  args_use(zh, local, func_res, mode, vargs);                    \
+  args_use(sess, local, func_res, mode, vargs);                  \
   }                                                              \
 
 #define ARGS_REVOKE                                              \
@@ -95,12 +99,21 @@ void args_use (ZebraHandle zh,
   const char **used;                                             \
   res_remove_over(temp_res);                                     \
   used = res_get_array(local, "_used");                          \
-  args_use(zh, zh->session_res, 0, ARG_MODE_FORCE, used);        \
+  args_use(sess, sess->res, 0, ARG_MODE_FORCE, used);              \
   free_array(used);                                              \
   }                                                              \
 
 #define ARGS_DONE                                                \
   if (func_res) res_close(func_res);                             \
+  if (temp_res) res_close_over(temp_res);                        \
   if (local) res_close(local);                                   \
 
 #endif /* API_SWIG_H */
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+