And another batch...

All sed -i with some manual fixups.
Less than 2000 to go.
This commit is contained in:
George Baltz N3GB 2024-06-03 18:55:15 -04:00
parent 9e4bacbec9
commit d6dcd4aad4
11 changed files with 108 additions and 108 deletions

View File

@ -163,7 +163,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
{
int read = 0, tries = 4;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
const struct pcr_priv_caps *caps = pcr_caps(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
@ -235,7 +235,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
static int
pcr_parse_answer(RIG *rig, char *buf, int len)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_TRACE, "%s: len = %d\n", __func__, len);
@ -342,7 +342,7 @@ static int
pcr_send(RIG *rig, const char *cmd)
{
int err;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
int len = strlen(cmd);
@ -371,7 +371,7 @@ static int
pcr_transaction(RIG *rig, const char *cmd)
{
int err;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct pcr_priv_caps *caps = pcr_caps(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
@ -481,16 +481,16 @@ pcr_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct pcr_priv_data *) calloc(1,
STATE(rig)->priv = (struct pcr_priv_data *) calloc(1,
sizeof(struct pcr_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
memset(priv, 0x00, sizeof(struct pcr_priv_data));
@ -532,9 +532,9 @@ pcr_cleanup(RIG *rig)
return -RIG_EINVAL;
}
free(rig->state.priv);
free(STATE(rig)->priv);
rig->state.priv = NULL;
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -549,7 +549,7 @@ pcr_cleanup(RIG *rig)
int
pcr_open(RIG *rig)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv;
@ -633,7 +633,7 @@ pcr_open(RIG *rig)
return err;
}
if ((rig->state.vfo_list & RIG_VFO_SUB) == RIG_VFO_SUB)
if ((STATE(rig)->vfo_list & RIG_VFO_SUB) == RIG_VFO_SUB)
{
err = pcr_set_squelch(rig, RIG_VFO_SUB, priv->sub_rcvr.squelch);
@ -675,7 +675,7 @@ pcr_open(RIG *rig)
int
pcr_close(RIG *rig)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
/* when the pcr turns itself off sometimes we receive
* a malformed answer, so don't check for it.
*/
@ -692,7 +692,7 @@ pcr_close(RIG *rig)
int
pcr_set_vfo(RIG *rig, vfo_t vfo)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo = %s\n",
__func__, rig_strvfo(vfo));
@ -715,7 +715,7 @@ pcr_set_vfo(RIG *rig, vfo_t vfo)
int
pcr_get_vfo(RIG *rig, vfo_t *vfo)
{
const struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
const struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
*vfo = priv->current_vfo;
return RIG_OK;
@ -755,7 +755,7 @@ pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo = %s, freq = %.0f\n",
__func__, rig_strvfo(vfo), freq);
priv = (struct pcr_priv_data *) rig->state.priv;
priv = (struct pcr_priv_data *) STATE(rig)->priv;
rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
SNPRINTF((char *) buf, sizeof(buf), "K%c%010" PRIll "0%c0%c00",
@ -783,7 +783,7 @@ pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int
pcr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -800,7 +800,7 @@ pcr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int
pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -941,7 +941,7 @@ pcr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
struct pcr_priv_data *priv;
struct pcr_rcvr *rcvr;
priv = (struct pcr_priv_data *) rig->state.priv;
priv = (struct pcr_priv_data *) STATE(rig)->priv;
rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
rig_debug(RIG_DEBUG_VERBOSE, "%s, last_mode = %c, last_filter = %c\n",
@ -1020,7 +1020,7 @@ pcr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
const char *
pcr_get_info(RIG *rig)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
char *country = NULL;
@ -1169,7 +1169,7 @@ int
pcr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1196,7 +1196,7 @@ pcr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
}
val->i = rig_raw2val(rcvr->raw_level, &rig->state.str_cal);
val->i = rig_raw2val(rcvr->raw_level, &STATE(rig)->str_cal);
/* rig_debug(RIG_DEBUG_TRACE, "%s, raw = %d, converted = %d\n",
__func__, rcvr->raw_level, val->i);
*/
@ -1235,7 +1235,7 @@ pcr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/*
* pcr_set_func
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* This is missing a way to call the set DSP noise reducer, as we don't have a func to call it
* based on the flags in rig.h -> see also missing a flag for setting the BFO.
@ -1243,7 +1243,7 @@ pcr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int
pcr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1342,7 +1342,7 @@ pcr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
/*
* pcr_get_func
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* This will need similar variables/flags as get_level. The PCR doesn't offer much in the way of
* confirmation of current settings (according to the docs).
@ -1401,7 +1401,7 @@ pcr_check_ok(RIG *rig)
static int
is_sub_rcvr(RIG *rig, vfo_t vfo)
{
const struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
const struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
return vfo == RIG_VFO_SUB ||
(vfo == RIG_VFO_CURR && priv->current_vfo == RIG_VFO_SUB);
@ -1442,7 +1442,7 @@ static int
pcr_set_volume(RIG *rig, vfo_t vfo, float level)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1461,7 +1461,7 @@ pcr_set_volume(RIG *rig, vfo_t vfo, float level)
/*
* pcr_set_squelch
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Format is J41xx - where xx is 00 to FF in hex, and specifies 255 squelch levels
*
@ -1481,7 +1481,7 @@ static int
pcr_set_squelch(RIG *rig, vfo_t vfo, float level)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1501,7 +1501,7 @@ pcr_set_squelch(RIG *rig, vfo_t vfo, float level)
/*
* pcr_set_if_shift
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the IF shift of the rig to the level specified in the level integer.
* IF-SHIFT position (in 256 stages, 80 = centre):
@ -1517,7 +1517,7 @@ int
pcr_set_if_shift(RIG *rig, vfo_t vfo, int level)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1536,7 +1536,7 @@ pcr_set_if_shift(RIG *rig, vfo_t vfo, int level)
/*
* pcr_set_agc
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the AGC on or off based on the level specified in the level integer.
* 00 = off, 01 (non zero) is on
@ -1548,7 +1548,7 @@ int
pcr_set_agc(RIG *rig, vfo_t vfo, int status)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1567,7 +1567,7 @@ pcr_set_agc(RIG *rig, vfo_t vfo, int status)
/*
* pcr_set_afc(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the Tracking Filter on or off based on the status argument.
* 00 = on, 01 (non zero) is off
@ -1584,7 +1584,7 @@ pcr_set_afc(RIG *rig, vfo_t vfo, int status)
/*
* pcr_set_nb(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the noise blanker on or off based on the level specified in the level integer.
* 00 = off, 01 (non zero) is on
@ -1629,7 +1629,7 @@ pcr_set_diversity(RIG *rig, vfo_t vfo, int status)
/*
* pcr_set_attenuator(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the attenuator on or off based on the level specified in the level integer.
* 00 = off, 01 (non zero) is on
@ -1643,7 +1643,7 @@ int
pcr_set_attenuator(RIG *rig, vfo_t vfo, int status)
{
int err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1662,7 +1662,7 @@ pcr_set_attenuator(RIG *rig, vfo_t vfo, int status)
/*
* pcr_set_bfo_shift
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the BFO of the rig to the level specified in the level integer.
* BFO-SHIFT position (in 256 stages, 80 = centre):
@ -1684,7 +1684,7 @@ pcr_set_bfo_shift(RIG *rig, vfo_t vfo, int level)
/*
* pcr_set_dsp(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the DSP to UT106 (01) or off (non 01)
*
@ -1704,7 +1704,7 @@ pcr_set_dsp(RIG *rig, vfo_t vfo, int level)
/*
* pcr_set_dsp_state(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the DSP on or off (> 0 = on, 0 = off)
*
@ -1725,7 +1725,7 @@ pcr_set_dsp_state(RIG *rig, vfo_t vfo, int level)
/*
* pcr_set_dsp_noise_reducer(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the DSP noise reducer on or off (0x01 = on, 0x00 = off)
* the level of NR set by values 0x01 to 0x10 (1 to 16 inclusive)
@ -1748,7 +1748,7 @@ pcr_set_dsp_noise_reducer(RIG *rig, vfo_t vfo, int level)
/*
* pcr_set_dsp_auto_notch(RIG *rig, vfo_t vfo, int level);
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*
* Sets the auto notch on or off (1 = on, 0 = off)
*/
@ -1777,7 +1777,7 @@ pcr_set_vsc(RIG *rig, vfo_t vfo, int status) // J50xx
int pcr_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1788,7 +1788,7 @@ int pcr_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
int pcr_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
{
int i, err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1827,7 +1827,7 @@ int pcr_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
int pcr_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *tone)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1838,7 +1838,7 @@ int pcr_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *tone)
int pcr_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t tone)
{
int i, err;
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
@ -1877,7 +1877,7 @@ int pcr_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t tone)
int pcr_set_trn(RIG *rig, int trn)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: trn = %d\n", __func__, trn);
@ -1915,7 +1915,7 @@ int pcr_decode_event(RIG *rig)
int pcr_set_powerstat(RIG *rig, powerstat_t status)
{
const struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
const struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
if (status == priv->power)
{
@ -1936,7 +1936,7 @@ int pcr_set_powerstat(RIG *rig, powerstat_t status)
int pcr_get_powerstat(RIG *rig, powerstat_t *status)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
int err;
/* return RIG_ERJCTED if power is off */
@ -1956,7 +1956,7 @@ int pcr_get_powerstat(RIG *rig, powerstat_t *status)
int pcr_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
struct pcr_priv_data *priv = (struct pcr_priv_data *) STATE(rig)->priv;
const struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;

View File

@ -140,7 +140,7 @@ MessageAide: DB "H",0Dh,0Ah
static void prm80_force_cache_timeout(RIG *rig)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
rig_force_cache_timeout(&priv->status_tv);
}
@ -283,9 +283,9 @@ int prm80_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (void *)calloc(1, sizeof(struct prm80_priv_data));
STATE(rig)->priv = (void *)calloc(1, sizeof(struct prm80_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
@ -301,8 +301,8 @@ int prm80_cleanup(RIG *rig)
return -RIG_EINVAL;
}
free(rig->state.priv);
rig->state.priv = NULL;
free(STATE(rig)->priv);
STATE(rig)->priv = NULL;
return RIG_OK;
}
@ -418,7 +418,7 @@ int prm80_set_rx_tx_freq(RIG *rig, freq_t rx_freq, freq_t tx_freq)
*/
int prm80_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
freq_t tx_freq;
int rc;
@ -448,7 +448,7 @@ int prm80_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
*/
int prm80_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
freq_t rx_freq;
int rc;
@ -471,7 +471,7 @@ int prm80_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
*/
int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
int ret;
channel_t chan;
@ -498,7 +498,7 @@ int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int prm80_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
priv->split = split;
@ -510,7 +510,7 @@ int prm80_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
*/
int prm80_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
const struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
const struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
*split = priv->split;
*tx_vfo = RIG_VFO_CURR;
@ -523,7 +523,7 @@ int prm80_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
*/
int prm80_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
int ret;
channel_t chan;
@ -694,7 +694,7 @@ static int prm80_do_read_system_state(hamlib_port_t *rigport, char *statebuf)
*/
static int prm80_read_system_state(RIG *rig, char *statebuf)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
int ret = RIG_OK;
if (rig_check_cache_timeout(&priv->status_tv, PRM80_CACHE_TIMEOUT))
@ -723,7 +723,7 @@ static int prm80_read_system_state(RIG *rig, char *statebuf)
*/
int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
{
const struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
const struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
char statebuf[BUFSZ];
int ret, chanstate, mode_byte, lock_byte;
@ -821,7 +821,7 @@ int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
*/
int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
{
struct prm80_priv_data *priv = (struct prm80_priv_data *)rig->state.priv;
struct prm80_priv_data *priv = (struct prm80_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char buf[BUFSZ];
int ret, chanstate;
@ -1107,7 +1107,7 @@ int prm80_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
{
char buf[BUFSZ];
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
int ret, i;

View File

@ -69,7 +69,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
int *data_len)
{
const struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)
rig->state.priv;
STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ];
char respbuf[BUFSZ];
@ -215,16 +215,16 @@ int ra37xx_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct ra37xx_priv_data *)calloc(1, sizeof(
STATE(rig)->priv = (struct ra37xx_priv_data *)calloc(1, sizeof(
struct ra37xx_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->receiver_id = -1;
@ -240,22 +240,22 @@ int ra37xx_cleanup(RIG *rig)
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;
}
/*
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int ra37xx_set_conf2(RIG *rig, hamlib_token_t token, const char *val, int val_len)
{
struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)rig->state.priv;
struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)STATE(rig)->priv;
int receiver_id;
switch (token)
@ -285,13 +285,13 @@ int ra37xx_set_conf(RIG *rig, hamlib_token_t token, const char *val)
/*
* assumes rig!=NULL,
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
* and val points to a buffer big enough to hold the conf value.
*/
int ra37xx_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{
const struct ra37xx_priv_data *priv = (struct ra37xx_priv_data *)
rig->state.priv;
STATE(rig)->priv;
switch (token)
{
@ -371,7 +371,7 @@ int ra37xx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int ra37xx_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
//struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)rig->state.priv;
//struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)STATE(rig)->priv;
int ra_mode, widthtype, widthnum = 0;
char buf[BUFSZ];
@ -631,7 +631,7 @@ int ra37xx_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
sscanf(resbuf + 5, "%d", &i);
val->i = i ? rig->state.preamp[0] : 0;
val->i = i ? STATE(rig)->preamp[0] : 0;
break;
case RIG_LEVEL_RAWSTR:

View File

@ -61,14 +61,14 @@ const struct confparams racal_cfg_params[] =
/*
* racal_transaction
* We assume that rig!=NULL, rig->state!= NULL
* We assume that rig!=NULL, RIGPORT(rig)!= NULL
*
* TODO: Status Response handling with G/T commands
*/
static int racal_transaction(RIG *rig, const char *cmd, char *data,
int *data_len)
{
const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
const struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
hamlib_port_t *rp = RIGPORT(rig);
char cmdbuf[BUFSZ + 1];
int retval;
@ -120,16 +120,16 @@ int racal_init(RIG *rig)
return -RIG_EINVAL;
}
rig->state.priv = (struct racal_priv_data *)calloc(1, sizeof(
STATE(rig)->priv = (struct racal_priv_data *)calloc(1, sizeof(
struct racal_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv = rig->state.priv;
priv = STATE(rig)->priv;
priv->receiver_id = 0;
priv->bfo = 0;
@ -147,12 +147,12 @@ int racal_cleanup(RIG *rig)
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;
}
@ -160,11 +160,11 @@ int racal_cleanup(RIG *rig)
/*
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int racal_set_conf(RIG *rig, hamlib_token_t token, const char *val)
{
struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
switch (token)
{
@ -181,12 +181,12 @@ int racal_set_conf(RIG *rig, hamlib_token_t token, const char *val)
/*
* assumes rig!=NULL,
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
* and val points to a buffer big enough to hold the conf value.
*/
int racal_get_conf2(RIG *rig, hamlib_token_t token, char *val, int val_len)
{
const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
const struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
switch (token)
{
@ -275,7 +275,7 @@ int racal_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
*/
int racal_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
const struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
const struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
int ra_mode;
char buf[BUFSZ];
@ -371,7 +371,7 @@ int racal_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
*/
int racal_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
char cmdbuf[BUFSZ];
int agc;
@ -427,7 +427,7 @@ int racal_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
*/
int racal_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct racal_priv_data *priv = (struct racal_priv_data *)rig->state.priv;
struct racal_priv_data *priv = (struct racal_priv_data *)STATE(rig)->priv;
char resbuf[BUFSZ];
int retval, len, att;
double f;
@ -510,7 +510,7 @@ int racal_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
/*
* Assumes rig!=NULL, rig->state.priv!=NULL
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
*/
int racal_reset(RIG *rig, reset_t reset)
{

View File

@ -36,7 +36,7 @@
/*
* rft_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
*/
int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)

View File

@ -47,7 +47,7 @@
/*
* ek89x
* 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
*/
int
ek89x_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,

View File

@ -52,7 +52,7 @@
/*
* gp2000
* 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
*/
int
gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,

View File

@ -50,7 +50,7 @@
/*
* rs_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
*/
int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int *data_len)
@ -334,7 +334,7 @@ int rs_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_ATT:
val->i = (!memcmp(buf, "ON", 2)
|| !memcmp(buf, "1", 1)) ? rig->state.attenuator[0] : 0;
|| !memcmp(buf, "1", 1)) ? STATE(rig)->attenuator[0] : 0;
break;
case RIG_LEVEL_AF:

View File

@ -51,7 +51,7 @@
/*
* skanti_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
* Otherwise, you'll get a nice seg fault. You've been warned!
* TODO: error case handling
*/

View File

@ -215,14 +215,14 @@ static int cu_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
rig->state.priv = calloc(1, sizeof(struct cu_priv_data));
STATE(rig)->priv = calloc(1, sizeof(struct cu_priv_data));
if (!rig->state.priv)
if (!STATE(rig)->priv)
{
return -RIG_ENOMEM;
}
priv = (struct cu_priv_data *)rig->state.priv;
priv = (struct cu_priv_data *)STATE(rig)->priv;
memset(priv, 0, sizeof(struct cu_priv_data));
priv->split = RIG_SPLIT_OFF;
@ -234,7 +234,7 @@ static int cu_open(RIG *rig)
static int cu_close(RIG *rig)
{
const char cmd[] = { 0x16 }; /* DLE */
struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv;
struct cu_priv_data *priv = (struct cu_priv_data *)STATE(rig)->priv;
free(priv);
@ -243,7 +243,7 @@ static int cu_close(RIG *rig)
int cu_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
const struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv;
const struct cu_priv_data *priv = (struct cu_priv_data *)STATE(rig)->priv;
char cmdbuf[16];
int ret;
@ -272,7 +272,7 @@ int cu_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
static int cu_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv;
struct cu_priv_data *priv = (struct cu_priv_data *)STATE(rig)->priv;
priv->split = split;
@ -478,7 +478,7 @@ int cu_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int cu_set_mem(RIG *rig, vfo_t vfo, int ch)
{
struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv;
struct cu_priv_data *priv = (struct cu_priv_data *)STATE(rig)->priv;
/* memorize channel for RIG_OP_TO_VFO & RIG_OP_FROM_VFO */
priv->ch = ch;
@ -489,7 +489,7 @@ static int cu_set_mem(RIG *rig, vfo_t vfo, int ch)
int cu_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
const struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv;
const struct cu_priv_data *priv = (struct cu_priv_data *)STATE(rig)->priv;
char cmdbuf[16];
switch (op)

View File

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