* abstract 64bit int format type to cope with portability issues.

introduce PRIll (printf format) and SCNll (scanf) in misc.h.
  This needs to have config.h included beforehand.
* do likewise with freq_t type (double) in rig.h
  FREQFMT is deprecated.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1903 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.4
Stéphane Fillod, F8CFE 2005-01-24 23:04:35 +00:00
rodzic f66acc1bb4
commit 23369a0c25
21 zmienionych plików z 117 dodań i 90 usunięć

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Alinco backend - main file
* Copyright (c) 2001-2004 by Stephane Fillod
* Copyright (c) 2001-2005 by Stephane Fillod
*
* $Id: alinco.c,v 1.24 2004-09-26 08:34:53 fillods Exp $
* $Id: alinco.c,v 1.25 2005-01-24 23:03:25 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
@ -254,7 +254,7 @@ int alinco_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
/* extract RX freq */
freqbuf[16] = '\0';
sscanf(freqbuf+6, "%"FREQFMT, freq);
sscanf(freqbuf+6, "%"SCNfreq, freq);
return RIG_OK;
}
@ -431,7 +431,7 @@ int alinco_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
/* extract TX freq first, as RX kills freqbuf[16] */
freqbuf[26] = '\0';
sscanf(freqbuf+16, "%"FREQFMT, tx_freq);
sscanf(freqbuf+16, "%"SCNfreq, tx_freq);
return RIG_OK;
}

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - main file
* Copyright (c) 2000-2004 by Stephane Fillod
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: aor.c,v 1.29 2004-09-07 20:40:20 fillods Exp $
* $Id: aor.c,v 1.30 2005-01-24 23:03:51 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
@ -128,7 +128,7 @@ int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
lowhz = 100;
f = f*100 + lowhz;
freq_len = sprintf(freqbuf,"RF%010lld" EOM, f);
freq_len = sprintf(freqbuf,"RF%010"PRIll EOM, f);
retval = aor_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
if (retval != RIG_OK)
@ -146,7 +146,6 @@ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char *rfp;
int freq_len, retval;
unsigned char freqbuf[BUFSZ];
long long f;
retval = aor_transaction (rig, "RX" EOM, 3, freqbuf, &freq_len);
if (retval != RIG_OK)
@ -159,8 +158,7 @@ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return -RIG_EPROTO;
}
sscanf(rfp+2,"%lld", &f);
*freq = f;
sscanf(rfp+2,"%"SCNfreq, &freq);
return RIG_OK;
}

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - AR3000 description
* Copyright (c) 2000-2004 by Stephane Fillod
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: ar3000.c,v 1.5 2004-09-07 20:37:41 fillods Exp $
* $Id: ar3000.c,v 1.6 2005-01-24 23:03:52 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
@ -264,7 +264,7 @@ int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rfp = strchr(freqbuf, 'Y');
if (!rfp)
return -RIG_EPROTO;
sscanf(rfp+1,"%"FREQFMT, freq);
sscanf(rfp+1,"%"SCNfreq, freq);
*freq *= 10;
return RIG_OK;

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib AOR backend - AR3030 description
* Copyright (c) 2000-2004 by Stephane Fillod
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: ar3030.c,v 1.6 2004-09-07 20:37:41 fillods Exp $
* $Id: ar3030.c,v 1.7 2005-01-24 23:03:52 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
@ -347,7 +347,7 @@ int ar3030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rfp = strchr(freqbuf, 'F');
if (!rfp)
return -RIG_EPROTO;
sscanf(rfp+1,"%"FREQFMT, freq);
sscanf(rfp+1,"%"SCNfreq, freq);
return RIG_OK;
}
@ -585,7 +585,7 @@ int ar3030_get_channel(RIG *rig, channel_t *chan)
return RIG_OK;
}
sscanf(infobuf+14,"%"FREQFMT, &chan->freq);
sscanf(infobuf+14,"%"SCNfreq, &chan->freq);
chan->freq *= 10;
switch (infobuf[22]) {

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Rotator backend - SDR-1000
* Copyright (c) 2003-2004 by Stephane Fillod
* Copyright (c) 2003-2005 by Stephane Fillod
*
* $Id: sdr1k.c,v 1.7 2004-10-02 20:37:24 fillods Exp $
* $Id: sdr1k.c,v 1.8 2005-01-24 23:03:53 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
@ -122,7 +122,7 @@ const struct rig_caps sdr1k_rig_caps = {
.rig_model = RIG_MODEL_SDR1000,
.model_name = "SDR-1000",
.mfg_name = "Flex-radio",
.version = "0.1.2",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_NEW,
.rig_type = RIG_TYPE_TUNER,
@ -275,7 +275,7 @@ static int set_band(RIG *rig, freq_t freq)
ret = write_latch (rig, L_BAND, 1 << band, 0x3f);
rig_debug(RIG_DEBUG_VERBOSE, "%s %lld band %d\n", __FUNCTION__, (long long)freq, band);
rig_debug(RIG_DEBUG_VERBOSE, "%s %"PRIll" band %d\n", __FUNCTION__, (long long)freq, band);
return ret;
}
@ -309,7 +309,7 @@ int sdr1k_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
else
frqval = freq;
rig_debug(RIG_DEBUG_VERBOSE, "%s curr %lld frqval %lld\n", __FUNCTION__, (long long)freq, (long long)frqval);
rig_debug(RIG_DEBUG_VERBOSE, "%s curr %"PRIll" frqval %"PRIll"\n", __FUNCTION__, (long long)freq, (long long)frqval);
if (priv->dds_freq == frqval) {
return RIG_OK;
@ -346,7 +346,7 @@ int sdr1k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv;
*freq = priv->dds_freq;
rig_debug(RIG_DEBUG_TRACE,"%s: %lld\n", __FUNCTION__, (long long)priv->dds_freq);
rig_debug(RIG_DEBUG_TRACE,"%s: %"PRIll"\n", __FUNCTION__, (long long)priv->dds_freq);
return RIG_OK;
}

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - API header
* Copyright (c) 2000-2004 by Stephane Fillod and Frank Singleton
*
* $Id: rig.h,v 1.100 2004-09-25 14:31:38 fillods Exp $
* $Id: rig.h,v 1.101 2005-01-24 23:03:22 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
@ -252,7 +252,11 @@ typedef enum {
* Frequency type unit in Hz, able to hold SHF frequencies.
*/
typedef double freq_t;
#define FREQFMT "lf"
/** \brief printf(3) format to be used for freq_t type */
#define PRIfreq "f"
/** \brief scanf(3) format to be used for freq_t type */
#define SCNfreq "lf"
#define FREQFMT SCNfreq
/**
* \brief Short frequency type
@ -579,7 +583,7 @@ enum rig_level_e {
/*!< These ones are not settable */
RIG_LEVEL_RAWSTR = (1<<26),/*!< Raw (A/D) value for signal strength, specific to each rig, arg int */
RIG_LEVEL_SQLSTAT = (1<<27),/*!< SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */
RIG_LEVEL_SWR = (1<<28),/*!< SWR, arg float */
RIG_LEVEL_SWR = (1<<28),/*!< SWR, arg float [0.0..infinite] */
RIG_LEVEL_ALC = (1<<29),/*!< ALC, arg float */
RIG_LEVEL_STRENGTH = (1<<30) /*!< Effective (calibrated) signal strength relative to S9, arg int (dB) */
/*RIG_LEVEL_BWC = (1<<31)*/ /*!< Bandwidth Control, arg int (Hz) */

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib JRC backend - main file
* Copyright (c) 2001-2004 by Stephane Fillod
* Copyright (c) 2001-2005 by Stephane Fillod
*
* $Id: jrc.c,v 1.19 2004-09-26 08:35:03 fillods Exp $
* $Id: jrc.c,v 1.20 2005-01-24 23:03:58 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
@ -139,7 +139,6 @@ int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv;
int freq_len, retval;
char freqbuf[BUFSZ];
long long f;
//note: JRCs use "I" to get information
retval = jrc_transaction (rig, "I" EOM, 2, freqbuf, &freq_len);
@ -155,8 +154,7 @@ int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
freqbuf[4+priv->max_freq_len] = '\0';
/* extract freq */
sscanf(freqbuf+4, "%llu", &f);
*freq = f;
sscanf(freqbuf+4, "%"SCNfreq, freq);
return RIG_OK;
}
@ -1347,12 +1345,10 @@ int jrc_decode_event(RIG *rig)
*/
if (rig->callbacks.freq_event) {
long long f;
//buf[14] = '\0'; /* side-effect: destroy AGC first digit! */
buf[4+priv->max_freq_len] = '\0'; /* side-effect: destroy AGC first digit! */
sscanf(buf+4, "%lld", &f);
freq = f;
sscanf(buf+4, "%"SCNfreq, &freq);
return rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq,
rig->callbacks.freq_arg);
}

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Kenwood backend - TH handheld primitives
* Copyright (c) 2001-2003 by Stephane Fillod
* Copyright (c) 2001-2005 by Stephane Fillod
*
* $Id: th.c,v 1.25 2004-12-28 12:58:51 f4dwv Exp $
* $Id: th.c,v 1.26 2005-01-24 23:04:03 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
@ -81,7 +81,7 @@ th_decode_event (RIG *rig)
rmode_t mode;
int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
retval = sscanf(asyncbuf, "BUF %d,%"FREQFMT",%d,%d,%d,%d,%d,,%d,,%d,%"FREQFMT",%d",
retval = sscanf(asyncbuf, "BUF %d,%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq",%d",
&vfo, &freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq, &offset, &mode);
@ -1162,7 +1162,7 @@ int th_get_channel(RIG *rig, channel_t *chan)
return retval;
strcpy(scf,req);
strcat(scf,",%"FREQFMT",%d,%d,%d,%d,%d,,%d,,%d,%"FREQFMT);
strcat(scf,",%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq);
retval = sscanf(ackbuf, scf,
&freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq, &offset);
@ -1207,7 +1207,7 @@ int th_get_channel(RIG *rig, channel_t *chan)
retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len);
if (retval == RIG_OK) {
strcpy(scf,req);
strcat(scf,",%"FREQFMT",%d");
strcat(scf,",%"SCNfreq",%d");
retval = sscanf(ackbuf, scf, &freq, &step);
chan->tx_freq=freq;
}

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Kenwood backend - TH-G71 description
* Copyright (c) 2003-2004 by Stephane Fillod
* Copyright (c) 2003-2005 by Stephane Fillod
*
* $Id: thg71.c,v 1.14 2004-12-06 22:16:55 f4dwv Exp $
* $Id: thg71.c,v 1.15 2005-01-24 23:04:16 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
@ -199,7 +199,7 @@ int thg71_decode_event (RIG *rig)
freq_t freq, offset;
int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
retval = sscanf(asyncbuf, "BUF 0,%"FREQFMT",%d,%d,%d,%d,%d,,%d,,%d,%"FREQFMT,
retval = sscanf(asyncbuf, "BUF 0,%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq,
&freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq, &offset);
if (retval != 11) {
@ -207,7 +207,7 @@ int thg71_decode_event (RIG *rig)
return -RIG_ERJCTED;
}
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"FREQFMT" Hz, mode %d)\n", __FUNCTION__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"PRIfreq" Hz, mode %d)\n", __FUNCTION__, freq);
/* Callback execution */
if (rig->callbacks.vfo_event) {
@ -311,7 +311,7 @@ int thg71_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (retval != RIG_OK)
return retval;
sscanf(ackbuf,"FQ %"FREQFMT",%d",&freq,&step);
sscanf(ackbuf,"FQ %"SCNfreq",%d",&freq,&step);
if(freq <MHz(136) ) {
*mode=RIG_MODE_AM;

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib Kenwood backend - TM-V7 description
* Copyright (c) 2004 by Stephane Fillod
* Copyright (c) 2004-2005 by Stephane Fillod
*
* $Id: tmv7.c,v 1.7 2004-12-28 12:59:41 f4dwv Exp $
* $Id: tmv7.c,v 1.8 2005-01-24 23:04:16 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
@ -229,7 +229,7 @@ int tmv7_decode_event (RIG *rig)
freq_t freq, offset;
int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
retval = sscanf(asyncbuf, "BUF 0,%"FREQFMT",%d,%d,%d,%d,%d,,%d,,%d,%"FREQFMT,
retval = sscanf(asyncbuf, "BUF 0,%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq,
&freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq, &offset);
if (retval != 11) {
@ -237,7 +237,7 @@ int tmv7_decode_event (RIG *rig)
return -RIG_ERJCTED;
}
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"FREQFMT" Hz, mode %d)\n", __FUNCTION__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"PRIfreq" Hz, mode %d)\n", __FUNCTION__, freq);
/* Callback execution */
if (rig->callbacks.vfo_event) {
@ -401,7 +401,7 @@ int tmv7_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (retval != RIG_OK)
return retval;
sscanf(ackbuf,"FQ %"FREQFMT",%d",&freq,&step);
sscanf(ackbuf,"FQ %"SCNfreq",%d",&freq,&step);
if(freq <MHz(137) ) {
*mode=RIG_MODE_AM;
@ -473,7 +473,7 @@ int tmv7_get_channel(RIG *rig, channel_t *chan)
return retval;
strcpy(scf,req);
strcat(scf,",%"FREQFMT",%d,%d,%d,%d,0,%d,%d,000,%d,,0");
strcat(scf,",%"SCNfreq",%d,%d,%d,%d,0,%d,%d,000,%d,,0");
retval = sscanf(ackbuf, scf,
&freq, &step, &shift, &rev, &tone,
&ctcss, &tonefq, &ctcssfq);
@ -515,7 +515,7 @@ int tmv7_get_channel(RIG *rig, channel_t *chan)
retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len);
if (retval == RIG_OK) {
strcpy(scf,req);
strcat(scf,",%"FREQFMT",%d");
strcat(scf,",%"SCNfreq",%d");
retval = sscanf(ackbuf, scf, &freq, &step);
chan->tx_freq=freq;
}

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib KIT backend - Sat-Schneider DRT1/SAD1 DRM receiver description
* Copyright (c) 2004 by Stephane Fillod
* Copyright (c) 2004-2005 by Stephane Fillod
*
* $Id: drt1.c,v 1.2 2004-11-27 13:40:58 fillods Exp $
* $Id: drt1.c,v 1.3 2005-01-24 23:04:16 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
@ -206,13 +206,13 @@ int drt1_set_conf(RIG *rig, token_t token, const char *val)
switch(token) {
case TOK_OSCFREQ:
sscanf(val, "%"FREQFMT, &priv->osc_freq);
sscanf(val, "%"SCNfreq, &priv->osc_freq);
break;
case TOK_REFMULT:
sscanf(val, "%d", &priv->ref_mult);
break;
case TOK_IFMIXFREQ:
sscanf(val, "%"FREQFMT, &priv->if_mix_freq);
sscanf(val, "%"SCNfreq, &priv->if_mix_freq);
break;
case TOK_PUMPCRNT:
sscanf(val, "%d", &priv->pump_crrnt);
@ -236,13 +236,13 @@ int drt1_get_conf(RIG *rig, token_t token, char *val)
switch(token) {
case TOK_OSCFREQ:
sprintf(val, "%"FREQFMT, priv->osc_freq);
sprintf(val, "%"PRIfreq, priv->osc_freq);
break;
case TOK_REFMULT:
sprintf(val, "%d", priv->ref_mult);
break;
case TOK_IFMIXFREQ:
sprintf(val, "%"FREQFMT, priv->if_mix_freq);
sprintf(val, "%"PRIfreq, priv->if_mix_freq);
break;
case TOK_PUMPCRNT:
sprintf(val, "%d", priv->pump_crrnt);

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib KIT backend - Elektor DRM receiver description
* Copyright (c) 2004 by Stephane Fillod
* Copyright (c) 2004-2005 by Stephane Fillod
*
* $Id: elektor304.c,v 1.4 2004-08-23 20:31:35 fillods Exp $
* $Id: elektor304.c,v 1.5 2005-01-24 23:04:21 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
@ -196,10 +196,10 @@ int elektor304_set_conf(RIG *rig, token_t token, const char *val)
switch(token) {
case TOK_OSCFREQ:
sscanf(val, "%"FREQFMT, &priv->osc_freq);
sscanf(val, "%"SCNfreq, &priv->osc_freq);
break;
case TOK_IFMIXFREQ:
sscanf(val, "%"FREQFMT, &priv->if_mix_freq);
sscanf(val, "%"SCNfreq, &priv->if_mix_freq);
break;
default:
return -RIG_EINVAL;
@ -220,10 +220,10 @@ int elektor304_get_conf(RIG *rig, token_t token, char *val)
switch(token) {
case TOK_OSCFREQ:
sprintf(val, "%"FREQFMT, priv->osc_freq);
sprintf(val, "%"PRIfreq, priv->osc_freq);
break;
case TOK_IFMIXFREQ:
sprintf(val, "%"FREQFMT, priv->if_mix_freq);
sprintf(val, "%"PRIfreq, priv->if_mix_freq);
break;
default:
return -RIG_EINVAL;

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - toolbox header
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: misc.h,v 1.17 2004-05-17 21:09:44 fillods Exp $
* $Id: misc.h,v 1.18 2005-01-24 23:03:25 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
@ -66,7 +66,36 @@ extern HAMLIB_EXPORT(int) sprintf_freq(char *str, freq_t);
/* check if it's any of CR or LF */
#define isreturn(c) ((c) == 10 || (c) == 13)
/* needs config.h included beforehand in .c file */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef PRId64
/** \brief printf(3) format to be used for long long (64bits) type */
#define PRIll PRId64
#else
#ifdef FBSD4
#define PRIll "qd"
#else
#define PRIll "lld"
#endif
#endif
#ifdef SCNd64
/** \brief scanf(3) format to be used for long long (64bits) type */
#define SCNll SCNd64
#else
#ifdef FBSD4
#define SCNll "qd"
#else
#define SCNll "lld"
#endif
#endif
__END_DECLS
#endif /* _MISC_H */

Wyświetl plik

@ -1,10 +1,10 @@
/*
* memcsv.c - (C) Stephane Fillod 2003-2004
* memcsv.c - (C) Stephane Fillod 2003-2005
*
* This program exercises the backup and restore of a radio
* using Hamlib. CSV primitives
*
* $Id: memcsv.c,v 1.5 2004-12-27 12:53:02 f4dwv Exp $
* $Id: memcsv.c,v 1.6 2005-01-24 23:04:21 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -291,7 +291,7 @@ void dump_csv_chan(const channel_cap_t *mem_caps, const channel_t *chan, FILE *f
fprintf(f,"%d;",chan->ant);
}
if (mem_caps->freq) {
fprintf(f,"%"FREQFMT";",chan->freq);
fprintf(f,"%"PRIfreq";",chan->freq);
}
if (mem_caps->mode) {
fprintf(f, "%s;", rig_strrmode(chan->mode));
@ -300,7 +300,7 @@ void dump_csv_chan(const channel_cap_t *mem_caps, const channel_t *chan, FILE *f
fprintf(f,"%d;",(int)chan->width);
}
if (mem_caps->tx_freq) {
fprintf(f,"%"FREQFMT";",chan->tx_freq);
fprintf(f,"%"PRIfreq";",chan->tx_freq);
}
if (mem_caps->tx_mode) {
fprintf(f, "%s;", rig_strrmode(chan->tx_mode));
@ -330,7 +330,7 @@ void dump_csv_chan(const channel_cap_t *mem_caps, const channel_t *chan, FILE *f
fprintf(f,"%d;",(int)chan->xit);
}
if (mem_caps->funcs) {
fprintf(f,"%llx;",(long long)chan->funcs);
fprintf(f,"%lx;",chan->funcs);
}
if (mem_caps->ctcss_tone) {
fprintf(f,"%d;",chan->ctcss_tone);

Wyświetl plik

@ -2,7 +2,7 @@
* memload.c - Copyright (C) 2003 Thierry Leconte
*
*
* $Id: memload.c,v 1.4 2004-05-17 21:09:45 fillods Exp $
* $Id: memload.c,v 1.5 2005-01-24 23:04:24 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -147,7 +147,7 @@ int set_chan(RIG *rig, channel_t *chan, xmlNodePtr node)
if (rig->state.chan_list[i].mem_caps.freq) {
prop=xmlGetProp(node, "freq");
if(prop!=NULL)
sscanf(prop,"%"FREQFMT,&chan->freq);
sscanf(prop,"%"SCNfreq,&chan->freq);
}
if (rig->state.chan_list[i].mem_caps.mode) {
prop=xmlGetProp(node, "mode");
@ -162,7 +162,7 @@ int set_chan(RIG *rig, channel_t *chan, xmlNodePtr node)
if (rig->state.chan_list[i].mem_caps.tx_freq) {
prop=xmlGetProp(node, "tx_freq");
if(prop!=NULL)
sscanf(prop,"%"FREQFMT,&chan->tx_freq);
sscanf(prop,"%"SCNfreq,&chan->tx_freq);
}
if (rig->state.chan_list[i].mem_caps.tx_mode) {
prop=xmlGetProp(node, "tx_mode");

Wyświetl plik

@ -1,11 +1,11 @@
/*
* rigctl.c - (C) Stephane Fillod 2000-2004
* rigctl.c - (C) Stephane Fillod 2000-2005
*
* This program test/control a radio using Hamlib.
* It takes commands in interactive mode as well as
* from command line options.
*
* $Id: rigctl.c,v 1.52 2004-10-02 10:33:21 fillods Exp $
* $Id: rigctl.c,v 1.53 2005-01-24 23:04:26 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -801,7 +801,7 @@ declare_proto_rig(set_freq)
{
freq_t freq;
sscanf(arg1, "%"FREQFMT, &freq);
sscanf(arg1, "%"SCNfreq, &freq);
return rig_set_freq(rig, vfo, freq);
}
@ -1038,7 +1038,7 @@ declare_proto_rig(set_split_freq)
{
freq_t txfreq;
sscanf(arg1, "%"FREQFMT, &txfreq);
sscanf(arg1, "%"SCNfreq, &txfreq);
return rig_set_split_freq(rig, vfo, txfreq);
}
@ -1149,7 +1149,7 @@ declare_proto_rig(power2mW)
printf("Power [0.0 .. 1.0]: ");
scanf("%f", &power);
printf("Frequency: ");
scanf("%"FREQFMT, &freq);
scanf("%"SCNfreq, &freq);
printf("Mode: ");
scanf("%d", &mode);
status = rig_power2mW(rig, &mwp, power, freq, mode);

Wyświetl plik

@ -31,7 +31,7 @@ int main (int argc, char *argv[])
}
printf("Little Endian mode\n");
printf("Frequency: %"FREQFMT"\n",f);
printf("Frequency: %"PRIfreq"\n",f);
to_bcd(b, f, digits);
printf("BCD: %2.2x",b[0]);
for (i = 1; i < (digits+1)/2; i++)
@ -39,7 +39,7 @@ int main (int argc, char *argv[])
printf("\nResult after recoding: %llu\n", from_bcd(b, digits));
printf("\nBig Endian mode\n");
printf("Frequency: %"FREQFMT"\n",f);
printf("Frequency: %"PRIfreq"\n",f);
to_bcd_be(b, f, digits);
printf("BCD: %2.2x",b[0]);
for (i = 1; i < (digits+1)/2; i++)

Wyświetl plik

@ -194,7 +194,7 @@ int main (int argc, char *argv[])
retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
if (retcode == RIG_OK ) {
printf("rig_get_freq: freq = %"FREQFMT"\n", freq);
printf("rig_get_freq: freq = %"PRIfreq"\n", freq);
} else {
printf("rig_get_freq: error = %s \n", rigerror(retcode));
}

Wyświetl plik

@ -14,7 +14,7 @@ int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg)
{
int *count_ptr = (int *) arg;
printf("Rig changed freq to %"FREQFMT"Hz\n", freq);
printf("Rig changed freq to %"PRIfreq"Hz\n", freq);
*count_ptr += 1;
return 0;

Wyświetl plik

@ -7,7 +7,7 @@
* The starting point for this code was Frank's ft847 implementation.
*
*
* $Id: ft100.c,v 1.14 2004-02-01 22:29:23 fillods Exp $
* $Id: ft100.c,v 1.15 2005-01-24 23:04:29 fillods Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -399,7 +399,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE,"ft100: requested freq = %"FREQFMT" Hz \n", freq);
rig_debug(RIG_DEBUG_VERBOSE,"ft100: requested freq = %"PRIfreq" Hz \n", freq);
rig_debug(RIG_DEBUG_VERBOSE,"ft100: vfo =%i \n", vfo);
if( ( vfo != RIG_VFO_CURR ) &&
@ -423,7 +423,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
to_bcd(p->p_cmd,freq,8); /* store bcd format in in p_cmd */
/* TODO -- fix 10Hz resolution -- FS */
rig_debug(RIG_DEBUG_VERBOSE,"ft100: requested freq after conversion = %"FREQFMT" Hz \n", from_bcd_be(p->p_cmd,8)* 10 );
rig_debug(RIG_DEBUG_VERBOSE,"ft100: requested freq after conversion = %"PRIfreq" Hz \n", from_bcd_be(p->p_cmd,8)* 10 );
cmd = p->p_cmd; /* get native sequence */
write_block(&rig_s->rigport, cmd, YAESU_CMD_LENGTH);
@ -465,7 +465,7 @@ int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
d1=strtol(freq_str,NULL,16);
d2=(d1*1.25); /* fixed 10Hz bug by OH2MMY */
rig_debug(RIG_DEBUG_VERBOSE,"ft100: d1=%"FREQFMT" d2=%"FREQFMT"\n",d1,d2);
rig_debug(RIG_DEBUG_VERBOSE,"ft100: d1=%"PRIfreq" d2=%"PRIfreq"\n",d1,d2);
sprintf(sfreq,"%8lli",(long long)d2);

Wyświetl plik

@ -7,7 +7,7 @@
* via serial interface to an FT-990 using the "CAT" interface
*
*
* $Id: ft990.c,v 1.13 2004-09-26 17:36:42 fillods Exp $
* $Id: ft990.c,v 1.14 2005-01-24 23:04:35 fillods Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -403,7 +403,7 @@ int ft990_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
return -RIG_EINVAL;
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"FREQFMT" Hz\n", __func__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
// Frequency range sanity check
if (freq < 100000 || freq > 30000000)
@ -503,7 +503,7 @@ int ft990_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
rig_debug(RIG_DEBUG_TRACE, "%s: p0=0x%02x p1=0x%02x p2=0x%02x\n",
__func__, p[0], p[1], p[2]);
rig_debug(RIG_DEBUG_TRACE,
"%s: freq = %"FREQFMT" Hz for vfo 0x%02x\n", __func__, f, vfo);
"%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo);
// Frequency sanity check
if (f<100000 || f>30000000)
@ -2620,7 +2620,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) {
return -RIG_EINVAL;
rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"FREQFMT" Hz\n", __func__, freq);
rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq);
priv = (struct ft990_priv_data *)rig->state.priv;