mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
rename typedef struct pm3_device
This commit is contained in:
parent
bae5362656
commit
5fce6271ee
9 changed files with 4081 additions and 3919 deletions
|
@ -542,7 +542,7 @@ bool IsCommunicationThreadDead(void) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) {
|
||||
bool OpenProxmark(pm3_device_t **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) {
|
||||
|
||||
if (!wait_for_port) {
|
||||
PrintAndLogEx(INFO, "Using UART port " _YELLOW_("%s"), port);
|
||||
|
@ -593,7 +593,7 @@ bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout,
|
|||
|
||||
fflush(stdout);
|
||||
if (*dev == NULL) {
|
||||
*dev = calloc(sizeof(pm3_device), sizeof(uint8_t));
|
||||
*dev = calloc(sizeof(pm3_device_t), sizeof(uint8_t));
|
||||
}
|
||||
(*dev)->g_conn = &g_conn; // TODO g_conn shouldn't be global
|
||||
return true;
|
||||
|
@ -601,7 +601,7 @@ bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout,
|
|||
}
|
||||
|
||||
// check if we can communicate with Pm3
|
||||
int TestProxmark(pm3_device *dev) {
|
||||
int TestProxmark(pm3_device_t *dev) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
uint16_t len = 32;
|
||||
|
@ -664,7 +664,7 @@ int TestProxmark(pm3_device *dev) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void CloseProxmark(pm3_device *dev) {
|
||||
void CloseProxmark(pm3_device_t *dev) {
|
||||
dev->g_conn->run = false;
|
||||
|
||||
#ifdef __BIONIC__
|
||||
|
|
|
@ -63,11 +63,10 @@ typedef struct {
|
|||
|
||||
extern communication_arg_t g_conn;
|
||||
|
||||
typedef struct pm3_device pm3_device;
|
||||
struct pm3_device {
|
||||
typedef struct pm3_device {
|
||||
communication_arg_t *g_conn;
|
||||
int script_embedded;
|
||||
};
|
||||
} pm3_device_t;
|
||||
|
||||
void *uart_receiver(void *targ);
|
||||
void SendCommandBL(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
|
||||
|
@ -78,10 +77,9 @@ void clearCommandBuffer(void);
|
|||
|
||||
#define FLASHMODE_SPEED 460800
|
||||
bool IsCommunicationThreadDead(void);
|
||||
typedef struct pm3_device pm3_device;
|
||||
bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed);
|
||||
int TestProxmark(pm3_device *dev);
|
||||
void CloseProxmark(pm3_device *dev);
|
||||
bool OpenProxmark(pm3_device_t **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed);
|
||||
int TestProxmark(pm3_device_t *dev);
|
||||
void CloseProxmark(pm3_device_t *dev);
|
||||
|
||||
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning);
|
||||
bool WaitForResponseTimeout(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "util_posix.h"
|
||||
#include "comms.h"
|
||||
|
||||
pm3_device *pm3_open(char *port) {
|
||||
pm3_device_t *pm3_open(char *port) {
|
||||
pm3_init();
|
||||
OpenProxmark(&g_session.current_device, port, false, 20, false, USART_BAUD_RATE);
|
||||
if (g_session.pm3_present && (TestProxmark(g_session.current_device) != PM3_SUCCESS)) {
|
||||
|
@ -30,7 +30,7 @@ pm3_device *pm3_open(char *port) {
|
|||
return g_session.current_device;
|
||||
}
|
||||
|
||||
void pm3_close(pm3_device *dev) {
|
||||
void pm3_close(pm3_device_t *dev) {
|
||||
// Clean up the port
|
||||
if (g_session.pm3_present) {
|
||||
clearCommandBuffer();
|
||||
|
@ -40,16 +40,16 @@ void pm3_close(pm3_device *dev) {
|
|||
}
|
||||
}
|
||||
|
||||
int pm3_console(pm3_device *dev, char *Cmd) {
|
||||
int pm3_console(pm3_device_t *dev, char *Cmd) {
|
||||
// For now, there is no real device context:
|
||||
(void) dev;
|
||||
return CommandReceived(Cmd);
|
||||
}
|
||||
|
||||
const char *pm3_name_get(pm3_device *dev) {
|
||||
const char *pm3_name_get(pm3_device_t *dev) {
|
||||
return dev->g_conn->serial_port_name;
|
||||
}
|
||||
|
||||
pm3_device *pm3_get_current_dev(void) {
|
||||
pm3_device_t *pm3_get_current_dev(void) {
|
||||
return g_session.current_device;
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ typedef struct {
|
|||
%extend {
|
||||
pm3() {
|
||||
// printf("SWIG pm3 constructor, get current pm3\n");
|
||||
pm3_device * p = pm3_get_current_dev();
|
||||
pm3_device_t * p = pm3_get_current_dev();
|
||||
p->script_embedded = 1;
|
||||
return p;
|
||||
}
|
||||
pm3(char *port) {
|
||||
// printf("SWIG pm3 constructor with port, open pm3\n");
|
||||
pm3_device * p = pm3_open(port);
|
||||
pm3_device_t * p = pm3_open(port);
|
||||
p->script_embedded = 0;
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This file was automatically generated by SWIG (http://www.swig.org).
|
||||
# Version 4.0.1
|
||||
# Version 4.0.2
|
||||
#
|
||||
# Do not make changes to this file unless you know what you are doing--modify
|
||||
# the SWIG interface file instead.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 4.0.1
|
||||
* Version 4.0.2
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
|
@ -502,7 +502,8 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
|||
for (s = type->str; *s; s++)
|
||||
if (*s == '|') last_name = s+1;
|
||||
return last_name;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return type->name;
|
||||
}
|
||||
|
||||
|
@ -915,7 +916,8 @@ typedef struct swig_elua_entry {
|
|||
prefixed with the location of the innermost Lua call-point
|
||||
(as formatted by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pusherrstring(lua_State *L, const char *str) {
|
||||
SWIG_Lua_pusherrstring (lua_State *L, const char *str)
|
||||
{
|
||||
luaL_where (L, 1);
|
||||
lua_pushstring (L, str);
|
||||
lua_concat (L, 2);
|
||||
|
@ -925,7 +927,8 @@ SWIG_Lua_pusherrstring(lua_State *L, const char *str) {
|
|||
the Lua stack, like lua_pushfstring, but prefixed with the
|
||||
location of the innermost Lua call-point (as formatted by luaL_where). */
|
||||
SWIGRUNTIME void
|
||||
SWIG_Lua_pushferrstring(lua_State *L, const char *fmt, ...) {
|
||||
SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
|
||||
{
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
luaL_where(L, 1);
|
||||
|
@ -1103,7 +1106,8 @@ SWIG_Lua_SetModule(lua_State *L, swig_module_info *module) {
|
|||
/* this function is called when trying to set an immutable.
|
||||
default action is to print an error.
|
||||
This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
|
||||
SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_set_immutable(lua_State *L)
|
||||
{
|
||||
/* there should be 1 param passed in: the new value */
|
||||
#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
|
||||
lua_pop(L,1); /* remove it */
|
||||
|
@ -1119,7 +1123,8 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L, void *ptr, size_t size, swi
|
|||
static int swig_lua_elua_emulate_unique_key;
|
||||
|
||||
/* This function emulates eLua rotables behaviour. It loads a rotable definition into the usual lua table. */
|
||||
SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table) {
|
||||
SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_entry *table)
|
||||
{
|
||||
int i, table_parsed, parsed_tables_array, target_table;
|
||||
assert(lua_istable(L,-1));
|
||||
target_table = lua_gettop(L);
|
||||
|
@ -1136,7 +1141,8 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
|
|||
lua_rawsetp(L, parsed_tables_array, table);
|
||||
table_parsed = 0;
|
||||
const int SWIGUNUSED pairs_start = lua_gettop(L);
|
||||
for (i = 0; table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL; i++) {
|
||||
for(i = 0;table[i].key.type != LUA_TNIL || table[i].value.type != LUA_TNIL;i++)
|
||||
{
|
||||
const swig_elua_entry *entry = table + i;
|
||||
int is_metatable = 0;
|
||||
switch(entry->key.type) {
|
||||
|
@ -1201,14 +1207,16 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
|
|||
assert(lua_gettop(L) == target_table);
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_elua_emulate_register_clear(lua_State *L)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
lua_rawsetp(L, LUA_REGISTRYINDEX, &swig_lua_elua_emulate_unique_key);
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L);
|
||||
|
||||
SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
|
||||
{
|
||||
SWIG_check_num_args("getmetatable(SWIG eLua emulation)", 1, 1);
|
||||
SWIG_Lua_get_class_registry(L);
|
||||
lua_getfield(L,-1,"lua_getmetatable");
|
||||
|
@ -1233,7 +1241,8 @@ fail:
|
|||
return 0;
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
|
||||
{
|
||||
SWIG_Lua_get_class_registry(L);
|
||||
lua_pushglobaltable(L);
|
||||
lua_pushstring(L,"lua_getmetatable");
|
||||
|
@ -1253,7 +1262,8 @@ SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L) {
|
|||
* global variable support code: namespaces and modules (which are the same thing)
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L)
|
||||
{
|
||||
/* there should be 2 params passed in
|
||||
(1) table (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1267,8 +1277,8 @@ SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L) {
|
|||
lua_pushvalue(L,2); /* key */
|
||||
lua_rawget(L,-2);
|
||||
lua_remove(L,-2); /* stack tidy, remove .get table */
|
||||
if (lua_iscfunction(L, -1)) {
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1))
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_call(L,0,1); /* 1 value in (userdata),1 out (result) */
|
||||
lua_remove(L,-2); /* stack tidy, remove metatable */
|
||||
return 1;
|
||||
|
@ -1280,8 +1290,8 @@ SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L) {
|
|||
lua_pushvalue(L,2); /* key */
|
||||
lua_rawget(L,-2); /* look for the fn */
|
||||
lua_remove(L,-2); /* stack tidy, remove .fn table */
|
||||
if (lua_isfunction(L, -1)) { /* note: whether it's a C function or lua function */
|
||||
/* found it so return the fn & let lua call it */
|
||||
if (lua_isfunction(L,-1)) /* note: whether it's a C function or lua function */
|
||||
{ /* found it so return the fn & let lua call it */
|
||||
lua_remove(L,-2); /* stack tidy, remove metatable */
|
||||
return 1;
|
||||
}
|
||||
|
@ -1289,7 +1299,8 @@ SWIGINTERN int SWIG_Lua_namespace_get(lua_State *L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L)
|
||||
{
|
||||
/* there should be 3 params passed in
|
||||
(1) table (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1301,12 +1312,13 @@ SWIGINTERN int SWIG_Lua_namespace_set(lua_State *L) {
|
|||
assert(lua_istable(L,-1));
|
||||
|
||||
SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
||||
if (lua_istable(L, -1)) {
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
/* look for the key in the .set table */
|
||||
lua_pushvalue(L,2); /* key */
|
||||
lua_rawget(L,-2);
|
||||
if (lua_iscfunction(L, -1)) {
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1))
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_pushvalue(L,3); /* value */
|
||||
lua_call(L,1,0);
|
||||
return 0;
|
||||
|
@ -1325,7 +1337,8 @@ SWIGINTERN void SWIG_Lua_add_variable(lua_State *L, const char *name, lua_CFunc
|
|||
SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss);
|
||||
|
||||
/* helper function - register namespace methods and attributes into namespace */
|
||||
SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns) {
|
||||
SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *ns)
|
||||
{
|
||||
int i;
|
||||
/* There must be namespace table (not metatable) at the top of the stack */
|
||||
assert(lua_istable(L,-1));
|
||||
|
@ -1348,7 +1361,8 @@ SWIGINTERN int SWIG_Lua_add_namespace_details(lua_State *L, swig_lua_namespace *
|
|||
}
|
||||
|
||||
/* Register all classes in the namespace */
|
||||
SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns) {
|
||||
SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace *ns)
|
||||
{
|
||||
swig_lua_class **classes;
|
||||
|
||||
/* There must be a module/namespace table at the top of the stack */
|
||||
|
@ -1369,7 +1383,8 @@ SWIGINTERN void SWIG_Lua_add_namespace_classes(lua_State *L, swig_lua_namespace
|
|||
when function is called).
|
||||
Function always returns newly registered table on top of the stack.
|
||||
*/
|
||||
SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg) {
|
||||
SWIGINTERN void SWIG_Lua_namespace_register(lua_State *L, swig_lua_namespace *ns, int reg)
|
||||
{
|
||||
swig_lua_namespace **sub_namespace;
|
||||
/* 1 argument - table on the top of the stack */
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
|
@ -1429,7 +1444,8 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L, const char *cname);
|
|||
typedef int (*swig_lua_base_iterator_func)(lua_State*,swig_type_info*, int, int *ret);
|
||||
|
||||
SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info * SWIGUNUSED swig_type,
|
||||
int first_arg, swig_lua_base_iterator_func func, int *const ret) {
|
||||
int first_arg, swig_lua_base_iterator_func func, int *const ret)
|
||||
{
|
||||
/* first_arg - position of the object in stack. Everything that is above are arguments
|
||||
* and is passed to every evocation of the func */
|
||||
int last_arg = lua_gettop(L);/* position of last argument */
|
||||
|
@ -1460,7 +1476,8 @@ SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info *SWIGUNUSED s
|
|||
|
||||
if(ret)
|
||||
*ret = 0;
|
||||
if (bases_count > 0) {
|
||||
if(bases_count>0)
|
||||
{
|
||||
int to_remove;
|
||||
size_t i;
|
||||
int j;
|
||||
|
@ -1526,7 +1543,8 @@ SWIGINTERN int SWIG_Lua_iterate_bases(lua_State *L, swig_type_info *SWIGUNUSED s
|
|||
* It returns an error code. Number of function return values is passed inside 'ret'.
|
||||
* first_arg is not used in this function because function always has 2 arguments.
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret) {
|
||||
SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
|
||||
{
|
||||
/* there should be 2 params passed in
|
||||
(1) userdata (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1541,8 +1559,8 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i
|
|||
/* NEW: looks for the __getitem() fn
|
||||
this is a user provided get fn */
|
||||
SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
|
||||
if (lua_iscfunction(L, -1)) { /* if its there */
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1)) /* if its there */
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_pushvalue(L,substack_start+1); /* the userdata */
|
||||
lua_pushvalue(L,substack_start+2); /* the parameter */
|
||||
lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
|
||||
|
@ -1563,7 +1581,8 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i
|
|||
* It returns an error code. Number of function return values is passed inside 'ret'.
|
||||
* first_arg is not used in this function because function always has 2 arguments.
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret) {
|
||||
SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SWIGUNUSED first_arg, int *ret)
|
||||
{
|
||||
/* there should be 2 params passed in
|
||||
(1) userdata (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1581,8 +1600,8 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
|
|||
lua_pushvalue(L,substack_start+2); /* key */
|
||||
lua_rawget(L,-2);
|
||||
lua_remove(L,-2); /* stack tidy, remove .get table */
|
||||
if (lua_iscfunction(L, -1)) {
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1))
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_pushvalue(L,substack_start+1); /* the userdata */
|
||||
lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
|
||||
lua_remove(L,-2); /* stack tidy, remove metatable */
|
||||
|
@ -1597,8 +1616,8 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
|
|||
lua_pushvalue(L,substack_start+2); /* key */
|
||||
lua_rawget(L,-2); /* look for the fn */
|
||||
lua_remove(L,-2); /* stack tidy, remove .fn table */
|
||||
if (lua_isfunction(L, -1)) { /* note: if its a C function or lua function */
|
||||
/* found it so return the fn & let lua call it */
|
||||
if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
|
||||
{ /* found it so return the fn & let lua call it */
|
||||
lua_remove(L,-2); /* stack tidy, remove metatable */
|
||||
if(ret)
|
||||
*ret = 1;
|
||||
|
@ -1614,7 +1633,8 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
|
|||
|
||||
/* the class.get method, performs the lookup of class attributes
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_class_get(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_class_get(lua_State *L)
|
||||
{
|
||||
/* there should be 2 params passed in
|
||||
(1) userdata (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1640,7 +1660,8 @@ SWIGINTERN int SWIG_Lua_class_get(lua_State *L) {
|
|||
/* helper for the class.set method, performs the lookup of class attributes
|
||||
* It returns error code. Number of function return values is passed inside 'ret'
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret) {
|
||||
SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int first_arg, int *ret)
|
||||
{
|
||||
/* there should be 3 params passed in
|
||||
(1) table (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1657,13 +1678,14 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
|
|||
*ret = 0; /* it is setter - number of return values is always 0 */
|
||||
|
||||
SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
||||
if (lua_istable(L, -1)) {
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
/* look for the key in the .set table */
|
||||
lua_pushvalue(L,substack_start+2); /* key */
|
||||
lua_rawget(L,-2);
|
||||
lua_remove(L,-2); /* tidy stack, remove .set table */
|
||||
if (lua_iscfunction(L, -1)) {
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1))
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_pushvalue(L,substack_start+1); /* userdata */
|
||||
lua_pushvalue(L,substack_start+3); /* value */
|
||||
lua_call(L,2,0);
|
||||
|
@ -1677,8 +1699,8 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
|
|||
/* NEW: looks for the __setitem() fn
|
||||
this is a user provided set fn */
|
||||
SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
|
||||
if (lua_iscfunction(L, -1)) { /* if its there */
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1)) /* if its there */
|
||||
{ /* found it so call the fn & return its value */
|
||||
lua_pushvalue(L,substack_start+1); /* the userdata */
|
||||
lua_pushvalue(L,substack_start+2); /* the parameter */
|
||||
lua_pushvalue(L,substack_start+3); /* the value */
|
||||
|
@ -1700,7 +1722,8 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
|
|||
/* This is the actual method exported to Lua. It calls SWIG_Lua_class_do_set and correctly
|
||||
* handles return values.
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_class_set(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_class_set(lua_State *L)
|
||||
{
|
||||
/* There should be 3 params passed in
|
||||
(1) table (not the meta table)
|
||||
(2) string name of the attribute
|
||||
|
@ -1724,7 +1747,8 @@ SWIGINTERN int SWIG_Lua_class_set(lua_State *L) {
|
|||
}
|
||||
|
||||
/* the class.destruct method called by the interpreter */
|
||||
SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L)
|
||||
{
|
||||
/* there should be 1 params passed in
|
||||
(1) userdata (not the meta table) */
|
||||
swig_lua_userdata *usr;
|
||||
|
@ -1732,9 +1756,11 @@ SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L) {
|
|||
assert(lua_isuserdata(L,-1)); /* just in case */
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
|
||||
/* if must be destroyed & has a destructor */
|
||||
if (usr->own) { /* if must be destroyed */
|
||||
if (usr->own) /* if must be destroyed */
|
||||
{
|
||||
clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
|
||||
if (clss && clss->destructor) { /* there is a destroy fn */
|
||||
if (clss && clss->destructor) /* there is a destroy fn */
|
||||
{
|
||||
clss->destructor(usr->ptr); /* bye bye */
|
||||
}
|
||||
}
|
||||
|
@ -1742,7 +1768,8 @@ SWIGINTERN int SWIG_Lua_class_destruct(lua_State *L) {
|
|||
}
|
||||
|
||||
/* the class.__tostring method called by the interpreter and print */
|
||||
SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
|
||||
{
|
||||
/* there should be 1 param passed in
|
||||
(1) userdata (not the metatable) */
|
||||
swig_lua_userdata* userData;
|
||||
|
@ -1754,7 +1781,8 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L) {
|
|||
}
|
||||
|
||||
/* to manually disown some userdata */
|
||||
SWIGINTERN int SWIG_Lua_class_disown(lua_State *L) {
|
||||
SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
|
||||
{
|
||||
/* there should be 1 params passed in
|
||||
(1) userdata (not the meta table) */
|
||||
swig_lua_userdata *usr;
|
||||
|
@ -1768,7 +1796,8 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L) {
|
|||
/* lua callable function to compare userdata's value
|
||||
the issue is that two userdata may point to the same thing
|
||||
but to lua, they are different objects */
|
||||
SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L) {
|
||||
SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L)
|
||||
{
|
||||
int result;
|
||||
swig_lua_userdata *usr1,*usr2;
|
||||
if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
|
||||
|
@ -1782,7 +1811,8 @@ SWIGRUNTIME int SWIG_Lua_class_equal(lua_State *L) {
|
|||
}
|
||||
|
||||
/* populate table at the top of the stack with metamethods that ought to be inherited */
|
||||
SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L)
|
||||
{
|
||||
SWIG_Lua_add_boolean(L, "__add", 1);
|
||||
SWIG_Lua_add_boolean(L, "__sub", 1);
|
||||
SWIG_Lua_add_boolean(L, "__mul", 1);
|
||||
|
@ -1801,7 +1831,8 @@ SWIGINTERN void SWIG_Lua_populate_inheritable_metamethods(lua_State *L) {
|
|||
}
|
||||
|
||||
/* creates the swig registry */
|
||||
SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L)
|
||||
{
|
||||
/* create main SWIG registry table */
|
||||
lua_pushstring(L,"SWIG");
|
||||
lua_newtable(L);
|
||||
|
@ -1824,12 +1855,13 @@ SWIGINTERN void SWIG_Lua_create_class_registry(lua_State *L) {
|
|||
}
|
||||
|
||||
/* gets the swig registry (or creates it) */
|
||||
SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L)
|
||||
{
|
||||
/* add this all into the swig registry: */
|
||||
lua_pushstring(L,"SWIG");
|
||||
lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
|
||||
if (!lua_istable(L, -1)) { /* not there */
|
||||
/* must be first time, so add it */
|
||||
if (!lua_istable(L,-1)) /* not there */
|
||||
{ /* must be first time, so add it */
|
||||
lua_pop(L,1); /* remove the result */
|
||||
SWIG_Lua_create_class_registry(L);
|
||||
/* then get it */
|
||||
|
@ -1838,7 +1870,8 @@ SWIGINTERN void SWIG_Lua_get_class_registry(lua_State *L) {
|
|||
}
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L) {
|
||||
SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L)
|
||||
{
|
||||
SWIG_Lua_get_class_registry(L);
|
||||
lua_pushstring(L, ".library");
|
||||
lua_rawget(L,-2);
|
||||
|
@ -1852,7 +1885,8 @@ SWIGINTERN void SWIG_Lua_get_inheritable_metamethods(lua_State *L) {
|
|||
}
|
||||
|
||||
/* Helper function to get the classes metatable from the register */
|
||||
SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L, const char *cname) {
|
||||
SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
|
||||
{
|
||||
SWIG_Lua_get_class_registry(L); /* get the registry */
|
||||
lua_pushstring(L,cname); /* get the name */
|
||||
lua_rawget(L,-2); /* get it */
|
||||
|
@ -1866,11 +1900,14 @@ It cannot be done at compile time, as this will not work with hireachies
|
|||
spread over more than one swig file.
|
||||
Therefore it must be done at runtime, querying the SWIG type system.
|
||||
*/
|
||||
SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
|
||||
{
|
||||
int i=0;
|
||||
swig_module_info *module=SWIG_GetModule(L);
|
||||
for (i = 0; clss->base_names[i]; i++) {
|
||||
if (clss->bases[i] == 0) { /* not found yet */
|
||||
for(i=0;clss->base_names[i];i++)
|
||||
{
|
||||
if (clss->bases[i]==0) /* not found yet */
|
||||
{
|
||||
/* lookup and cache the base class */
|
||||
swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
|
||||
if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
|
||||
|
@ -1880,7 +1917,8 @@ SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L, swig_lua_class *clss) {
|
|||
|
||||
#if defined(SWIG_LUA_SQUASH_BASES) && (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA)
|
||||
/* Merges two tables */
|
||||
SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source) {
|
||||
SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int source)
|
||||
{
|
||||
/* iterating */
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L,source) != 0) {
|
||||
|
@ -1895,7 +1933,8 @@ SWIGINTERN void SWIG_Lua_merge_tables_by_index(lua_State *L, int target, int sou
|
|||
}
|
||||
|
||||
/* Merges two tables with given name. original - index of target metatable, base - index of source metatable */
|
||||
SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char *name, int original, int base) {
|
||||
SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char* name, int original, int base)
|
||||
{
|
||||
/* push original[name], then base[name] */
|
||||
lua_pushstring(L,name);
|
||||
lua_rawget(L,original);
|
||||
|
@ -1909,7 +1948,8 @@ SWIGINTERN void SWIG_Lua_merge_tables(lua_State *L, const char *name, int origin
|
|||
}
|
||||
|
||||
/* Function takes all symbols from base and adds it to derived class. It's just a helper. */
|
||||
SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls) {
|
||||
SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cls)
|
||||
{
|
||||
/* There is one parameter - original, i.e. 'derived' class metatable */
|
||||
assert(lua_istable(L,-1));
|
||||
int original = lua_gettop(L);
|
||||
|
@ -1922,10 +1962,12 @@ SWIGINTERN void SWIG_Lua_class_squash_base(lua_State *L, swig_lua_class *base_cl
|
|||
}
|
||||
|
||||
/* Function squashes all symbols from 'clss' bases into itself */
|
||||
SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int i;
|
||||
SWIG_Lua_get_class_metatable(L,clss->fqname);
|
||||
for (i = 0; clss->base_names[i]; i++) {
|
||||
for(i=0;clss->base_names[i];i++)
|
||||
{
|
||||
if (clss->bases[i]==0) /* Somehow it's not found. Skip it */
|
||||
continue;
|
||||
/* Thing is: all bases are already registered. Thus they have already executed
|
||||
|
@ -1940,13 +1982,15 @@ SWIGINTERN void SWIG_Lua_class_squash_bases(lua_State *L, swig_lua_class *clss)
|
|||
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA) /* In elua this is useless */
|
||||
/* helper add a variable to a registered class */
|
||||
SWIGINTERN void SWIG_Lua_add_variable(lua_State *L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
|
||||
SWIGINTERN void SWIG_Lua_add_variable(lua_State *L,const char *name,lua_CFunction getFn,lua_CFunction setFn)
|
||||
{
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
SWIG_Lua_get_table(L,".get"); /* find the .get table */
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
SWIG_Lua_add_function(L,name,getFn);
|
||||
lua_pop(L,1); /* tidy stack (remove table) */
|
||||
if (setFn) {
|
||||
if (setFn)
|
||||
{
|
||||
SWIG_Lua_get_table(L,".set"); /* find the .set table */
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
SWIG_Lua_add_function(L,name,setFn);
|
||||
|
@ -1955,12 +1999,14 @@ SWIGINTERN void SWIG_Lua_add_variable(lua_State *L, const char *name, lua_CFunc
|
|||
}
|
||||
|
||||
/* helper to recursively add class static details (static attributes, operations and constants) */
|
||||
SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int i = 0;
|
||||
/* The class namespace table must be on the top of the stack */
|
||||
assert(lua_istable(L,-1));
|
||||
/* call all the base classes first: we can then override these later: */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_add_class_static_details(L,clss->bases[i]);
|
||||
}
|
||||
|
||||
|
@ -1970,13 +2016,15 @@ SWIGINTERN void SWIG_Lua_add_class_static_details(lua_State *L, swig_lua_class *
|
|||
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss); /* forward declaration */
|
||||
|
||||
/* helper to recursively add class details (attributes & operations) */
|
||||
SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int i;
|
||||
size_t bases_count = 0;
|
||||
/* Add bases to .bases table */
|
||||
SWIG_Lua_get_table(L,".bases");
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
|
||||
/* Base class must be already registered */
|
||||
assert(lua_istable(L,-1));
|
||||
|
@ -2040,7 +2088,8 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration
|
|||
* SWIG_Lua_resolve_metamethod
|
||||
* */
|
||||
SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
|
||||
int skip_check) {
|
||||
int skip_check)
|
||||
{
|
||||
/* This function is called recursively */
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
@ -2061,7 +2110,8 @@ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class
|
|||
}
|
||||
|
||||
/* Forwarding calls to bases */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
result = SWIG_Lua_do_resolve_metamethod(L, clss->bases[i], metamethod_name_idx, 0);
|
||||
if (result)
|
||||
break;
|
||||
|
@ -2072,7 +2122,8 @@ SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class
|
|||
|
||||
/* The proxy function for metamethod. All parameters are passed as cclosure. Searches for actual method
|
||||
* and calls it */
|
||||
SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L) {
|
||||
SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
|
||||
{
|
||||
int numargs;
|
||||
int metamethod_name_idx;
|
||||
const swig_lua_class* clss;
|
||||
|
@ -2108,7 +2159,8 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L) {
|
|||
* Returns 1 if successfully added, 0 if not added because no base class has it, -1
|
||||
* if method is defined in the class metatable itself
|
||||
*/
|
||||
SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index) {
|
||||
SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *clss, const int metatable_index)
|
||||
{
|
||||
int key_index;
|
||||
int success = 0;
|
||||
int i = 0;
|
||||
|
@ -2128,7 +2180,8 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
lua_pop(L,1);
|
||||
|
||||
/* Iterating over immediate bases */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
const swig_lua_class *base = clss->bases[i];
|
||||
SWIG_Lua_get_class_metatable(L, base->fqname);
|
||||
lua_pushvalue(L, key_index);
|
||||
|
@ -2154,7 +2207,8 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
|
|||
return success;
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
int metatable_index;
|
||||
int metamethods_info_index;
|
||||
int tostring_undefined;
|
||||
|
@ -2210,7 +2264,8 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
|
|||
}
|
||||
|
||||
/* Register class static methods,attributes etc as well as constructor proxy */
|
||||
SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
lua_checkstack(L,5); /* just in case */
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
|
@ -2224,7 +2279,8 @@ SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *cls
|
|||
so you can do MyClass(...) as well as new_MyClass(...)
|
||||
BUT only if a constructor is defined
|
||||
(this overcomes the problem of pure virtual classes without constructors)*/
|
||||
if (clss->constructor) {
|
||||
if (clss->constructor)
|
||||
{
|
||||
lua_getmetatable(L,-1);
|
||||
assert(lua_istable(L,-1)); /* just in case */
|
||||
SWIG_Lua_add_function(L,"__call", clss->constructor);
|
||||
|
@ -2242,7 +2298,8 @@ SWIGINTERN void SWIG_Lua_class_register_static(lua_State *L, swig_lua_class *cls
|
|||
/* Performs the instance (non-static) class registration process. Metatable for class is created
|
||||
* and added to the class registry.
|
||||
*/
|
||||
SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L,swig_lua_class *clss)
|
||||
{
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
int i;
|
||||
/* if name already there (class is already registered) then do nothing */
|
||||
|
@ -2256,7 +2313,8 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L, swig_lua_class *
|
|||
}
|
||||
lua_pop(L,2); /* tidy stack */
|
||||
/* Recursively initialize all bases */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_class_register_instance(L,clss->bases[i]);
|
||||
}
|
||||
/* Again, get registry and push name */
|
||||
|
@ -2270,7 +2328,8 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L, swig_lua_class *
|
|||
*/
|
||||
{
|
||||
int new_metatable_index = lua_absindex(L,-1);
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
int base_metatable;
|
||||
SWIG_Lua_get_class_metatable(L,clss->bases[i]->fqname);
|
||||
base_metatable = lua_absindex(L,-1);
|
||||
|
@ -2321,7 +2380,8 @@ SWIGINTERN void SWIG_Lua_class_register_instance(lua_State *L, swig_lua_class *
|
|||
assert( lua_gettop(L) == begin );
|
||||
}
|
||||
|
||||
SWIGINTERN void SWIG_Lua_class_register(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_class_register(lua_State *L,swig_lua_class *clss)
|
||||
{
|
||||
int SWIGUNUSED begin;
|
||||
assert(lua_istable(L,-1)); /* This is a table (module or namespace) where classes will be added */
|
||||
SWIG_Lua_class_register_instance(L,clss);
|
||||
|
@ -2358,7 +2418,8 @@ SWIGINTERN void SWIG_Lua_class_register(lua_State *L, swig_lua_class *clss) {
|
|||
#endif /* SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_LUA */
|
||||
|
||||
#if (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUA) || (SWIG_LUA_TARGET == SWIG_LUA_FLAVOR_ELUAC)
|
||||
SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss) {
|
||||
SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_class *clss)
|
||||
{
|
||||
const int SWIGUNUSED begin = lua_gettop(L);
|
||||
int i;
|
||||
/* if name already there (class is already registered) then do nothing */
|
||||
|
@ -2372,7 +2433,8 @@ SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_cla
|
|||
}
|
||||
lua_pop(L,2); /* tidy stack */
|
||||
/* Recursively initialize all bases */
|
||||
for (i = 0; clss->bases[i]; i++) {
|
||||
for(i=0;clss->bases[i];i++)
|
||||
{
|
||||
SWIG_Lua_elua_class_register_instance(L,clss->bases[i]);
|
||||
}
|
||||
/* Again, get registry and push name */
|
||||
|
@ -2391,19 +2453,25 @@ SWIGINTERN void SWIG_Lua_elua_class_register_instance(lua_State *L, swig_lua_cla
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* helper to add metatable to new lua object */
|
||||
SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L, swig_type_info *type) {
|
||||
if (type->clientdata) { /* there is clientdata: so add the metatable */
|
||||
SWIGINTERN void SWIG_Lua_AddMetatable(lua_State *L,swig_type_info *type)
|
||||
{
|
||||
if (type->clientdata) /* there is clientdata: so add the metatable */
|
||||
{
|
||||
SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->fqname);
|
||||
if (lua_istable(L, -1)) {
|
||||
if (lua_istable(L,-1))
|
||||
{
|
||||
lua_setmetatable(L,-2);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pop(L,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* pushes a new object into the lua stack */
|
||||
SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L, void *ptr, swig_type_info *type, int own) {
|
||||
SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L,void *ptr,swig_type_info *type, int own)
|
||||
{
|
||||
swig_lua_userdata *usr;
|
||||
if (!ptr){
|
||||
lua_pushnil(L);
|
||||
|
@ -2420,25 +2488,36 @@ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State *L, void *ptr, swig_type_info
|
|||
|
||||
/* takes a object from the lua stack & converts it into an object of the correct type
|
||||
(if possible) */
|
||||
SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L, int index, void **ptr, swig_type_info *type, int flags) {
|
||||
SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type_info *type,int flags)
|
||||
{
|
||||
swig_lua_userdata *usr;
|
||||
swig_cast_info *cast;
|
||||
/* special case: lua nil => NULL pointer */
|
||||
if (lua_isnil(L, index)) {
|
||||
if (lua_isnil(L,index))
|
||||
{
|
||||
*ptr=0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
if (lua_islightuserdata(L,index))
|
||||
{
|
||||
*ptr=lua_touserdata(L,index);
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
}
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
|
||||
if (usr) {
|
||||
if (flags & SWIG_POINTER_DISOWN) { /* must disown the object */
|
||||
if (usr)
|
||||
{
|
||||
if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
|
||||
{
|
||||
usr->own=0;
|
||||
}
|
||||
if (!type) { /* special cast void*, no casting fn */
|
||||
if (!type) /* special cast void*, no casting fn */
|
||||
{
|
||||
*ptr=usr->ptr;
|
||||
return SWIG_OK; /* ok */
|
||||
}
|
||||
cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
|
||||
if (cast) {
|
||||
if (cast)
|
||||
{
|
||||
int newmemory = 0;
|
||||
*ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
|
||||
assert(!newmemory); /* newmemory handling not yet implemented */
|
||||
|
@ -2459,7 +2538,8 @@ SWIGRUNTIME void *SWIG_Lua_MustGetPtr(lua_State *L, int index, swig_type_info *t
|
|||
}
|
||||
|
||||
/* pushes a packed userdata. user for member fn pointers only */
|
||||
SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L, void *ptr, size_t size, swig_type_info *type) {
|
||||
SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_type_info *type)
|
||||
{
|
||||
swig_lua_rawdata *raw;
|
||||
assert(ptr); /* not acceptable to pass in a NULL value */
|
||||
raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
|
||||
|
@ -2470,11 +2550,13 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L, void *ptr, size_t size, swi
|
|||
}
|
||||
|
||||
/* converts a packed userdata. user for member fn pointers only */
|
||||
SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L, int index, void *ptr, size_t size, swig_type_info *type) {
|
||||
SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
|
||||
{
|
||||
swig_lua_rawdata *raw;
|
||||
raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
|
||||
if (!raw) return SWIG_ERROR; /* error */
|
||||
if (type == 0 || type == raw->type) { /* void* or identical type */
|
||||
if (type==0 || type==raw->type) /* void* or identical type */
|
||||
{
|
||||
memcpy(ptr,raw->data,size); /* copy it */
|
||||
return SWIG_OK; /* ok */
|
||||
}
|
||||
|
@ -2482,9 +2564,11 @@ SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L, int index, void *ptr, size
|
|||
}
|
||||
|
||||
/* a function to get the typestring of a piece of data */
|
||||
SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) {
|
||||
SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
|
||||
{
|
||||
swig_lua_userdata *usr;
|
||||
if (lua_isuserdata(L, tp)) {
|
||||
if (lua_isuserdata(L,tp))
|
||||
{
|
||||
usr=(swig_lua_userdata*)lua_touserdata(L,tp); /* get data */
|
||||
if (usr && usr->type && usr->type->str)
|
||||
return usr->type->str;
|
||||
|
@ -2494,7 +2578,8 @@ SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) {
|
|||
}
|
||||
|
||||
/* lua callable function to get the userdata's type */
|
||||
SWIGRUNTIME int SWIG_Lua_type(lua_State *L) {
|
||||
SWIGRUNTIME int SWIG_Lua_type(lua_State *L)
|
||||
{
|
||||
lua_pushstring(L,SWIG_Lua_typename(L,1));
|
||||
return 1;
|
||||
}
|
||||
|
@ -2608,7 +2693,7 @@ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
|
|||
|
||||
SWIGINTERN pm3 *new_pm3__SWIG_0(void){
|
||||
// printf("SWIG pm3 constructor, get current pm3\n");
|
||||
pm3_device *p = pm3_get_current_dev();
|
||||
pm3_device_t * p = pm3_get_current_dev();
|
||||
p->script_embedded = 1;
|
||||
return p;
|
||||
}
|
||||
|
@ -2622,7 +2707,7 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
|
|||
|
||||
SWIGINTERN pm3 *new_pm3__SWIG_1(char *port){
|
||||
// printf("SWIG pm3 constructor with port, open pm3\n");
|
||||
pm3_device *p = pm3_open(port);
|
||||
pm3_device_t * p = pm3_open(port);
|
||||
p->script_embedded = 0;
|
||||
return p;
|
||||
}
|
||||
|
@ -2643,8 +2728,7 @@ static int _wrap_new_pm3__SWIG_0(lua_State *L) {
|
|||
|
||||
SWIG_check_num_args("pm3::pm3",0,0)
|
||||
result = (pm3 *)new_pm3__SWIG_0();
|
||||
SWIG_NewPointerObj(L, result, SWIGTYPE_p_pm3, 1);
|
||||
SWIG_arg++;
|
||||
SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3,1); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
@ -2664,8 +2748,7 @@ static int _wrap_new_pm3__SWIG_1(lua_State *L) {
|
|||
if(!SWIG_lua_isnilstring(L,1)) SWIG_fail_arg("pm3::pm3",1,"char *");
|
||||
arg1 = (char *)lua_tostring(L, 1);
|
||||
result = (pm3 *)new_pm3__SWIG_1(arg1);
|
||||
SWIG_NewPointerObj(L, result, SWIGTYPE_p_pm3, 1);
|
||||
SWIG_arg++;
|
||||
SWIG_NewPointerObj(L,result,SWIGTYPE_p_pm3,1); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
@ -2700,8 +2783,7 @@ static int _wrap_new_pm3(lua_State *L) {
|
|||
" Possible C/C++ prototypes are:\n"
|
||||
" pm3::pm3()\n"
|
||||
" pm3::pm3(char *)\n");
|
||||
lua_error(L);
|
||||
return 0;
|
||||
lua_error(L);return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2721,8 +2803,7 @@ static int _wrap_pm3_console(lua_State *L) {
|
|||
|
||||
arg2 = (char *)lua_tostring(L, 2);
|
||||
result = (int)pm3_console(arg1,arg2);
|
||||
lua_pushnumber(L, (lua_Number) result);
|
||||
SWIG_arg++;
|
||||
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
@ -2746,8 +2827,7 @@ static int _wrap_pm3_name_get(lua_State *L) {
|
|||
}
|
||||
|
||||
result = (char *)pm3_name_get(arg1);
|
||||
lua_pushstring(L, (const char *)result);
|
||||
SWIG_arg++;
|
||||
lua_pushstring(L,(const char *)result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
if(0) SWIG_fail;
|
||||
|
@ -3079,8 +3159,7 @@ SWIG_PropagateClientData(void) {
|
|||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{
|
||||
/* c-mode */
|
||||
{ /* c-mode */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -3177,7 +3256,8 @@ SWIGEXPORT int SWIG_init(lua_State *L) /* default Lua action */
|
|||
const char* SWIG_LUACODE=
|
||||
"";
|
||||
|
||||
void SWIG_init_user(lua_State *L) {
|
||||
void SWIG_init_user(lua_State* L)
|
||||
{
|
||||
/* exec Lua code if applicable */
|
||||
SWIG_Lua_dostring(L,SWIG_LUACODE);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 4.0.1
|
||||
* Version 4.0.2
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
|
@ -516,7 +516,8 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
|||
for (s = type->str; *s; s++)
|
||||
if (*s == '|') last_name = s+1;
|
||||
return last_name;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return type->name;
|
||||
}
|
||||
|
||||
|
@ -781,16 +782,21 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|||
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
|
||||
*/
|
||||
SWIGINTERN char*
|
||||
SWIG_Python_str_AsChar(PyObject *str) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
return (char *)PyUnicode_AsUTF8(str);
|
||||
#elif PY_VERSION_HEX >= 0x03000000
|
||||
char *newstr = 0;
|
||||
str = PyUnicode_AsUTF8String(str);
|
||||
if (str) {
|
||||
char *cstr;
|
||||
Py_ssize_t len;
|
||||
PyBytes_AsStringAndSize(str, &cstr, &len);
|
||||
if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
|
||||
newstr = (char *) malloc(len+1);
|
||||
if (newstr)
|
||||
memcpy(newstr, cstr, len+1);
|
||||
}
|
||||
Py_XDECREF(str);
|
||||
}
|
||||
return newstr;
|
||||
|
@ -799,15 +805,16 @@ SWIG_Python_str_AsChar(PyObject *str) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#else
|
||||
#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x)
|
||||
#else
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#endif
|
||||
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SWIG_Python_str_FromChar(const char *c) {
|
||||
SWIG_Python_str_FromChar(const char *c)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_FromString(c);
|
||||
#else
|
||||
|
@ -879,7 +886,8 @@ SWIG_Python_ErrorType(int code) {
|
|||
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_AddErrorMsg(const char *mesg) {
|
||||
SWIG_Python_AddErrorMsg(const char* mesg)
|
||||
{
|
||||
PyObject *type = 0;
|
||||
PyObject *value = 0;
|
||||
PyObject *traceback = 0;
|
||||
|
@ -904,7 +912,8 @@ SWIG_Python_AddErrorMsg(const char *mesg) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_TypeErrorOccurred(PyObject *obj) {
|
||||
SWIG_Python_TypeErrorOccurred(PyObject *obj)
|
||||
{
|
||||
PyObject *error;
|
||||
if (obj)
|
||||
return 0;
|
||||
|
@ -913,7 +922,8 @@ SWIG_Python_TypeErrorOccurred(PyObject *obj) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_RaiseOrModifyTypeError(const char *message) {
|
||||
SWIG_Python_RaiseOrModifyTypeError(const char *message)
|
||||
{
|
||||
if (SWIG_Python_TypeErrorOccurred(NULL)) {
|
||||
/* Use existing TypeError to preserve stacktrace and enhance with given message */
|
||||
PyObject *newvalue;
|
||||
|
@ -1168,7 +1178,8 @@ SWIG_Python_AppendOutput(PyObject *result, PyObject *obj) {
|
|||
/* Unpack the argument tuple */
|
||||
|
||||
SWIGINTERN Py_ssize_t
|
||||
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) {
|
||||
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
|
||||
{
|
||||
if (!args) {
|
||||
if (!min && !max) {
|
||||
return 1;
|
||||
|
@ -1212,6 +1223,19 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
|
|||
}
|
||||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
|
||||
int no_kwargs = 1;
|
||||
if (kwargs) {
|
||||
assert(PyDict_Check(kwargs));
|
||||
if (PyDict_Size(kwargs) > 0) {
|
||||
PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
|
||||
no_kwargs = 0;
|
||||
}
|
||||
}
|
||||
return no_kwargs;
|
||||
}
|
||||
|
||||
/* A functor is a function object with one single object argument */
|
||||
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
|
||||
|
||||
|
@ -1245,7 +1269,8 @@ extern "C" {
|
|||
/* The python void return value */
|
||||
|
||||
SWIGRUNTIMEINLINE PyObject *
|
||||
SWIG_Py_Void(void) {
|
||||
SWIG_Py_Void(void)
|
||||
{
|
||||
PyObject *none = Py_None;
|
||||
Py_INCREF(none);
|
||||
return none;
|
||||
|
@ -1264,7 +1289,8 @@ typedef struct {
|
|||
} SwigPyClientData;
|
||||
|
||||
SWIGRUNTIMEINLINE int
|
||||
SWIG_Python_CheckImplicit(swig_type_info *ty) {
|
||||
SWIG_Python_CheckImplicit(swig_type_info *ty)
|
||||
{
|
||||
SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
|
||||
int fail = data ? data->implicitconv : 0;
|
||||
if (fail)
|
||||
|
@ -1281,7 +1307,8 @@ SWIG_Python_ExceptionType(swig_type_info *desc) {
|
|||
|
||||
|
||||
SWIGRUNTIME SwigPyClientData *
|
||||
SwigPyClientData_New(PyObject *obj) {
|
||||
SwigPyClientData_New(PyObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -1349,7 +1376,8 @@ typedef struct {
|
|||
#ifdef SWIGPYTHON_BUILTIN
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
|
||||
if (!sobj->dict)
|
||||
|
@ -1362,12 +1390,14 @@ SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
|||
#endif
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_long(SwigPyObject *v) {
|
||||
SwigPyObject_long(SwigPyObject *v)
|
||||
{
|
||||
return PyLong_FromVoidPtr(v->ptr);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_format(const char *fmt, SwigPyObject *v) {
|
||||
SwigPyObject_format(const char* fmt, SwigPyObject *v)
|
||||
{
|
||||
PyObject *res = NULL;
|
||||
PyObject *args = PyTuple_New(1);
|
||||
if (args) {
|
||||
|
@ -1388,17 +1418,20 @@ SwigPyObject_format(const char *fmt, SwigPyObject *v) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_oct(SwigPyObject *v) {
|
||||
SwigPyObject_oct(SwigPyObject *v)
|
||||
{
|
||||
return SwigPyObject_format("%o",v);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_hex(SwigPyObject *v) {
|
||||
SwigPyObject_hex(SwigPyObject *v)
|
||||
{
|
||||
return SwigPyObject_format("%x",v);
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_repr(SwigPyObject *v) {
|
||||
SwigPyObject_repr(SwigPyObject *v)
|
||||
{
|
||||
const char *name = SWIG_TypePrettyName(v->ty);
|
||||
PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
|
||||
if (v->next) {
|
||||
|
@ -1418,12 +1451,14 @@ SwigPyObject_repr(SwigPyObject *v) {
|
|||
/* We need a version taking two PyObject* parameters so it's a valid
|
||||
* PyCFunction to use in swigobject_methods[]. */
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
return SwigPyObject_repr((SwigPyObject*)v);
|
||||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) {
|
||||
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
|
||||
{
|
||||
void *i = v->ptr;
|
||||
void *j = w->ptr;
|
||||
return (i < j) ? -1 : ((i > j) ? 1 : 0);
|
||||
|
@ -1431,7 +1466,8 @@ SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) {
|
|||
|
||||
/* Added for Python 3.x, would it also be useful for Python 2.x? */
|
||||
SWIGRUNTIME PyObject*
|
||||
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) {
|
||||
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
|
||||
{
|
||||
PyObject* res;
|
||||
if( op != Py_EQ && op != Py_NE ) {
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
|
@ -1480,7 +1516,8 @@ SWIGRUNTIME PyObject *
|
|||
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
|
||||
|
||||
SWIGRUNTIME void
|
||||
SwigPyObject_dealloc(PyObject *v) {
|
||||
SwigPyObject_dealloc(PyObject *v)
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
PyObject *next = sobj->next;
|
||||
if (sobj->own == SWIG_POINTER_OWN) {
|
||||
|
@ -1530,7 +1567,8 @@ SwigPyObject_dealloc(PyObject *v) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject*
|
||||
SwigPyObject_append(PyObject *v, PyObject *next) {
|
||||
SwigPyObject_append(PyObject* v, PyObject* next)
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
if (!SwigPyObject_Check(next)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
|
||||
|
@ -1542,7 +1580,8 @@ SwigPyObject_append(PyObject *v, PyObject *next) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject*
|
||||
SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
if (sobj->next) {
|
||||
Py_INCREF(sobj->next);
|
||||
|
@ -1553,21 +1592,24 @@ SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
|||
}
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SwigPyObject_disown(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
sobj->own = 0;
|
||||
return SWIG_Py_Void();
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SwigPyObject_acquire(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
|
||||
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *)v;
|
||||
sobj->own = SWIG_POINTER_OWN;
|
||||
return SWIG_Py_Void();
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
SwigPyObject_own(PyObject *v, PyObject *args) {
|
||||
SwigPyObject_own(PyObject *v, PyObject *args)
|
||||
{
|
||||
PyObject *val = 0;
|
||||
if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
|
||||
return NULL;
|
||||
|
@ -1707,6 +1749,12 @@ SwigPyObject_TypeOnce(void) {
|
|||
#if PY_VERSION_HEX >= 0x03040000
|
||||
0, /* tp_finalize */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /* tp_vectorcall */
|
||||
#endif
|
||||
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
|
||||
0, /* tp_print */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0, /* tp_allocs */
|
||||
0, /* tp_frees */
|
||||
|
@ -1724,7 +1772,8 @@ SwigPyObject_TypeOnce(void) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyObject_New(void *ptr, swig_type_info *ty, int own) {
|
||||
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
|
||||
{
|
||||
SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
|
||||
if (sobj) {
|
||||
sobj->ptr = ptr;
|
||||
|
@ -1747,7 +1796,8 @@ typedef struct {
|
|||
} SwigPyPacked;
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyPacked_repr(SwigPyPacked *v) {
|
||||
SwigPyPacked_repr(SwigPyPacked *v)
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
|
||||
return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
|
||||
|
@ -1757,7 +1807,8 @@ SwigPyPacked_repr(SwigPyPacked *v) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyPacked_str(SwigPyPacked *v) {
|
||||
SwigPyPacked_str(SwigPyPacked *v)
|
||||
{
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
|
||||
return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
|
||||
|
@ -1767,7 +1818,8 @@ SwigPyPacked_str(SwigPyPacked *v) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) {
|
||||
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
|
||||
{
|
||||
size_t i = v->size;
|
||||
size_t j = w->size;
|
||||
int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
|
||||
|
@ -1789,7 +1841,8 @@ SwigPyPacked_Check(PyObject *op) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SwigPyPacked_dealloc(PyObject *v) {
|
||||
SwigPyPacked_dealloc(PyObject *v)
|
||||
{
|
||||
if (SwigPyPacked_Check(v)) {
|
||||
SwigPyPacked *sobj = (SwigPyPacked *) v;
|
||||
free(sobj->pack);
|
||||
|
@ -1863,6 +1916,12 @@ SwigPyPacked_TypeOnce(void) {
|
|||
#if PY_VERSION_HEX >= 0x03040000
|
||||
0, /* tp_finalize */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /* tp_vectorcall */
|
||||
#endif
|
||||
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
|
||||
0, /* tp_print */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0, /* tp_allocs */
|
||||
0, /* tp_frees */
|
||||
|
@ -1880,7 +1939,8 @@ SwigPyPacked_TypeOnce(void) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) {
|
||||
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
|
||||
{
|
||||
SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
|
||||
if (sobj) {
|
||||
void *pack = malloc(size);
|
||||
|
@ -1898,7 +1958,8 @@ SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) {
|
||||
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
|
||||
{
|
||||
if (SwigPyPacked_Check(obj)) {
|
||||
SwigPyPacked *sobj = (SwigPyPacked *)obj;
|
||||
if (sobj->size != size) return 0;
|
||||
|
@ -1916,7 +1977,8 @@ SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) {
|
|||
static PyObject *Swig_This_global = NULL;
|
||||
|
||||
SWIGRUNTIME PyObject *
|
||||
SWIG_This(void) {
|
||||
SWIG_This(void)
|
||||
{
|
||||
if (Swig_This_global == NULL)
|
||||
Swig_This_global = SWIG_Python_str_FromChar("this");
|
||||
return Swig_This_global;
|
||||
|
@ -1930,7 +1992,8 @@ SWIG_This(void) {
|
|||
#endif
|
||||
|
||||
SWIGRUNTIME SwigPyObject *
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj) {
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (SwigPyObject_Check(pyobj))
|
||||
|
@ -2167,7 +2230,8 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
|
|||
*/
|
||||
|
||||
SWIGRUNTIME PyObject*
|
||||
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
|
||||
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
|
||||
{
|
||||
PyObject *inst = 0;
|
||||
PyObject *newraw = data->newraw;
|
||||
if (newraw) {
|
||||
|
@ -2184,8 +2248,10 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
|
|||
}
|
||||
}
|
||||
#else
|
||||
PyObject *key = SWIG_This();
|
||||
PyObject_SetAttr(inst, key, swig_this);
|
||||
if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
|
||||
Py_DECREF(inst);
|
||||
inst = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
@ -2197,10 +2263,14 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
|
|||
inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
|
||||
Py_DECREF(empty_kwargs);
|
||||
if (inst) {
|
||||
PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||
if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
|
||||
Py_DECREF(inst);
|
||||
inst = 0;
|
||||
} else {
|
||||
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
Py_DECREF(empty_args);
|
||||
}
|
||||
#else
|
||||
|
@ -2215,24 +2285,21 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
|
|||
return inst;
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) {
|
||||
PyObject *dict;
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
|
||||
{
|
||||
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
|
||||
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
||||
if (dictptr != NULL) {
|
||||
dict = *dictptr;
|
||||
PyObject *dict = *dictptr;
|
||||
if (dict == NULL) {
|
||||
dict = PyDict_New();
|
||||
*dictptr = dict;
|
||||
}
|
||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||
return;
|
||||
return PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||
}
|
||||
#endif
|
||||
dict = PyObject_GetAttrString(inst, "__dict__");
|
||||
PyDict_SetItem(dict, SWIG_This(), swig_this);
|
||||
Py_DECREF(dict);
|
||||
return PyObject_SetAttr(inst, SWIG_This(), swig_this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2246,7 +2313,8 @@ SWIG_Python_InitShadowInstance(PyObject *args) {
|
|||
if (sthis) {
|
||||
SwigPyObject_append((PyObject*) sthis, obj[1]);
|
||||
} else {
|
||||
SWIG_Python_SetSwigThis(obj[0], obj[1]);
|
||||
if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0)
|
||||
return NULL;
|
||||
}
|
||||
return SWIG_Py_Void();
|
||||
}
|
||||
|
@ -2340,7 +2408,8 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_DestroyModule(PyObject *obj) {
|
||||
SWIG_Python_DestroyModule(PyObject *obj)
|
||||
{
|
||||
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
|
||||
swig_type_info **types = swig_module->types;
|
||||
size_t i;
|
||||
|
@ -2380,7 +2449,8 @@ SWIG_Python_TypeCache(void) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME swig_type_info *
|
||||
SWIG_Python_TypeQuery(const char *type) {
|
||||
SWIG_Python_TypeQuery(const char *type)
|
||||
{
|
||||
PyObject *cache = SWIG_Python_TypeCache();
|
||||
PyObject *key = SWIG_Python_str_FromChar(type);
|
||||
PyObject *obj = PyDict_GetItem(cache, key);
|
||||
|
@ -2408,7 +2478,8 @@ SWIG_Python_TypeQuery(const char *type) {
|
|||
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_AddErrMesg(const char *mesg, int infront) {
|
||||
SWIG_Python_AddErrMesg(const char* mesg, int infront)
|
||||
{
|
||||
if (PyErr_Occurred()) {
|
||||
PyObject *type = 0;
|
||||
PyObject *value = 0;
|
||||
|
@ -2435,7 +2506,8 @@ SWIG_Python_AddErrMesg(const char *mesg, int infront) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_ArgFail(int argnum) {
|
||||
SWIG_Python_ArgFail(int argnum)
|
||||
{
|
||||
if (PyErr_Occurred()) {
|
||||
/* add information about failing argument */
|
||||
char mesg[256];
|
||||
|
@ -2447,14 +2519,16 @@ SWIG_Python_ArgFail(int argnum) {
|
|||
}
|
||||
|
||||
SWIGRUNTIMEINLINE const char *
|
||||
SwigPyObject_GetDesc(PyObject *self) {
|
||||
SwigPyObject_GetDesc(PyObject *self)
|
||||
{
|
||||
SwigPyObject *v = (SwigPyObject *)self;
|
||||
swig_type_info *ty = v ? v->ty : 0;
|
||||
return ty ? ty->str : "";
|
||||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SWIG_Python_TypeError(const char *type, PyObject *obj) {
|
||||
SWIG_Python_TypeError(const char *type, PyObject *obj)
|
||||
{
|
||||
if (type) {
|
||||
#if defined(SWIG_COBJECT_TYPES)
|
||||
if (obj && SwigPyObject_Check(obj)) {
|
||||
|
@ -2617,7 +2691,7 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
|
|||
#endif
|
||||
#define SWIG_name "_pm3"
|
||||
|
||||
#define SWIGVERSION 0x040001
|
||||
#define SWIGVERSION 0x040002
|
||||
#define SWIG_VERSION SWIGVERSION
|
||||
|
||||
|
||||
|
@ -2631,13 +2705,14 @@ static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
|
|||
|
||||
SWIGINTERN pm3 *new_pm3__SWIG_0(void){
|
||||
// printf("SWIG pm3 constructor, get current pm3\n");
|
||||
pm3_device *p = pm3_get_current_dev();
|
||||
pm3_device_t * p = pm3_get_current_dev();
|
||||
p->script_embedded = 1;
|
||||
return p;
|
||||
}
|
||||
|
||||
SWIGINTERN swig_type_info*
|
||||
SWIG_pchar_descriptor(void) {
|
||||
SWIG_pchar_descriptor(void)
|
||||
{
|
||||
static int init = 0;
|
||||
static swig_type_info* info = 0;
|
||||
if (!init) {
|
||||
|
@ -2649,7 +2724,8 @@ SWIG_pchar_descriptor(void) {
|
|||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
|
||||
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
|
||||
{
|
||||
#if PY_VERSION_HEX>=0x03000000
|
||||
#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||
if (PyBytes_Check(obj))
|
||||
|
@ -2660,8 +2736,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
|
|||
if (PyString_Check(obj))
|
||||
#endif
|
||||
{
|
||||
char *cstr;
|
||||
Py_ssize_t len;
|
||||
char *cstr; Py_ssize_t len;
|
||||
int ret = SWIG_OK;
|
||||
#if PY_VERSION_HEX>=0x03000000
|
||||
#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
|
||||
|
@ -2678,9 +2753,11 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
|
|||
if (alloc)
|
||||
*alloc = SWIG_NEWOBJ;
|
||||
#endif
|
||||
PyBytes_AsStringAndSize(obj, &cstr, &len);
|
||||
if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
|
||||
return SWIG_TypeError;
|
||||
#else
|
||||
PyString_AsStringAndSize(obj, &cstr, &len);
|
||||
if (PyString_AsStringAndSize(obj, &cstr, &len) == -1)
|
||||
return SWIG_TypeError;
|
||||
#endif
|
||||
if (cptr) {
|
||||
if (alloc) {
|
||||
|
@ -2717,8 +2794,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
|
|||
#endif
|
||||
#if PY_VERSION_HEX<0x03000000
|
||||
if (PyUnicode_Check(obj)) {
|
||||
char *cstr;
|
||||
Py_ssize_t len;
|
||||
char *cstr; Py_ssize_t len;
|
||||
if (!alloc && cptr) {
|
||||
return SWIG_RuntimeError;
|
||||
}
|
||||
|
@ -2760,7 +2836,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
|
|||
|
||||
SWIGINTERN pm3 *new_pm3__SWIG_1(char *port){
|
||||
// printf("SWIG pm3 constructor with port, open pm3\n");
|
||||
pm3_device *p = pm3_open(port);
|
||||
pm3_device_t * p = pm3_open(port);
|
||||
p->script_embedded = 0;
|
||||
return p;
|
||||
}
|
||||
|
@ -2774,13 +2850,15 @@ SWIGINTERN void delete_pm3(pm3 *self) {
|
|||
}
|
||||
|
||||
SWIGINTERNINLINE PyObject*
|
||||
SWIG_From_int(int value) {
|
||||
SWIG_From_int (int value)
|
||||
{
|
||||
return PyInt_FromLong((long) value);
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERNINLINE PyObject *
|
||||
SWIG_FromCharPtrAndSize(const char *carray, size_t size) {
|
||||
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
|
||||
{
|
||||
if (carray) {
|
||||
if (size > INT_MAX) {
|
||||
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
|
||||
|
@ -2804,7 +2882,8 @@ SWIG_FromCharPtrAndSize(const char *carray, size_t size) {
|
|||
|
||||
|
||||
SWIGINTERNINLINE PyObject *
|
||||
SWIG_FromCharPtr(const char *cptr) {
|
||||
SWIG_FromCharPtr(const char *cptr)
|
||||
{
|
||||
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
|
||||
}
|
||||
|
||||
|
@ -3004,8 +3083,7 @@ static swig_cast_info *swig_cast_initial[] = {
|
|||
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
|
||||
|
||||
static swig_const_info swig_const_table[] = {
|
||||
{0, 0, 0, 0.0, 0, 0}
|
||||
};
|
||||
{0, 0, 0, 0.0, 0, 0}};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -3403,6 +3481,12 @@ swig_varlink_type(void) {
|
|||
#if PY_VERSION_HEX >= 0x03040000
|
||||
0, /* tp_finalize */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /* tp_vectorcall */
|
||||
#endif
|
||||
#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
|
||||
0, /* tp_print */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0, /* tp_allocs */
|
||||
0, /* tp_frees */
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
// uint8_t device_debug_level;
|
||||
uint16_t client_exe_delay;
|
||||
char *history_path;
|
||||
pm3_device *current_device;
|
||||
pm3_device_t *current_device;
|
||||
} session_arg_t;
|
||||
|
||||
extern session_arg_t g_session;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue