mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
pm3_console() in Python/Lua/C: replace passthru by capture and quiet
This commit is contained in:
parent
57ec287ab0
commit
de96479d80
16 changed files with 4341 additions and 4193 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
|||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Changed `pm3_console()` - Python/Lua/C: replace `passthru` by `capture` and `quiet` (@doegox)
|
||||
- Fixed `hf iclass list` - annotation crc handled better (@iceman1001)
|
||||
- Fixed `hf_mf_uscuid_prog.lua` - bad divisions and code style fixes (@iceman1001)
|
||||
- Changed `hf iclass info` - now checks for cards silicon version (@antiklesys)
|
||||
|
|
|
@ -13,3 +13,4 @@
|
|||
ln -s build/proxmark3 .
|
||||
)
|
||||
ln -s ../pyscripts/pm3.py
|
||||
ln -s ../lualibs/dkjson.lua
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
(
|
||||
cd ..
|
||||
make -j
|
||||
)
|
||||
ln -s ../pyscripts/pm3.py
|
||||
ln -s ../lualibs/dkjson.lua
|
||||
|
|
|
@ -10,7 +10,7 @@ for line in p.grabbed_output:gmatch("[^\r\n]+") do
|
|||
end
|
||||
|
||||
print("Device:", p.name)
|
||||
p:console("Rem passthru remark! :coffee:", true)
|
||||
p:console("Rem passthru remark! :coffee:", false, false)
|
||||
|
||||
local json = require("dkjson")
|
||||
print("Fetching prefs:")
|
||||
|
|
|
@ -11,7 +11,7 @@ for line in p.grabbed_output.split('\n'):
|
|||
if "uC:" in line:
|
||||
print(line)
|
||||
print("Device:", p.name)
|
||||
p.console("Rem passthru remark! :coffee:", True)
|
||||
p.console("Rem passthru remark! :coffee:", capture=False, quiet=False)
|
||||
|
||||
import json
|
||||
print("Fetching prefs:")
|
||||
|
|
|
@ -9,6 +9,6 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
pm3 *p;
|
||||
p = pm3_open(argv[1]);
|
||||
pm3_console(p, "hw status", true);
|
||||
pm3_console(p, "hw status", false, false);
|
||||
pm3_close(p);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
|
|||
p = pm3_open(argv[1]);
|
||||
|
||||
// Execute the command
|
||||
pm3_console(p, "hw status", false);
|
||||
pm3_console(p, "hw status", true, true);
|
||||
|
||||
const char *buf = pm3_grabbed_output_get(p);
|
||||
const char *line_start = buf;
|
||||
|
|
|
@ -12,7 +12,7 @@ for line in p.grabbed_output:gmatch("[^\r\n]+") do
|
|||
end
|
||||
|
||||
print("Device:", p.name)
|
||||
p:console("Rem passthru remark! :coffee:", true)
|
||||
p:console("Rem passthru remark! :coffee:", false, false)
|
||||
|
||||
local json = require("dkjson")
|
||||
print("Fetching prefs:")
|
||||
|
|
|
@ -11,7 +11,7 @@ for line in p.grabbed_output.split('\n'):
|
|||
if "uC:" in line:
|
||||
print(line)
|
||||
print("Device:", p.name)
|
||||
p.console("Rem passthru remark! :coffee:", True)
|
||||
p.console("Rem passthru remark! :coffee:", capture=False, quiet=False)
|
||||
|
||||
import json
|
||||
print("Fetching prefs:")
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
typedef struct pm3_device pm3;
|
||||
|
||||
pm3 *pm3_open(const char *port);
|
||||
int pm3_console(pm3 *dev, const char *cmd, bool passthru);
|
||||
int pm3_console(pm3 *dev, const char *cmd, bool capture, bool quiet);
|
||||
const char *pm3_grabbed_output_get(pm3 *dev);
|
||||
const char *pm3_name_get(pm3 *dev);
|
||||
void pm3_close(pm3 *dev);
|
||||
|
|
|
@ -538,7 +538,7 @@ if args.final_check:
|
|||
cmd = f"hf mf fchk -f keys_{uid:08x}.dic --no-default --dump"
|
||||
if args.debug:
|
||||
print(cmd)
|
||||
p.console(cmd, passthru=True)
|
||||
p.console(cmd, capture=False, quiet=False)
|
||||
else:
|
||||
print()
|
||||
print(plus + color("found keys:", fg="green"))
|
||||
|
|
|
@ -66,8 +66,8 @@ class pm3(object):
|
|||
_pm3.pm3_swiginit(self, _pm3.new_pm3(*args))
|
||||
__swig_destroy__ = _pm3.delete_pm3
|
||||
|
||||
def console(self, cmd, passthru=False):
|
||||
return _pm3.pm3_console(self, cmd, passthru)
|
||||
def console(self, cmd, capture=True, quiet=True):
|
||||
return _pm3.pm3_console(self, cmd, capture, quiet)
|
||||
name = property(_pm3.pm3_name_get)
|
||||
grabbed_output = property(_pm3.pm3_grabbed_output_get)
|
||||
|
||||
|
|
|
@ -58,12 +58,14 @@ void pm3_close(pm3_device_t *dev) {
|
|||
free_grabber();
|
||||
}
|
||||
|
||||
int pm3_console(pm3_device_t *dev, const char *cmd, bool passthru) {
|
||||
int pm3_console(pm3_device_t *dev, const char *cmd, bool capture, bool quiet) {
|
||||
// For now, there is no real device context:
|
||||
(void) dev;
|
||||
uint8_t prev_printAndLog = g_printAndLog;
|
||||
if (! passthru) {
|
||||
if (capture) {
|
||||
g_printAndLog |= PRINTANDLOG_GRAB;
|
||||
}
|
||||
if (quiet) {
|
||||
g_printAndLog &= ~PRINTANDLOG_PRINT;
|
||||
}
|
||||
int ret = CommandReceived(cmd);
|
||||
|
|
|
@ -11,8 +11,11 @@
|
|||
|
||||
#ifdef PYWRAP
|
||||
#include <Python.h>
|
||||
%typemap(default) bool passthru {
|
||||
$1 = Py_False;
|
||||
%typemap(default) bool capture {
|
||||
$1 = Py_True;
|
||||
}
|
||||
%typemap(default) bool quiet {
|
||||
$1 = Py_True;
|
||||
}
|
||||
#endif
|
||||
typedef struct {
|
||||
|
@ -37,7 +40,7 @@ typedef struct {
|
|||
pm3_close($self);
|
||||
}
|
||||
}
|
||||
int console(char *cmd, bool passthru = false);
|
||||
int console(char *cmd, bool capture = true, bool quiet = true);
|
||||
char const * const name;
|
||||
char const * const grabbed_output;
|
||||
}
|
||||
|
|
|
@ -536,7 +536,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;
|
||||
}
|
||||
|
||||
|
@ -962,7 +963,8 @@ static const char *(lua_tolstring)(lua_State *L, int idx, size_t *len) {
|
|||
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);
|
||||
|
@ -972,7 +974,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);
|
||||
|
@ -1150,7 +1153,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 */
|
||||
|
@ -1166,7 +1170,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);
|
||||
|
@ -1183,7 +1188,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) {
|
||||
|
@ -1248,14 +1254,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");
|
||||
|
@ -1280,7 +1288,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");
|
||||
|
@ -1300,7 +1309,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
|
||||
|
@ -1314,8 +1324,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;
|
||||
|
@ -1327,8 +1337,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;
|
||||
}
|
||||
|
@ -1336,7 +1346,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
|
||||
|
@ -1348,12 +1359,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;
|
||||
|
@ -1372,7 +1384,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));
|
||||
|
@ -1395,7 +1408,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 */
|
||||
|
@ -1416,7 +1430,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);
|
||||
|
@ -1476,7 +1491,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 */
|
||||
|
@ -1507,7 +1523,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;
|
||||
|
@ -1573,7 +1590,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
|
||||
|
@ -1589,8 +1607,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 it's there */
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1)) /* if it's 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) */
|
||||
|
@ -1611,7 +1629,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
|
||||
|
@ -1630,8 +1649,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 */
|
||||
|
@ -1646,8 +1665,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 it's a C function or lua function */
|
||||
/* found it so return the fn & let lua call it */
|
||||
if (lua_isfunction(L,-1)) /* note: if 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 */
|
||||
if(ret)
|
||||
*ret = 1;
|
||||
|
@ -1663,7 +1682,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
|
||||
|
@ -1689,7 +1709,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
|
||||
|
@ -1706,13 +1727,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);
|
||||
|
@ -1726,8 +1748,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 it's there */
|
||||
/* found it so call the fn & return its value */
|
||||
if (lua_iscfunction(L,-1)) /* if it's 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 */
|
||||
|
@ -1749,7 +1771,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
|
||||
|
@ -1773,7 +1796,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;
|
||||
|
@ -1781,9 +1805,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 */
|
||||
}
|
||||
}
|
||||
|
@ -1791,7 +1817,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;
|
||||
|
@ -1803,7 +1830,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;
|
||||
|
@ -1817,7 +1845,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 */
|
||||
|
@ -1831,7 +1860,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);
|
||||
|
@ -1850,7 +1880,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);
|
||||
|
@ -1873,12 +1904,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 */
|
||||
|
@ -1887,7 +1919,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);
|
||||
|
@ -1901,7 +1934,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 */
|
||||
|
@ -1915,11 +1949,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;
|
||||
|
@ -1929,7 +1966,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) {
|
||||
|
@ -1944,7 +1982,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);
|
||||
|
@ -1958,7 +1997,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);
|
||||
|
@ -1971,10 +2011,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
|
||||
|
@ -1989,13 +2031,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);
|
||||
|
@ -2004,12 +2048,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]);
|
||||
}
|
||||
|
||||
|
@ -2019,13 +2065,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));
|
||||
|
@ -2089,7 +2137,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;
|
||||
|
@ -2110,7 +2159,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;
|
||||
|
@ -2121,7 +2171,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;
|
||||
|
@ -2157,7 +2208,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;
|
||||
|
@ -2177,7 +2229,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);
|
||||
|
@ -2203,7 +2256,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;
|
||||
|
@ -2259,7 +2313,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 */
|
||||
|
@ -2273,7 +2328,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);
|
||||
|
@ -2291,7 +2347,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 */
|
||||
|
@ -2305,7 +2362,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 */
|
||||
|
@ -2319,7 +2377,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);
|
||||
|
@ -2370,7 +2429,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);
|
||||
|
@ -2407,7 +2467,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 */
|
||||
|
@ -2421,7 +2482,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 */
|
||||
|
@ -2440,19 +2502,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);
|
||||
|
@ -2469,40 +2537,51 @@ 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)
|
||||
{
|
||||
int ret = SWIG_ERROR;
|
||||
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)) {
|
||||
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_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own) {
|
||||
if (usr)
|
||||
{
|
||||
if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !usr->own)
|
||||
{
|
||||
return SWIG_ERROR_RELEASE_NOT_OWNED;
|
||||
}
|
||||
if (flags & SWIG_POINTER_DISOWN) { /* must disown the object */
|
||||
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;
|
||||
ret = SWIG_OK;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
cast=SWIG_TypeCheck(usr->type->name,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 */
|
||||
ret = SWIG_OK;
|
||||
}
|
||||
}
|
||||
if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR)) {
|
||||
if ((ret == SWIG_OK) && (flags & SWIG_POINTER_CLEAR))
|
||||
{
|
||||
usr->ptr = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2520,7 +2599,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 */
|
||||
|
@ -2531,11 +2611,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 */
|
||||
}
|
||||
|
@ -2543,9 +2625,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;
|
||||
|
@ -2555,7 +2639,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;
|
||||
}
|
||||
|
@ -2704,12 +2789,10 @@ 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;
|
||||
|
||||
fail:
|
||||
SWIGUNUSED;
|
||||
fail: SWIGUNUSED;
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2724,12 +2807,10 @@ 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;
|
||||
|
||||
fail:
|
||||
SWIGUNUSED;
|
||||
fail: SWIGUNUSED;
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2759,8 +2840,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2768,13 +2848,15 @@ static int _wrap_pm3_console(lua_State *L) {
|
|||
int SWIG_arg = 0;
|
||||
pm3 *arg1 = (pm3 *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
bool arg3 = (bool) false ;
|
||||
bool arg3 = (bool) true ;
|
||||
bool arg4 = (bool) true ;
|
||||
int result;
|
||||
|
||||
SWIG_check_num_args("pm3::console", 2, 3)
|
||||
SWIG_check_num_args("pm3::console",2,4)
|
||||
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pm3::console",1,"pm3 *");
|
||||
if(!SWIG_lua_isnilstring(L,2)) SWIG_fail_arg("pm3::console",2,"char *");
|
||||
if(lua_gettop(L)>=3 && !lua_isboolean(L,3)) SWIG_fail_arg("pm3::console",3,"bool");
|
||||
if(lua_gettop(L)>=4 && !lua_isboolean(L,4)) SWIG_fail_arg("pm3::console",4,"bool");
|
||||
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_pm3,0))){
|
||||
SWIG_fail_ptr("pm3_console",1,SWIGTYPE_p_pm3);
|
||||
|
@ -2784,13 +2866,14 @@ static int _wrap_pm3_console(lua_State *L) {
|
|||
if(lua_gettop(L)>=3){
|
||||
arg3 = (lua_toboolean(L, 3)!=0);
|
||||
}
|
||||
result = (int)pm3_console(arg1, arg2, arg3);
|
||||
lua_pushnumber(L, (lua_Number) result);
|
||||
SWIG_arg++;
|
||||
if(lua_gettop(L)>=4){
|
||||
arg4 = (lua_toboolean(L, 4)!=0);
|
||||
}
|
||||
result = (int)pm3_console(arg1,arg2,arg3,arg4);
|
||||
lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
fail:
|
||||
SWIGUNUSED;
|
||||
fail: SWIGUNUSED;
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2809,12 +2892,10 @@ 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;
|
||||
|
||||
fail:
|
||||
SWIGUNUSED;
|
||||
fail: SWIGUNUSED;
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2833,12 +2914,10 @@ static int _wrap_pm3_grabbed_output_get(lua_State *L) {
|
|||
}
|
||||
|
||||
result = (char *)pm3_grabbed_output_get(arg1);
|
||||
lua_pushstring(L, (const char *)result);
|
||||
SWIG_arg++;
|
||||
lua_pushstring(L,(const char *)result); SWIG_arg++;
|
||||
return SWIG_arg;
|
||||
|
||||
fail:
|
||||
SWIGUNUSED;
|
||||
fail: SWIGUNUSED;
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3169,8 +3248,7 @@ SWIG_PropagateClientData(void) {
|
|||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{
|
||||
/* c-mode */
|
||||
{ /* c-mode */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -3267,7 +3345,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);
|
||||
}
|
||||
|
|
|
@ -574,7 +574,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;
|
||||
}
|
||||
|
||||
|
@ -835,7 +836,8 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|||
|
||||
/* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */
|
||||
SWIGINTERN const char *
|
||||
SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes) {
|
||||
SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
# if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
|
||||
*pbytes = NULL;
|
||||
|
@ -856,7 +858,8 @@ SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes
|
|||
}
|
||||
|
||||
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
|
||||
|
@ -946,7 +949,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;
|
||||
|
@ -972,7 +976,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;
|
||||
|
@ -981,7 +986,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;
|
||||
|
@ -1249,7 +1255,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;
|
||||
|
@ -1594,7 +1601,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;
|
||||
|
@ -1613,7 +1621,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)
|
||||
|
@ -1630,7 +1639,8 @@ SWIG_Python_ExceptionType(swig_type_info *desc) {
|
|||
|
||||
|
||||
SWIGRUNTIME SwigPyClientData *
|
||||
SwigPyClientData_New(PyObject *obj) {
|
||||
SwigPyClientData_New(PyObject* obj)
|
||||
{
|
||||
if (!obj) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -1679,7 +1689,8 @@ SwigPyClientData_New(PyObject *obj) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME void
|
||||
SwigPyClientData_Del(SwigPyClientData *data) {
|
||||
SwigPyClientData_Del(SwigPyClientData *data)
|
||||
{
|
||||
Py_XDECREF(data->klass);
|
||||
Py_XDECREF(data->newraw);
|
||||
Py_XDECREF(data->newargs);
|
||||
|
@ -1704,7 +1715,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)
|
||||
|
@ -1717,12 +1729,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) {
|
||||
|
@ -1746,17 +1760,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 (repr && v->next) {
|
||||
|
@ -1781,12 +1798,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);
|
||||
|
@ -1794,7 +1813,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 = NULL;
|
||||
if (!PyErr_Occurred()) {
|
||||
if (op != Py_EQ && op != Py_NE) {
|
||||
|
@ -1859,7 +1879,8 @@ SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
|
|||
static PyObject* Swig_Capsule_global = NULL;
|
||||
|
||||
SWIGRUNTIME void
|
||||
SwigPyObject_dealloc(PyObject *v) {
|
||||
SwigPyObject_dealloc(PyObject *v)
|
||||
{
|
||||
SwigPyObject *sobj = (SwigPyObject *) v;
|
||||
PyObject *next = sobj->next;
|
||||
if (sobj->own == SWIG_POINTER_OWN) {
|
||||
|
@ -1917,7 +1938,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");
|
||||
|
@ -1930,7 +1952,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);
|
||||
|
@ -1941,21 +1964,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;
|
||||
|
@ -2145,7 +2171,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;
|
||||
|
@ -2177,7 +2204,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);
|
||||
|
@ -2187,7 +2215,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);
|
||||
|
@ -2197,7 +2226,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);
|
||||
|
@ -2231,7 +2261,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);
|
||||
|
@ -2354,7 +2385,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);
|
||||
|
@ -2372,7 +2404,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;
|
||||
|
@ -2390,7 +2423,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;
|
||||
|
@ -2404,7 +2438,8 @@ SWIG_This(void) {
|
|||
#endif
|
||||
|
||||
SWIGRUNTIME SwigPyObject *
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj) {
|
||||
SWIG_Python_GetSwigThis(PyObject *pyobj)
|
||||
{
|
||||
PyObject *obj;
|
||||
|
||||
if (SwigPyObject_Check(pyobj))
|
||||
|
@ -2658,7 +2693,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) {
|
||||
|
@ -2723,7 +2759,8 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
|
|||
}
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) {
|
||||
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
|
||||
{
|
||||
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
|
||||
PyObject **dictptr = _PyObject_GetDictPtr(inst);
|
||||
if (dictptr != NULL) {
|
||||
|
@ -2869,7 +2906,8 @@ SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
|
|||
static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */
|
||||
|
||||
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;
|
||||
|
@ -2915,7 +2953,8 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -2945,7 +2984,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;
|
||||
|
@ -2973,7 +3013,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];
|
||||
|
@ -2985,14 +3026,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)) {
|
||||
|
@ -3154,7 +3197,8 @@ SWIGINTERN pm3 *new_pm3__SWIG_0(void) {
|
|||
}
|
||||
|
||||
SWIGINTERN swig_type_info*
|
||||
SWIG_pchar_descriptor(void) {
|
||||
SWIG_pchar_descriptor(void)
|
||||
{
|
||||
static int init = 0;
|
||||
static swig_type_info* info = 0;
|
||||
if (!init) {
|
||||
|
@ -3168,7 +3212,8 @@ SWIG_pchar_descriptor(void) {
|
|||
/* Return string from Python obj. NOTE: obj must remain in scope in order
|
||||
to use the returned cptr (but only when alloc is set to SWIG_OLDOBJ) */
|
||||
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))
|
||||
|
@ -3179,8 +3224,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;
|
||||
PyObject *bytes = NULL;
|
||||
int ret = SWIG_OK;
|
||||
if (alloc)
|
||||
|
@ -3214,8 +3258,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;
|
||||
}
|
||||
|
@ -3271,7 +3314,8 @@ SWIGINTERN void delete_pm3(pm3 *self) {
|
|||
}
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_double(PyObject *obj, double *val) {
|
||||
SWIG_AsVal_double (PyObject *obj, double *val)
|
||||
{
|
||||
int res = SWIG_TypeError;
|
||||
if (PyFloat_Check(obj)) {
|
||||
if (val) *val = PyFloat_AsDouble(obj);
|
||||
|
@ -3354,7 +3398,8 @@ SWIG_CanCastAsInteger(double *d, double min, double max) {
|
|||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_long(PyObject *obj, long *val) {
|
||||
SWIG_AsVal_long (PyObject *obj, long* val)
|
||||
{
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
if (PyInt_Check(obj)) {
|
||||
if (val) *val = PyInt_AsLong(obj);
|
||||
|
@ -3401,7 +3446,8 @@ SWIG_AsVal_long(PyObject *obj, long *val) {
|
|||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_bool(PyObject *obj, bool *val) {
|
||||
SWIG_AsVal_bool (PyObject *obj, bool *val)
|
||||
{
|
||||
int r;
|
||||
if (!PyBool_Check(obj))
|
||||
return SWIG_ERROR;
|
||||
|
@ -3414,13 +3460,15 @@ SWIG_AsVal_bool(PyObject *obj, bool *val) {
|
|||
|
||||
|
||||
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();
|
||||
|
@ -3444,7 +3492,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));
|
||||
}
|
||||
|
||||
|
@ -3546,7 +3595,8 @@ SWIGINTERN PyObject *_wrap_pm3_console(PyObject *self, PyObject *args) {
|
|||
PyObject *resultobj = 0;
|
||||
pm3 *arg1 = (pm3 *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
bool arg3 = (bool) false ;
|
||||
bool arg3 = (bool) true ;
|
||||
bool arg4 = (bool) true ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
int res2 ;
|
||||
|
@ -3554,11 +3604,13 @@ SWIGINTERN PyObject *_wrap_pm3_console(PyObject *self, PyObject *args) {
|
|||
int alloc2 = 0 ;
|
||||
bool val3 ;
|
||||
int ecode3 = 0 ;
|
||||
PyObject *swig_obj[3] ;
|
||||
bool val4 ;
|
||||
int ecode4 = 0 ;
|
||||
PyObject *swig_obj[4] ;
|
||||
int result;
|
||||
|
||||
(void)self;
|
||||
if (!SWIG_Python_UnpackTuple(args, "pm3_console", 2, 3, swig_obj)) SWIG_fail;
|
||||
if (!SWIG_Python_UnpackTuple(args, "pm3_console", 2, 4, swig_obj)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_pm3, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_console" "', argument " "1"" of type '" "pm3 *""'");
|
||||
|
@ -3576,7 +3628,14 @@ SWIGINTERN PyObject *_wrap_pm3_console(PyObject *self, PyObject *args) {
|
|||
}
|
||||
arg3 = (bool)(val3);
|
||||
}
|
||||
result = (int)pm3_console(arg1, arg2, arg3);
|
||||
if (swig_obj[3]) {
|
||||
ecode4 = SWIG_AsVal_bool(swig_obj[3], &val4);
|
||||
if (!SWIG_IsOK(ecode4)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "pm3_console" "', argument " "4"" of type '" "bool""'");
|
||||
}
|
||||
arg4 = (bool)(val4);
|
||||
}
|
||||
result = (int)pm3_console(arg1,arg2,arg3,arg4);
|
||||
resultobj = SWIG_From_int((int)(result));
|
||||
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||
return resultobj;
|
||||
|
@ -3679,8 +3738,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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue