diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 21:17:19 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 21:17:19 (GMT) |
commit | 405c805f249cacb07f8861d5550abda8f6694d0c (patch) | |
tree | 669743f4b895c063296f0c6799fe698202d34893 /src/bindings | |
parent | 79b8a7941354416f83aae9cb53fbdf7e680beae2 (diff) | |
download | uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.zip uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.tar.gz uscxml-405c805f249cacb07f8861d5550abda8f6694d0c.tar.bz2 |
Various smaller bug-fixes (see details)
- Pass -DPHP_CONFIG=/usr/bin/zts-php-config for custom php-config
- More php bug fixes
- Fixed nasty "parse from string" bug
- Reindented source code
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/swig/php/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/bindings/swig/php/test.php | 46 | ||||
-rw-r--r-- | src/bindings/swig/php/uscxml.i | 19 | ||||
-rw-r--r-- | src/bindings/swig/php/uscxmlNativePHP.php | 4 |
4 files changed, 51 insertions, 28 deletions
diff --git a/src/bindings/swig/php/CMakeLists.txt b/src/bindings/swig/php/CMakeLists.txt index 2a63bb9..17c9465 100644 --- a/src/bindings/swig/php/CMakeLists.txt +++ b/src/bindings/swig/php/CMakeLists.txt @@ -64,14 +64,18 @@ SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(uscxmlNativePHP php5 uscxml.i) foreach(PHP_LIBRARY ${PHP_LIBRARIES}) - SWIG_LINK_LIBRARIES(uscxmlNativePHP ${PHP_LIBRARY}) +# SWIG_LINK_LIBRARIES(uscxmlNativePHP ${PHP_LIBRARY}) endforeach() +SWIG_LINK_LIBRARIES(uscxmlNativePHP uscxml) if (APPLE) set_target_properties(uscxmlNativePHP PROPERTIES LINK_FLAGS ${PHP_MODULE_CXX_FLAGS}) endif() -#set_target_properties(uscxmlNativePHP PROPERTIES LINK_FLAGS ${PHP_LDFLAGS}) + +if (PHP_ZTS_ENABLED) + # we are only building php bindings for unices anyhow + set_target_properties(uscxmlNativePHP PROPERTIES COMPILE_FLAGS "-DZTS -DPTHREADS") +endif() set_target_properties(uscxmlNativePHP PROPERTIES FOLDER "Bindings") -SWIG_LINK_LIBRARIES(uscxmlNativePHP uscxml) diff --git a/src/bindings/swig/php/test.php b/src/bindings/swig/php/test.php index 992f962..3ac64eb 100644 --- a/src/bindings/swig/php/test.php +++ b/src/bindings/swig/php/test.php @@ -2,24 +2,42 @@ require_once('uscxmlNativePHP.php'); -$exts = get_loaded_extensions(); -foreach ($exts as $e) -{ - echo "Name: ".$e." --"; - print_r(get_extension_funcs($e)); -} +// $exts = get_loaded_extensions(); +// foreach ($exts as $e) +// { +// echo "Name: ".$e." --"; +// print_r(get_extension_funcs($e)); +// } class MyMonitor extends InterpreterMonitor { + function beforeExitingStates($interpreter,$statesToExit) { + print "MyMonitor.beforeExitingStates()\n"; + } + function afterExitingStates($interpreter) { + print "MyMonitor.afterExitingStates()\n"; + } + function beforeEnteringStates($interpreter,$statesToEnter) { + print "MyMonitor.beforeEnteringStates()\n"; + } + function afterEnteringStates($interpreter) { + print "MyMonitor.afterEnteringStates()\n"; + } function onStableConfiguration($interpreter) { - print "MyMonitor.onStableConfiguration()\n"; - } + print "MyMonitor.onStableConfiguration()\n"; + } function beforeCompletion($interpreter) { - print "MyMonitor.beforeCompletion()\n"; + print "MyMonitor.beforeCompletion()\n"; } function afterCompletion($interpreter) { - print "MyMonitor.afterCompletion()\n"; + print "MyMonitor.afterCompletion()\n"; + } + function beforeMicroStep($interpreter) { + print "MyMonitor.beforeMicroStep()\n"; + } + function beforeTakingTransitions($interpreter,$transitions) { + print "MyMonitor.beforeTakingTransitions()\n"; } -}; +} $monitor = new MyMonitor(); @@ -27,4 +45,10 @@ $interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/mas $interpreter->addMonitor($monitor); $interpreter->interpret(); +// $interpreter = Interpreter::fromURI('https://raw.github.com/tklab-tud/uscxml/master/test/samples/uscxml/test-invoked.scxml'); +// $parentQueue = +// $interpreter->setParentQueue($parentQueue); +// $interpreter->addMonitor($monitor); +// $interpreter->interpret(); + ?>
\ No newline at end of file diff --git a/src/bindings/swig/php/uscxml.i b/src/bindings/swig/php/uscxml.i index 3aafb11..edf51e0 100644 --- a/src/bindings/swig/php/uscxml.i +++ b/src/bindings/swig/php/uscxml.i @@ -1,27 +1,19 @@ %module(directors="1", allprotected="1") uscxmlNativePHP // import swig typemaps -//%include <arrays_java.i> -//%include <inttypes.i> -//%include <boost_shared_ptr.i> %include <std_string.i> +// macros from cmake +%import "uscxml/config.h" + // disable warning related to unknown base class #pragma SWIG nowarn=401 -//%ignore boost::enable_shared_from_this; - -//%javaconst(1); - -# %shared_ptr(uscxml::dom::Element); -# %shared_ptr(uscxml::dom::Executable); - //************************************************** // This ends up in the generated wrapper code //************************************************** %{ - #include "../../../uscxml/Message.h" #include "../../../uscxml/Interpreter.h" @@ -29,12 +21,12 @@ using namespace uscxml; %} +// Add this to the very top of the generated wrapper code + %insert("begin") %{ void*** tsrm_ls; %} -//%rename(toString) operator<<; - %feature("director") uscxml::InterpreterMonitor; //*********************************************** @@ -43,4 +35,3 @@ void*** tsrm_ls; %include "../../../uscxml/Message.h" %include "../../../uscxml/Interpreter.h" - diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index 3b34dc9..6bab7af 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -26,6 +26,10 @@ if (!extension_loaded('uscxmlNativePHP')) { +abstract class uscxmlNativePHP { + const ZTS = ZTS; +} + /* PHP Proxy Classes */ class Data { public $_cPtr=null; |