Hamlib 4.7~git
Loading...
Searching...
No Matches
register.h
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/config.h"
27
28#ifdef __cplusplus
29#define EXTERN_C extern "C"
30#else
31#define EXTERN_C extern
32#endif
33
34#define CONCAT4(w__, x__, y__, z__) w__ ## x__ ## y__ ## z__
35#define MAKE_VERSIONED_FN(prefix__, version__, name_args__) CONCAT4(prefix__, version__, _, name_args__)
36/* void MAKE_VERSIONED_FN(foo, 42, bar(int i)) -> void foo42_bar(int i) */
37
38#ifndef ABI_VERSION
39#error ABI_VERSION undefined! Did you include config.h?
40#endif
41
42#define PREFIX_INITRIG initrigs
43#define PREFIX_PROBERIG probeallrigs
44
45#define DECLARE_INITRIG_BACKEND(backend) \
46 EXTERN_C BACKEND_EXPORT(int) \
47 MAKE_VERSIONED_FN(PREFIX_INITRIG, ABI_VERSION, backend(void *be_handle))
48
49#define DECLARE_PROBERIG_BACKEND(backend) \
50 EXTERN_C BACKEND_EXPORT(rig_model_t) \
51 MAKE_VERSIONED_FN(PREFIX_PROBERIG, \
52 ABI_VERSION, \
53 backend(hamlib_port_t *port, \
54 rig_probe_func_t cfunc, \
55 rig_ptr_t data))
56
57#define PREFIX_INITROTS initrots
58#define PREFIX_PROBEROTS probeallrots
59
60#define DECLARE_INITROT_BACKEND(backend) \
61 EXTERN_C BACKEND_EXPORT(int) \
62 MAKE_VERSIONED_FN(PREFIX_INITROTS, ABI_VERSION, backend(void *be_handle))
63
64#define DECLARE_PROBEROT_BACKEND(backend) \
65 EXTERN_C BACKEND_EXPORT(rot_model_t) \
66 MAKE_VERSIONED_FN(PREFIX_PROBEROTS, \
67 ABI_VERSION, \
68 backend(hamlib_port_t *port, \
69 rig_probe_func_t cfunc, \
70 rig_ptr_t data))
71
72#define PREFIX_INITAMPS initamps
73#define PREFIX_PROBEAMPS probeallamps
74
75#define DECLARE_INITAMP_BACKEND(backend) \
76 EXTERN_C BACKEND_EXPORT(int) \
77 MAKE_VERSIONED_FN(PREFIX_INITAMPS, ABI_VERSION, backend(void *be_handle))
78
79#define DECLARE_PROBEAMP_BACKEND(backend) \
80 EXTERN_C BACKEND_EXPORT(amp_model_t) \
81 MAKE_VERSIONED_FN(PREFIX_PROBEAMPS, \
82 ABI_VERSION, \
83 backend(hamlib_port_t *port, \
84 rig_probe_func_t cfunc, \
85 rig_ptr_t data))
86
87#endif /* _REGISTER_H */
Hamlib rig data structures.