aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorDavide Morelli <morellid@users.sourceforge.net>2006-01-12 09:24:23 +0000
committerDavide Morelli <morellid@users.sourceforge.net>2006-01-12 09:24:23 +0000
commit20854f57a1617b4f662516445d20778ddbd6552d (patch)
tree25f1ced623d1de1af74d6fc1d78d5dcb8332ef46 /external
parent70fd0fd73aaa002d4d7e9841d8af105c4c80ddf4 (diff)
checking in the c sharp part
svn path=/trunk/externals/clr/; revision=4388
Diffstat (limited to 'external')
-rwxr-xr-xexternal/External.cs104
-rwxr-xr-xexternal/external.csproj105
-rwxr-xr-xexternal/pd.cs49
3 files changed, 258 insertions, 0 deletions
diff --git a/external/External.cs b/external/External.cs
new file mode 100755
index 0000000..3923f06
--- /dev/null
+++ b/external/External.cs
@@ -0,0 +1,104 @@
+using System;
+
+
+namespace PureData
+{
+
+
+
+ public class External
+ {
+ private IntPtr x;
+
+ public External()
+ {
+ x = IntPtr.Zero;
+ }
+
+
+
+ // this function MUST exist
+ public void SetUp(IntPtr pdClass)
+ {
+ // you must assign pdclass to x !
+ x = pdClass;
+
+ // now you can do what you like...
+ Console.WriteLine("pointer set!");
+ Console.WriteLine("setting selectors..");
+ pd.AddSelector(x, "sel1", "Sel1", ParametersType.None);
+ pd.AddSelector(x, "sel2", "Sel2", ParametersType.None);
+ pd.AddSelector(x, "selFloat", "SelFloat", ParametersType.Float);
+ pd.AddSelector(x, "selString", "SelString", ParametersType.Symbol);
+ pd.AddSelector(x, "selList", "SelList", ParametersType.List);
+ pd.AddSelector(x, "selStringList", "SelStringList", ParametersType.List);
+ pd.AddSelector(x, "selFloatList", "SelFloatList", ParametersType.List);
+ Console.WriteLine("selectors set");
+ pd.AddOutlet(x, ParametersType.Float);
+ pd.AddInlet(x, "selFloat", ParametersType.Float);
+ }
+
+
+
+
+ public void Sel1()
+ {
+ pd.PostMessage("Sel1 invoked!");
+ }
+
+ public void Sel2()
+ {
+ pd.PostMessage("Sel2 invoked!");
+ }
+
+ public void SelFloat(float f)
+ {
+ pd.PostMessage("SelFloat received " + f);
+ }
+
+ public void SelString(ref string s)
+ {
+ pd.PostMessage("SelString received " + s);
+ }
+
+ public void SelList(int [] list)
+ {
+ pd.PostMessage("SelList received " + list.Length + " elements");
+ for (int i = 0; i<list.Length; i++)
+ {
+ pd.PostMessage("int " + i + " = " + list[i]);
+ }
+ }
+
+ public void SelStringList(string [] list)
+ {
+ pd.PostMessage("SetStringList received a " + list.Length + " long list");
+ for (int i = 0; i<list.Length; i++)
+ {
+ pd.PostMessage("string " + i + " = " + list[i]);
+ }
+ }
+
+ public void SelFloatList(int [] list)
+ {
+ pd.PostMessage("SetStringList received a " + list.Length + " long list");
+ for (int i = 0; i<list.Length; i++)
+ {
+ pd.PostMessage("float " + i + " = " + list[0]);
+ }
+ }
+
+ public int test(int a)
+ {
+
+
+ Console.WriteLine("test("+a+")");
+ return a+1;
+ }
+ }
+
+
+
+
+
+}
diff --git a/external/external.csproj b/external/external.csproj
new file mode 100755
index 0000000..417f6aa
--- /dev/null
+++ b/external/external.csproj
@@ -0,0 +1,105 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "PureData"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "PureData"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "External.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "pd.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/external/pd.cs b/external/pd.cs
new file mode 100755
index 0000000..c844195
--- /dev/null
+++ b/external/pd.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Runtime.CompilerServices;
+
+namespace PureData
+{
+ public enum ParametersType {None = 0, Float=1, Symbol=2, List=3};
+
+ public class pd
+ {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void RegisterSelector (IntPtr x, string sel, string met, int type);
+ // function called by the user
+ public static void AddSelector(IntPtr x, string sel, string met, ParametersType type)
+ {
+ RegisterSelector (x, sel, met, (int) type);
+ }
+
+ // TODO
+ // send stuff to an outlet
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void ToOutlet (IntPtr x, int outlet, int type /*, ? array of values */);
+
+ // create an outlet
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void CreateOutlet (IntPtr x, int type);
+ // function called by the user
+ public static void AddOutlet(IntPtr x, ParametersType type)
+ {
+ CreateOutlet (x, (int) type);
+ }
+
+ // create an inlet
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void CreateInlet (IntPtr x, string selector, int type);
+ // function called by the user
+ public static void AddInlet(IntPtr x, string selector, ParametersType type)
+ {
+ CreateInlet (x, selector, (int) type);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void PostMessage (string message);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void ErrorMessage (string message);
+
+
+ }
+}