Add new method for debugging calling functions -- need to test with multiple compilers to see if it compiles OK

pull/875/head
Mike Black W9MDB 2021-11-08 10:19:12 -06:00
rodzic 3b927a81eb
commit 5eb169edc1
2 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -1732,12 +1732,23 @@ int HAMLIB_API rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t selection,
return RIG_OK;
}
static char *funcname = "Unknown";
static int linenum = 0;
#undef vfo_fixup
vfo_t HAMLIB_API vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, const char *func, int line)
{
funcname = (char*)func;
linenum = line;
return vfo_fixup(rig,vfo,split);
}
// we're mappping our VFO here to work with either VFO A/B rigs or Main/Sub
// Hamlib uses VFO_A and VFO_B as TX/RX as of 2021-04-13
// So we map these to Main/Sub as required
vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
{
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, vfo_curr=%s\n", __func__,
rig_debug(RIG_DEBUG_TRACE, "%s(from %s:%d): vfo=%s, vfo_curr=%s\n", __func__, funcname, linenum,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
if (vfo == RIG_VFO_CURR)

Wyświetl plik

@ -107,6 +107,8 @@ extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t usec);
extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag);
extern HAMLIB_EXPORT(vfo_t) vfo_fixup(RIG *rig, vfo_t vfo, split_t split);
extern HAMLIB_EXPORT(vfo_t) vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, const char *func, int line);
#define vfo_fixup(r,v,s) vfo_fixup2a(r,v,s,__builtin_FUNCTION(),__LINE__)
extern HAMLIB_EXPORT(int) parse_hoststr(char *hoststr, char host[256], char port[6]);