diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-06-27 22:32:46 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-06-27 22:32:46 (GMT) |
commit | c70d02010ea99e6c8e35da3b767f41f1ee5dce56 (patch) | |
tree | a0ef030204ec2eb656845d03876006d9cdc0760c /embedding/csharp/uSCXMLEmbedding | |
parent | a4b506fd774ec50ad79b7531bd3698c5a6339407 (diff) | |
download | uscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.zip uscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.tar.gz uscxml-c70d02010ea99e6c8e35da3b767f41f1ee5dce56.tar.bz2 |
Major header movement
- Used IWYU to reorganize headers
- Dropped PHP support
- Updated tests
Diffstat (limited to 'embedding/csharp/uSCXMLEmbedding')
8 files changed, 363 insertions, 0 deletions
diff --git a/embedding/csharp/uSCXMLEmbedding/Examples.csproj b/embedding/csharp/uSCXMLEmbedding/Examples.csproj new file mode 100644 index 0000000..b1579bf --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Examples.csproj @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A186DC8C-0655-49D4-A1DB-3C23A24DAA5E}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>uSCXMLEmbedding</RootNamespace>
+ <AssemblyName>uSCXMLEmbedding</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="uscxmlCSharp">
+ <HintPath>C:\Users\sradomski\Desktop\build\uscxml\lib\uscxmlCSharp.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Extensions\SampleDataModel.cs" />
+ <Compile Include="Extensions\SampleExecutableContent.cs" />
+ <Compile Include="Extensions\SampleInterpreterMonitor.cs" />
+ <Compile Include="Extensions\SampleInvoker.cs" />
+ <Compile Include="Extensions\SampleIOProc.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/SampleDataModel.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleDataModel.cs new file mode 100644 index 0000000..4d70594 --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleDataModel.cs @@ -0,0 +1,92 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using org.uscxml;
+
+namespace EmbeddedDataModel
+{
+ class SampleDataModel : DataModel
+ {
+ public override DataModel create(Interpreter interpreter)
+ {
+ return new SampleDataModel();
+ }
+
+ public override void eval(string scriptElem, string expr)
+ {
+ // evaluate expr on the datamodel
+ }
+
+ public override bool evalAsBool(string elem, string content)
+ {
+ return evalAsBool(content);
+ }
+
+ public override bool evalAsBool(string expr)
+ {
+ // evaluate expr as bool
+ return false;
+ }
+
+ public override void assign(string assignElem, string location, string content)
+ {
+ // set variable at location to content
+ }
+
+ public override string evalAsString(string expr)
+ {
+ // evaluate given expr as a string (e.g. for <log>)
+ return "";
+ }
+
+ public override uint getLength(string expr)
+ {
+ // return the length of an expression for foreach
+ return 0;
+ }
+
+ public override StringList getNames()
+ {
+ // name of this datamodel to be used in scxml element
+ StringList names = new StringList();
+ names.add("simple");
+ return names;
+ }
+
+ public override DataNative getStringAsData(string content)
+ {
+ // DataNative ought to be wrapped by a Data.cs class - used to carry JSONesque structures
+ DataNative data = new DataNative();
+ return data;
+ }
+
+ public override void init(string dataElem, string location, string content)
+ {
+ // initialize variable at location to evaluated content - used for scxml data elements
+ }
+
+ public override void setEvent(Event arg0)
+ {
+ // represent given event as _event in datamodel
+ }
+
+ public override bool isDeclared(string expr)
+ {
+ // using an undeclared variable is an error.execution with some scxml constructs -
+ // determine whether the given expression is defined
+ return true;
+ }
+
+ public override void setForeach(string item, string array, string index, uint iteration)
+ {
+ // called per foreach iteration, set datamodel variables accordingly
+ }
+
+ public override bool validate(string location, string schema)
+ {
+ // primarily intended for xpath datamodel
+ return true;
+ }
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/SampleExecutableContent.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleExecutableContent.cs new file mode 100644 index 0000000..a86776f --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleExecutableContent.cs @@ -0,0 +1,33 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using org.uscxml;
+
+namespace embedding
+{
+ class SampleExecutableContent : ExecutableContent
+ {
+ public override string getLocalName()
+ {
+ return "custom";
+ }
+
+ public override void enterElement(string node)
+ {
+
+ }
+
+ public override void exitElement(string node)
+ {
+
+ }
+
+ public override ExecutableContent create(Interpreter interpreter)
+ {
+ return new SampleExecutableContent();
+ }
+
+
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/SampleIOProc.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleIOProc.cs new file mode 100644 index 0000000..5abbf37 --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleIOProc.cs @@ -0,0 +1,33 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using org.uscxml;
+
+namespace embedding
+{
+ class SampleIOProc : IOProcessor
+ {
+ public override IOProcessor create(Interpreter interpreter)
+ {
+ return new SampleIOProc();
+ }
+
+ public override DataNative getDataModelVariables()
+ {
+ DataNative data = new DataNative();
+ return data;
+ }
+
+ public override StringList getNames()
+ {
+ StringList names = new StringList();
+ names.add("simple");
+ return names;
+ }
+
+ public override void send(SendRequest req)
+ {
+ }
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInterpreterMonitor.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInterpreterMonitor.cs new file mode 100644 index 0000000..2a2f561 --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInterpreterMonitor.cs @@ -0,0 +1,31 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using org.uscxml;
+
+namespace embedding
+{
+ class SampleInterpreterMonitor : InterpreterMonitor
+ {
+ public override void afterCompletion(Interpreter interpreter) { }
+ public override void afterMicroStep(Interpreter interpreter) { }
+ public override void beforeCompletion(Interpreter interpreter) { }
+ public override void beforeMicroStep(Interpreter interpreter) { }
+ public override void beforeProcessingEvent(Interpreter interpreter, Event arg1) { }
+ public override void onStableConfiguration(Interpreter interpreter) { }
+ public override void afterEnteringState(Interpreter interpreter, string stateId, string xpath, string state, bool moreComing) { }
+ public override void afterExecutingContent(Interpreter interpreter, string tagName, string xpath, string element) { }
+ public override void afterExitingState(Interpreter interpreter, string stateId, string xpath, string state, bool moreComing) { }
+ public override void afterInvoking(Interpreter interpreter, string xpath, string invokeid, string element) { }
+ public override void afterTakingTransition(Interpreter interpreter, string xpath, string source, StringList targets, string element, bool moreComing) { }
+ public override void afterUninvoking(Interpreter interpreter, string xpath, string invokeid, string element) { }
+ public override void beforeEnteringState(Interpreter interpreter, string stateId, string xpath, string state, bool moreComing) { }
+ public override void beforeExecutingContent(Interpreter interpreter, string tagName, string xpath, string element) { }
+ public override void beforeExitingState(Interpreter interpreter, string stateId, string xpath, string state, bool moreComing) { }
+ public override void beforeInvoking(Interpreter interpreter, string xpath, string invokeid, string element) { }
+ public override void beforeTakingTransition(Interpreter interpreter, string xpath, string source, StringList targets, string element, bool moreComing) { }
+ public override void beforeUninvoking(Interpreter interpreter, string xpath, string invokeid, string element) { }
+
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInvoker.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInvoker.cs new file mode 100644 index 0000000..f5fb363 --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/SampleInvoker.cs @@ -0,0 +1,37 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using org.uscxml;
+
+namespace EmbeddedInvoker
+{
+ class SampleInvoker : Invoker
+ {
+ public override Invoker create(Interpreter interpreter)
+ {
+ return new SampleInvoker();
+ }
+
+ public override DataNative getDataModelVariables()
+ {
+ DataNative data = new DataNative();
+ return data;
+ }
+
+ public override StringList getNames()
+ {
+ StringList names = new StringList();
+ names.add("simple");
+ return names;
+ }
+
+ public override void invoke(InvokeRequest req)
+ {
+ }
+
+ public override void send(SendRequest req)
+ {
+ }
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Program.cs b/embedding/csharp/uSCXMLEmbedding/Program.cs new file mode 100644 index 0000000..559d28f --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Program.cs @@ -0,0 +1,36 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace embedding
+{
+ using org.uscxml;
+
+ class Program
+ {
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
+ private static extern void SetDllDirectory(string lpPathName);
+
+ static void Main(string[] args)
+ {
+
+ /*
+ * Make sure this path contains the uscxmlNativeCSharp.dll!
+ */
+ if (System.Environment.Is64BitProcess)
+ {
+ SetDllDirectory("C:\\Users\\sradomski\\Desktop\\build\\uscxml64\\lib\\csharp");
+ }
+ else
+ {
+ SetDllDirectory("C:\\Users\\sradomski\\Desktop\\build\\uscxml\\lib\\csharp");
+ }
+
+ Interpreter interpreter = Interpreter.fromXML("<scxml><state id=\"f oo\" final=\"true\" /></scxml>");
+ interpreter.addMonitor(new SampleInterpreterMonitor());
+ interpreter.interpret();
+ }
+ }
+}
diff --git a/embedding/csharp/uSCXMLEmbedding/Properties/AssemblyInfo.cs b/embedding/csharp/uSCXMLEmbedding/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..141c1cf --- /dev/null +++ b/embedding/csharp/uSCXMLEmbedding/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("uSCXMLEmbedding")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("uSCXMLEmbedding")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5bcfdd5c-6567-40dd-b4ea-3a9d3c64076a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
|