diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2006-03-09 01:48:21 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2006-03-09 01:48:21 +0000 |
commit | 241c6627ee72374d51e21cb71d021f26692ef41a (patch) | |
tree | ec7db227bcc4eab864c3c653e992b0c025ca6fff /PureData | |
parent | 6bc4123e40a3fe3ffc768fa7f943dfcda034e571 (diff) |
implemented proxy objects and other stuff
cleaned up the code
svn path=/trunk/externals/clr/; revision=4660
Diffstat (limited to 'PureData')
-rw-r--r-- | PureData/PureData.cs | 99 |
1 files changed, 61 insertions, 38 deletions
diff --git a/PureData/PureData.cs b/PureData/PureData.cs index 8dbac5b..ea0042b 100644 --- a/PureData/PureData.cs +++ b/PureData/PureData.cs @@ -13,30 +13,36 @@ namespace PureData [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static string SymEval(void *sym); + // -------------------------------------------------------------------------- + [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void AddInlet(void *obj,Symbol sel,Symbol to_sel); // map to data member - // \NOTE don't know if this is really safe since f must stay at its place (but it should, no?) [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void AddInlet(void *obj,ref float f); // map to data member - // \NOTE don't know if this is really safe since s must stay at its place (but it should, no?) [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void AddInlet(void *obj,ref Symbol s); // map to data member - // \NOTE don't know if this is really safe since s must stay at its place (but it should, no?) // [MethodImplAttribute (MethodImplOptions.InternalCall)] // internal extern static void AddInlet(void *obj,ref Pointer f); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal extern static void AddInlet(void *obj); // create proxy inlet + internal extern static void AddInlet(void *obj,Symbol type); // create proxy inlet (typed) + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + internal extern static void AddInlet(void *obj); // create proxy inlet (anything) + + // -------------------------------------------------------------------------- [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void AddOutlet(void *obj,Symbol type); + // -------------------------------------------------------------------------- + [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void Outlet(void *obj,int n); @@ -58,6 +64,8 @@ namespace PureData [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void Outlet(void *obj,int n,Symbol s,Atom[] l); + // -------------------------------------------------------------------------- + [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern static void Bind(void *obj,Symbol dst); @@ -76,27 +84,39 @@ namespace PureData // -------------------------------------------------------------------------- - protected readonly static Symbol s__ = new Symbol(""); - protected readonly static Symbol s_bang = new Symbol("bang"); - protected readonly static Symbol s_float = new Symbol("float"); - protected readonly static Symbol s_symbol = new Symbol("symbol"); - protected readonly static Symbol s_pointer = new Symbol("pointer"); - protected readonly static Symbol s_list = new Symbol("list"); - protected readonly static Symbol s_anything = new Symbol("anything"); + protected readonly static Symbol _ = new Symbol(""); + protected readonly static Symbol _bang = new Symbol("bang"); + protected readonly static Symbol _float = new Symbol("float"); + protected readonly static Symbol _symbol = new Symbol("symbol"); + protected readonly static Symbol _pointer = new Symbol("pointer"); + protected readonly static Symbol _list = new Symbol("list"); + protected readonly static Symbol _anything = new Symbol("anything"); // -------------------------------------------------------------------------- [MethodImplAttribute (MethodImplOptions.InternalCall)] protected extern static void Post(string message); + protected static void Post(string format,object arg0) { Post(String.Format(format,arg0)); } + protected static void Post(string format,object arg0,object arg1) { Post(String.Format(format,arg0,arg1)); } + protected static void Post(string format,object arg0,object arg1,object arg2) { Post(String.Format(format,arg0,arg1,arg2)); } + protected static void Post(string format,params object[] args) { Post(String.Format(format,args)); } + [MethodImplAttribute (MethodImplOptions.InternalCall)] protected extern static void PostError(string message); - [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void PostBug(string message); + protected static void PostError(string format,object arg0) { PostError(String.Format(format,arg0)); } + protected static void PostError(string format,object arg0,object arg1) { PostError(String.Format(format,arg0,arg1)); } + protected static void PostError(string format,object arg0,object arg1,object arg2) { PostError(String.Format(format,arg0,arg1,arg2)); } + protected static void PostError(string format,params object[] args) { PostError(String.Format(format,args)); } [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void PostVerbose(string message); + protected extern static void PostVerbose(int lvl,string message); + + protected static void PostVerbose(int lvl,string format,object arg0) { PostVerbose(lvl,String.Format(format,arg0)); } + protected static void PostVerbose(int lvl,string format,object arg0,object arg1) { PostVerbose(lvl,String.Format(format,arg0,arg1)); } + protected static void PostVerbose(int lvl,string format,object arg0,object arg1,object arg2) { PostVerbose(lvl,String.Format(format,arg0,arg1,arg2)); } + protected static void PostVerbose(int lvl,string format,params object[] args) { PostVerbose(lvl,String.Format(format,args)); } // -------------------------------------------------------------------------- @@ -105,49 +125,52 @@ namespace PureData 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); + protected delegate void MethodAnything(int inlet,Symbol tag,AtomList lst); + + // -------------------------------------------------------------------------- [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodBang m); + protected extern static void AddMethod(int inlet,MethodBang m); [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodFloat m); + protected extern static void AddMethod(int inlet,MethodFloat m); [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodSymbol m); + protected extern static void AddMethod(int inlet,MethodSymbol m); [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodPointer m); + protected extern static void AddMethod(int inlet,MethodPointer m); [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodList m); + protected extern static void AddMethod(int inlet,MethodList m); [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(Symbol sel,MethodList m); + protected extern static void AddMethod(int inlet,Symbol sel,MethodAnything m); - protected static void Add(string sel,MethodList m) { Add(new Symbol(sel),m); } + protected static void AddMethod(int inlet,string sel,MethodAnything m) { AddMethod(inlet,new Symbol(sel),m); } [MethodImplAttribute (MethodImplOptions.InternalCall)] - protected extern static void Add(MethodAnything m); + protected extern static void AddMethod(int inlet,MethodAnything m); // -------------------------------------------------------------------------- - protected void AddInlet(Symbol sel,Symbol to_sel) { Internal.AddInlet(ptr,sel,to_sel); } - protected void AddInlet(ref float f) { Internal.AddInlet(ptr,ref f); } - protected void AddInlet(ref Symbol s) { Internal.AddInlet(ptr,ref s); } + protected void AddInlet(ref float f) { Internal.AddInlet(ptr,ref f); } // map to data member + protected void AddInlet(ref Symbol s) { Internal.AddInlet(ptr,ref s); } // map to data member // protected void AddInlet(ref Pointer p) { Internal.AddInlet(ptr,ref p); } // map to data member - protected void AddInlet() { Internal.AddInlet(ptr); } // create proxy inlet +// protected void AddInlet(Symbol type) { Internal.AddInlet(ptr,type); } // create typed inlet + protected void AddInlet() { Internal.AddInlet(ptr); } // create inlet responding to any message + protected void AddInlet(Symbol sel,Symbol to_sel) { Internal.AddInlet(ptr,sel,to_sel); } // redirect messages to defined selector // -------------------------------------------------------------------------- protected void AddOutlet(Symbol type) { Internal.AddOutlet(ptr,type); } - protected void AddOutletBang() { AddOutlet(s_bang); } - protected void AddOutletFloat() { AddOutlet(s_float); } - protected void AddOutletSymbol() { AddOutlet(s_symbol); } - protected void AddOutletPointer() { AddOutlet(s_pointer); } - protected void AddOutletList() { AddOutlet(s_list); } - protected void AddOutletAnything() { AddOutlet(s_anything); } + protected void AddOutletBang() { AddOutlet(_bang); } + protected void AddOutletFloat() { AddOutlet(_float); } + protected void AddOutletSymbol() { AddOutlet(_symbol); } + protected void AddOutletPointer() { AddOutlet(_pointer); } + protected void AddOutletList() { AddOutlet(_list); } + protected void AddOutletAnything() { AddOutlet(_anything); } // -------------------------------------------------------------------------- @@ -156,8 +179,8 @@ namespace PureData protected void Outlet(int n,Symbol s) { Internal.Outlet(ptr,n,s); } protected void Outlet(int n,Pointer p) { Internal.Outlet(ptr,n,p); } protected void Outlet(int n,Atom a) { Internal.Outlet(ptr,n,a); } - protected void Outlet(int n,AtomList l) { Internal.Outlet(ptr,n,s_list,l); } - protected void Outlet(int n,Atom[] l) { Internal.Outlet(ptr,n,s_list,l); } + protected void Outlet(int n,AtomList l) { Internal.Outlet(ptr,n,_list,l); } + protected void Outlet(int n,Atom[] l) { Internal.Outlet(ptr,n,_list,l); } protected void Outlet(int n,Symbol s,AtomList l) { Internal.Outlet(ptr,n,s,l); } protected void Outlet(int n,Symbol s,Atom[] l) { Internal.Outlet(ptr,n,s,l); } @@ -171,12 +194,12 @@ namespace PureData [MethodImplAttribute (MethodImplOptions.InternalCall)] protected extern static void Send(Symbol sym,Atom a); - protected static void Send(Symbol sym) { Send(sym,s_bang,null); } + protected static void Send(Symbol sym) { Send(sym,_bang,null); } protected static void Send(Symbol sym,float f) { Send(sym,new Atom(f)); } protected static void Send(Symbol sym,Symbol s) { Send(sym,new Atom(s)); } protected static void Send(Symbol sym,Pointer p) { Send(sym,new Atom(p)); } - protected static void Send(Symbol sym,AtomList l) { Send(sym,s_list,l); } - protected static void Send(Symbol sym,Atom[] l) { Send(sym,s_list,l); } + protected static void Send(Symbol sym,AtomList l) { Send(sym,_list,l); } + protected static void Send(Symbol sym,Atom[] l) { Send(sym,_list,l); } [MethodImplAttribute (MethodImplOptions.InternalCall)] protected extern static void Send(Symbol sym,Symbol s,AtomList l); |