diff options
Diffstat (limited to 'PureData/PureData.cs')
-rw-r--r-- | PureData/PureData.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/PureData/PureData.cs b/PureData/PureData.cs new file mode 100644 index 0000000..c9ac143 --- /dev/null +++ b/PureData/PureData.cs @@ -0,0 +1,64 @@ +using System; +using System.Runtime.CompilerServices; // for extern import +using System.Runtime.InteropServices; // for structures + +namespace PureData +{ + // PD core functions + public unsafe class Internal + { + [MethodImplAttribute (MethodImplOptions.InternalCall)] + internal extern static void *SymGen(string sym); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + internal extern static string SymEval(void *sym); + } + + // This is the base class for a PD/CLR external + public unsafe class External + { + // PD object pointer + private readonly void *ptr; + + // -------------------------------------------------------------------------- + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Post(string message); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void PostError(string message); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void PostBug(string message); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void PostVerbose(string message); + + // -------------------------------------------------------------------------- + + protected delegate void MethodBang(); + protected delegate void MethodFloat(float f); + protected delegate void MethodSymbol(Symbol s); + protected delegate void MethodPointer(Pointer p); + protected delegate void MethodList(AtomList lst); + protected delegate void MethodAnything(Symbol tag,AtomList lst); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodBang m); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodFloat m); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodSymbol m); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodPointer m); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodList m); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + protected extern static void Add(MethodAnything m); + } +} |