diff --git a/alinco/alinco.c b/alinco/alinco.c index d64d1710c..86f3fc650 100644 --- a/alinco/alinco.c +++ b/alinco/alinco.c @@ -2,7 +2,7 @@ * Hamlib Alinco backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: alinco.c,v 1.15 2003-04-07 22:41:44 fillods Exp $ + * $Id: alinco.c,v 1.16 2003-04-16 22:30:38 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,6 +33,7 @@ #include #include #include +#include #include "alinco.h" @@ -820,7 +821,7 @@ int alinco_get_mem(RIG *rig, vfo_t vfo, int *ch) /* * initrigs_alinco is called by rig_backend_load */ -int initrigs_alinco(void *be_handle) +DECLARE_INITRIG_BACKEND(alinco) { rig_debug(RIG_DEBUG_VERBOSE, "alinco: _init called\n"); diff --git a/alinco/alinco.h b/alinco/alinco.h index 915a5a136..419c6d09e 100644 --- a/alinco/alinco.h +++ b/alinco/alinco.h @@ -2,7 +2,7 @@ * Hamlib Alinco backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: alinco.h,v 1.11 2003-04-06 18:40:35 fillods Exp $ + * $Id: alinco.h,v 1.12 2003-04-16 22:30:38 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -56,8 +56,5 @@ int alinco_get_mem(RIG *rig, vfo_t vfo, int *ch); extern const struct rig_caps dx77_caps; -extern BACKEND_EXPORT(int) initrigs_alinco(void *be_handle); - - #endif /* _ALINCO_H */ diff --git a/aor/aor.c b/aor/aor.c index d77334e62..715f48da3 100644 --- a/aor/aor.c +++ b/aor/aor.c @@ -2,7 +2,7 @@ * Hamlib AOR backend - main file * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: aor.c,v 1.23 2003-04-07 22:41:44 fillods Exp $ + * $Id: aor.c,v 1.24 2003-04-16 22:30:38 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "aor.h" @@ -502,7 +503,7 @@ const char *aor_get_info(RIG *rig) /* * initrigs_aor is called by rig_backend_load */ -int initrigs_aor(void *be_handle) +DECLARE_INITRIG_BACKEND(aor) { rig_debug(RIG_DEBUG_VERBOSE, "aor: _init called\n"); diff --git a/aor/aor.h b/aor/aor.h index eb8bddda9..814f1d57e 100644 --- a/aor/aor.h +++ b/aor/aor.h @@ -2,7 +2,7 @@ * Hamlib AOR backend - main header * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: aor.h,v 1.13 2003-02-24 22:27:41 fillods Exp $ + * $Id: aor.h,v 1.14 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -47,8 +47,5 @@ extern const struct rig_caps ar8000_caps; extern const struct rig_caps ar5000_caps; extern const struct rig_caps ar3000a_caps; -extern BACKEND_EXPORT(int) initrigs_aor(void *be_handle); - - #endif /* _AOR_H */ diff --git a/configure.ac b/configure.ac index 8f99d7835..0b0ff2ced 100644 --- a/configure.ac +++ b/configure.ac @@ -7,12 +7,17 @@ AC_CONFIG_SRCDIR([include/hamlib/rig.h]) AM_CONFIG_HEADER(include/config.h) AM_MAINTAINER_MODE +ABI_VERSION=1 + # Minimum Autoconf version required. AC_PREREQ(2.50) dnl Pick up the Hamlib macros. AM_ACLOCAL_INCLUDE(macros) +AC_DEFINE_UNQUOTED(ABI_VERSION, $ABI_VERSION, [Frontend ABI version]) +AC_SUBST(ABI_VERSION) + dnl directory for docs (html) hamlibdocdir=$datadir/doc/hamlib AC_SUBST(hamlibdocdir) diff --git a/drake/drake.c b/drake/drake.c index 009fd5c12..e1db6fe83 100644 --- a/drake/drake.c +++ b/drake/drake.c @@ -2,7 +2,7 @@ * Hamlib Drake backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: drake.c,v 1.4 2003-04-07 22:41:56 fillods Exp $ + * $Id: drake.c,v 1.5 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "drake.h" @@ -205,7 +206,7 @@ const char *drake_get_info(RIG *rig) /* * initrigs_drake is called by rig_backend_load */ -int initrigs_drake(void *be_handle) +DECLARE_INITRIG_BACKEND(drake) { rig_debug(RIG_DEBUG_VERBOSE, "drake: _init called\n"); @@ -215,9 +216,9 @@ int initrigs_drake(void *be_handle) } /* - * probe_drake + * probe_drake(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ -rig_model_t probeallrigs_drake(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) +DECLARE_PROBERIG_BACKEND(drake) { static unsigned char idbuf[BUFSZ]; int retval, id_len; diff --git a/drake/drake.h b/drake/drake.h index 7cd143fbf..b3fcf2679 100644 --- a/drake/drake.h +++ b/drake/drake.h @@ -2,7 +2,7 @@ * Hamlib Drake backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: drake.h,v 1.3 2003-03-10 08:26:08 fillods Exp $ + * $Id: drake.h,v 1.4 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,9 +33,5 @@ const char *drake_get_info(RIG *rig); extern const struct rig_caps r8b_caps; -extern BACKEND_EXPORT(int) initrigs_drake(void *be_handle); -extern BACKEND_EXPORT(rig_model_t) probeallrigs_drake(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data); - - #endif /* _DRAKE_H */ diff --git a/dummy/dummy.c b/dummy/dummy.c index 4e6061e59..f12cd9cd9 100644 --- a/dummy/dummy.c +++ b/dummy/dummy.c @@ -2,7 +2,7 @@ * Hamlib Dummy backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: dummy.c,v 1.33 2003-04-07 22:41:46 fillods Exp $ + * $Id: dummy.c,v 1.34 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -34,6 +34,7 @@ #include "misc.h" #include "tones.h" #include "idx_builtin.h" +#include "register.h" #include "dummy.h" @@ -1136,7 +1137,7 @@ const struct rig_caps dummy_caps = { .get_trn = dummy_get_trn, }; -int initrigs_dummy(void *be_handle) +DECLARE_INITRIG_BACKEND(dummy) { rig_debug(RIG_DEBUG_VERBOSE, "dummy: _init called\n"); diff --git a/dummy/dummy.h b/dummy/dummy.h index ee10f7283..b54ec86a1 100644 --- a/dummy/dummy.h +++ b/dummy/dummy.h @@ -2,7 +2,7 @@ * Hamlib Dummy backend - main header * Copyright (c) 2001,2002 by Stephane Fillod * - * $Id: dummy.h,v 1.5 2001-12-28 20:28:03 fillods Exp $ + * $Id: dummy.h,v 1.6 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -26,6 +26,4 @@ extern const struct rig_caps dummy_caps; -extern BACKEND_EXPORT(int) initrigs_dummy(void *be_handle); - #endif /* _DUMMY_H */ diff --git a/dummy/rot_dummy.c b/dummy/rot_dummy.c index 3fcaeaa0b..89662fdb3 100644 --- a/dummy/rot_dummy.c +++ b/dummy/rot_dummy.c @@ -2,7 +2,7 @@ * Hamlib Dummy backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: rot_dummy.c,v 1.5 2003-04-07 22:41:47 fillods Exp $ + * $Id: rot_dummy.c,v 1.6 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "rot_dummy.h" @@ -187,7 +188,7 @@ const struct rot_caps dummy_rot_caps = { .get_info = dummy_rot_get_info, }; -int initrots_dummy(void *be_handle) +DECLARE_INITROT_BACKEND(dummy) { rig_debug(RIG_DEBUG_VERBOSE, "dummy: _init called\n"); diff --git a/dummy/rot_dummy.h b/dummy/rot_dummy.h index 314179f2a..46a078bdd 100644 --- a/dummy/rot_dummy.h +++ b/dummy/rot_dummy.h @@ -2,7 +2,7 @@ * Hamlib Dummy backend - main header * Copyright (c) 2001,2002 by Stephane Fillod * - * $Id: rot_dummy.h,v 1.1 2001-12-28 20:29:33 fillods Exp $ + * $Id: rot_dummy.h,v 1.2 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -26,6 +26,4 @@ extern const struct rot_caps dummy_rot_caps; -extern BACKEND_EXPORT(int) initrots_dummy(void *be_handle); - #endif /* _ROT_DUMMY_H */ diff --git a/easycomm/easycomm.c b/easycomm/easycomm.c index 96f00b66e..4f80c516b 100644 --- a/easycomm/easycomm.c +++ b/easycomm/easycomm.c @@ -3,7 +3,7 @@ * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief * - * $Id: easycomm.c,v 1.4 2003-04-07 22:41:48 fillods Exp $ + * $Id: easycomm.c,v 1.5 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,6 +33,7 @@ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "easycomm.h" @@ -315,7 +316,7 @@ const struct rot_caps easycomm2_rot_caps = { /* ************************************************************************* */ -int initrots_easycomm(void *be_handle) +DECLARE_INITROT_BACKEND(easycomm) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); diff --git a/easycomm/easycomm.h b/easycomm/easycomm.h index ba9f83f04..ea9e67b9d 100644 --- a/easycomm/easycomm.h +++ b/easycomm/easycomm.h @@ -1,9 +1,9 @@ /* * Hamlib Rotator backend - Easycomm interface protocol - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief * - * $Id: easycomm.h,v 1.1 2002-01-16 16:35:22 fgretief Exp $ + * $Id: easycomm.h,v 1.2 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -27,6 +27,4 @@ extern const struct rot_caps easycomm1_rot_caps; extern const struct rot_caps easycomm2_rot_caps; -extern BACKEND_EXPORT(int) initrots_easycomm(void *be_handle); - #endif /* _ROT_EASYCOMM_H */ diff --git a/fodtrack/fodtrack.c b/fodtrack/fodtrack.c index 257545d49..306200349 100644 --- a/fodtrack/fodtrack.c +++ b/fodtrack/fodtrack.c @@ -2,7 +2,7 @@ * Hamlib Rotator backend - Fodtrack parallel port * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: fodtrack.c,v 1.2 2003-04-07 22:41:49 fillods Exp $ + * $Id: fodtrack.c,v 1.3 2003-04-16 22:30:39 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -42,6 +42,7 @@ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "fodtrack.h" @@ -136,7 +137,7 @@ const struct rot_caps fodtrack_rot_caps = { /* ************************************************************************* */ -int initrots_fodtrack(void *be_handle) +DECLARE_INITROT_BACKEND(fodtrack) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); diff --git a/fodtrack/fodtrack.h b/fodtrack/fodtrack.h index 2aa527cb1..939fcc0d1 100644 --- a/fodtrack/fodtrack.h +++ b/fodtrack/fodtrack.h @@ -1,8 +1,8 @@ /* * Hamlib Rotator backend - Fodtrack interface protocol - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: fodtrack.h,v 1.1 2002-11-28 22:24:10 fillods Exp $ + * $Id: fodtrack.h,v 1.2 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -25,6 +25,4 @@ extern const struct rot_caps fodtrack_rot_caps; -extern BACKEND_EXPORT(int) initrots_fodtrack(void *be_handle); - #endif /* _ROT_FODTRACK_H */ diff --git a/gnuradio/gnuradio.h b/gnuradio/gnuradio.h index 31dc79167..552197f52 100644 --- a/gnuradio/gnuradio.h +++ b/gnuradio/gnuradio.h @@ -2,7 +2,7 @@ * Hamlib GNUradio backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: gnuradio.h,v 1.3 2003-04-06 18:50:21 fillods Exp $ + * $Id: gnuradio.h,v 1.4 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -65,8 +65,6 @@ extern const struct rig_caps gr_caps; extern const struct rig_caps mc4020_caps; extern const struct rig_caps graudio_caps; -extern BACKEND_EXPORT(int) initrigs_gnuradio(void *be_handle); - __END_DECLS #endif /* _GNURADIO_H */ diff --git a/icom/icom.c b/icom/icom.c index 52cea8179..b1f753e48 100644 --- a/icom/icom.c +++ b/icom/icom.c @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main file * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: icom.c,v 1.74 2003-04-07 22:41:50 fillods Exp $ + * $Id: icom.c,v 1.75 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -34,6 +34,7 @@ #include #include #include +#include #include "icom.h" #include "icom_defs.h" @@ -2383,9 +2384,10 @@ int icom_decode_event(RIG *rig) * init_icom is called by rig_probe_all (register.c) * * probe_icom reports all the devices on the CI-V bus. - * TODO: try different speeds + * + * rig_model_t probeallrigs_icom(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ -rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) +DECLARE_PROBERIG_BACKEND(icom) { unsigned char buf[MAXFRAMELEN], civ_addr, civ_id; int frm_len, i; @@ -2394,23 +2396,23 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) int rates[] = { 19200, 9600, 300, 0 }; int rates_idx; - if (!p) + if (!port) return RIG_MODEL_NONE; - if (p->type.rig != RIG_PORT_SERIAL) + if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; - p->write_delay = p->post_write_delay = 0; - p->retry = 1; + port->write_delay = port->post_write_delay = 0; + port->retry = 1; /* * try for all different baud rates */ for (rates_idx = 0; rates[rates_idx]; rates_idx++) { - p->parm.serial.rate = rates[rates_idx]; - p->timeout = 2*1000/rates[rates_idx] + 40; + port->parm.serial.rate = rates[rates_idx]; + port->timeout = 2*1000/rates[rates_idx] + 40; - retval = serial_open(p); + retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; @@ -2426,16 +2428,16 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) frm_len = make_cmd_frame(buf, civ_addr, C_RD_TRXID, S_RD_TRXID, NULL, 0); - serial_flush(p); - write_block(p, buf, frm_len); + serial_flush(port); + write_block(port, buf, frm_len); /* read out the bytes we just sent * TODO: check this is what we expect */ - frm_len = read_icom_frame(p, buf); + frm_len = read_icom_frame(port, buf); /* this is the reply */ - frm_len = read_icom_frame(p, buf); + frm_len = read_icom_frame(port, buf); /* timeout.. nobody's there */ if (frm_len <= 0) @@ -2445,7 +2447,7 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) /* protocol error, unexpected reply. * is this a CI-V device? */ - close(p->fd); + close(port->fd); return RIG_MODEL_NONE; } else if (buf[4] == NAK) { /* @@ -2463,7 +2465,7 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) " at %#x\n", civ_id, buf[3]); model = icom_addr_list[i].model; if (cfunc) - (*cfunc)(p, model, data); + (*cfunc)(port, model, data); break; } } @@ -2476,7 +2478,7 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) "with CI-V ID %#x, please report to Hamlib " "developers.\n", civ_id); } - close(p->fd); + close(port->fd); /* * Assumes all the rigs on the bus are running at same speed. @@ -2492,7 +2494,7 @@ rig_model_t probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data) /* * initrigs_icom is called by rig_backend_load */ -int initrigs_icom(void *be_handle) +DECLARE_INITRIG_BACKEND(icom) { rig_debug(RIG_DEBUG_VERBOSE, "icom: _init called\n"); diff --git a/icom/icom.h b/icom/icom.h index c537bfb1f..05b0b7b69 100644 --- a/icom/icom.h +++ b/icom/icom.h @@ -2,7 +2,7 @@ * Hamlib CI-V backend - main header * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: icom.h,v 1.55 2003-04-09 06:37:37 fillods Exp $ + * $Id: icom.h,v 1.56 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -171,9 +171,6 @@ extern const struct rig_caps os535_caps; extern const struct rig_caps omnivip_caps; -extern BACKEND_EXPORT(rig_model_t) probeallrigs_icom(port_t *p, rig_probe_func_t cfunc, rig_ptr_t data); -extern BACKEND_EXPORT(int) initrigs_icom(void *be_handle); - #endif /* _ICOM_H */ diff --git a/jrc/jrc.c b/jrc/jrc.c index 752d37bbd..c9daf3c6c 100644 --- a/jrc/jrc.c +++ b/jrc/jrc.c @@ -2,7 +2,7 @@ * Hamlib JRC backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: jrc.c,v 1.7 2003-04-07 22:41:52 fillods Exp $ + * $Id: jrc.c,v 1.8 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "serial.h" #include "misc.h" #include "cal.h" +#include "register.h" #include "jrc.h" @@ -856,7 +857,7 @@ int jrc_decode_event(RIG *rig) /* * initrigs_jrc is called by rig_backend_load */ -int initrigs_jrc(void *be_handle) +DECLARE_INITRIG_BACKEND(jrc) { rig_debug(RIG_DEBUG_VERBOSE, "jrc: _init called\n"); diff --git a/jrc/jrc.h b/jrc/jrc.h index 6b612a58d..5968b351d 100644 --- a/jrc/jrc.h +++ b/jrc/jrc.h @@ -1,8 +1,8 @@ /* * Hamlib JRC backend - main header - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: jrc.h,v 1.4 2001-12-28 20:28:03 fillods Exp $ + * $Id: jrc.h,v 1.5 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -52,8 +52,6 @@ int jrc_decode_event(RIG *rig); extern const struct rig_caps nrd545_caps; -extern BACKEND_EXPORT(int) initrigs_jrc(void *be_handle); - #endif /* _JRC_H */ diff --git a/kachina/kachina.c b/kachina/kachina.c index 819a8b928..6b4b915e5 100644 --- a/kachina/kachina.c +++ b/kachina/kachina.c @@ -2,7 +2,7 @@ * Hamlib Kachina backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: kachina.c,v 1.5 2003-04-07 22:41:52 fillods Exp $ + * $Id: kachina.c,v 1.6 2003-04-16 22:30:40 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -33,6 +33,7 @@ #include "serial.h" #include "misc.h" #include "cal.h" +#include "register.h" #include "kachina.h" @@ -205,7 +206,7 @@ int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) /* * initrigs_kachina is called by rig_backend_load */ -int initrigs_kachina(void *be_handle) +DECLARE_INITRIG_BACKEND(kachina) { rig_debug(RIG_DEBUG_VERBOSE, "kachina: _init called\n"); diff --git a/kachina/kachina.h b/kachina/kachina.h index 2c42714ec..be8c5801a 100644 --- a/kachina/kachina.h +++ b/kachina/kachina.h @@ -1,8 +1,8 @@ /* * Hamlib Kachina backend - main header - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: kachina.h,v 1.3 2001-12-28 20:28:03 fillods Exp $ + * $Id: kachina.h,v 1.4 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -36,8 +36,6 @@ int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); extern const struct rig_caps k505dsp_caps; -extern BACKEND_EXPORT(int) initrigs_kachina(void *be_handle); - #endif /* _KACHINA_H */ diff --git a/kenwood/kenwood.c b/kenwood/kenwood.c index e100d8842..a7d78a1df 100644 --- a/kenwood/kenwood.c +++ b/kenwood/kenwood.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - main file * Copyright (c) 2000-2003 by Stephane Fillod and others * - * $Id: kenwood.c,v 1.60 2003-04-07 22:41:53 fillods Exp $ + * $Id: kenwood.c,v 1.61 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "kenwood.h" @@ -1311,8 +1312,10 @@ const char* kenwood_get_info(RIG *rig) * * Notes: * There's only one rig possible per port. + * + * rig_model_t probeallrigs_kenwood(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ -rig_model_t probeallrigs_kenwood(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) +DECLARE_PROBERIG_BACKEND(kenwood) { unsigned char idbuf[IDBUFSZ]; int id_len=-1, i, k_id; @@ -1478,7 +1481,7 @@ int kenwood_cleanup(RIG *rig) /* * initrigs_kenwood is called by rig_backend_load */ -int initrigs_kenwood(void *be_handle) +DECLARE_INITRIG_BACKEND(kenwood) { rig_debug(RIG_DEBUG_VERBOSE, "kenwood: _init called\n"); diff --git a/kenwood/kenwood.h b/kenwood/kenwood.h index 81345339d..24a104524 100644 --- a/kenwood/kenwood.h +++ b/kenwood/kenwood.h @@ -1,8 +1,8 @@ /* * Hamlib Kenwood backend - main header - * Copyright (c) 2000-2002 by Stephane Fillod + * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: kenwood.h,v 1.28 2003-03-15 23:58:41 fillods Exp $ + * $Id: kenwood.h,v 1.29 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -96,9 +96,6 @@ extern const struct rig_caps thf7a_caps; extern const struct rig_caps thf7e_caps; extern const struct rig_caps k2_caps; -extern BACKEND_EXPORT(int) initrigs_kenwood(void *be_handle); -extern BACKEND_EXPORT(rig_model_t) probeallrigs_kenwood(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data); - #endif /* _KENWOOD_H */ diff --git a/microtune/microtune.h b/microtune/microtune.h index 964763f9b..d52c4c3dd 100644 --- a/microtune/microtune.h +++ b/microtune/microtune.h @@ -1,8 +1,8 @@ /* * Hamlib Microtune backend - main header - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: microtune.h,v 1.1 2003-01-29 23:06:30 fillods Exp $ + * $Id: microtune.h,v 1.2 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,6 @@ int module_4937_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int module_4937_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); extern const struct rig_caps module_4937_caps; -extern BACKEND_EXPORT(int) initrigs_microtune(void *be_handle); __END_DECLS diff --git a/microtune/module_4937.c b/microtune/module_4937.c index 3b4f26176..38a71e4b8 100644 --- a/microtune/module_4937.c +++ b/microtune/module_4937.c @@ -2,7 +2,7 @@ * Hamlib microtune backend - 4937 file * Copyright (c) 2003 by Stephane Fillod * - * $Id: module_4937.c,v 1.1 2003-01-29 23:06:30 fillods Exp $ + * $Id: module_4937.c,v 1.2 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include +#include "register.h" #include "microtune.h" /* @@ -93,7 +94,7 @@ const struct rig_caps module_4937_caps = { }; -int initrigs_microtune(void *be_handle) +DECLARE_INITRIG_BACKEND(microtune) { rig_debug(RIG_DEBUG_VERBOSE, "microtune: _init called\n"); diff --git a/pcr/pcr.c b/pcr/pcr.c index 77aca2911..1e4e279e6 100644 --- a/pcr/pcr.c +++ b/pcr/pcr.c @@ -2,7 +2,7 @@ * Hamlib PCR backend - main file * Copyright (c) 2001-2003 by Stephane Fillod and Darren Hatcher * - * $Id: pcr.c,v 1.17 2003-04-07 22:41:55 fillods Exp $ + * $Id: pcr.c,v 1.18 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -32,6 +32,7 @@ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "pcr.h" @@ -1380,7 +1381,7 @@ int pcr_set_VSC(RIG *rig, int level) // J50xx /* * initrigs_pcr is called by rig_backend_load */ -int initrigs_pcr(void *be_handle) +DECLARE_INITRIG_BACKEND(pcr) { rig_debug(RIG_DEBUG_VERBOSE, "pcr: _init called\n"); diff --git a/pcr/pcr.h b/pcr/pcr.h index 4e83bcbf9..1845125d1 100644 --- a/pcr/pcr.h +++ b/pcr/pcr.h @@ -1,8 +1,8 @@ /* * Hamlib PCR backend - main header - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: pcr.h,v 1.8 2002-08-26 22:33:52 fillods Exp $ + * $Id: pcr.h,v 1.9 2003-04-16 22:30:41 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -76,8 +76,6 @@ int pcr_set_DSP_auto_notch(RIG *rig, int state); // J83xx extern const struct rig_caps pcr1000_caps; extern const struct rig_caps pcr100_caps; -extern BACKEND_EXPORT(int) initrigs_pcr(void *be_handle); - #endif /* _PCR_H */ diff --git a/rotorez/rotorez.c b/rotorez/rotorez.c index ab26de825..c687d4907 100644 --- a/rotorez/rotorez.c +++ b/rotorez/rotorez.c @@ -12,7 +12,7 @@ * Hy-Gain is a trademark of MFJ Enterprises * * - * $Id: rotorez.c,v 1.6 2003-04-07 22:41:55 fillods Exp $ + * $Id: rotorez.c,v 1.7 2003-04-16 22:30:41 fillods Exp $ * * * This library is free software; you can redistribute it and/or @@ -42,6 +42,7 @@ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" +#include "register.h" #include "rotorez.h" @@ -410,7 +411,8 @@ static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr) { * Initialize backend */ -int initrots_rotorez(void *be_handle) { +DECLARE_INITROT_BACKEND(rotorez) +{ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot_register(&rotorez_rot_caps); diff --git a/rotorez/rotorez.h b/rotorez/rotorez.h index 897bb1a8c..90021966f 100644 --- a/rotorez/rotorez.h +++ b/rotorez/rotorez.h @@ -9,7 +9,7 @@ * supports the Hy-Gain DCU-1. * * - * $Id: rotorez.h,v 1.4 2003-02-27 03:50:03 n0nb Exp $ + * $Id: rotorez.h,v 1.5 2003-04-16 22:30:41 fillods Exp $ * * * This library is free software; you can redistribute it and/or @@ -37,8 +37,6 @@ extern const struct rot_caps rotorez_rot_caps; extern const struct rot_caps rotorcard_rot_caps; extern const struct rot_caps dcu_rot_caps; -extern BACKEND_EXPORT(int) initrots_rotorez(void *be_handle); - /* * API local implementation * diff --git a/rpcrig/rpcrig_backend.c b/rpcrig/rpcrig_backend.c index 1c2b454e6..4f99a09ba 100644 --- a/rpcrig/rpcrig_backend.c +++ b/rpcrig/rpcrig_backend.c @@ -2,7 +2,7 @@ * Hamlib RPC backend - main file * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: rpcrig_backend.c,v 1.13 2003-04-07 22:41:56 fillods Exp $ + * $Id: rpcrig_backend.c,v 1.14 2003-04-16 22:30:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -35,6 +35,7 @@ #include "serial.h" #include "misc.h" #include "token.h" +#include "register.h" #include #ifdef HAVE_RPC_RPCENT_H @@ -1099,7 +1100,7 @@ struct rig_caps rpcrig_caps = { .reset = rpcrig_reset, }; -int initrigs_rpcrig(void *be_handle) +DECLARE_INITRIG_BACKEND(rpcrig) { rig_debug(RIG_DEBUG_VERBOSE, "rpcrig: _init called\n"); diff --git a/rpcrig/rpcrig_backend.h b/rpcrig/rpcrig_backend.h index f7e444ae4..dc79683e7 100644 --- a/rpcrig/rpcrig_backend.h +++ b/rpcrig/rpcrig_backend.h @@ -1,8 +1,8 @@ /* * Hamlib RPC backend - main header - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * - * $Id: rpcrig_backend.h,v 1.4 2001-12-28 20:28:03 fillods Exp $ + * $Id: rpcrig_backend.h,v 1.5 2003-04-16 22:30:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -26,6 +26,4 @@ extern struct rig_caps rpcrig_caps; -extern BACKEND_EXPORT(int) initrigs_rpcrig(void *be_handle); - #endif /* _RPCRIG_H */ diff --git a/rpcrot/rpcrot_backend.c b/rpcrot/rpcrot_backend.c index 815a4ae45..f2d07f93a 100644 --- a/rpcrot/rpcrot_backend.c +++ b/rpcrot/rpcrot_backend.c @@ -1,9 +1,9 @@ /* * Hamlib RPC backend - main file - * Copyright (c) 2001,2002 by Stephane Fillod + * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief * - * $Id: rpcrot_backend.c,v 1.6 2003-04-07 22:41:56 fillods Exp $ + * $Id: rpcrot_backend.c,v 1.7 2003-04-16 22:30:42 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -36,6 +36,7 @@ #include "serial.h" #include "misc.h" #include "token.h" +#include "register.h" #include #ifdef HAVE_RPC_RPCENT_H @@ -400,7 +401,7 @@ struct rot_caps rpcrot_caps = { /* ************************************************************************* */ -int initrots_rpcrot(void *be_handle) +DECLARE_INITROT_BACKEND(rpcrot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); diff --git a/src/Makefile.am b/src/Makefile.am index 4148adc68..73739a8f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,10 +5,10 @@ RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \ lib_LTLIBRARIES = libhamlib.la libhamlib_la_SOURCES = $(RIGSRC) -libhamlib_la_LDFLAGS = -no-undefined -release @VERSION@ -version-info 1:0:0 +libhamlib_la_LDFLAGS = -no-undefined -release @VERSION@ -version-info @ABI_VERSION@:0:0 libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(libdir)\" libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la @MATH_LIBS@ noinst_HEADERS = event.h misc.h serial.h iofunc.h cal.h tones.h \ - rot_conf.h token.h idx_builtin.h + rot_conf.h token.h idx_builtin.h register.h diff --git a/src/register.c b/src/register.c index 4b6522129..7489e51ca 100644 --- a/src/register.c +++ b/src/register.c @@ -2,7 +2,7 @@ * Hamlib Interface - provides registering for dynamically loadable backends. * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: register.c,v 1.19 2003-04-06 18:34:15 fillods Exp $ + * $Id: register.c,v 1.20 2003-04-16 22:30:38 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -282,23 +282,14 @@ int rig_load_all_backends() */ int rig_load_backend(const char *be_name) { - /* - * determine PREFIX and POSTFIX values from configure script - */ -#ifdef __CYGWIN__ -# define PREFIX "cyghamlib-" -# define POSTFIX ".dll" -#else # define PREFIX "hamlib-" -# define POSTFIX ".la" -#endif lt_dlhandle be_handle; int (*be_init)(rig_ptr_t); int status; char libname[PATH_MAX]; - char initfname[MAXFUNCNAMELEN] = "initrigs_"; - char probefname[MAXFUNCNAMELEN] = "probeallrigs_"; + char initfname[MAXFUNCNAMELEN]; + char probefname[MAXFUNCNAMELEN]; int i; /* @@ -345,7 +336,7 @@ int rig_load_backend(const char *be_name) return -RIG_EINVAL; } - strncat(initfname, be_name, MAXFUNCNAMELEN); + snprintf(initfname, MAXFUNCNAMELEN, "initrigs%d_%s", ABI_VERSION, be_name); be_init = (int (*)(rig_ptr_t)) lt_dlsym (be_handle, initfname); if (!be_init) { rig_debug(RIG_DEBUG_ERR, "rig: dlsym(%s) failed (%s)\n", @@ -362,7 +353,7 @@ int rig_load_backend(const char *be_name) */ for (i=0; i +#include + +#ifdef DECLARE_INITRIG_BACKEND +#undef DECLARE_INITRIG_BACKEND +#endif +#define DECLARE_INITRIG_BACKEND(backend) extern BACKEND_EXPORT(int) initrigs1_##backend(void *be_handle) + +#ifdef DECLARE_PROBERIG_BACKEND +#undef DECLARE_PROBERIG_BACKEND +#endif +#define DECLARE_PROBERIG_BACKEND(backend) extern BACKEND_EXPORT(rig_model_t) probeallrigs1_##backend(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) + +#ifdef DECLARE_INITROT_BACKEND +#undef DECLARE_INITROT_BACKEND +#endif +#define DECLARE_INITROT_BACKEND(backend) extern BACKEND_EXPORT(int) initrots1_##backend(void *be_handle) + +#ifdef DECLARE_PROBEROT_BACKEND +#undef DECLARE_PROBEROT_BACKEND +#endif +#define DECLARE_PROBEROT_BACKEND(backend) extern BACKEND_EXPORT(rot_model_t) probeallrots1_##backend(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) + diff --git a/src/rot_reg.c b/src/rot_reg.c index a70cf00cb..f4e517c39 100644 --- a/src/rot_reg.c +++ b/src/rot_reg.c @@ -1,8 +1,8 @@ /* * Hamlib Interface - provides registering for dynamically loadable backends. - * Copyright (c) 2000,2001,2002 by Stephane Fillod + * Copyright (c) 2000-2003 by Stephane Fillod * - * $Id: rot_reg.c,v 1.5 2002-11-04 22:27:49 fillods Exp $ + * $Id: rot_reg.c,v 1.6 2003-04-16 22:30:38 fillods Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -259,23 +259,14 @@ int rot_load_all_backends() */ int rot_load_backend(const char *be_name) { - /* - * determine PREFIX and POSTFIX values from configure script - */ -#ifdef __CYGWIN__ -# define PREFIX "cyghamlib-" -# define POSTFIX ".dll" -#else # define PREFIX "hamlib-" -# define POSTFIX ".la" -#endif lt_dlhandle be_handle; int (*be_init)(rig_ptr_t); int status; char libname[PATH_MAX]; - char initfname[MAXFUNCNAMELEN] = "initrots_"; - char probefname[MAXFUNCNAMELEN] = "proberots_"; + char initfname[MAXFUNCNAMELEN]; + char probefname[MAXFUNCNAMELEN]; int i; /* @@ -320,7 +311,7 @@ int rot_load_backend(const char *be_name) return -RIG_EINVAL; } - strncat(initfname, be_name, MAXFUNCNAMELEN); + snprintf(initfname, MAXFUNCNAMELEN, "initrots%d_%s", ABI_VERSION, be_name); be_init = (int (*)(rig_ptr_t)) lt_dlsym (be_handle, initfname); if (!be_init) { rot_debug(RIG_DEBUG_ERR, "rot: dlsym(%s) failed (%s)\n", @@ -337,7 +328,7 @@ int rot_load_backend(const char *be_name) */ for (i=0; i