1 /* This file is part of the Zebra server.
2 Copyright (C) 1995-2008 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 void idzebra_api_init(void);
21 char **api_errors(void);
23 int api_check_error(void);
25 void api_clear_error(void);
28 IDZebraService idzebra_start (RES_LIST);
30 IDZEBRA_RES idzebra_stop(IDZebraService srv);
33 IDZebraSession idzebra_open (IDZebraService srv, RES_LIST);
35 IDZEBRA_RES idzebra_close(IDZebraSession sess);
37 IDZEBRA_RES idzebra_samplefunc(IDZebraSession sess, RES_LIST);
41 -------------------------------------------------------------------------------
42 Utility functions for argument handling
43 -------------------------------------------------------------------------------
46 #if __STDC_VERSION__ < 199901L
48 # define __func__ __FUNCTION__
50 # define __func__ "<unknown>"
54 #define API_SET_CONTEXT api_error_context = __func__
56 void args_parse_res (Res r,
57 const char **valid_args,
61 void args_use (IDZebraSession sess,
67 #define ARG_MODE_OPTIONAL 0
68 #define ARG_MODE_MANDATORY 1
69 #define ARG_MODE_FORCE 2
71 #define RES_OPEN(var,def,over) \
72 var = res_open(def, over); \
73 res_set(var,"__context__", __func__ ); \
80 #define ARGS_PARSE(...) \
82 const char *vargs[] = { __VA_ARGS__ , 0 }; \
83 RES_OPEN(func_res, 0, 0); \
84 RES_OPEN(local, 0, 0); \
85 args_parse_res(func_res, vargs, local, res_args); \
89 temp_res = res_add_over(sess->res, func_res); \
91 #define ARGS_PROCESS(mode, ...) \
93 const char *vargs[] = { __VA_ARGS__ , 0 }; \
94 args_use(sess, local, func_res, mode, vargs); \
100 res_remove_over(temp_res); \
101 used = res_get_array(local, "_used"); \
102 args_use(sess, sess->res, 0, ARG_MODE_FORCE, used); \
107 if (func_res) res_close(func_res); \
108 if (temp_res) res_close_over(temp_res); \
109 if (local) res_close(local); \
111 #endif /* API_SWIG_H */
115 * indent-tabs-mode: nil
117 * vim: shiftwidth=4 tabstop=8 expandtab