2021-01-20 16:46:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <hamlib/rig.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
printf("Check rig_caps offsets\n");
|
2021-12-27 15:03:34 +00:00
|
|
|
printf("If changed will break shared library API\n");
|
2021-01-20 16:46:07 +00:00
|
|
|
RIG *rig;
|
|
|
|
int retcode = 0;
|
|
|
|
rig_set_debug_level(RIG_DEBUG_NONE);
|
|
|
|
rig = rig_init(1);
|
|
|
|
void *p1 = &rig->state.rigport;
|
|
|
|
void *p2 = &rig->state.vfo_list;
|
|
|
|
unsigned long offset = p2 - p1;
|
2021-03-03 14:21:52 +00:00
|
|
|
printf("offset vfo_list=%lu -- this is the important one\n", offset);
|
2021-01-21 18:04:46 +00:00
|
|
|
#if defined(WIN64) || defined (_WIN64) || defined (__WIN64__)
|
2021-01-21 15:36:46 +00:00
|
|
|
int expected = 13264; // mingw64
|
2021-01-21 18:04:46 +00:00
|
|
|
#elif defined(WIN32) || defined (_WIN32) || defined(__WIN32__)
|
|
|
|
int expected = 10144; // mingw32
|
2021-01-21 15:36:46 +00:00
|
|
|
#else
|
2021-12-27 15:03:34 +00:00
|
|
|
int expected = 13328; // should be most 64-bit compilers
|
2021-01-21 15:36:46 +00:00
|
|
|
#endif
|
2021-01-22 16:41:30 +00:00
|
|
|
|
|
|
|
if (offset == 9384) { expected = 9384; } // 32-bit Intel
|
|
|
|
|
|
|
|
if (offset == 10144) { expected = 10144; } // 32-bit Arm
|
2021-01-21 15:36:46 +00:00
|
|
|
|
|
|
|
if (offset != expected)
|
2021-01-20 16:46:07 +00:00
|
|
|
{
|
|
|
|
printf("offset of vfo_list has changed!!!\n");
|
2021-01-21 15:36:46 +00:00
|
|
|
printf("was %d, now %lu\n", expected, offset);
|
2021-01-20 16:46:07 +00:00
|
|
|
retcode = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
p2 = &rig->state.power_max;
|
|
|
|
offset = p2 - p1;
|
2021-02-28 18:43:23 +00:00
|
|
|
printf("offset power_max=%lu\n", offset);
|
2021-01-20 16:46:07 +00:00
|
|
|
|
2021-01-21 18:04:46 +00:00
|
|
|
#if defined(WIN64) || defined (_WIN64) || defined (__WIN64__)
|
2021-01-21 15:36:46 +00:00
|
|
|
expected = 13664; // mingw64
|
2021-01-21 18:04:46 +00:00
|
|
|
#elif defined(WIN32) || defined (_WIN32) || defined(__WIN32__)
|
|
|
|
expected = 10448; // mingw32
|
2021-01-21 15:36:46 +00:00
|
|
|
#else
|
2021-12-27 15:03:34 +00:00
|
|
|
expected = 14188;
|
2021-01-21 15:36:46 +00:00
|
|
|
#endif
|
2021-01-22 16:41:30 +00:00
|
|
|
|
|
|
|
if (offset == 9676) { expected = 9676; } // 32-bit Intel
|
|
|
|
|
|
|
|
if (offset == 10448) { expected = 10448; } // 32-bit Arm
|
2021-01-21 15:36:46 +00:00
|
|
|
|
|
|
|
if (offset != expected)
|
2021-01-20 16:46:07 +00:00
|
|
|
{
|
2021-03-03 14:21:52 +00:00
|
|
|
printf("Warning...offset of power_max has changed!!!\n");
|
2021-01-21 15:36:46 +00:00
|
|
|
printf("was %d, now %lu\n", expected, offset);
|
2021-12-27 15:03:34 +00:00
|
|
|
retcode = 2;
|
|
|
|
}
|
|
|
|
if (retcode == 0)
|
|
|
|
{
|
|
|
|
printf("Offsets are OK (i.e. have not changed)\n");
|
2021-01-20 16:46:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return retcode;
|
|
|
|
}
|