More portable debug method -- should work on any compiler

pull/875/head
Mike Black W9MDB 2021-11-08 10:28:28 -06:00
rodzic 5eb169edc1
commit b17d681fc2
3 zmienionych plików z 15 dodań i 5 usunięć

Wyświetl plik

@ -147,6 +147,16 @@ int main(int argc, char *argv[])
if (n <= 0) { perror("ID"); }
}
else if (strcmp(buf, "AI;") == 0)
{
printf("%s\n", buf);
usleep(50 * 1000);
snprintf(buf, sizeof(buf), "AI0;");
n = write(fd, buf, strlen(buf));
printf("n=%d\n", n);
if (n <= 0) { perror("ID"); }
}
#if 0
else if (strncmp(buf, "AI", 2) == 0)

Wyświetl plik

@ -1739,7 +1739,7 @@ static int linenum = 0;
vfo_t HAMLIB_API vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, const char *func, int line)
{
funcname = (char*)func;
linenum = line;
linenum = (int)line;
return vfo_fixup(rig,vfo,split);
}
@ -1748,8 +1748,8 @@ vfo_t HAMLIB_API vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, const char *fun
// 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(from %s:%d): vfo=%s, vfo_curr=%s\n", __func__, funcname, linenum,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
rig_debug(RIG_DEBUG_TRACE, "%s:(from %s:%d) vfo=%s, vfo_curr=%s, split=%d\n", __func__, funcname, linenum,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo), split);
if (vfo == RIG_VFO_CURR)
{

Wyświetl plik

@ -107,8 +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(vfo_t) vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split, const char *func, const int line);
#define vfo_fixup(r,v,s) vfo_fixup2a(r,v,s,__func__,__LINE__)
extern HAMLIB_EXPORT(int) parse_hoststr(char *hoststr, char host[256], char port[6]);