2021-01-20 16:46:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <hamlib/rig.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
printf("Check rig_caps offsets\n");
|
|
|
|
printf("If changed can affect shared library API\n");
|
|
|
|
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;
|
|
|
|
printf("offset vfo_list=%ld\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
|
|
|
|
int expected = 13280; // should be most 64-bit compilers
|
|
|
|
#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;
|
|
|
|
printf("offset power_max=%ld\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
|
|
|
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-01-20 16:46:07 +00:00
|
|
|
expected = 13696;
|
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
|
|
|
{
|
|
|
|
printf("offset of power_max 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retcode;
|
|
|
|
}
|