moving phpmod in esl to use swig2.0 which fixes the few issues when you reswig
This commit is contained in:
parent
a54901212c
commit
c2798d7d11
|
@ -2,7 +2,7 @@
|
|||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.35
|
||||
* Version 2.0.7
|
||||
*
|
||||
* 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
|
||||
|
@ -11,13 +11,12 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
// Try to load our extension if it's not already loaded.
|
||||
if (!extension_loaded("ESL")) {
|
||||
if (!extension_loaded('ESL')) {
|
||||
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
||||
if (!dl('php_ESL.dll')) return;
|
||||
} else {
|
||||
// PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
|
||||
// It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
|
||||
if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
|
||||
// PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
|
||||
if (PHP_SHLIB_SUFFIX === 'dylib') {
|
||||
if (!dl('ESL.so')) return;
|
||||
} else {
|
||||
if (!dl('ESL.'.PHP_SHLIB_SUFFIX)) return;
|
||||
|
@ -36,28 +35,37 @@ abstract class ESL {
|
|||
/* PHP Proxy Classes */
|
||||
class ESLevent {
|
||||
public $_cPtr=null;
|
||||
protected $_pData=array();
|
||||
|
||||
function __set($var,$value) {
|
||||
$func = 'ESLevent_'.$var.'_set';
|
||||
if (function_exists($func)) call_user_func($func,$this->_cPtr,$value);
|
||||
if (function_exists($func)) return call_user_func($func,$this->_cPtr,$value);
|
||||
if ($var === 'thisown') return swig_ESL_alter_newobject($this->_cPtr,$value);
|
||||
$this->_pData[$var] = $value;
|
||||
}
|
||||
|
||||
function __isset($var) {
|
||||
return function_exists('ESLevent_'.$var.'_set');
|
||||
if (function_exists('ESLevent_'.$var.'_set')) return true;
|
||||
if ($var === 'thisown') return true;
|
||||
return array_key_exists($var, $this->_pData);
|
||||
}
|
||||
|
||||
function __get($var) {
|
||||
$func = 'ESLevent_'.$var.'_get';
|
||||
if (function_exists($func)) return call_user_func($func,$this->_cPtr);
|
||||
return null;
|
||||
if ($var === 'thisown') return swig_ESL_get_newobject($this->_cPtr);
|
||||
return $this->_pData[$var];
|
||||
}
|
||||
|
||||
function __construct($type_or_wrap_me_or_me,$subclass_name_or_free_me=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=new_ESLevent($type_or_wrap_me_or_me); break;
|
||||
default: $r=new_ESLevent($type_or_wrap_me_or_me,$subclass_name_or_free_me);
|
||||
if (is_resource($type_or_wrap_me_or_me) && get_resource_type($type_or_wrap_me_or_me) === '_p_ESLevent') {
|
||||
$this->_cPtr=$type_or_wrap_me_or_me;
|
||||
return;
|
||||
}
|
||||
switch (func_num_args()) {
|
||||
case 1: $this->_cPtr=new_ESLevent($type_or_wrap_me_or_me); break;
|
||||
default: $this->_cPtr=new_ESLevent($type_or_wrap_me_or_me,$subclass_name_or_free_me);
|
||||
}
|
||||
$this->_cPtr=$r;
|
||||
}
|
||||
|
||||
function serialize($format=null) {
|
||||
|
@ -119,15 +127,34 @@ class ESLevent {
|
|||
|
||||
class ESLconnection {
|
||||
public $_cPtr=null;
|
||||
protected $_pData=array();
|
||||
|
||||
function __set($var,$value) {
|
||||
if ($var === 'thisown') return swig_ESL_alter_newobject($this->_cPtr,$value);
|
||||
$this->_pData[$var] = $value;
|
||||
}
|
||||
|
||||
function __isset($var) {
|
||||
if ($var === 'thisown') return true;
|
||||
return array_key_exists($var, $this->_pData);
|
||||
}
|
||||
|
||||
function __get($var) {
|
||||
if ($var === 'thisown') return swig_ESL_get_newobject($this->_cPtr);
|
||||
return $this->_pData[$var];
|
||||
}
|
||||
|
||||
function __construct($host_or_socket,$port=null,$user_or_password=null,$password=null) {
|
||||
switch (func_num_args()) {
|
||||
case 1: $r=new_ESLconnection($host_or_socket); break;
|
||||
case 2: $r=new_ESLconnection($host_or_socket,$port); break;
|
||||
case 3: $r=new_ESLconnection($host_or_socket,$port,$user_or_password); break;
|
||||
default: $r=new_ESLconnection($host_or_socket,$port,$user_or_password,$password);
|
||||
if (is_resource($host_or_socket) && get_resource_type($host_or_socket) === '_p_ESLconnection') {
|
||||
$this->_cPtr=$host_or_socket;
|
||||
return;
|
||||
}
|
||||
switch (func_num_args()) {
|
||||
case 1: $this->_cPtr=new_ESLconnection($host_or_socket); break;
|
||||
case 2: $this->_cPtr=new_ESLconnection($host_or_socket,$port); break;
|
||||
case 3: $this->_cPtr=new_ESLconnection($host_or_socket,$port,$user_or_password); break;
|
||||
default: $this->_cPtr=new_ESLconnection($host_or_socket,$port,$user_or_password,$password);
|
||||
}
|
||||
$this->_cPtr=$r;
|
||||
}
|
||||
|
||||
function socketDescriptor() {
|
||||
|
@ -140,7 +167,12 @@ class ESLconnection {
|
|||
|
||||
function getInfo() {
|
||||
$r=ESLconnection_getInfo($this->_cPtr);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function send($cmd) {
|
||||
|
@ -149,7 +181,12 @@ class ESLconnection {
|
|||
|
||||
function sendRecv($cmd) {
|
||||
$r=ESLconnection_sendRecv($this->_cPtr,$cmd);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function api($cmd,$arg=null) {
|
||||
|
@ -157,7 +194,12 @@ class ESLconnection {
|
|||
case 1: $r=ESLconnection_api($this->_cPtr,$cmd); break;
|
||||
default: $r=ESLconnection_api($this->_cPtr,$cmd,$arg);
|
||||
}
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function bgapi($cmd,$arg=null,$job_uuid=null) {
|
||||
|
@ -166,12 +208,22 @@ class ESLconnection {
|
|||
case 2: $r=ESLconnection_bgapi($this->_cPtr,$cmd,$arg); break;
|
||||
default: $r=ESLconnection_bgapi($this->_cPtr,$cmd,$arg,$job_uuid);
|
||||
}
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function sendEvent($send_me) {
|
||||
$r=ESLconnection_sendEvent($this->_cPtr,$send_me);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function sendMSG($send_me,$uuid=null) {
|
||||
|
@ -184,17 +236,32 @@ class ESLconnection {
|
|||
|
||||
function recvEvent() {
|
||||
$r=ESLconnection_recvEvent($this->_cPtr);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function recvEventTimed($ms) {
|
||||
$r=ESLconnection_recvEventTimed($this->_cPtr,$ms);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function filter($header,$value) {
|
||||
$r=ESLconnection_filter($this->_cPtr,$header,$value);
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function events($etype,$value) {
|
||||
|
@ -207,7 +274,12 @@ class ESLconnection {
|
|||
case 2: $r=ESLconnection_execute($this->_cPtr,$app,$arg); break;
|
||||
default: $r=ESLconnection_execute($this->_cPtr,$app,$arg,$uuid);
|
||||
}
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function executeAsync($app,$arg=null,$uuid=null) {
|
||||
|
@ -216,7 +288,12 @@ class ESLconnection {
|
|||
case 2: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg); break;
|
||||
default: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg,$uuid);
|
||||
}
|
||||
return is_resource($r) ? new ESLevent($r) : $r;
|
||||
if (is_resource($r)) {
|
||||
$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
|
||||
if (class_exists($c)) return new $c($r);
|
||||
return new ESLevent($r);
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function setAsyncExecute($val) {
|
||||
|
|
|
@ -16,7 +16,7 @@ WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function
|
|||
all: ESL.so
|
||||
|
||||
esl_wrap.cpp:
|
||||
swig -module ESL -php5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
|
||||
swig2.0 -module ESL -php5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
|
||||
sed -e 's/ char \*type_name;/ const char \*type_name;/' -i esl_wrap.cpp
|
||||
|
||||
esl_wrap.o: esl_wrap.cpp
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.35
|
||||
* Version 2.0.7
|
||||
*
|
||||
* 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
|
||||
|
@ -8,8 +8,6 @@
|
|||
* interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
#ifndef PHP_ESL_H
|
||||
#define PHP_ESL_H
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@ if ($argc > 1) {
|
|||
array_shift($argv);
|
||||
$command = sprintf('%s', implode(' ', $argv));
|
||||
printf("Command to run is: %s\n", $command);
|
||||
|
||||
$sock = new ESLconnection('localhost', '8021', 'ClueCon');
|
||||
$res = $sock->api($command);
|
||||
printf("%s\n", $res->getBody());
|
||||
$esl = new eslConnection('127.0.0.1', '8021', 'ClueCon');
|
||||
$e = $esl->api("$command");
|
||||
print $e->getBody();
|
||||
} else {
|
||||
printf("ERROR: You Need To Pass A Command\nUsage:\n\t%s <command>", $argv[0]);
|
||||
}
|
||||
|
|
|
@ -5,3 +5,4 @@ $esl = new eslConnection('127.0.0.1', '8021', 'ClueCon');
|
|||
$e = $esl->sendRecv("api status");
|
||||
print $e->getBody();
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue