Skip to content

Commit 9e4bacb

Browse files
committed
Pointerize state references in Tentec rigs.
1 parent 9eda062 commit 9e4bacb

File tree

9 files changed

+122
-122
lines changed

9 files changed

+122
-122
lines changed

rigs/tentec/jupiter.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,16 @@ int tt538_init(RIG *rig)
291291
{
292292
struct tt538_priv_data *priv;
293293

294-
rig->state.priv = (struct tt538_priv_data *) calloc(1, sizeof(
294+
STATE(rig)->priv = (struct tt538_priv_data *) calloc(1, sizeof(
295295
struct tt538_priv_data));
296296

297-
if (!rig->state.priv)
297+
if (!STATE(rig)->priv)
298298
{
299299
/* whoops! memory shortage! */
300300
return -RIG_ENOMEM;
301301
}
302302

303-
priv = rig->state.priv;
303+
priv = STATE(rig)->priv;
304304

305305
memset(priv, 0, sizeof(struct tt538_priv_data));
306306

@@ -315,7 +315,7 @@ int tt538_init(RIG *rig)
315315

316316
static char which_vfo(const RIG *rig, vfo_t vfo)
317317
{
318-
const struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv;
318+
const struct tt538_priv_data *priv = (struct tt538_priv_data *)STATE(rig)->priv;
319319

320320
if (vfo == RIG_VFO_CURR)
321321
{
@@ -340,7 +340,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
340340
int tt538_get_vfo(RIG *rig, vfo_t *vfo)
341341
{
342342

343-
const struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv;
343+
const struct tt538_priv_data *priv = (struct tt538_priv_data *) STATE(rig)->priv;
344344
*vfo = priv->vfo_curr;
345345
return RIG_OK;
346346
}
@@ -351,7 +351,7 @@ int tt538_get_vfo(RIG *rig, vfo_t *vfo)
351351
*/
352352
int tt538_set_vfo(RIG *rig, vfo_t vfo)
353353
{
354-
struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv;
354+
struct tt538_priv_data *priv = (struct tt538_priv_data *)STATE(rig)->priv;
355355

356356
if (vfo == RIG_VFO_CURR)
357357
{
@@ -436,7 +436,7 @@ int tt538_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
436436

437437
/*
438438
* tt538_set_freq
439-
* assumes rig!=NULL, rig->state.priv!=NULL
439+
* assumes rig!=NULL, STATE(rig)->priv!=NULL
440440
* assumes priv->mode in AM,CW,LSB or USB.
441441
*/
442442

@@ -634,7 +634,7 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
634634
unsigned char cmdbuf[32], respbuf[32], ttmode;
635635
int resp_len, retval;
636636

637-
const struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv;
637+
const struct tt538_priv_data *priv = (struct tt538_priv_data *) STATE(rig)->priv;
638638

639639
/* Query mode for both VFOs. */
640640
SNPRINTF((char *) cmdbuf, sizeof(cmdbuf), "?M" EOM);

rigs/tentec/omnivii.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ int tt588_init(RIG *rig)
330330
struct tt588_priv_data *priv;
331331

332332
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
333-
rig->state.priv = (struct tt588_priv_data *) calloc(1, sizeof(
333+
STATE(rig)->priv = (struct tt588_priv_data *) calloc(1, sizeof(
334334
struct tt588_priv_data));
335335

336-
if (!rig->state.priv)
336+
if (!STATE(rig)->priv)
337337
{
338338
/* whoops! memory shortage! */
339339
return -RIG_ENOMEM;
340340
}
341341

342-
priv = rig->state.priv;
342+
priv = STATE(rig)->priv;
343343

344344
memset(priv, 0, sizeof(struct tt588_priv_data));
345345

@@ -380,7 +380,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
380380
int tt588_get_vfo(RIG *rig, vfo_t *vfo)
381381
{
382382
static int getinfo = TRUE;
383-
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
383+
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
384384

385385
if (getinfo) // this is the first call to this package so we do this here
386386
{
@@ -407,7 +407,7 @@ int tt588_get_vfo(RIG *rig, vfo_t *vfo)
407407
*/
408408
int tt588_set_vfo(RIG *rig, vfo_t vfo)
409409
{
410-
struct tt588_priv_data *priv = (struct tt588_priv_data *)rig->state.priv;
410+
struct tt588_priv_data *priv = (struct tt588_priv_data *)STATE(rig)->priv;
411411

412412
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
413413

@@ -461,7 +461,7 @@ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
461461

462462
int resp_len, retval;
463463
unsigned char cmdbuf[16], respbuf[32];
464-
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
464+
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
465465

466466
if (vfo == RIG_VFO_CURR)
467467
{
@@ -504,7 +504,7 @@ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
504504

505505
/*
506506
* tt588_set_freq
507-
* assumes rig!=NULL, rig->state.priv!=NULL
507+
* assumes rig!=NULL, STATE(rig)->priv!=NULL
508508
*/
509509
int tt588_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
510510
{
@@ -597,7 +597,7 @@ int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
597597
int resp_len, retval;
598598
unsigned char cmdbuf[16], respbuf[32];
599599
char ttmode;
600-
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
600+
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
601601

602602

603603
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
@@ -798,7 +798,7 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
798798
unsigned char cmdbuf[32], respbuf[32], ttmode;
799799
int resp_len, retval;
800800

801-
const struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv;
801+
const struct tt588_priv_data *priv = (struct tt588_priv_data *) STATE(rig)->priv;
802802

803803
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s mode=%s width=%d\n", __func__,
804804
rig_strvfo(vfo), rig_strrmode(mode), (int)width);

rigs/tentec/orion.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ double tt565_timenow() /* returns current time in secs+microsecs */
101101
*
102102
* This is the basic I/O transaction to/from the Orion.
103103
* \n Read variable number of bytes, up to buffer size, if data & data_len != NULL.
104-
* \n We assume that rig!=NULL, rig->state!= NULL.
104+
* \n We assume that rig!=NULL, STATE(rig)!= NULL.
105105
* Otherwise, you'll get a nice seg fault. You've been warned!
106106
*/
107107

@@ -221,12 +221,12 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
221221
int tt565_init(RIG *rig)
222222
{
223223
struct tt565_priv_data *priv;
224-
rig->state.priv = (struct tt565_priv_data *)calloc(1, sizeof(
224+
STATE(rig)->priv = (struct tt565_priv_data *)calloc(1, sizeof(
225225
struct tt565_priv_data));
226226

227-
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
227+
if (!STATE(rig)->priv) { return -RIG_ENOMEM; } /* no memory available */
228228

229-
priv = rig->state.priv;
229+
priv = STATE(rig)->priv;
230230

231231
memset(priv, 0, sizeof(struct tt565_priv_data));
232232
priv->ch = 0; /* set arbitrary initial status */
@@ -242,12 +242,12 @@ int tt565_init(RIG *rig)
242242
*/
243243
int tt565_cleanup(RIG *rig)
244244
{
245-
if (rig->state.priv)
245+
if (STATE(rig)->priv)
246246
{
247-
free(rig->state.priv);
247+
free(STATE(rig)->priv);
248248
}
249249

250-
rig->state.priv = NULL;
250+
STATE(rig)->priv = NULL;
251251

252252
return RIG_OK;
253253
}
@@ -274,11 +274,11 @@ int tt565_open(RIG *rig)
274274
if (!strstr(buf, "1."))
275275
{
276276
/* Not v1 means probably v2 */
277-
memcpy(&rig->state.str_cal, &cal2, sizeof(cal_table_t));
277+
memcpy(&STATE(rig)->str_cal, &cal2, sizeof(cal_table_t));
278278
}
279279
else
280280
{
281-
memcpy(&rig->state.str_cal, &cal1, sizeof(cal_table_t));
281+
memcpy(&STATE(rig)->str_cal, &cal1, sizeof(cal_table_t));
282282
}
283283

284284
return RIG_OK;
@@ -296,7 +296,7 @@ int tt565_open(RIG *rig)
296296
*/
297297
static char which_receiver(const RIG *rig, vfo_t vfo)
298298
{
299-
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
299+
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
300300

301301
if (vfo == RIG_VFO_CURR)
302302
{
@@ -325,7 +325,7 @@ static char which_receiver(const RIG *rig, vfo_t vfo)
325325
*/
326326
static char which_vfo(const RIG *rig, vfo_t vfo)
327327
{
328-
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
328+
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
329329

330330
if (vfo == RIG_VFO_CURR)
331331
{
@@ -353,7 +353,7 @@ static char which_vfo(const RIG *rig, vfo_t vfo)
353353
* \param freq
354354
* \brief Set a frequence into the specified VFO
355355
*
356-
* assumes rig->state.priv!=NULL
356+
* assumes STATE(rig)->priv!=NULL
357357
* \n assumes priv->mode in AM,CW,LSB or USB.
358358
*/
359359

@@ -373,7 +373,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
373373

374374
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
375375
{
376-
this_range = rig->state.rx_range_list[i];
376+
this_range = STATE(rig)->rx_range_list[i];
377377

378378
if (this_range.startf == 0 && this_range.endf == 0)
379379
{
@@ -382,7 +382,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
382382

383383
/* We don't care about mode setting, but vfo must match. */
384384
if (freq >= this_range.startf && freq <= this_range.endf &&
385-
(this_range.vfo == rig->state.current_vfo))
385+
(this_range.vfo == STATE(rig)->current_vfo))
386386
{
387387
in_range = TRUE;
388388
break;
@@ -481,7 +481,7 @@ int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
481481
*/
482482
int tt565_set_vfo(RIG *rig, vfo_t vfo)
483483
{
484-
struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
484+
struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
485485

486486
if (vfo == RIG_VFO_CURR)
487487
{
@@ -510,7 +510,7 @@ int tt565_set_vfo(RIG *rig, vfo_t vfo)
510510
*/
511511
int tt565_get_vfo(RIG *rig, vfo_t *vfo)
512512
{
513-
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
513+
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
514514

515515
*vfo = priv->vfo_curr;
516516

@@ -1783,7 +1783,7 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
17831783
*/
17841784
int tt565_set_mem(RIG *rig, vfo_t vfo, int ch)
17851785
{
1786-
struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
1786+
struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
17871787

17881788
priv->ch = ch; /* See RIG_OP_TO/FROM_VFO */
17891789
return RIG_OK;
@@ -1798,7 +1798,7 @@ int tt565_set_mem(RIG *rig, vfo_t vfo, int ch)
17981798
*/
17991799
int tt565_get_mem(RIG *rig, vfo_t vfo, int *ch)
18001800
{
1801-
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
1801+
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
18021802

18031803
*ch = priv->ch;
18041804
return RIG_OK;
@@ -1820,7 +1820,7 @@ int tt565_get_mem(RIG *rig, vfo_t vfo, int *ch)
18201820
*/
18211821
int tt565_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
18221822
{
1823-
const struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv;
1823+
const struct tt565_priv_data *priv = (struct tt565_priv_data *)STATE(rig)->priv;
18241824
char cmdbuf[TT565_BUFSIZE];
18251825
int retval;
18261826

0 commit comments

Comments
 (0)