diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-25 20:36:03 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-25 20:36:03 (GMT) |
commit | 00f5d8af3c8e42ba8a0d0c206d2c2e8f1867a61e (patch) | |
tree | afa4183b1bb4ee777cad27475c3d7679822c8046 | |
parent | 4d6fb580b1c1378cb1441fff4adeca889cbba58e (diff) | |
download | uscxml-00f5d8af3c8e42ba8a0d0c206d2c2e8f1867a61e.zip uscxml-00f5d8af3c8e42ba8a0d0c206d2c2e8f1867a61e.tar.gz uscxml-00f5d8af3c8e42ba8a0d0c206d2c2e8f1867a61e.tar.bz2 |
Refactored CMakeLists and updated W3C tests
33 files changed, 1275 insertions, 654 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8abbe26..1d4925a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,7 @@ include("${CMAKE_MODULE_PATH}/HeaderExists.cmake") set(USCXML_CORE_LIBS) set(USCXML_OPT_LIBS) set(USCXML_FILES) +set(USCXML_INCLUDE_DIRS) # some compiler flags #message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") @@ -308,8 +309,11 @@ foreach( OUTPUT_CONFIG ${CMAKE_CONFIGURATION_TYPES} ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUT_CONFIG} "${OUTPUT_DIR}/lib" ) endforeach() +OPTION(BUILD_AS_PLUGINS "Build invokers, ioprocessors and datamodels as plugins" OFF) + # this is where the config.h ends up include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(src) ############################################################ # Dependent libraries @@ -329,42 +333,26 @@ elseif(WIN32) list (APPEND USCXML_CORE_LIBS ${XML_LIBRARIES}) endif() - # CURL find_package(CURL REQUIRED) -# find_package(OpenSSL REQUIRED) -# find_package(ZLIB REQUIRED) - -# include_directories(${OPENSSL_INCLUDE_DIR}) -# include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${CURL_INCLUDE_DIRS}) list (APPEND USCXML_CORE_LIBS ${CURL_LIBRARIES}) -# list (APPEND USCXML_CORE_LIBS ${OPENSSL_LIBRARIES}) -# list (APPEND USCXML_CORE_LIBS ${ZLIB_LIBRARIES}) if (WIN32) add_definitions("-DCURL_STATICLIB") endif() - # prefer rest as static libraries set(CMAKE_FIND_LIBRARY_SUFFIXES_ORIG ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) -################################ -# required libraries for core - - # GLOG - # set(ENV{GLOG_SRC} ${CMAKE_SOURCE_DIR}/../glog) find_package(GLOG REQUIRED) include_directories(${GLOG_INCLUDE_DIR}) list (APPEND USCXML_CORE_LIBS ${GLOG_LIBRARY}) add_definitions(-DGLOG_NO_ABBREVIATED_SEVERITIES) - # ARABICA - # set($ENV{ARABICA_SRC} ${PROJECT_SOURCE_DIR}/../arabica) find_package(Arabica REQUIRED) include_directories(${ARABICA_INCLUDE_DIR}) @@ -373,620 +361,35 @@ if (WIN32) add_definitions("-DUSE_MSXML") endif() - # BOOST - header only - FIND_PATH(Boost_INCLUDE_DIR boost/version.hpp) include_directories(${Boost_INCLUDE_DIR}) - # LIBEVENT - #set(ENV{EVENT_SRC} ${CMAKE_SOURCE_DIR}/../libevent) find_package(EVENT REQUIRED) include_directories(${EVENT_INCLUDE_DIR}) list (APPEND USCXML_CORE_LIBS ${EVENT_LIBRARY}) -############################################################ -# Actual files of core library -############################################################ - -file(GLOB_RECURSE USCXML_SERVER - src/uscxml/server/*.cpp - src/uscxml/server/*.h -) -source_group("Interpreter" FILES ${USCXML_SERVER}) -list (APPEND USCXML_FILES ${USCXML_SERVER}) - -file(GLOB_RECURSE USCXML_CONCURRENCY - src/uscxml/concurrency/*.cpp - src/uscxml/concurrency/*.h -) -source_group("Interpreter" FILES ${USCXML_CONCURRENCY}) -list (APPEND USCXML_FILES ${USCXML_CONCURRENCY}) - -file(GLOB_RECURSE USCXML_DEBUG - src/uscxml/debug/*.cpp - src/uscxml/debug/*.h -) -source_group("Interpreter" FILES ${USCXML_DEBUG}) -list (APPEND USCXML_FILES ${USCXML_DEBUG}) - -file(GLOB_RECURSE USCXML_INTERPRETERS - src/uscxml/interpreter/*.cpp - src/uscxml/interpreter/*.h -) -source_group("Interpreter" FILES ${USCXML_INTERPRETERS}) -list (APPEND USCXML_FILES ${USCXML_INTERPRETERS}) - -file(GLOB USCXML_CORE - contrib/src/jsmn/jsmn.c - src/uscxml/*.cpp - src/uscxml/*.h -) -source_group("Interpreter" FILES ${USCXML_CORE}) -list (APPEND USCXML_FILES ${USCXML_CORE}) - -include_directories(src) - -OPTION(BUILD_AS_PLUGINS "Build invokers, ioprocessors and datamodels as plugins" OFF) -if (BUILD_AS_PLUGINS) - include_directories(${PROJECT_SOURCE_DIR}/src/uscxml/plugins) - file(GLOB PLUMA - src/uscxml/plugins/Pluma/*.cpp - src/uscxml/plugins/Pluma/*.h - src/uscxml/plugins/*.cpp - src/uscxml/plugins/*.h - ) - source_group("Interpreter" FILES ${PLUMA}) - list (APPEND USCXML_FILES ${PLUMA}) - add_definitions("-DBUILD_AS_PLUGINS") -endif() - -if (BUILD_AS_PLUGINS) - add_library(uscxml ${USCXML_FILES}) -endif() ################################################# -# optional things we can build as plugins - -# sample invoker - include to make sure it compiles -file(GLOB_RECURSE SAMPLE_INVOKER - src/uscxml/plugins/invoker/sample/*.cpp - src/uscxml/plugins/invoker/sample/*.h -) -source_group("Invoker\\sample" FILES ${SAMPLE_INVOKER}) -if (BUILD_AS_PLUGINS) - add_library( - invoker_sample SHARED - ${SAMPLE_INVOKER}) - target_link_libraries(invoker_sample uscxml) - set_target_properties(invoker_sample PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${SAMPLE_INVOKER}) -endif() - - -# LIBEVENT basichttp ioprocessor - this one is already required above - -file(GLOB_RECURSE BASICHTTP_IOPROCESSOR - src/uscxml/plugins/ioprocessor/basichttp/*.cpp - src/uscxml/plugins/ioprocessor/basichttp/*.h -) -source_group("IOProcessor\\basichttp" FILES ${BASICHTTP_IOPROCESSOR}) -if (BUILD_AS_PLUGINS) - add_library( - ioprocessor_basichttp SHARED - ${BASICHTTP_IOPROCESSOR}) - target_link_libraries(ioprocessor_basichttp uscxml) - set_target_properties(ioprocessor_basichttp PROPERTIES FOLDER "Plugin IOProcessor") -else() - list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR}) -endif() - - -# scxml ioprocessor - this one is already required above - -file(GLOB_RECURSE SCXML_IOPROCESSOR - src/uscxml/plugins/ioprocessor/scxml/*.cpp - src/uscxml/plugins/ioprocessor/scxml/*.h -) -source_group("IOProcessor\\scxml" FILES ${SCXML_IOPROCESSOR}) -if (BUILD_AS_PLUGINS) - add_library( - ioprocessor_scxml SHARED - ${SCXML_IOPROCESSOR}) - target_link_libraries(ioprocessor_scxml uscxml) - set_target_properties(ioprocessor_scxml PROPERTIES FOLDER "Plugin IOProcessor") -else() - list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR}) -endif() - - -# mmi ioprocessor - -file(GLOB_RECURSE MMI_IOPROCESSOR - src/uscxml/plugins/ioprocessor/modality/*.cpp - src/uscxml/plugins/ioprocessor/modality/*.h -) -source_group("IOProcessor\\modality" FILES ${MMI_IOPROCESSOR}) -if (BUILD_AS_PLUGINS) - add_library( - ioprocessor_mmi SHARED - ${MMI_IOPROCESSOR}) - target_link_libraries(ioprocessor_mmi uscxml) - set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor") -else() - list (APPEND USCXML_FILES ${MMI_IOPROCESSOR}) -endif() - - -# Fetch element - -file(GLOB_RECURSE FETCH_ELEMENT - src/uscxml/plugins/element/fetch/*.cpp - src/uscxml/plugins/element/fetch/*.h -) -source_group("Element\\fetch" FILES ${FETCH_ELEMENT}) -if (BUILD_AS_PLUGINS) - add_library( - element_fetch SHARED - ${FETCH_ELEMENT}) - target_link_libraries(element_fetch uscxml) - set_target_properties(element_fetch PROPERTIES FOLDER "Plugin Element") -else() - list (APPEND USCXML_FILES ${FETCH_ELEMENT}) -endif() - - -# Postpone element - -file(GLOB_RECURSE POSTPONE_ELEMENT - src/uscxml/plugins/element/postpone/*.cpp - src/uscxml/plugins/element/postpone/*.h -) -source_group("Element\\postpone" FILES ${POSTPONE_ELEMENT}) -if (BUILD_AS_PLUGINS) - add_library( - element_postpone SHARED - ${POSTPONE_ELEMENT}) - target_link_libraries(element_postpone uscxml) - set_target_properties(element_postpone PROPERTIES FOLDER "Plugin Element") -else() - list (APPEND USCXML_FILES ${POSTPONE_ELEMENT}) -endif() - - -# Respond element - -file(GLOB_RECURSE RESPOND_ELEMENT - src/uscxml/plugins/element/respond/*.cpp - src/uscxml/plugins/element/respond/*.h -) -source_group("Element\\respond" FILES ${RESPOND_ELEMENT}) -if (BUILD_AS_PLUGINS) - add_library( - element_respond SHARED - ${RESPOND_ELEMENT}) - target_link_libraries(element_respond uscxml) - set_target_properties(element_respond PROPERTIES FOLDER "Plugin Element") -else() - list (APPEND USCXML_FILES ${RESPOND_ELEMENT}) -endif() - - -# DirMon invoker to watch for filesystem changes - -file(GLOB_RECURSE DIRMON_INVOKER - src/uscxml/plugins/invoker/filesystem/dirmon/*.cpp - src/uscxml/plugins/invoker/filesystem/dirmon/*.h -) -source_group("Invoker\\dirmon" FILES ${DIRMON_INVOKER}) -include_directories(${PROJECT_SOURCE_DIR}/src/uscxml/plugins/invoker/filesystem/dirmon/) -if (BUILD_AS_PLUGINS) - add_library( - invoker_dirmon SHARED - ${DIRMON_INVOKER}) - target_link_libraries(invoker_dirmon uscxml) - set_target_properties(invoker_dirmon PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${DIRMON_INVOKER}) -endif() - - -# System invoker to open a native command - -file(GLOB_RECURSE SYSTEM_INVOKER - src/uscxml/plugins/invoker/system/*.cpp - src/uscxml/plugins/invoker/system/*.h -) -source_group("Invoker\\system" FILES ${SYSTEM_INVOKER}) -include_directories(${PROJECT_SOURCE_DIR}/src/uscxml/plugins/invoker/system/) -if (BUILD_AS_PLUGINS) - add_library( - invoker_system SHARED - ${SYSTEM_INVOKER}) - target_link_libraries(invoker_system uscxml) - set_target_properties(invoker_system PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${SYSTEM_INVOKER}) -endif() - - -# SQLite3 SQL Invoker - -find_package(Sqlite3) -if (SQLITE3_FOUND) - file(GLOB_RECURSE SQLITE3_INVOKER - src/uscxml/plugins/invoker/sqlite3/*.cpp - src/uscxml/plugins/invoker/sqlite3/*.h - ) - source_group("Invoker\\sqlite" FILES ${SQLITE3_INVOKER}) - if (BUILD_AS_PLUGINS) - add_library( - invoker_sqlite3 SHARED - ${SQLITE3_INVOKER}) - target_link_libraries(invoker_sqlite3 uscxml) - set_target_properties(invoker_sqlite3 PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${SQLITE3_INVOKER}) - endif() -endif() - - -# ffmpeg invoker - -find_package(FFMPEG) -if (FFMPEG_FOUND) - include_directories(${FFMPEG_INCLUDE_DIR}) - file(GLOB_RECURSE FFMPEG_INVOKER - src/uscxml/plugins/invoker/ffmpeg/*.cpp - src/uscxml/plugins/invoker/ffmpeg/*.h - ) - source_group("Invoker\\ffmpeg" FILES ${FFMPEG_INVOKER}) - if (BUILD_AS_PLUGINS) - add_library( - invoker_ffmpeg SHARED - ${FFMPEG_INVOKER}) - target_link_libraries(invoker_ffmpeg uscxml) - set_target_properties(invoker_ffmpeg PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${FFMPEG_INVOKER}) - endif() -endif() - - -# JavaScriptCore ecmascript datamodel -if (APPLE AND IOS AND OFF) - FIND_LIBRARY(JSC_LIBRARY JavaScriptCore) - set(JSC_FOUND ON) - file(GLOB JSC_DATAMODEL - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.cpp - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.h - ) - source_group("Datamodel\\jsc" FILES ${JSC_DATAMODEL}) - file(GLOB_RECURSE JSC_DOM - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.cpp - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.h - ) - source_group("Datamodel\\DOM" FILES ${JSC_DOM}) - if (BUILD_AS_PLUGINS) - add_library( - datamodel_jsc SHARED - ${JSC_DATAMODEL} - ${JSC_DOM}) - target_link_libraries(datamodel_jsc - uscxml - ${JSC_LIBRARY}) - set_target_properties(datamodel_jsc PROPERTIES FOLDER "Plugin DataModel") - else() - list (APPEND USCXML_FILES ${JSC_DATAMODEL}) - list (APPEND USCXML_FILES ${JSC_DOM}) - list (APPEND USCXML_OPT_LIBS ${JSC_LIBRARY}) - endif() - -endif() - - -# NULL datamodel - -file(GLOB NULL_DATAMODEL - src/uscxml/plugins/datamodel/null/*.cpp - src/uscxml/plugins/datamodel/null/*.h -) -source_group("Datamodel\\null" FILES ${NULL_DATAMODEL}) -if (BUILD_AS_PLUGINS) - add_library(datamodel_null SHARED ${NULL_DATAMODEL}) - target_link_libraries(datamodel_null uscxml) - set_target_properties(datamodel_null PROPERTIES FOLDER "Plugin DataModel") -else() - list (APPEND USCXML_FILES ${NULL_DATAMODEL}) -endif() - - -# XPath datamodel - -file(GLOB XPATH_DATAMODEL - src/uscxml/plugins/datamodel/xpath/*.cpp - src/uscxml/plugins/datamodel/xpath/*.h -) -source_group("Datamodel\\xpath" FILES ${XPATH_DATAMODEL}) -if (BUILD_AS_PLUGINS) - add_library(datamodel_xpath SHARED ${XPATH_DATAMODEL}) - target_link_libraries(datamodel_xpath uscxml) - set_target_properties(datamodel_xpath PROPERTIES FOLDER "Plugin DataModel") -else() - list (APPEND USCXML_FILES ${XPATH_DATAMODEL}) -endif() - - -# GOOGLE V8 ecmascript datamodel - -#if (NOT APPLE OR IOS) - # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8) - find_package(V8) - if (V8_FOUND) - include_directories(${V8_INCLUDE_DIR}) - file(GLOB V8_DATAMODEL - src/uscxml/plugins/datamodel/ecmascript/v8/*.cpp - src/uscxml/plugins/datamodel/ecmascript/v8/*.h - ) - source_group("Datamodel\\v8" FILES ${V8_DATAMODEL}) - file(GLOB_RECURSE V8_DOM -# ${PROJECT_SOURCE_DIR}/contrib/dom/scripts/gen/*.cpp -# ${PROJECT_SOURCE_DIR}/contrib/dom/scripts/gen/*.h - src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.cpp - src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.h - ) - # include_directories(${PROJECT_SOURCE_DIR}/contrib/dom/scripts/gen/) - # list(APPEND V8_DOM "src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp") - # list(APPEND V8_DOM "src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h") - - source_group("Datamodel\\DOM" FILES ${V8_DOM}) - - if (BUILD_AS_PLUGINS) - add_library( - datamodel_v8 SHARED - ${V8_DATAMODEL} - ${V8_DOM}) - target_link_libraries(datamodel_v8 - uscxml - ${V8_LIBRARY}) - set_target_properties(datamodel_v8 PROPERTIES FOLDER "Plugin DataModel") - else() - list (APPEND USCXML_FILES ${V8_DATAMODEL}) - list (APPEND USCXML_FILES ${V8_DOM}) - list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY}) - endif() - endif() -#endif() - - -# SWI PROLOG datamodel - -#set(SWI_INCLUDE_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/include) -#set(SWI_LIBRARY_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/lib/x86_64-darwin12.2.0) -find_package(SWI) -#find_package(GMP) -#find_package(CURSES) -if (SWI_FOUND) - include_directories(${SWI_INCLUDE_DIR}) -# include_directories(${GMP_INCLUDE_DIR}) -# include_directories(${CURSES_INCLUDE_DIR}) - file(GLOB_RECURSE SWI_DATAMODEL - src/uscxml/plugins/datamodel/prolog/swi/*.cpp - src/uscxml/plugins/datamodel/prolog/swi/*.h - ) - source_group("Datamodel\\swi" FILES ${SWI_DATAMODEL}) - if (BUILD_AS_PLUGINS) - add_library( - datamodel_swi SHARED - ${SWI_DATAMODEL}) - target_link_libraries(datamodel_swi - uscxml -# ${GMP_LIBRARY} -# ${CURSES_LIBRARIES} - ${SWI_LIBRARY}) - set_target_properties(datamodel_swi PROPERTIES FOLDER "Plugin DataModel") - else() - list (APPEND USCXML_FILES ${SWI_DATAMODEL}) - list (APPEND USCXML_OPT_LIBS ${SWI_LIBRARY}) # ${GMP_LIBRARY} ${CURSES_LIBRARIES}) - endif() -endif() - - -# UMUNDO invoker - -if (WIN32) - find_package(UMUNDO COMPONENTS convenience) -else() - find_package(UMUNDO COMPONENTS rpc serial core) -endif() -if (UMUNDO_FOUND) - include_directories(${UMUNDO_INCLUDE_DIR}) - file(GLOB_RECURSE UMUNDO_INVOKER - src/uscxml/plugins/invoker/umundo/*.cpp - src/uscxml/plugins/invoker/umundo/*.h) - source_group("Invoker\\umundo" FILES ${UMUNDO_INVOKER}) - if (BUILD_AS_PLUGINS) - add_library( - invoker_umundo SHARED - ${UMUNDO_INVOKER}) - target_link_libraries(invoker_umundo - uscxml - ${UMUNDO_LIBRARIES}) - set_target_properties(invoker_umundo PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${UMUNDO_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${UMUNDO_LIBRARIES}) - endif() - add_definitions("-DUMUNDO_STATIC") -endif() - +# Gather source files -# USCXML invoker +# we use include instead of add_subdirectory because +# source groups do not work otherwise. -file(GLOB_RECURSE USCXML_INVOKER - src/uscxml/plugins/invoker/scxml/*.cpp - src/uscxml/plugins/invoker/scxml/*.h) -source_group("Invoker\\uscxml" FILES ${USCXML_INVOKER}) -if (BUILD_AS_PLUGINS) - add_library( - invoker_uscxml SHARED - ${USCXML_INVOKER}) - target_link_libraries(invoker_uscxml - uscxml) - set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${USCXML_INVOKER}) -endif() - - -# HTTP server invoker - -file(GLOB_RECURSE HTTPSERVLET_INVOKER - src/uscxml/plugins/invoker/http/*.cpp - src/uscxml/plugins/invoker/http/*.h) -source_group("Invoker\\httpservlet" FILES ${HTTPSERVLET_INVOKER}) -if (BUILD_AS_PLUGINS) - add_library( - invoker_httpserver SHARED - ${HTTPSERVLET_INVOKER}) - target_link_libraries(invoker_httpserver - uscxml) - set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${HTTPSERVLET_INVOKER}) -endif() - - -# Heartbeat invoker +include(src/uscxml/CMakeLists.txt) +include_directories(${USCXML_INCLUDE_DIRS}) -file(GLOB_RECURSE HEARTBEAT_INVOKER - src/uscxml/plugins/invoker/heartbeat/*.cpp - src/uscxml/plugins/invoker/heartbeat/*.h -) -source_group("Invoker\\heartbeat" FILES ${HEARTBEAT_INVOKER}) -if (BUILD_AS_PLUGINS) - add_library( - invoker_heartbeat SHARED - ${HEARTBEAT_INVOKER}) - target_link_libraries(invoker_heartbeat uscxml) - set_target_properties(invoker_heartbeat PROPERTIES FOLDER "Plugin Invoker") -else() - list (APPEND USCXML_FILES ${HEARTBEAT_INVOKER}) -endif() - - -# OpenSceneGraph invoker -if (UNIX) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIG}) # link dynamically! -elseif(WIN32) - if (ENV{OSG_ROOT} STREQUAL "") - set(ENV{OSG_ROOT} "C:/Program Files/OpenSceneGraph-3.0.1") - endif() -endif() - -find_package(OpenSceneGraph COMPONENTS osgViewer osgGA osgText osgFX osgManipulator osgDB osgUtil OpenThreads) -find_package(OpenGL) -if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) - - include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) - include_directories(${OPENGL_INCLUDE_DIR}) - - file(GLOB OPENSCENEGRAPH_INVOKER - src/uscxml/plugins/invoker/graphics/openscenegraph/*.cpp - src/uscxml/plugins/invoker/graphics/openscenegraph/*.h) - source_group("Invoker\\scenegraph" FILES ${OPENSCENEGRAPH_INVOKER}) - - if (BUILD_AS_PLUGINS) - add_library( - invoker_openscenegraph SHARED - ${OPENSCENEGRAPH_INVOKER}) - target_link_libraries(invoker_openscenegraph - ${OPENSCENEGRAPH_LIBRARIES} - ${OPENGL_LIBRARIES} - uscxml) - set_target_properties(invoker_openscenegraph PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) - endif() - - file(GLOB OPENSCENEGRAPH_CONVERTER_INVOKER - src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.cpp - src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.h) - source_group("Invoker\\scenegraph\\convert" FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) - - if (BUILD_AS_PLUGINS) - add_library( - invoker_openscenegraph_convert SHARED - ${OPENSCENEGRAPH_CONVERTER_INVOKER}) - target_link_libraries(invoker_openscenegraph_convert - ${OPENSCENEGRAPH_LIBRARIES} - ${OPENGL_LIBRARIES} - uscxml) - set_target_properties(invoker_openscenegraph_convert PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) - endif() - -endif() - -if (UNIX) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) -endif() - -# MILES modality components - -find_package(MILES) -if (MILES_FOUND AND OFF) - include_directories(${MILES_INCLUDE_DIR}) - - # openal is only needed for miles - find_package(OpenAL REQUIRED) -# find_package(JPEG REQUIRED) - list (APPEND MILES_LIBRARIES "iconv") - list (APPEND MILES_LIBRARIES ${JPEG_LIBRARIES}) - include_directories(${OPENAL_INCLUDE_DIR}) - - file(GLOB_RECURSE MILES_INVOKER src/uscxml/plugins/invoker/miles/*.cpp src/uscxml/plugins/invoker/miles/*.h) - source_group("Invoker\\miles" FILES ${MILES_INVOKER}) -# message("MILES_INVOKER ${MILES_INVOKER}") - - if (BUILD_AS_PLUGINS) - add_library( - invoker_miles SHARED - ${MILES_INVOKER}) - target_link_libraries(invoker_miles - ${MILES_LIBRARIES} - ${OPENAL_LIBRARY} - uscxml) - set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker") - else() - list (APPEND USCXML_FILES ${MILES_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${MILES_LIBRARIES}) - list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY}) - endif() -endif() - - -# order of libraries matters with some gcc versions?! -if (UNIX AND NOT APPLE) - list (APPEND USCXML_CORE_LIBS "pthread") - list (APPEND USCXML_CORE_LIBS "rt") - list (APPEND USCXML_CORE_LIBS "dl") -endif() - -list(SORT USCXML_FILES) ############################################################ # Binaries and tests ############################################################ # build library -if (NOT BUILD_AS_PLUGINS) +if (BUILD_AS_PLUGINS) + add_library(uscxml ${USCXML_FILES}) +else() add_library(uscxml ${USCXML_FILES}) endif() target_link_libraries(uscxml ${USCXML_OPT_LIBS} ${USCXML_CORE_LIBS}) diff --git a/apps/samples/vrml/viewer.html b/apps/samples/vrml/viewer.html index 52b0f66..1e1043b 100644 --- a/apps/samples/vrml/viewer.html +++ b/apps/samples/vrml/viewer.html @@ -46,9 +46,7 @@ <body class="tundra"> <table> <tr><td> - <div style="width: 600px; height: 600px"> - <div id="scene1"></div> - </div> + <div id="scene1" /> </td></tr> <tr><td> <div id="annotations1"></div> diff --git a/apps/samples/vrml/viewer.js b/apps/samples/vrml/viewer.js index c897917..f6f2e42 100644 --- a/apps/samples/vrml/viewer.js +++ b/apps/samples/vrml/viewer.js @@ -2,7 +2,7 @@ function VRMLViewer(element, params) { // private attributes var self = this; - + // private instanceId if (!VRMLViewer.instances) VRMLViewer.instances = 0; @@ -18,8 +18,8 @@ function VRMLViewer(element, params) { this.pose.x = 0; this.pose.y = 0; this.pose.z = 0; - this.pose.width = 640; - this.pose.height = 480; + this.pose.width = 450; + this.pose.height = 350; this.pose.autorotate = false; this.serverURL = "http://88.69.49.213:8080/vrml"; @@ -63,9 +63,12 @@ function VRMLViewer(element, params) { ready) { ready(function() { + if (typeof(element) === 'string') { element = dom.byId(element); } + element.style.height = self.pose.height; + element.style.width = self.pose.width; self.element = element; self.xhr = xhr; diff --git a/contrib/proto/mmi/LifeCycleEvents.proto b/contrib/proto/mmi/LifeCycleEvents.proto new file mode 100644 index 0000000..f77c3d0 --- /dev/null +++ b/contrib/proto/mmi/LifeCycleEvents.proto @@ -0,0 +1,217 @@ +option java_package = "@mmi.protoc.package@";
+
+message LifeCycleEvent {
+ required string RequestID = 1;
+ required string Source = 2;
+ required string Target = 3;
+
+ // For type identification of nested types
+ enum LifeCycleEventType {
+ NEW_CONTEXT_REQUEST = 0;
+ NEW_CONTEXT_RESPONSE = 1;
+ PREPARE_REQUEST = 2;
+ PREPARE_RESPONSE = 3;
+ START_REQUEST = 4;
+ START_RESPONSE = 5;
+ DONE_NOTIFICATION = 6;
+ CANCEL_REQUEST = 7;
+ CANCEL_RESPONSE = 8;
+ PAUSE_REQUEST = 9;
+ PAUSE_RESPONSE = 10;
+ RESUME_REQUEST = 11;
+ RESUME_RESPONSE = 12;
+ EXTENSION_NOTIFICATION = 13;
+ CLEAR_CONTEXT_REQUEST = 14;
+ CLEAR_CONTEXT_RESPONSE = 15;
+ STATUS_REQUEST = 16;
+ STATUS_RESPONSE = 17;
+ }
+ required LifeCycleEventType Type = 4;
+ // For the nested extension and for data
+ extensions 5 to max;
+}
+
+message LifeCycleRequest {
+ extend LifeCycleEvent {
+ required LifeCycleRequest Request = 5;
+ }
+
+ required string Context = 1;
+ extensions 2 to max;
+}
+
+message LifeCycleResponse {
+ extend LifeCycleEvent {
+ required LifeCycleResponse Response = 6;
+ }
+
+ enum StatusType {
+ SUCCESS = 0;
+ FAILURE = 1;
+ }
+
+ required string Context = 1;
+ required StatusType Status = 2;
+ optional string StatusInfo = 3;
+ extensions 4 to max;
+}
+
+
+message NewContextRequest {
+ extend LifeCycleEvent {
+ required NewContextRequest Request = 7;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message NewContextResponse {
+ extend LifeCycleResponse {
+ required NewContextResponse Response = 4;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message PrepareRequest {
+ extend LifeCycleRequest {
+ required PrepareRequest Request = 2;
+ }
+
+ optional string ContentURL = 1;
+ optional string Content = 2;
+ // Extend for custom data
+ extensions 3 to max;
+}
+
+message PrepareResponse {
+ extend LifeCycleResponse {
+ required PrepareResponse Response = 5;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message StartRequest {
+ extend LifeCycleRequest {
+ required StartRequest Request = 3;
+ }
+ optional string ContentURL = 1;
+ optional string Content = 2;
+ // Extend for custom data
+ extensions 3 to max;
+}
+
+message StartResponse {
+ extend LifeCycleResponse {
+ required StartResponse Response = 6;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message DoneNotification {
+ extend LifeCycleResponse {
+ required DoneNotification Notification = 9;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message CancelRequest {
+ extend LifeCycleRequest {
+ required CancelRequest Request = 4;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message CancelResponse {
+ extend LifeCycleResponse {
+ required CancelResponse Response = 7;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message PauseRequest {
+ extend LifeCycleRequest {
+ required PauseRequest Request = 5;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message PauseResponse {
+ extend LifeCycleResponse {
+ required PauseResponse Response = 8;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message ResumeRequest {
+ extend LifeCycleRequest {
+ required ResumeRequest Request = 6;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message ResumeResponse {
+ extend LifeCycleResponse {
+ required ResumeResponse Response = 10;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message ExtensionNotification {
+ extend LifeCycleEvent {
+ required ExtensionNotification Notification = 8;
+ }
+ required string Name = 1;
+ required string Context = 2;
+ // Extend for custom data
+ extensions 3 to max;
+}
+
+message ClearContextRequest {
+ extend LifeCycleRequest {
+ required ClearContextRequest Request = 7;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message ClearContextResponse {
+ extend LifeCycleResponse {
+ required ClearContextResponse Response = 11;
+ }
+ // Extend for custom data
+ extensions 1 to max;
+}
+
+message StatusRequest {
+ extend LifeCycleEvent {
+ required StatusRequest Request = 9;
+ }
+ optional string Context = 2;
+ // Extend for custom data
+ extensions 3 to max;
+}
+
+message StatusResponse {
+ extend LifeCycleEvent {
+ required StatusResponse Response = 10;
+ }
+ enum StatusType {
+ ALIVE = 0;
+ DEAD = 1;
+ }
+
+ optional string Context = 1;
+ required StatusType Status = 2;
+ // Extend for custom data
+ extensions 3 to max;
+}
diff --git a/contrib/proto/mmi/StringDataExtension.proto b/contrib/proto/mmi/StringDataExtension.proto new file mode 100644 index 0000000..428f2ff --- /dev/null +++ b/contrib/proto/mmi/StringDataExtension.proto @@ -0,0 +1,129 @@ +import "LifeCycleEvents.proto"; + +option java_package = "@mmi.protoc.package@"; + +message NewContextRequestData { + extend NewContextRequest { + required NewContextRequestData Request = 1; + } + optional string Data = 1; +} + +message NewContextResponseData { + extend NewContextResponse { + required NewContextResponseData Response = 1; + } + optional string Data = 1; +} + +message PrepareRequestData { + extend PrepareRequest { + required PrepareRequestData Request = 3; + } + optional string Data = 1; +} + +message PrepareResponseData { + extend PrepareResponse { + required PrepareResponseData Response = 1; + } + optional string Data = 1; +} + +message StartRequestData { + extend StartRequest { + required StartRequestData Request = 3; + } + optional string Data = 1; +} + +message StartResponseData { + extend StartResponse { + required StartResponseData Response = 1; + } + optional string Data = 1; +} + +message DoneNotificationData { + extend DoneNotification { + required DoneNotificationData Notification = 1; + } + optional string Data = 1; +} + +message CancelRequestData { + extend CancelRequest { + required CancelRequestData Request = 1; + } + optional string Data = 1; +} + +message CancelResponseData { + extend CancelResponse { + required CancelResponseData Response = 1; + } + optional string Data = 1; +} + +message PauseRequestData { + extend PauseRequest { + required PauseRequestData Request = 1; + } + optional string Data = 1; +} + +message PauseResponseData { + extend PauseResponse { + required PauseResponseData Response = 1; + } + optional string Data = 1; +} + +message ResumeRequestData { + extend ResumeRequest { + required ResumeRequestData Request = 1; + } + optional string Data = 1; +} + +message ResumeResponseData { + extend ResumeResponse { + required ResumeResponseData Response = 1; + } + optional string Data = 1; +} + +message ExtensionNotificationData { + extend ExtensionNotification { + required ExtensionNotificationData Notification = 3; + } + optional string Data = 1; +} + +message ClearContextRequestData { + extend ClearContextRequest { + required ClearContextRequestData Request = 1; + } + optional string Data = 1; +} + +message ClearContextResponseData { + extend ClearContextResponse { + required ClearContextResponseData Response = 1; + } + optional string Data = 1; +} + +message StatusRequestData { + extend StatusRequest { + required StatusRequestData Request = 3; + } + optional string Data = 1; +} + +message StatusResponseData { + extend StatusResponse { + required StatusResponse Response = 3; + } + optional string Data = 1; +} diff --git a/installer/license.txt b/installer/license.txt index e602ee8..220eb6f 100644 --- a/installer/license.txt +++ b/installer/license.txt @@ -32,5 +32,5 @@ Group. IMPORTANT! -Please note that the various implementations used in uMundo come with +Please note that the various implementations used in uSCXML come with their own licenses and are only packaged as a matter of convenience. diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index 86eba7b..e7ef93d 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -224,6 +224,22 @@ class Event { Event_setDOM($this->_cPtr,$dom); } + function getFirstDOMElement() { + return Event_getFirstDOMElement($this->_cPtr); + } + + function getStrippedDOM() { + return Event_getStrippedDOM($this->_cPtr); + } + + function getRaw() { + return Event_getRaw($this->_cPtr); + } + + function setRaw($raw) { + Event_setRaw($this->_cPtr,$raw); + } + function getContent() { return Event_getContent($this->_cPtr); } diff --git a/src/uscxml/CMakeLists.txt b/src/uscxml/CMakeLists.txt new file mode 100644 index 0000000..3167405 --- /dev/null +++ b/src/uscxml/CMakeLists.txt @@ -0,0 +1,58 @@ +############################################################ +# Actual files of core library +############################################################ + +file(GLOB_RECURSE USCXML_SERVER + src/uscxml/server/*.cpp + src/uscxml/server/*.h +) +source_group("Interpreter" FILES ${USCXML_SERVER}) +list (APPEND USCXML_FILES ${USCXML_SERVER}) + +file(GLOB_RECURSE USCXML_CONCURRENCY + src/uscxml/concurrency/*.cpp + src/uscxml/concurrency/*.h +) +source_group("Interpreter" FILES ${USCXML_CONCURRENCY}) +list (APPEND USCXML_FILES ${USCXML_CONCURRENCY}) + +file(GLOB_RECURSE USCXML_DEBUG + src/uscxml/debug/*.cpp + src/uscxml/debug/*.h +) +source_group("Interpreter" FILES ${USCXML_DEBUG}) +list (APPEND USCXML_FILES ${USCXML_DEBUG}) + +file(GLOB_RECURSE USCXML_INTERPRETERS + src/uscxml/interpreter/*.cpp + src/uscxml/interpreter/*.h +) +source_group("Interpreter" FILES ${USCXML_INTERPRETERS}) +list (APPEND USCXML_FILES ${USCXML_INTERPRETERS}) + +file(GLOB USCXML_CORE + ${CMAKE_SOURCE_DIR}/contrib/src/jsmn/jsmn.c + src/uscxml/*.cpp + src/uscxml/*.h +) +source_group("Interpreter" FILES ${USCXML_CORE}) +list (APPEND USCXML_FILES ${USCXML_CORE}) + +if (BUILD_AS_PLUGINS) + list (APPEND USCXML_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/uscxml/plugins) + file(GLOB PLUMA + src/uscxml/plugins/Pluma/*.cpp + src/uscxml/plugins/Pluma/*.h + src/uscxml/plugins/*.cpp + src/uscxml/plugins/*.h + ) + source_group("Interpreter" FILES ${PLUMA}) + list (APPEND USCXML_FILES ${PLUMA}) + add_definitions("-DBUILD_AS_PLUGINS") +endif() + +include(src/uscxml/plugins/datamodel/CMakeLists.txt) +include(src/uscxml/plugins/element/CMakeLists.txt) +include(src/uscxml/plugins/invoker/CMakeLists.txt) +include(src/uscxml/plugins/ioprocessor/CMakeLists.txt) + diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h index 0b0a628..5840d97 100644 --- a/src/uscxml/Common.h +++ b/src/uscxml/Common.h @@ -14,7 +14,7 @@ // possible loss of data #pragma warning (disable : 4244) #pragma warning (disable : 4267) -// 'this' : used in base member initializer list (TypedSubscriber) +// 'this' : used in base member initializer list #pragma warning (disable : 4355) // is thrown alot in arabica headers diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt new file mode 100644 index 0000000..0634984 --- /dev/null +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -0,0 +1,132 @@ +# JavaScriptCore ecmascript datamodel +if (APPLE AND IOS AND OFF) + FIND_LIBRARY(JSC_LIBRARY JavaScriptCore) + set(JSC_FOUND ON) + file(GLOB JSC_DATAMODEL + src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.cpp + src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.h + ) + source_group("Datamodel\\jsc" FILES ${JSC_DATAMODEL}) + file(GLOB_RECURSE JSC_DOM + src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.cpp + src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.h + ) + source_group("Datamodel\\DOM" FILES ${JSC_DOM}) + if (BUILD_AS_PLUGINS) + add_library( + datamodel_jsc SHARED + ${JSC_DATAMODEL} + ${JSC_DOM}) + target_link_libraries(datamodel_jsc + uscxml + ${JSC_LIBRARY}) + set_target_properties(datamodel_jsc PROPERTIES FOLDER "Plugin DataModel") + else() + list (APPEND USCXML_FILES ${JSC_DATAMODEL}) + list (APPEND USCXML_FILES ${JSC_DOM}) + list (APPEND USCXML_OPT_LIBS ${JSC_LIBRARY}) + endif() + +endif() + + +# NULL datamodel + +file(GLOB NULL_DATAMODEL + src/uscxml/plugins/datamodel/null/*.cpp + src/uscxml/plugins/datamodel/null/*.h +) +source_group("Datamodel\\null" FILES ${NULL_DATAMODEL}) +if (BUILD_AS_PLUGINS) + add_library(datamodel_null SHARED ${NULL_DATAMODEL}) + target_link_libraries(datamodel_null uscxml) + set_target_properties(datamodel_null PROPERTIES FOLDER "Plugin DataModel") +else() + list (APPEND USCXML_FILES ${NULL_DATAMODEL}) +endif() + + +# XPath datamodel + +file(GLOB XPATH_DATAMODEL + src/uscxml/plugins/datamodel/xpath/*.cpp + src/uscxml/plugins/datamodel/xpath/*.h +) +source_group("Datamodel\\xpath" FILES ${XPATH_DATAMODEL}) +if (BUILD_AS_PLUGINS) + add_library(datamodel_xpath SHARED ${XPATH_DATAMODEL}) + target_link_libraries(datamodel_xpath uscxml) + set_target_properties(datamodel_xpath PROPERTIES FOLDER "Plugin DataModel") +else() + list (APPEND USCXML_FILES ${XPATH_DATAMODEL}) +endif() + + +# GOOGLE V8 ecmascript datamodel + +#if (NOT APPLE OR IOS) + # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8) + find_package(V8) + if (V8_FOUND) + list (APPEND USCXML_INCLUDE_DIRS ${V8_INCLUDE_DIR}) + file(GLOB V8_DATAMODEL + src/uscxml/plugins/datamodel/ecmascript/v8/*.cpp + src/uscxml/plugins/datamodel/ecmascript/v8/*.h + ) + source_group("Datamodel\\v8" FILES ${V8_DATAMODEL}) + file(GLOB_RECURSE V8_DOM + src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.cpp + src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.h + ) + source_group("Datamodel\\v8\\DOM" FILES ${V8_DOM}) + + if (BUILD_AS_PLUGINS) + add_library( + datamodel_v8 SHARED + ${V8_DATAMODEL} + ${V8_DOM}) + target_link_libraries(datamodel_v8 + uscxml + ${V8_LIBRARY}) + set_target_properties(datamodel_v8 PROPERTIES FOLDER "Plugin DataModel") + else() + list (APPEND USCXML_FILES ${V8_DATAMODEL}) + list (APPEND USCXML_FILES ${V8_DOM}) + list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY}) + endif() + endif() +#endif() + + +# SWI PROLOG datamodel + +#set(SWI_INCLUDE_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/include) +#set(SWI_LIBRARY_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/lib/x86_64-darwin12.2.0) +find_package(SWI) +#find_package(GMP) +#find_package(CURSES) +if (SWI_FOUND) + list (APPEND USCXML_INCLUDE_DIRS ${SWI_INCLUDE_DIR}) +# message(FATAL_ERROR "SWI_INCLUDE_DIR: ${SWI_INCLUDE_DIR}") +# include_directories(${GMP_INCLUDE_DIR}) +# include_directories(${CURSES_INCLUDE_DIR}) + file(GLOB_RECURSE SWI_DATAMODEL + src/uscxml/plugins/datamodel/prolog/swi/*.cpp + src/uscxml/plugins/datamodel/prolog/swi/*.h + ) + source_group("Datamodel\\swi" FILES ${SWI_DATAMODEL}) + if (BUILD_AS_PLUGINS) + add_library( + datamodel_swi SHARED + ${SWI_DATAMODEL}) + target_link_libraries(datamodel_swi + uscxml +# ${GMP_LIBRARY} +# ${CURSES_LIBRARIES} + ${SWI_LIBRARY}) + set_target_properties(datamodel_swi PROPERTIES FOLDER "Plugin DataModel") + else() + list (APPEND USCXML_FILES ${SWI_DATAMODEL}) + list (APPEND USCXML_OPT_LIBS ${SWI_LIBRARY}) # ${GMP_LIBRARY} ${CURSES_LIBRARIES}) + endif() +endif() diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index db91869..5d6455f 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -43,6 +43,12 @@ boost::shared_ptr<DataModelImpl> SWIDataModel::create(InterpreterImpl* interpret return boost::shared_ptr<DataModelImpl>(); } + // load SWI XML parser + PlCall("use_module", PlCompound("library", PlTerm("sgml"))); + PlCall("assert", PlCompound("sessionId", PlTerm(PlString(dm->_interpreter->getSessionId().c_str())))); + PlCall("assert", PlCompound("name", PlTerm(PlString(dm->_interpreter->getName().c_str())))); + + PlCall("assert(eventName(X) :- event(Y,_), arg(1, Y, X))."); return dm; } @@ -76,8 +82,55 @@ void SWIDataModel::initialize() { } void SWIDataModel::setEvent(const Event& event) { -// std::cout << "SWIDataModel::setEvent" << std::endl; - _event = event; + // remove old event + PlCall("system", "retractall", PlTermv("event")); + + PlTermv plEvent(7); + plEvent[0] = PlCompound("name", PlTerm(PlString(event.name.c_str()))); + plEvent[1] = PlCompound("raw", PlTerm(PlString(event.raw.c_str()))); + plEvent[2] = PlCompound("origin", PlTerm(PlString(event.origin.c_str()))); + plEvent[3] = PlCompound("origintype", PlTerm(PlString(event.origintype.c_str()))); + plEvent[4] = PlCompound("data", PlTerm(PlString(event.content.c_str()))); + + Event::params_t::const_iterator paramIter; + // count unique keys in params + paramIter = event.params.begin(); + size_t uniqueKeys = 0; + while(paramIter != event.params.end()) { + uniqueKeys++; + paramIter = event.params.upper_bound(paramIter->first); + } + + // create a compund for every unique key + PlTermv paramTerm(uniqueKeys); + paramIter = event.params.begin(); + for(int i = 0; paramIter != event.params.end(); i++) { + Event::params_t::const_iterator lastValueIter = event.params.upper_bound(paramIter->first); + size_t items = event.params.count(paramIter->first); + PlTermv keyTerm(items); + for (int j = 0; paramIter != lastValueIter; j++) { + keyTerm[j] = PlString(paramIter->second.c_str()); + paramIter++; + } + paramTerm[i] = PlCompound(paramIter->first.c_str(), keyTerm); + paramIter = lastValueIter; + } + plEvent[5] = PlCompound("params", paramTerm); + + PlTerm type; + switch (event.type) { + case Event::PLATFORM: + type = "platform"; + break; + case Event::INTERNAL: + type = "internal"; + break; + case Event::EXTERNAL: + type = "external"; + break; + } + plEvent[6] = PlCompound("type", type); + PlCall("assert", PlCompound("event", plEvent)); } Data SWIDataModel::getStringAsData(const std::string& content) { @@ -128,13 +181,12 @@ std::string SWIDataModel::evalAsString(const std::string& expr) { PlQuery query(compound.name(), termv); std::stringstream ss; + const char* separator = ""; while (query.next_solution()) { for (int i = 0; i < compound.arity(); i++) { - const char* separator = ""; ss << separator << (char *)termv[i]; separator = ", "; } - ss << std::endl; } return ss.str(); } @@ -158,7 +210,15 @@ void SWIDataModel::assign(const std::string& location, const Data& data) { void SWIDataModel::init(const Arabica::DOM::Element<std::string>& dataElem, const Arabica::DOM::Document<std::string>& doc, - const std::string& content) {} + const std::string& content) { + std::string key; + if (HAS_ATTR(dataElem, "id")) { + key = ATTR(dataElem, "id"); + } else if (HAS_ATTR(dataElem, "location")) { + key = ATTR(dataElem, "location"); + } + assign(dataElem, doc, content); +} void SWIDataModel::init(const std::string& location, const Data& data) {} bool SWIDataModel::isDeclared(const std::string& expr) { diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index 6377af2..1af56b5 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -380,19 +380,23 @@ void XPathDataModel::assign(const Element<std::string>& assignElem, // test 326ff XPathValue<std::string> key = _xpath.evaluate_expr(location, _doc); +#if 0 if (key.type() == NODE_SET) { - for (int i = 0; i < key.asNodeSet().size(); i++) { - Node<std::string> node = key.asNodeSet()[i]; - if (node == _varResolver.resolveVariable("", "_ioprocessors").asNodeSet()[0]) - throw Event("error.execution", Event::PLATFORM); - if (node == _varResolver.resolveVariable("", "_sessionid").asNodeSet()[0]) - throw Event("error.execution", Event::PLATFORM); - if (node == _varResolver.resolveVariable("", "_name").asNodeSet()[0]) - throw Event("error.execution", Event::PLATFORM); - if (node == _varResolver.resolveVariable("", "_event").asNodeSet()[0]) - throw Event("error.execution", Event::PLATFORM); - } + try { + for (int i = 0; i < key.asNodeSet().size(); i++) { + Node<std::string> node = key.asNodeSet()[i]; + if (node == _varResolver.resolveVariable("", "_ioprocessors").asNodeSet()[0]) + throw Event("error.execution", Event::PLATFORM); + if (node == _varResolver.resolveVariable("", "_sessionid").asNodeSet()[0]) + throw Event("error.execution", Event::PLATFORM); + if (node == _varResolver.resolveVariable("", "_name").asNodeSet()[0]) + throw Event("error.execution", Event::PLATFORM); + if (node == _varResolver.resolveVariable("", "_event").asNodeSet()[0]) + throw Event("error.execution", Event::PLATFORM); + } + } catch (Event e) {} } +#endif NodeSet<std::string> nodeSet; if (doc) { if (doc.getDocumentElement()) { @@ -495,7 +499,7 @@ void XPathDataModel::init(const Element<std::string>& dataElem, // put data element into nodeset and bind to xpath variable NodeSet<std::string> nodeSet; -#if 1 +#if 0 nodeSet.push_back(container); #else Node<std::string> node = container.getFirstChild(); diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt new file mode 100644 index 0000000..fa54fc3 --- /dev/null +++ b/src/uscxml/plugins/element/CMakeLists.txt @@ -0,0 +1,53 @@ +# Fetch element + +file(GLOB_RECURSE FETCH_ELEMENT + src/uscxml/plugins/element/fetch/*.cpp + src/uscxml/plugins/element/fetch/*.h +) +source_group("Element\\fetch" FILES ${FETCH_ELEMENT}) +if (BUILD_AS_PLUGINS) + add_library( + element_fetch SHARED + ${FETCH_ELEMENT}) + target_link_libraries(element_fetch uscxml) + set_target_properties(element_fetch PROPERTIES FOLDER "Plugin Element") +else() + list (APPEND USCXML_FILES ${FETCH_ELEMENT}) +endif() + + +# Postpone element + +file(GLOB_RECURSE POSTPONE_ELEMENT + src/uscxml/plugins/element/postpone/*.cpp + src/uscxml/plugins/element/postpone/*.h +) +source_group("Element\\postpone" FILES ${POSTPONE_ELEMENT}) +if (BUILD_AS_PLUGINS) + add_library( + element_postpone SHARED + ${POSTPONE_ELEMENT}) + target_link_libraries(element_postpone uscxml) + set_target_properties(element_postpone PROPERTIES FOLDER "Plugin Element") +else() + list (APPEND USCXML_FILES ${POSTPONE_ELEMENT}) +endif() + + +# Respond element + +file(GLOB_RECURSE RESPOND_ELEMENT + src/uscxml/plugins/element/respond/*.cpp + src/uscxml/plugins/element/respond/*.h +) +source_group("Element\\respond" FILES ${RESPOND_ELEMENT}) +if (BUILD_AS_PLUGINS) + add_library( + element_respond SHARED + ${RESPOND_ELEMENT}) + target_link_libraries(element_respond uscxml) + set_target_properties(element_respond PROPERTIES FOLDER "Plugin Element") +else() + list (APPEND USCXML_FILES ${RESPOND_ELEMENT}) +endif() + diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt new file mode 100644 index 0000000..4d38199 --- /dev/null +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -0,0 +1,272 @@ +# sample invoker - include to make sure it compiles +file(GLOB_RECURSE SAMPLE_INVOKER + src/uscxml/plugins/invoker/sample/*.cpp + src/uscxml/plugins/invoker/sample/*.h +) +source_group("Invoker\\sample" FILES ${SAMPLE_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_sample SHARED + ${SAMPLE_INVOKER}) + target_link_libraries(invoker_sample uscxml) + set_target_properties(invoker_sample PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${SAMPLE_INVOKER}) +endif() + + +# DirMon invoker to watch for filesystem changes + +file(GLOB_RECURSE DIRMON_INVOKER + src/uscxml/plugins/invoker/filesystem/dirmon/*.cpp + src/uscxml/plugins/invoker/filesystem/dirmon/*.h +) +source_group("Invoker\\dirmon" FILES ${DIRMON_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_dirmon SHARED + ${DIRMON_INVOKER}) + target_link_libraries(invoker_dirmon uscxml) + set_target_properties(invoker_dirmon PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${DIRMON_INVOKER}) +endif() + + +# System invoker to open a native command + +file(GLOB_RECURSE SYSTEM_INVOKER + src/uscxml/plugins/invoker/system/*.cpp + src/uscxml/plugins/invoker/system/*.h +) +source_group("Invoker\\system" FILES ${SYSTEM_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_system SHARED + ${SYSTEM_INVOKER}) + target_link_libraries(invoker_system uscxml) + set_target_properties(invoker_system PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${SYSTEM_INVOKER}) +endif() + + +# SQLite3 SQL Invoker + +find_package(Sqlite3) +if (SQLITE3_FOUND) + file(GLOB_RECURSE SQLITE3_INVOKER + src/uscxml/plugins/invoker/sqlite3/*.cpp + src/uscxml/plugins/invoker/sqlite3/*.h + ) + source_group("Invoker\\sqlite" FILES ${SQLITE3_INVOKER}) + if (BUILD_AS_PLUGINS) + add_library( + invoker_sqlite3 SHARED + ${SQLITE3_INVOKER}) + target_link_libraries(invoker_sqlite3 uscxml) + set_target_properties(invoker_sqlite3 PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${SQLITE3_INVOKER}) + endif() +endif() + + +# ffmpeg invoker + +find_package(FFMPEG) +if (FFMPEG_FOUND) + list (APPEND USCXML_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR}) + file(GLOB_RECURSE FFMPEG_INVOKER + src/uscxml/plugins/invoker/ffmpeg/*.cpp + src/uscxml/plugins/invoker/ffmpeg/*.h + ) + source_group("Invoker\\ffmpeg" FILES ${FFMPEG_INVOKER}) + if (BUILD_AS_PLUGINS) + add_library( + invoker_ffmpeg SHARED + ${FFMPEG_INVOKER}) + target_link_libraries(invoker_ffmpeg uscxml) + set_target_properties(invoker_ffmpeg PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${FFMPEG_INVOKER}) + endif() +endif() + + +# UMUNDO invoker + +if (WIN32) + find_package(UMUNDO COMPONENTS convenience) +else() + find_package(UMUNDO COMPONENTS rpc serial core) +endif() +if (UMUNDO_FOUND) + list (APPEND USCXML_INCLUDE_DIRS ${UMUNDO_INCLUDE_DIR}) + file(GLOB_RECURSE UMUNDO_INVOKER + src/uscxml/plugins/invoker/umundo/*.cpp + src/uscxml/plugins/invoker/umundo/*.h) + source_group("Invoker\\umundo" FILES ${UMUNDO_INVOKER}) + if (BUILD_AS_PLUGINS) + add_library( + invoker_umundo SHARED + ${UMUNDO_INVOKER}) + target_link_libraries(invoker_umundo + uscxml + ${UMUNDO_LIBRARIES}) + set_target_properties(invoker_umundo PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${UMUNDO_INVOKER}) + list (APPEND USCXML_OPT_LIBS ${UMUNDO_LIBRARIES}) + endif() + add_definitions("-DUMUNDO_STATIC") +endif() + + +# USCXML invoker + +file(GLOB_RECURSE USCXML_INVOKER + src/uscxml/plugins/invoker/scxml/*.cpp + src/uscxml/plugins/invoker/scxml/*.h) +source_group("Invoker\\uscxml" FILES ${USCXML_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_uscxml SHARED + ${USCXML_INVOKER}) + target_link_libraries(invoker_uscxml + uscxml) + set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${USCXML_INVOKER}) +endif() + + +# HTTP server invoker + +file(GLOB_RECURSE HTTPSERVLET_INVOKER + src/uscxml/plugins/invoker/http/*.cpp + src/uscxml/plugins/invoker/http/*.h) +source_group("Invoker\\httpservlet" FILES ${HTTPSERVLET_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_httpserver SHARED + ${HTTPSERVLET_INVOKER}) + target_link_libraries(invoker_httpserver + uscxml) + set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${HTTPSERVLET_INVOKER}) +endif() + + +# Heartbeat invoker + +file(GLOB_RECURSE HEARTBEAT_INVOKER + src/uscxml/plugins/invoker/heartbeat/*.cpp + src/uscxml/plugins/invoker/heartbeat/*.h +) +source_group("Invoker\\heartbeat" FILES ${HEARTBEAT_INVOKER}) +if (BUILD_AS_PLUGINS) + add_library( + invoker_heartbeat SHARED + ${HEARTBEAT_INVOKER}) + target_link_libraries(invoker_heartbeat uscxml) + set_target_properties(invoker_heartbeat PROPERTIES FOLDER "Plugin Invoker") +else() + list (APPEND USCXML_FILES ${HEARTBEAT_INVOKER}) +endif() + + +# OpenSceneGraph invoker +if (UNIX) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIG}) # link dynamically! +elseif(WIN32) + if (ENV{OSG_ROOT} STREQUAL "") + set(ENV{OSG_ROOT} "C:/Program Files/OpenSceneGraph-3.0.1") + endif() +endif() +find_package(OpenSceneGraph COMPONENTS osgViewer osgGA osgText osgFX osgManipulator osgDB osgUtil OpenThreads) +find_package(OpenGL) +if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) + list (APPEND USCXML_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIRS}) + list (APPEND USCXML_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) + + file(GLOB OPENSCENEGRAPH_INVOKER + src/uscxml/plugins/invoker/graphics/openscenegraph/*.cpp + src/uscxml/plugins/invoker/graphics/openscenegraph/*.h) + source_group("Invoker\\scenegraph" FILES ${OPENSCENEGRAPH_INVOKER}) + + if (BUILD_AS_PLUGINS) + add_library( + invoker_openscenegraph SHARED + ${OPENSCENEGRAPH_INVOKER}) + target_link_libraries(invoker_openscenegraph + ${OPENSCENEGRAPH_LIBRARIES} + ${OPENGL_LIBRARIES} + uscxml) + set_target_properties(invoker_openscenegraph PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER}) + list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) + endif() + + file(GLOB OPENSCENEGRAPH_CONVERTER_INVOKER + src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.cpp + src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.h) + source_group("Invoker\\scenegraph\\convert" FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) + + if (BUILD_AS_PLUGINS) + add_library( + invoker_openscenegraph_convert SHARED + ${OPENSCENEGRAPH_CONVERTER_INVOKER}) + target_link_libraries(invoker_openscenegraph_convert + ${OPENSCENEGRAPH_LIBRARIES} + ${OPENGL_LIBRARIES} + uscxml) + set_target_properties(invoker_openscenegraph_convert PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) + list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) + endif() + +endif() +if (UNIX) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() + + +# MILES modality components + +find_package(MILES) +if (MILES_FOUND AND OFF) + list (APPEND USCXML_INCLUDE_DIRS ${MILES_INCLUDE_DIR}) + + # openal is only needed for miles + find_package(OpenAL REQUIRED) +# find_package(JPEG REQUIRED) + list (APPEND MILES_LIBRARIES "iconv") + list (APPEND MILES_LIBRARIES ${JPEG_LIBRARIES}) + list (APPEND USCXML_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR}) + + file(GLOB_RECURSE MILES_INVOKER + src/uscxml/plugins/invoker/miles/*.cpp + src/uscxml/plugins/invoker/miles/*.h) + source_group("Invoker\\miles" FILES ${MILES_INVOKER}) +# message("MILES_INVOKER ${MILES_INVOKER}") + + if (BUILD_AS_PLUGINS) + add_library( + invoker_miles SHARED + ${MILES_INVOKER}) + target_link_libraries(invoker_miles + ${MILES_LIBRARIES} + ${OPENAL_LIBRARY} + uscxml) + set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${MILES_INVOKER}) + list (APPEND USCXML_OPT_LIBS ${MILES_LIBRARIES}) + list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY}) + endif() +endif() + diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt new file mode 100644 index 0000000..c5f46e8 --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt @@ -0,0 +1,53 @@ +# LIBEVENT basichttp ioprocessor - this one is already required above + +file(GLOB_RECURSE BASICHTTP_IOPROCESSOR + src/uscxml/plugins/ioprocessor/basichttp/*.cpp + src/uscxml/plugins/ioprocessor/basichttp/*.h +) +source_group("IOProcessor\\basichttp" FILES ${BASICHTTP_IOPROCESSOR}) +if (BUILD_AS_PLUGINS) + add_library( + ioprocessor_basichttp SHARED + ${BASICHTTP_IOPROCESSOR}) + target_link_libraries(ioprocessor_basichttp uscxml) + set_target_properties(ioprocessor_basichttp PROPERTIES FOLDER "Plugin IOProcessor") +else() + list (APPEND USCXML_FILES ${BASICHTTP_IOPROCESSOR}) +endif() + + +# scxml ioprocessor - this one is already required above + +file(GLOB_RECURSE SCXML_IOPROCESSOR + src/uscxml/plugins/ioprocessor/scxml/*.cpp + src/uscxml/plugins/ioprocessor/scxml/*.h +) +source_group("IOProcessor\\scxml" FILES ${SCXML_IOPROCESSOR}) +if (BUILD_AS_PLUGINS) + add_library( + ioprocessor_scxml SHARED + ${SCXML_IOPROCESSOR}) + target_link_libraries(ioprocessor_scxml uscxml) + set_target_properties(ioprocessor_scxml PROPERTIES FOLDER "Plugin IOProcessor") +else() + list (APPEND USCXML_FILES ${SCXML_IOPROCESSOR}) +endif() + + +# mmi ioprocessor + +file(GLOB_RECURSE MMI_IOPROCESSOR + src/uscxml/plugins/ioprocessor/modality/*.cpp + src/uscxml/plugins/ioprocessor/modality/*.h +) +source_group("IOProcessor\\modality" FILES ${MMI_IOPROCESSOR}) +if (BUILD_AS_PLUGINS) + add_library( + ioprocessor_mmi SHARED + ${MMI_IOPROCESSOR}) + target_link_libraries(ioprocessor_mmi uscxml) + set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor") +else() + list (APPEND USCXML_FILES ${MMI_IOPROCESSOR}) +endif() + diff --git a/test/samples/uscxml/test-prolog.scxml b/test/samples/uscxml/test-prolog.scxml index 266bd8d..e29def1 100644 --- a/test/samples/uscxml/test-prolog.scxml +++ b/test/samples/uscxml/test-prolog.scxml @@ -1,3 +1,4 @@ +<?xml version="1.0"?> <scxml datamodel="prolog" initial="start" binding="late"> <datamodel> <data id="facts"> @@ -12,11 +13,34 @@ mouse(jerry). animal(X):- mouse(X). </script> <state id="start"> - <transition target="end" cond="not(cat(jerry)), cat(tom), mouse(jerry)." /> + <onentry> + <log label="SessionId" expr="sessionId(X)"/> + <log label="Name" expr="name(X)"/> + <send event="foo">This is a foo event.</send> + </onentry> + <transition event="foo" cond="not(cat(jerry)), cat(tom), mouse(jerry)." target="s1"/> + </state> + <state id="s1"> + <onentry> + <log expr="eventName(X)."/> + <send event="bar"> + <ISBNdb server_time="2009-03-19T02:01:00Z"> + <BookList total_results="1" page_size="10" page_number="1" shown_results="1"> + <BookData book_id="the_data_compression_book" isbn="1558514341"> + <Title>The Data Compression Book</Title> + <TitleLong/> + <AuthorsText>Mark Nelson, Jean-Loup Gailly, </AuthorsText> + <PublisherText publisher_id="m_t_books">M&T Books</PublisherText> + </BookData> + </BookList> + </ISBNdb> + </send> + </onentry> + <transition target="end"/> </state> <state id="end" final="true"> <onentry> - <log expr="animal(X)." /> + <log expr="animal(X)."/> </onentry> </state> -</scxml>
\ No newline at end of file +</scxml> diff --git a/test/samples/w3c/confEcma.xsl b/test/samples/w3c/confEcma.xsl index 0ec3d3d..61d48c6 100644 --- a/test/samples/w3c/confEcma.xsl +++ b/test/samples/w3c/confEcma.xsl @@ -356,12 +356,12 @@ <xsl:attribute name="cond"> <xsl:analyze-string select="." regex="([0-9]+)([=<>]=?)([0-9+])"> - <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/><xsl:text>/text() </xsl:text> + <xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/> <xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable> <xsl:choose> <xsl:when test="$op='='">=</xsl:when> <xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise> - </xsl:choose>Var<xsl:value-of select="regex-group(3)"/><xsl:text>/text() </xsl:text> + </xsl:choose>Var<xsl:value-of select="regex-group(3)"/> </xsl:matching-substring> </xsl:analyze-string> </xsl:attribute> @@ -416,7 +416,7 @@ is the second argument --> </xsl:template> <xsl:template match="//@conf:emptyEventData"> - <xsl:attribute name="cond">_event.data == null</xsl:attribute> + <xsl:attribute name="cond">typeof _event.data === 'undefined'</xsl:attribute> </xsl:template> <!-- return true if the _name system var has the specified quoted value --> @@ -494,7 +494,7 @@ is the second argument --> <!-- returns true if specified field of _event has no value --> <xsl:template match="//@conf:eventFieldHasNoValue"> - <xsl:attribute name="cond">_event.<xsl:value-of select="." /> == null</xsl:attribute> + <xsl:attribute name="cond">typeof _event.<xsl:value-of select="." /> === 'undefined' </xsl:attribute> </xsl:template> <!-- true if the language of _event matches the processor's datamodel --> diff --git a/test/samples/w3c/convert-tests.sh b/test/samples/w3c/convert-tests.sh index 4c47c71..42f8fce 100755 --- a/test/samples/w3c/convert-tests.sh +++ b/test/samples/w3c/convert-tests.sh @@ -18,3 +18,6 @@ do echo "Processing $TXML to $DEST" java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar $TXML confXPath.xsl -o:$DEST done + +cp txml/*.txt ecma/ +cp txml/*.txt xpath/
\ No newline at end of file diff --git a/test/samples/w3c/ecma/robots.txt b/test/samples/w3c/ecma/robots.txt new file mode 100644 index 0000000..54f3e01 --- /dev/null +++ b/test/samples/w3c/ecma/robots.txt @@ -0,0 +1,96 @@ +# +# robots.txt for http://www.w3.org/ +# +# $Id: robots.txt,v 1.66 2012/07/17 21:30:56 gerald Exp $ +# + +# For use by search.w3.org +User-agent: W3C-gsa +Disallow: /Out-Of-Date + +User-agent: W3T_SE +Disallow: /Out-Of-Date + +User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot) +Disallow: / + +# W3C Link checker +User-agent: W3C-checklink +Disallow: + +# the following settings apply to all bots +User-agent: * +# Blogs - WordPress +# https://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization +Disallow: /*/wp-admin/ +Disallow: /*/wp-includes/ +Disallow: /*/wp-content/plugins/ +Disallow: /*/wp-content/cache/ +Disallow: /*/wp-content/themes/ +Disallow: /blog/*/trackback/ +Disallow: /blog/*/feed/ +Disallow: /blog/*/comments/ +Disallow: /blog/*/category/*/* +Disallow: /blog/*/*/trackback/ +Disallow: /blog/*/*/feed/ +Disallow: /blog/*/*/comments/ +Disallow: /blog/*/*? +Disallow: /community/trackback/ +Disallow: /community/feed/ +Disallow: /community/comments/ +Disallow: /community/category/*/* +Disallow: /community/*/trackback/ +Disallow: /community/*/feed/ +Disallow: /community/*/comments/ +Disallow: /community/*/category/*/* +Disallow: /community/*? +Disallow: /Consortium/Offices/trackback/ +Disallow: /Consortium/Offices/feed/ +Disallow: /Consortium/Offices/comments/ +Disallow: /Consortium/Offices/category/*/* +Disallow: /Consortium/Offices/*/trackback/ +Disallow: /Consortium/Offices/*/feed/ +Disallow: /Consortium/Offices/*/comments/ +Disallow: /Consortium/Offices/*? +# Wikis - Mediawiki +# https://www.mediawiki.org/wiki/Manual:Robots.txt +Disallow: /wiki/index.php? +Disallow: /wiki/index.php/Help +Disallow: /wiki/index.php/MediaWiki +Disallow: /wiki/index.php/Special: +Disallow: /wiki/index.php/Template +Disallow: /wiki/skins/ +Disallow: /*/wiki/index.php? +Disallow: /*/wiki/index.php/Help +Disallow: /*/wiki/index.php/MediaWiki +Disallow: /*/wiki/index.php/Special: +Disallow: /*/wiki/index.php/Template +# various other access-controlled or expensive areas +Disallow: /2004/ontaria/basic +Disallow: /Team/ +Disallow: /Project +Disallow: /Web +Disallow: /Systems +Disallow: /History +Disallow: /Out-Of-Date +Disallow: /2002/02/mid +Disallow: /mid/ +Disallow: /2005/06/blog/ +Disallow: /2004/08/W3CTalks +Disallow: /2007/11/Talks/search +Disallow: /People/all/ +Disallow: /RDF/Validator/ARPServlet +Disallow: /2003/03/Translations/byLanguage +Disallow: /2003/03/Translations/byTechnology +Disallow: /2005/11/Translations/Query +Disallow: /2000/06/webdata/xslt +Disallow: /2000/09/webdata/xslt +Disallow: /2005/08/online_xslt/xslt +Disallow: /Bugs/ +Disallow: /Search/Mail/Public/ +Disallow: /2006/02/chartergen +Disallow: /2004/01/pp-impl +Disallow: /Consortium/supporters +Disallow: /2007/08/pyRdfa/ +Disallow: /WAI/PF/comments/ + diff --git a/test/samples/w3c/ecma/test153.scxml b/test/samples/w3c/ecma/test153.scxml index ad54994..c46c32d 100644 --- a/test/samples/w3c/ecma/test153.scxml +++ b/test/samples/w3c/ecma/test153.scxml @@ -13,7 +13,7 @@ it ever isn't, set Var4 to 0, indicating failure --><scxml xmlns="http://www.w3. <state id="s0"> <onentry> <foreach item="Var2" array="Var3"> - <if cond="Var1<Var2 "> + <if cond="Var1<Var2"> <assign location="Var1" expr="Var2"/> <else/> <!-- values are out of order, record failure --> diff --git a/test/samples/w3c/ecma/test201.scxml b/test/samples/w3c/ecma/test201.scxml index 6460bbb..8ded0d5 100644 --- a/test/samples/w3c/ecma/test201.scxml +++ b/test/samples/w3c/ecma/test201.scxml @@ -3,7 +3,7 @@ test since platforms are not required to support basic http event i/o --><scxml <state id="s0"> <onentry> - <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" event="event1"/> + <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors['basichttp']['location']" event="event1"/> <send event="timeout"/> </onentry> diff --git a/test/samples/w3c/ecma/test333.scxml b/test/samples/w3c/ecma/test333.scxml index cb9721a..9e06896 100644 --- a/test/samples/w3c/ecma/test333.scxml +++ b/test/samples/w3c/ecma/test333.scxml @@ -4,7 +4,7 @@ <onentry> <send event="foo"/> </onentry> - <transition event="foo" cond="_event.sendid == null" target="pass"/> + <transition event="foo" cond="typeof _event.sendid === 'undefined' " target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test335.scxml b/test/samples/w3c/ecma/test335.scxml index 57da1ba..a56074a 100644 --- a/test/samples/w3c/ecma/test335.scxml +++ b/test/samples/w3c/ecma/test335.scxml @@ -4,7 +4,7 @@ <onentry> <raise event="foo"/> </onentry> - <transition event="foo" cond="_event.origin == null" target="pass"/> + <transition event="foo" cond="typeof _event.origin === 'undefined' " target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test337.scxml b/test/samples/w3c/ecma/test337.scxml index c4c663e..71092a8 100644 --- a/test/samples/w3c/ecma/test337.scxml +++ b/test/samples/w3c/ecma/test337.scxml @@ -4,7 +4,7 @@ <onentry> <raise event="foo"/> </onentry> - <transition event="foo" cond="_event.origintype == null" target="pass"/> + <transition event="foo" cond="typeof _event.origintype === 'undefined' " target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test339.scxml b/test/samples/w3c/ecma/test339.scxml index 7ffbabf..82864c9 100644 --- a/test/samples/w3c/ecma/test339.scxml +++ b/test/samples/w3c/ecma/test339.scxml @@ -4,7 +4,7 @@ <onentry> <raise event="foo"/> </onentry> - <transition event="foo" cond="_event.invokeid == null" target="pass"/> + <transition event="foo" cond="typeof _event.invokeid === 'undefined' " target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test343.scxml b/test/samples/w3c/ecma/test343.scxml index 9765739..7f15cf0 100644 --- a/test/samples/w3c/ecma/test343.scxml +++ b/test/samples/w3c/ecma/test343.scxml @@ -24,7 +24,7 @@ event has empty event.data --> <state id="s1"> - <transition event="done.state.s0" cond="_event.data == null" target="pass"/> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test488.scxml b/test/samples/w3c/ecma/test488.scxml index 8e007e3..9d9e1d8 100644 --- a/test/samples/w3c/ecma/test488.scxml +++ b/test/samples/w3c/ecma/test488.scxml @@ -24,7 +24,7 @@ event has empty event.data --> <state id="s1"> - <transition event="done.state.s0" cond="_event.data == null" target="pass"/> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test528.scxml b/test/samples/w3c/ecma/test528.scxml index 9f1ebd4..edeb367 100644 --- a/test/samples/w3c/ecma/test528.scxml +++ b/test/samples/w3c/ecma/test528.scxml @@ -24,7 +24,7 @@ event has empty event.data --> <state id="s1"> - <transition event="done.state.s0" cond="_event.data == null" target="pass"/> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> <transition event="*" target="fail"/> </state> diff --git a/test/samples/w3c/ecma/test568.scxml b/test/samples/w3c/ecma/test568.scxml index 17bc380..e8b888f 100644 --- a/test/samples/w3c/ecma/test568.scxml +++ b/test/samples/w3c/ecma/test568.scxml @@ -4,7 +4,7 @@ send events. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http: <state id="s0"> - <transition cond="$_ioprocessors/processor[@name='http://www.w3.org/TR/scxml/#SCXMLEventProcessor']/location/text()" target="pass"/> + <transition cond="$_ioprocessors/[@name='http://www.w3.org/TR/scxml/#SCXMLEventProcessor']/location/text()" target="pass"/> <transition target="fail"/> </state> diff --git a/test/samples/w3c/txml/test201.txml b/test/samples/w3c/txml/test201.txml index c21eb7e..cdcf285 100644 --- a/test/samples/w3c/txml/test201.txml +++ b/test/samples/w3c/txml/test201.txml @@ -7,7 +7,9 @@ test since platforms are not required to support basic http event i/o --> <state id="s0"> <onentry> - <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" event="event1"/> + <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" + conf:basicHTTPAccessURITarget="" + event="event1"/> <send event="timeout"/> </onentry> diff --git a/test/samples/w3c/update-txml.sh b/test/samples/w3c/update-txml.sh index 6cf9c01..3c7255b 100755 --- a/test/samples/w3c/update-txml.sh +++ b/test/samples/w3c/update-txml.sh @@ -1,5 +1,7 @@ #!/bin/bash -wget -rl1 -Atxml,txt http://www.w3.org/Voice/2013/scxml-irp/ +wget -rl1 -Atxml,txt,xsl http://www.w3.org/Voice/2013/scxml-irp/ + find ./www.w3.org -name *.txml -exec cp {} ./txml \; find ./www.w3.org -name *.txt -exec cp {} ./txml \; +find ./www.w3.org -name *.xsl -exec cp {} . \; rm -rf www.w3.org
\ No newline at end of file diff --git a/test/samples/w3c/xpath/robots.txt b/test/samples/w3c/xpath/robots.txt new file mode 100644 index 0000000..54f3e01 --- /dev/null +++ b/test/samples/w3c/xpath/robots.txt @@ -0,0 +1,96 @@ +# +# robots.txt for http://www.w3.org/ +# +# $Id: robots.txt,v 1.66 2012/07/17 21:30:56 gerald Exp $ +# + +# For use by search.w3.org +User-agent: W3C-gsa +Disallow: /Out-Of-Date + +User-agent: W3T_SE +Disallow: /Out-Of-Date + +User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot) +Disallow: / + +# W3C Link checker +User-agent: W3C-checklink +Disallow: + +# the following settings apply to all bots +User-agent: * +# Blogs - WordPress +# https://codex.wordpress.org/Search_Engine_Optimization_for_WordPress#Robots.txt_Optimization +Disallow: /*/wp-admin/ +Disallow: /*/wp-includes/ +Disallow: /*/wp-content/plugins/ +Disallow: /*/wp-content/cache/ +Disallow: /*/wp-content/themes/ +Disallow: /blog/*/trackback/ +Disallow: /blog/*/feed/ +Disallow: /blog/*/comments/ +Disallow: /blog/*/category/*/* +Disallow: /blog/*/*/trackback/ +Disallow: /blog/*/*/feed/ +Disallow: /blog/*/*/comments/ +Disallow: /blog/*/*? +Disallow: /community/trackback/ +Disallow: /community/feed/ +Disallow: /community/comments/ +Disallow: /community/category/*/* +Disallow: /community/*/trackback/ +Disallow: /community/*/feed/ +Disallow: /community/*/comments/ +Disallow: /community/*/category/*/* +Disallow: /community/*? +Disallow: /Consortium/Offices/trackback/ +Disallow: /Consortium/Offices/feed/ +Disallow: /Consortium/Offices/comments/ +Disallow: /Consortium/Offices/category/*/* +Disallow: /Consortium/Offices/*/trackback/ +Disallow: /Consortium/Offices/*/feed/ +Disallow: /Consortium/Offices/*/comments/ +Disallow: /Consortium/Offices/*? +# Wikis - Mediawiki +# https://www.mediawiki.org/wiki/Manual:Robots.txt +Disallow: /wiki/index.php? +Disallow: /wiki/index.php/Help +Disallow: /wiki/index.php/MediaWiki +Disallow: /wiki/index.php/Special: +Disallow: /wiki/index.php/Template +Disallow: /wiki/skins/ +Disallow: /*/wiki/index.php? +Disallow: /*/wiki/index.php/Help +Disallow: /*/wiki/index.php/MediaWiki +Disallow: /*/wiki/index.php/Special: +Disallow: /*/wiki/index.php/Template +# various other access-controlled or expensive areas +Disallow: /2004/ontaria/basic +Disallow: /Team/ +Disallow: /Project +Disallow: /Web +Disallow: /Systems +Disallow: /History +Disallow: /Out-Of-Date +Disallow: /2002/02/mid +Disallow: /mid/ +Disallow: /2005/06/blog/ +Disallow: /2004/08/W3CTalks +Disallow: /2007/11/Talks/search +Disallow: /People/all/ +Disallow: /RDF/Validator/ARPServlet +Disallow: /2003/03/Translations/byLanguage +Disallow: /2003/03/Translations/byTechnology +Disallow: /2005/11/Translations/Query +Disallow: /2000/06/webdata/xslt +Disallow: /2000/09/webdata/xslt +Disallow: /2005/08/online_xslt/xslt +Disallow: /Bugs/ +Disallow: /Search/Mail/Public/ +Disallow: /2006/02/chartergen +Disallow: /2004/01/pp-impl +Disallow: /Consortium/supporters +Disallow: /2007/08/pyRdfa/ +Disallow: /WAI/PF/comments/ + diff --git a/test/samples/w3c/xpath/test201.scxml b/test/samples/w3c/xpath/test201.scxml index f988e7e..8f4e285 100644 --- a/test/samples/w3c/xpath/test201.scxml +++ b/test/samples/w3c/xpath/test201.scxml @@ -3,7 +3,7 @@ test since platforms are not required to support basic http event i/o --><scxml <state id="s0"> <onentry> - <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" event="event1"/> + <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="$_ioprocessors/processor[@name="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"]/location/text()" event="event1"/> <send event="timeout"/> </onentry> |