Fix lua bindings for 64-bit compilation

Tested on swig 4.0.1 and lua 5.3.5
pull/183/head
Michael Black 2020-01-19 11:15:44 -06:00
rodzic fcbb386fcd
commit 09b5d87449
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
3 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -333,6 +333,11 @@ Additionally, you may want to add the '--with-perl-binding' or
'--with-python-binding' or '--with-tcl-binding' or '--with-lua-binding' if you are
interested in SWIG binding support for those scripting languages.
For LUA bindinds if you run "lua luatest.lua" and see this error message:
luatest.lua:44: Error in Rig::set_mode (arg 2), expected 'rmode_t' got 'string'
This means you need to upgrade both swig and lua for 64-bit lua support
This is known to work on swig 4.0.1 and lua 5.3.5
NOTE: The bootstrap script has only to be run the first time after a fresh
checkout or when a Makefile.am or other build file is modified or added.

Wyświetl plik

@ -112,6 +112,9 @@ function doStartup()
if sw2 > 0 then D = 'S' else D = 'N' end
print(string.format("Latitude:\t%4.4f, %4.0f° %.0f' %2.0f\" %1s\trecoded: %9.4f", lat1, deg2, mins2, sec2, D, lat3))
print(string.format("The next two lines should show 0x8000000000000000"));
print(string.format("RIG_MODE_TESTS_MAX: 0x%08x", Hamlib.RIG_MODE_TESTS_MAX));
print(string.format("RIG_FUNC_BIT63: 0x%08x", Hamlib.RIG_FUNC_BIT63));
end

Wyświetl plik

@ -85,11 +85,13 @@
double-precision floating point type internally for number
representations (max 53 bits of precision) so makes a string
constant from a constant number literal using ull */
/* #define CONSTANT_64BIT_FLAG(BIT) (1 << (BIT)) */
// #define CONSTANT_64BIT_FLAG(BIT) (1 << (BIT))
// #define SWIGLUAHIDE
/* But this appears to have been fixed so we'll use the correct one now
If you have the older version of SWIG comment out this line and use
the one above */
#define CONSTANT_64BIT_FLAG(BIT) (1ull << (BIT))
the two above */
// This 1ul definition works on swig 4.0.1 and lua 5.3.5
#define CONSTANT_64BIT_FLAG(BIT) (1ul << (BIT))
#endif
__BEGIN_DECLS
@ -872,8 +874,8 @@ typedef uint64_t setting_t;
#define RIG_FUNC_TBURST CONSTANT_64BIT_FLAG (29) /*!< \c TBURST -- 1750 Hz tone burst */
#define RIG_FUNC_TUNER CONSTANT_64BIT_FLAG (30) /*!< \c TUNER -- Enable automatic tuner */
#define RIG_FUNC_XIT CONSTANT_64BIT_FLAG (31) /*!< \c XIT -- Transmitter Incremental Tuning */
#ifndef SWIGLUA
/* Hide the top 32 bits from the Lua binding as they can't be represented */
#ifndef SWIGLUAHIDE
/* Hide the top 32 bits from the old Lua binding as they can't be represented */
#define RIG_FUNC_NB2 CONSTANT_64BIT_FLAG (32) /*!< \c NB2 -- 2nd Noise Blanker */
#define RIG_FUNC_CSQL CONSTANT_64BIT_FLAG (33) /*!< \c CSQL -- DCS Squelch setting */
#define RIG_FUNC_AFLT CONSTANT_64BIT_FLAG (34) /*!< \c AFLT -- AF Filter setting */
@ -964,7 +966,7 @@ typedef uint64_t rmode_t;
#define RIG_MODE_AMN CONSTANT_64BIT_FLAG (29) /*!< \c AM-N -- Narrow band AM mode IC-R30 */
#define RIG_MODE_PSK CONSTANT_64BIT_FLAG (30) /*!< \c PSK - Kenwood PSK and others */
#define RIG_MODE_PSKR CONSTANT_64BIT_FLAG (31) /*!< \c PSKR - Kenwood PSKR and others */
#ifndef SWIGLUA
#ifndef SWIGLUAHIDE
/* hide the top 32 bits from the Lua binding as they will not work */
#define RIG_MODE_DD CONSTANT_64BIT_FLAG (32) /*!< \c DD Mode IC-9700 */
#define RIG_MODE_C4FM CONSTANT_64BIT_FLAG (33) /*!< \c Yaesu C4FM mode */