More sed -i with manual fixups.

This leaves rigs/dummy/ to finish, then the biggies - rigs/icom & rigs/yaesu
pull/1562/head
George Baltz N3GB 2024-06-04 14:10:57 -04:00
rodzic d17290b835
commit 5b84c02b80
9 zmienionych plików z 112 dodań i 112 usunięć

Wyświetl plik

@ -50,7 +50,7 @@ struct quisk_priv_data
int quisk_get_vfo_mode(RIG *rig) int quisk_get_vfo_mode(RIG *rig)
{ {
struct quisk_priv_data *priv; struct quisk_priv_data *priv;
priv = (struct quisk_priv_data *)rig->state.priv; priv = (struct quisk_priv_data *)STATE(rig)->priv;
return priv->rigctld_vfo_mode; return priv->rigctld_vfo_mode;
} }
#endif #endif
@ -109,7 +109,7 @@ static int quisk_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
vfostr[0] = 0; vfostr[0] = 0;
priv = (struct quisk_priv_data *)rig->state.priv; priv = (struct quisk_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
@ -122,9 +122,9 @@ static int quisk_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
else if (vfo == RIG_VFO_RX) { vfo = priv->rx_vfo; } else if (vfo == RIG_VFO_RX) { vfo = priv->rx_vfo; }
else if (vfo == RIG_VFO_TX) { vfo = priv->tx_vfo; } else if (vfo == RIG_VFO_TX) { vfo = priv->tx_vfo; }
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt); rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, STATE(rig)->vfo_opt);
if (rig->state.vfo_opt || priv->rigctld_vfo_mode) if (STATE(rig)->vfo_opt || priv->rigctld_vfo_mode)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt vfo=%u\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt vfo=%u\n", __func__, vfo);
char *myvfo; char *myvfo;
@ -168,15 +168,15 @@ static int quisk_init(RIG *rig)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
rig->state.priv = (struct quisk_priv_data *)calloc(1, sizeof( STATE(rig)->priv = (struct quisk_priv_data *)calloc(1, sizeof(
struct quisk_priv_data)); struct quisk_priv_data));
if (!rig->state.priv) if (!STATE(rig)->priv)
{ {
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
priv = rig->state.priv; priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct quisk_priv_data)); memset(priv, 0, sizeof(struct quisk_priv_data));
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version); rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
@ -193,9 +193,9 @@ static int quisk_init(RIG *rig)
static int quisk_cleanup(RIG *rig) static int quisk_cleanup(RIG *rig)
{ {
if (rig->state.priv) { free(rig->state.priv); } if (STATE(rig)->priv) { free(STATE(rig)->priv); }
rig->state.priv = NULL; STATE(rig)->priv = NULL;
return RIG_OK; return RIG_OK;
} }
@ -208,7 +208,7 @@ extern int parse_array_double(const char *s, const char *delim, double *array,
static int quisk_open(RIG *rig) static int quisk_open(RIG *rig)
{ {
int ret, i; int ret, i;
struct rig_state *rs = &rig->state; struct rig_state *rs = STATE(rig);
int prot_ver; int prot_ver;
char cmd[CMD_MAX]; char cmd[CMD_MAX];
char buf[BUF_MAX]; char buf[BUF_MAX];
@ -218,7 +218,7 @@ static int quisk_open(RIG *rig)
ENTERFUNC; ENTERFUNC;
priv = (struct quisk_priv_data *)rig->state.priv; priv = (struct quisk_priv_data *)rs->priv;
priv->rx_vfo = RIG_VFO_A; priv->rx_vfo = RIG_VFO_A;
priv->tx_vfo = RIG_VFO_A; priv->tx_vfo = RIG_VFO_A;
@ -850,7 +850,7 @@ static int quisk_open(RIG *rig)
static int quisk_close(RIG *rig) static int quisk_close(RIG *rig)
{ {
const struct rig_state *rs = &rig->state; const struct rig_state *rs = STATE(rig);
int ret; int ret;
char buf[BUF_MAX]; char buf[BUF_MAX];
@ -1035,7 +1035,7 @@ static int quisk_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct quisk_priv_data *)rig->state.priv; priv = (struct quisk_priv_data *)STATE(rig)->priv;
SNPRINTF(cmd, sizeof(cmd), "V%s %s\n", vfostr, rig_strvfo(vfo)); SNPRINTF(cmd, sizeof(cmd), "V%s %s\n", vfostr, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd); rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd);
@ -1047,7 +1047,7 @@ static int quisk_set_vfo(RIG *rig, vfo_t vfo)
} }
priv->vfo_curr = vfo; // remember our vfo priv->vfo_curr = vfo; // remember our vfo
rig->state.current_vfo = vfo; STATE(rig)->current_vfo = vfo;
return ret; return ret;
} }
@ -1061,7 +1061,7 @@ static int quisk_get_vfo(RIG *rig, vfo_t *vfo)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct quisk_priv_data *)rig->state.priv; priv = (struct quisk_priv_data *)STATE(rig)->priv;
SNPRINTF(cmd, sizeof(cmd), "v\n"); SNPRINTF(cmd, sizeof(cmd), "v\n");
@ -2582,7 +2582,7 @@ static int quisk_set_vfo_opt(RIG *rig, int status)
return -RIG_EPROTO; return -RIG_EPROTO;
} }
rig->state.vfo_opt = status; STATE(rig)->vfo_opt = status;
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -274,15 +274,15 @@ static int sdrsharp_init(RIG *rig)
ENTERFUNC; ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version); rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, rig->caps->version);
rig->state.priv = (struct sdrsharp_priv_data *)calloc(1, sizeof( STATE(rig)->priv = (struct sdrsharp_priv_data *)calloc(1, sizeof(
struct sdrsharp_priv_data)); struct sdrsharp_priv_data));
if (!rig->state.priv) if (!STATE(rig)->priv)
{ {
RETURNFUNC(-RIG_ENOMEM); RETURNFUNC(-RIG_ENOMEM);
} }
priv = rig->state.priv; priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct sdrsharp_priv_data)); memset(priv, 0, sizeof(struct sdrsharp_priv_data));
memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t)); memset(priv->parms, 0, RIG_SETTING_MAX * sizeof(value_t));
@ -290,7 +290,7 @@ static int sdrsharp_init(RIG *rig)
/* /*
* set arbitrary initial status * set arbitrary initial status
*/ */
rig->state.current_vfo = RIG_VFO_A; STATE(rig)->current_vfo = RIG_VFO_A;
priv->split = 0; priv->split = 0;
priv->ptt = 0; priv->ptt = 0;
priv->curr_modeA = -1; priv->curr_modeA = -1;
@ -310,12 +310,12 @@ static int sdrsharp_init(RIG *rig)
/* /*
* sdrsharp_get_freq * sdrsharp_get_freq
* Assumes rig!=NULL, rig->state.priv!=NULL, freq!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL, freq!=NULL
*/ */
static int sdrsharp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) static int sdrsharp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
char value[MAXARGLEN]; char value[MAXARGLEN];
struct sdrsharp_priv_data *priv = (struct sdrsharp_priv_data *) rig->state.priv; struct sdrsharp_priv_data *priv = (struct sdrsharp_priv_data *) STATE(rig)->priv;
ENTERFUNC; ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
@ -331,7 +331,7 @@ static int sdrsharp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = rig->state.current_vfo; vfo = STATE(rig)->current_vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: get_freq2 vfo=%s\n", rig_debug(RIG_DEBUG_TRACE, "%s: get_freq2 vfo=%s\n",
__func__, rig_strvfo(vfo)); __func__, rig_strvfo(vfo));
} }
@ -377,7 +377,7 @@ static int sdrsharp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* /*
* sdrsharp_open * sdrsharp_open
* Assumes rig!=NULL, rig->state.priv!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int sdrsharp_open(RIG *rig) static int sdrsharp_open(RIG *rig)
{ {
@ -397,9 +397,9 @@ static int sdrsharp_open(RIG *rig)
RETURNFUNC(RIG_EPROTO); RETURNFUNC(RIG_EPROTO);
} }
rig->state.current_vfo = RIG_VFO_A; STATE(rig)->current_vfo = RIG_VFO_A;
rig_debug(RIG_DEBUG_TRACE, "%s: currvfo=%s value=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: currvfo=%s value=%s\n", __func__,
rig_strvfo(rig->state.current_vfo), value); rig_strvfo(STATE(rig)->current_vfo), value);
RETURNFUNC(retval); RETURNFUNC(retval);
} }
@ -417,7 +417,7 @@ static int sdrsharp_close(RIG *rig)
/* /*
* sdrsharp_cleanup * sdrsharp_cleanup
* Assumes rig!=NULL, rig->state.priv!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int sdrsharp_cleanup(RIG *rig) static int sdrsharp_cleanup(RIG *rig)
{ {
@ -430,12 +430,12 @@ static int sdrsharp_cleanup(RIG *rig)
RETURNFUNC2(-RIG_EINVAL); RETURNFUNC2(-RIG_EINVAL);
} }
priv = (struct sdrsharp_priv_data *)rig->state.priv; priv = (struct sdrsharp_priv_data *)STATE(rig)->priv;
free(priv->ext_parms); free(priv->ext_parms);
free(rig->state.priv); free(STATE(rig)->priv);
rig->state.priv = NULL; STATE(rig)->priv = NULL;
// we really don't need to free this up as it's only done once // we really don't need to free this up as it's only done once
// was causing problem when cleanup was followed by rig_open // was causing problem when cleanup was followed by rig_open
@ -463,7 +463,7 @@ static int sdrsharp_cleanup(RIG *rig)
/* /*
* sdrsharp_set_freq * sdrsharp_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL * assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int sdrsharp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) static int sdrsharp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
@ -471,7 +471,7 @@ static int sdrsharp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char cmd[MAXARGLEN]; char cmd[MAXARGLEN];
char value[1024]; char value[1024];
//struct sdrsharp_priv_data *priv = (struct sdrsharp_priv_data *) rig->state.priv; //struct sdrsharp_priv_data *priv = (struct sdrsharp_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.0f\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.0f\n", __func__,
@ -488,7 +488,7 @@ static int sdrsharp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = rig->state.current_vfo; vfo = STATE(rig)->current_vfo;
} }
#endif #endif

Wyświetl plik

@ -208,7 +208,7 @@ static int vfo_curr(RIG *rig, vfo_t vfo)
int retval = 0; int retval = 0;
vfo_t vfocurr; vfo_t vfocurr;
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
// get the current VFO from trxmanager in case user changed it // get the current VFO from trxmanager in case user changed it
if ((retval = trxmanager_get_vfo(rig, &vfocurr)) != RIG_OK) if ((retval = trxmanager_get_vfo(rig, &vfocurr)) != RIG_OK)
@ -257,15 +257,15 @@ static int trxmanager_init(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER); rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER);
rig->state.priv = (struct trxmanager_priv_data *)calloc(1, STATE(rig)->priv = (struct trxmanager_priv_data *)calloc(1,
sizeof(struct trxmanager_priv_data)); sizeof(struct trxmanager_priv_data));
if (!rig->state.priv) if (!STATE(rig)->priv)
{ {
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
priv = rig->state.priv; priv = STATE(rig)->priv;
memset(priv, 0, sizeof(struct trxmanager_priv_data)); memset(priv, 0, sizeof(struct trxmanager_priv_data));
@ -287,7 +287,7 @@ static int trxmanager_init(RIG *rig)
/* /*
* trxmanager_open * trxmanager_open
* Assumes rig!=NULL, rig->state.priv!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int trxmanager_open(RIG *rig) static int trxmanager_open(RIG *rig)
{ {
@ -297,7 +297,7 @@ static int trxmanager_open(RIG *rig)
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
hamlib_port_t *rp = RIGPORT(rig); hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, BACKEND_VER); rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, BACKEND_VER);
@ -377,7 +377,7 @@ static int trxmanager_close(RIG *rig)
/* /*
* trxmanager_cleanup * trxmanager_cleanup
* Assumes rig!=NULL, rig->state.priv!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int trxmanager_cleanup(RIG *rig) static int trxmanager_cleanup(RIG *rig)
{ {
@ -387,15 +387,15 @@ static int trxmanager_cleanup(RIG *rig)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
free(rig->state.priv); free(STATE(rig)->priv);
rig->state.priv = NULL; STATE(rig)->priv = NULL;
return RIG_OK; return RIG_OK;
} }
/* /*
* trxmanager_get_freq * trxmanager_get_freq
* Assumes rig!=NULL, rig->state.priv!=NULL, freq!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL, freq!=NULL
*/ */
static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
@ -405,7 +405,7 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char cmd[MAXCMDLEN]; char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -465,7 +465,7 @@ static int trxmanager_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* /*
* trxmanager_set_freq * trxmanager_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL * assumes rig!=NULL, STATE(rig)->priv!=NULL
*/ */
static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq) static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
@ -474,7 +474,7 @@ static int trxmanager_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char cmd[MAXCMDLEN]; char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s freq=%.1f\n", __func__,
@ -725,7 +725,7 @@ static int trxmanager_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
/* /*
* trxmanager_get_mode * trxmanager_get_mode
* Assumes rig!=NULL, rig->state.priv!=NULL, mode!=NULL * Assumes rig!=NULL, STATE(rig)->priv!=NULL, mode!=NULL
*/ */
static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width) pbwidth_t *width)
@ -738,7 +738,7 @@ static int trxmanager_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
hamlib_port_t *rp = RIGPORT(rig); hamlib_port_t *rp = RIGPORT(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -877,9 +877,9 @@ static int trxmanager_set_vfo(RIG *rig, vfo_t vfo)
int retval; int retval;
char cmd[MAXCMDLEN]; char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
struct rig_state *rs = &rig->state; struct rig_state *rs = STATE(rig);
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; rs->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__,
@ -929,7 +929,7 @@ static int trxmanager_get_vfo(RIG *rig, vfo_t *vfo)
// So we maintain our own internal state during set_vfo // So we maintain our own internal state during set_vfo
// This keeps the hamlib interface consistent with other rigs // This keeps the hamlib interface consistent with other rigs
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
char vfoab; char vfoab;
@ -1092,7 +1092,7 @@ static int trxmanager_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
char cmd[MAXCMDLEN]; char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
SNPRINTF(cmd, sizeof(cmd), "SP;"); SNPRINTF(cmd, sizeof(cmd), "SP;");
@ -1136,7 +1136,7 @@ static int trxmanager_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
char cmd[MAXCMDLEN]; char cmd[MAXCMDLEN];
char response[MAXCMDLEN] = ""; char response[MAXCMDLEN] = "";
struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
@ -1205,7 +1205,7 @@ static int trxmanager_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
static const char *trxmanager_get_info(RIG *rig) static const char *trxmanager_get_info(RIG *rig)
{ {
const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *) const struct trxmanager_priv_data *priv = (struct trxmanager_priv_data *)
rig->state.priv; STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
return priv->info; return priv->info;

Wyświetl plik

@ -107,7 +107,7 @@ static int gs100_init(RIG *rig)
RETURNFUNC(-RIG_ENOMEM); RETURNFUNC(-RIG_ENOMEM);
} }
rig->state.priv = (void *)priv; STATE(rig)->priv = (void *)priv;
#ifdef _LOCAL_SIMULATION_ #ifdef _LOCAL_SIMULATION_
RIGPORT(rig)->type.rig = RIG_PORT_NONE; // just simulation RIGPORT(rig)->type.rig = RIG_PORT_NONE; // just simulation
@ -126,12 +126,12 @@ static int gs100_cleanup(RIG *rig)
{ {
ENTERFUNC; ENTERFUNC;
if (rig->state.priv) if (STATE(rig)->priv)
{ {
free(rig->state.priv); free(STATE(rig)->priv);
} }
rig->state.priv = NULL; STATE(rig)->priv = NULL;
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }
@ -169,11 +169,11 @@ static int gs100_close(RIG *rig)
static int gs100_set_conf(RIG *rig, hamlib_token_t token, const char *val) static int gs100_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{ {
__attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data __attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
ENTERFUNC; ENTERFUNC;
priv = (struct gs100_priv_data *)rig->state.priv; priv = (struct gs100_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -195,11 +195,11 @@ static int gs100_set_conf(RIG *rig, hamlib_token_t token, const char *val)
static int gs100_get_conf(RIG *rig, hamlib_token_t token, char *val) static int gs100_get_conf(RIG *rig, hamlib_token_t token, char *val)
{ {
__attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data __attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
ENTERFUNC; ENTERFUNC;
priv = (struct gs100_priv_data *)rig->state.priv; priv = (struct gs100_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -220,7 +220,7 @@ static int gs100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
#ifdef _LOCAL_SIMULATION_ #ifdef _LOCAL_SIMULATION_
__attribute__((unused)) const struct gs100_priv_data *priv = __attribute__((unused)) const struct gs100_priv_data *priv =
(struct gs100_priv_data (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
#endif #endif
char fstr[20], value[20]; char fstr[20], value[20];
int retval; int retval;
@ -255,7 +255,7 @@ static int gs100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
#ifdef _LOCAL_SIMULATION_ #ifdef _LOCAL_SIMULATION_
__attribute__((unused)) const struct gs100_priv_data *priv = __attribute__((unused)) const struct gs100_priv_data *priv =
(struct gs100_priv_data (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
#endif #endif
char resp[20]; char resp[20];
int retval; int retval;
@ -292,7 +292,7 @@ static int gs100_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
#ifdef _LOCAL_SIMULATION_ #ifdef _LOCAL_SIMULATION_
__attribute__((unused)) const struct gs100_priv_data *priv = __attribute__((unused)) const struct gs100_priv_data *priv =
(struct gs100_priv_data (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
#endif #endif
char fstr[20], value[20]; char fstr[20], value[20];
int retval; int retval;
@ -327,7 +327,7 @@ static int gs100_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
#ifdef _LOCAL_SIMULATION_ #ifdef _LOCAL_SIMULATION_
__attribute__((unused)) const struct gs100_priv_data *priv = __attribute__((unused)) const struct gs100_priv_data *priv =
(struct gs100_priv_data (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
#endif #endif
char resp[20]; char resp[20];
int retval; int retval;
@ -440,7 +440,7 @@ struct rig_caps GS100_caps =
static int gomx_set(RIG *rig, int table, char *varname, char *varvalue) static int gomx_set(RIG *rig, int table, char *varname, char *varvalue)
{ {
__attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data __attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
int retval; int retval;
char msg[BUFSZ], resp[BUFSZ]; char msg[BUFSZ], resp[BUFSZ];
@ -479,7 +479,7 @@ static int gomx_get(RIG *rig, int table, char *varname, const char *varvalue,
int varvalue_len) int varvalue_len)
{ {
__attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data __attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data
*)rig->state.priv; *)STATE(rig)->priv;
int retval; int retval;
char msg[BUFSZ], resp[BUFSZ], *c; char msg[BUFSZ], resp[BUFSZ], *c;
char fmt[32]; char fmt[32];

Wyświetl plik

@ -267,16 +267,16 @@ int icm710_init(RIG *rig)
priv_caps = (const struct icm710_priv_caps *) caps->priv; priv_caps = (const struct icm710_priv_caps *) caps->priv;
rig->state.priv = (struct icm710_priv_data *)calloc(1, STATE(rig)->priv = (struct icm710_priv_data *)calloc(1,
sizeof(struct icm710_priv_data)); sizeof(struct icm710_priv_data));
if (!rig->state.priv) if (!STATE(rig)->priv)
{ {
/* whoops! memory shortage! */ /* whoops! memory shortage! */
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
priv = rig->state.priv; priv = STATE(rig)->priv;
priv->remote_id = priv_caps->default_remote_id; priv->remote_id = priv_caps->default_remote_id;
priv->split = RIG_SPLIT_OFF; priv->split = RIG_SPLIT_OFF;
@ -317,12 +317,12 @@ int icm710_cleanup(RIG *rig)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (rig->state.priv) if (STATE(rig)->priv)
{ {
free(rig->state.priv); free(STATE(rig)->priv);
} }
rig->state.priv = NULL; STATE(rig)->priv = NULL;
return RIG_OK; return RIG_OK;
} }
@ -331,7 +331,7 @@ int icm710_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -350,7 +350,7 @@ int icm710_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -376,7 +376,7 @@ int icm710_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
int retval; int retval;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1)); SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1));
@ -412,7 +412,7 @@ int icm710_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
*/ */
int icm710_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int icm710_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
*freq = ((struct icm710_priv_data *)rig->state.priv)->rxfreq; *freq = ((struct icm710_priv_data *)STATE(rig)->priv)->rxfreq;
return RIG_OK; return RIG_OK;
} }
@ -423,7 +423,7 @@ int icm710_set_tx_freq(RIG *rig, vfo_t vfo, freq_t freq)
int retval; int retval;
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1)); SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1));
@ -442,7 +442,7 @@ int icm710_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
*freq = priv->txfreq; *freq = priv->txfreq;
return RIG_OK; return RIG_OK;
@ -452,7 +452,7 @@ int icm710_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
/* when disabling split mode */ /* when disabling split mode */
@ -475,7 +475,7 @@ int icm710_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
*split = priv->split; *split = priv->split;
*tx_vfo = rx_vfo; *tx_vfo = rx_vfo;
@ -522,7 +522,7 @@ int icm710_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int icm710_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) int icm710_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{ {
*mode = ((struct icm710_priv_data *)rig->state.priv)->mode; *mode = ((struct icm710_priv_data *)STATE(rig)->priv)->mode;
*width = 2200; *width = 2200;
return RIG_OK; return RIG_OK;
@ -536,7 +536,7 @@ int icm710_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int retval; int retval;
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
retval = icmarine_transaction(rig, CMD_PTT, retval = icmarine_transaction(rig, CMD_PTT,
ptt == RIG_PTT_ON ? "TX" : "RX", NULL); ptt == RIG_PTT_ON ? "TX" : "RX", NULL);
@ -552,7 +552,7 @@ int icm710_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int icm710_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) int icm710_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{ {
*ptt = ((struct icm710_priv_data *)rig->state.priv)->ptt; *ptt = ((struct icm710_priv_data *)STATE(rig)->priv)->ptt;
return RIG_OK; return RIG_OK;
} }
@ -613,7 +613,7 @@ int icm710_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
unsigned value; unsigned value;
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
switch (level) switch (level)
@ -676,7 +676,7 @@ int icm710_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{ {
struct icm710_priv_data *priv; struct icm710_priv_data *priv;
priv = (struct icm710_priv_data *)rig->state.priv; priv = (struct icm710_priv_data *)STATE(rig)->priv;
switch (level) switch (level)

Wyświetl plik

@ -129,16 +129,16 @@ int icmarine_init(RIG *rig)
priv_caps = (const struct icmarine_priv_caps *) caps->priv; priv_caps = (const struct icmarine_priv_caps *) caps->priv;
rig->state.priv = (struct icmarine_priv_data *)calloc(1, sizeof( STATE(rig)->priv = (struct icmarine_priv_data *)calloc(1, sizeof(
struct icmarine_priv_data)); struct icmarine_priv_data));
if (!rig->state.priv) if (!STATE(rig)->priv)
{ {
/* whoops! memory shortage! */ /* whoops! memory shortage! */
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
priv = rig->state.priv; priv = STATE(rig)->priv;
priv->remote_id = priv_caps->default_remote_id; priv->remote_id = priv_caps->default_remote_id;
priv->split = RIG_SPLIT_OFF; priv->split = RIG_SPLIT_OFF;
@ -153,12 +153,12 @@ int icmarine_cleanup(RIG *rig)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (rig->state.priv) if (STATE(rig)->priv)
{ {
free(rig->state.priv); free(STATE(rig)->priv);
} }
rig->state.priv = NULL; STATE(rig)->priv = NULL;
return RIG_OK; return RIG_OK;
} }
@ -187,7 +187,7 @@ int icmarine_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{ {
struct icmarine_priv_data *priv; struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data *)rig->state.priv; priv = (struct icmarine_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -206,7 +206,7 @@ int icmarine_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{ {
struct icmarine_priv_data *priv; struct icmarine_priv_data *priv;
priv = (struct icmarine_priv_data *)rig->state.priv; priv = (struct icmarine_priv_data *)STATE(rig)->priv;
switch (token) switch (token)
{ {
@ -229,7 +229,7 @@ int icmarine_get_conf(RIG *rig, hamlib_token_t token, char *val)
/* /*
* icmarine_transaction * icmarine_transaction
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL * We assume that rig!=NULL, STATE(rig)!= NULL, data!=NULL, data_len!=NULL
* *
* cmd: mandatory * cmd: mandatory
* param: only 1 optional NMEA parameter, NULL for none (=query) * param: only 1 optional NMEA parameter, NULL for none (=query)
@ -252,7 +252,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
rig_debug(RIG_DEBUG_TRACE, "%s: cmd='%s', param=%s\n", __func__, cmd, rig_debug(RIG_DEBUG_TRACE, "%s: cmd='%s', param=%s\n", __func__, cmd,
param == NULL ? "NULL" : param); param == NULL ? "NULL" : param);
rs = &rig->state; rs = STATE(rig);
priv = (struct icmarine_priv_data *)rs->priv; priv = (struct icmarine_priv_data *)rs->priv;
rig_flush(rp); rig_flush(rp);
@ -362,7 +362,7 @@ int icmarine_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
priv = (struct icmarine_priv_data *)rig->state.priv; priv = (struct icmarine_priv_data *)STATE(rig)->priv;
SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1)); SNPRINTF(freqbuf, sizeof(freqbuf), "%.6f", freq / MHz(1));
@ -461,7 +461,7 @@ int icmarine_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
priv = (struct icmarine_priv_data *)rig->state.priv; priv = (struct icmarine_priv_data *)STATE(rig)->priv;
/* when disabling split mode */ /* when disabling split mode */
if (RIG_SPLIT_ON == priv->split && if (RIG_SPLIT_ON == priv->split &&
@ -487,7 +487,7 @@ int icmarine_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split,
rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s:\n", __func__);
priv = (struct icmarine_priv_data *)rig->state.priv; priv = (struct icmarine_priv_data *)STATE(rig)->priv;
*split = priv->split; *split = priv->split;
*tx_vfo = rx_vfo; *tx_vfo = rx_vfo;

Wyświetl plik

@ -59,7 +59,7 @@
/* /*
* jrc_transaction * jrc_transaction
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL * We assume that rig!=NULL, RIGPORT(rig)!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned! * Otherwise, you'll get a nice seg fault. You've been warned!
* TODO: error case handling * TODO: error case handling
*/ */

Wyświetl plik

@ -286,7 +286,7 @@ static int jst145_init(RIG *rig)
return -RIG_ENOMEM; return -RIG_ENOMEM;
} }
rig->state.priv = (void *)priv; STATE(rig)->priv = (void *)priv;
return RIG_OK; return RIG_OK;
} }
@ -296,7 +296,7 @@ static int jst145_open(RIG *rig)
freq_t freq; freq_t freq;
rmode_t mode; rmode_t mode;
pbwidth_t width; pbwidth_t width;
struct jst145_priv_data *priv = rig->state.priv; struct jst145_priv_data *priv = STATE(rig)->priv;
retval = write_block(RIGPORT(rig), (unsigned char *) "H1\r", 3); retval = write_block(RIGPORT(rig), (unsigned char *) "H1\r", 3);
@ -345,7 +345,7 @@ ptt_retry:
if (ptt) // can't get vfo while transmitting if (ptt) // can't get vfo while transmitting
{ {
*vfo = rig->state.current_vfo; *vfo = STATE(rig)->current_vfo;
return RIG_OK; return RIG_OK;
} }
@ -371,8 +371,8 @@ static int jst145_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{ {
char freqbuf[MAX_LEN]; char freqbuf[MAX_LEN];
int retval; int retval;
struct jst145_priv_data *priv = rig->state.priv; struct jst145_priv_data *priv = STATE(rig)->priv;
vfo_t save_vfo = rig->state.current_vfo; vfo_t save_vfo = STATE(rig)->current_vfo;
if (vfo == RIG_VFO_CURR) { vfo = save_vfo; } if (vfo == RIG_VFO_CURR) { vfo = save_vfo; }
@ -414,9 +414,9 @@ static int jst145_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int freqbuf_size = sizeof(freqbuf); int freqbuf_size = sizeof(freqbuf);
int retval; int retval;
int n; int n;
vfo_t save_vfo = rig->state.current_vfo; vfo_t save_vfo = STATE(rig)->current_vfo;
//struct jst145_priv_data *priv = rig->state.priv; //struct jst145_priv_data *priv = STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s curr_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strvfo(save_vfo)); rig_strvfo(vfo), rig_strvfo(save_vfo));
@ -455,7 +455,7 @@ static int jst145_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{ {
int retval; int retval;
char *modestr; char *modestr;
struct jst145_priv_data *priv = rig->state.priv; struct jst145_priv_data *priv = STATE(rig)->priv;
switch (mode) switch (mode)
{ {
@ -579,7 +579,7 @@ static int jst145_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
static int jst145_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) static int jst145_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
char cmd[MAX_LEN]; char cmd[MAX_LEN];
struct jst145_priv_data *priv = rig->state.priv; struct jst145_priv_data *priv = STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__);
SNPRINTF(cmd, sizeof(cmd), "X%c\r", ptt ? '1' : '0'); SNPRINTF(cmd, sizeof(cmd), "X%c\r", ptt ? '1' : '0');
priv->ptt = ptt; priv->ptt = ptt;
@ -592,7 +592,7 @@ static int jst145_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
char pttstatus[MAX_LEN]; char pttstatus[MAX_LEN];
int pttstatus_size = sizeof(pttstatus); int pttstatus_size = sizeof(pttstatus);
int retval; int retval;
struct jst145_priv_data *priv = rig->state.priv; struct jst145_priv_data *priv = STATE(rig)->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: entered\n", __func__);

Wyświetl plik

@ -58,7 +58,7 @@
/* /*
* kachina_transaction * kachina_transaction
* We assume that rig!=NULL, rig->state!= NULL * We assume that rig!=NULL, STATE(rig)!= NULL
* Otherwise, you'll get a nice seg fault. You've been warned! * Otherwise, you'll get a nice seg fault. You've been warned!
* TODO: error case handling * TODO: error case handling
*/ */