1 /*
2  *  Hamlib Interface - plugin registration
3  *  Copyright (c) 2003-2005 by Stephane Fillod
4  *
5  *
6  *   This library is free software; you can redistribute it and/or
7  *   modify it under the terms of the GNU Lesser General Public
8  *   License as published by the Free Software Foundation; either
9  *   version 2.1 of the License, or (at your option) any later version.
10  *
11  *   This library is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *   Lesser General Public License for more details.
15  *
16  *   You should have received a copy of the GNU Lesser General Public
17  *   License along with this library; if not, write to the Free Software
18  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21 #ifndef _REGISTER_H
22 #define _REGISTER_H 1
23 
24 
25 #include <hamlib/rig.h>
26 #include <hamlib/rotator.h>
27 #include <hamlib/amplifier.h>
28 #include <config.h>
29 
30 #ifdef __cplusplus
31 #define EXTERN_C extern "C"
32 #else
33 #define EXTERN_C extern
34 #endif
35 
36 #define CONCAT4(w__, x__, y__, z__) w__ ## x__ ## y__ ## z__
37 #define MAKE_VERSIONED_FN(prefix__, version__, name_args__) CONCAT4(prefix__, version__, _, name_args__)
38 /* void MAKE_VERSIONED_FN(foo, 42, bar(int i))  ->  void foo42_bar(int i) */
39 
40 #ifndef ABI_VERSION
41 #error ABI_VERSION undefined! Did you include config.h?
42 #endif
43 
44 #define PREFIX_INITRIG initrigs
45 #define PREFIX_PROBERIG probeallrigs
46 
47 #define DECLARE_INITRIG_BACKEND(backend)                                \
48     EXTERN_C BACKEND_EXPORT(int)                                        \
49     MAKE_VERSIONED_FN(PREFIX_INITRIG, ABI_VERSION, backend(void *be_handle))
50 
51 #define DECLARE_PROBERIG_BACKEND(backend)                               \
52     EXTERN_C BACKEND_EXPORT(rig_model_t)                                \
53     MAKE_VERSIONED_FN(PREFIX_PROBERIG,                                  \
54                       ABI_VERSION,                                      \
55                       backend(hamlib_port_t *port,                      \
56                               rig_probe_func_t cfunc,                   \
57                               rig_ptr_t data))
58 
59 #define PREFIX_INITROTS initrots
60 #define PREFIX_PROBEROTS probeallrots
61 
62 #define DECLARE_INITROT_BACKEND(backend)                                \
63     EXTERN_C BACKEND_EXPORT(int)                                        \
64     MAKE_VERSIONED_FN(PREFIX_INITROTS, ABI_VERSION, backend(void *be_handle))
65 
66 #define DECLARE_PROBEROT_BACKEND(backend)               \
67     EXTERN_C BACKEND_EXPORT(rot_model_t)                \
68     MAKE_VERSIONED_FN(PREFIX_PROBEROTS,                 \
69                       ABI_VERSION,                      \
70                       backend(hamlib_port_t *port,      \
71                               rig_probe_func_t cfunc,   \
72                               rig_ptr_t data))
73 
74 #define PREFIX_INITAMPS initamps
75 #define PREFIX_PROBEAMPS probeallamps
76 
77 #define DECLARE_INITAMP_BACKEND(backend)                                \
78     EXTERN_C BACKEND_EXPORT(int)                                        \
79     MAKE_VERSIONED_FN(PREFIX_INITAMPS, ABI_VERSION, backend(void *be_handle))
80 
81 #define DECLARE_PROBEAMP_BACKEND(backend)               \
82     EXTERN_C BACKEND_EXPORT(amp_model_t)                \
83     MAKE_VERSIONED_FN(PREFIX_PROBEAMPS,                 \
84                       ABI_VERSION,                      \
85                       backend(hamlib_port_t *port,      \
86                               rig_probe_func_t cfunc,   \
87                               rig_ptr_t data))
88 
89 #endif  /* _REGISTER_H */
90