From 88ae96ff82ddc836a822a55aef17ea66ca06ac65 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 7 Mar 2006 13:18:32 +0000 Subject: restructured project (MSVC can't cope well with folder/classname mismatch) search for CLR DLLs in PD path first steps to efficient method handling svn path=/trunk/externals/clr/; revision=4656 --- pd/AssemblyInfo.cs | 58 ------------ pd/Atom.cs | 270 ----------------------------------------------------- pd/PureData.cs | 48 ---------- pd/README.txt | 3 - pd/pd.csproj | 105 --------------------- pd/pd.sln | 21 ----- 6 files changed, 505 deletions(-) delete mode 100755 pd/AssemblyInfo.cs delete mode 100755 pd/Atom.cs delete mode 100644 pd/PureData.cs delete mode 100755 pd/README.txt delete mode 100755 pd/pd.csproj delete mode 100755 pd/pd.sln (limited to 'pd') diff --git a/pd/AssemblyInfo.cs b/pd/AssemblyInfo.cs deleted file mode 100755 index 93484d8..0000000 --- a/pd/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// Le informazioni generali relative a un assembly sono controllate dal seguente -// insieme di attributi. Per modificare le informazioni associate a un assembly -// occorre quindi modificare i valori di questi attributi. -// -[assembly: AssemblyTitle("PureData")] -[assembly: AssemblyDescription("bridge between C sharp externals and pd")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Davide Morelli, Thomas Grill")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: -// -// Numero di versione principale -// Numero di versione secondario -// Numero revisione -// Numero build -// -// È possibile specificare tutti i valori o impostare come predefiniti i valori Numero revisione e Numero build -// utilizzando l'asterisco (*) come illustrato di seguito: - -[assembly: AssemblyVersion("1.0.*")] - -// -// Per firmare l'assembly è necessario specificare una chiave da utilizzare. -// Fare riferimento alla documentazione di Microsoft .NET Framework per ulteriori informazioni sulla firma degli assembly. -// -// Utilizzare gli attributi elencati di seguito per verificare la chiave utilizzata per la firma. -// -// Note: -// (*) Se non è specificata alcuna chiave, non sarà possibile firmare l'assembly. -// (*) KeyName fa riferimento a una chiave installata nel provider di servizi di -// crittografia (CSP) sul computer in uso. KeyFile fa riferimento a un file che contiene -// una chiave. -// (*) Se entrambi i valori KeyFile e KeyName sono specificati, si -// verificherà il seguente processo: -// (1) Se KeyName è presente in CSP, verrà utilizzata tale chiave. -// (2) Se KeyName non esiste e KeyFile esiste, la chiave -// di KeyFile verrà installata nel CSP e utilizzata. -// (*) Per creare un KeyFile, è possibile utilizzare l'utilità sn.exe (Strong Name). -// Quando si specifica il KeyFile, il percorso dovrà essere -// relativo alla directory di output del progetto, ovvero -// %Project Directory%\obj\. Se ad esempio il KeyFile si -// trova nella directory del progetto, occorre specificare l'attributo AssemblyKeyFile -// come [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) La firma ritardata è un'opzione avanzata. Vedere la documentazione di Microsoft -// .NET Framework per ulteriori informazioni. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/pd/Atom.cs b/pd/Atom.cs deleted file mode 100755 index d872961..0000000 --- a/pd/Atom.cs +++ /dev/null @@ -1,270 +0,0 @@ -using System; -using System.Runtime.InteropServices; // for structures -using System.Collections; -#if NET_2_0 -using System.Collections.Generic; -#endif - -namespace PureData -{ - [StructLayout (LayoutKind.Sequential)] - public unsafe struct Symbol - { - // this should NOT be public (or at least read only) - private readonly void *sym; - - public Symbol(string s) - { - sym = Core.SymGen(s); - } - - public override string ToString() - { - return Core.SymEval(sym); - } - } - - [StructLayout (LayoutKind.Sequential)] - public unsafe struct Pointer - { - private readonly void *ptr; - - public override string ToString() - { - if(sizeof(void *) == 4) - return ((int)ptr).ToString(); - else - return ((long)ptr).ToString(); - } - } - - [StructLayout (LayoutKind.Sequential)] - public unsafe struct Atom - { - private enum AtomType {Null = 0, Float = 1, Symbol = 2, Pointer = 3}; - - [StructLayout (LayoutKind.Explicit)] - private struct Word - { - [FieldOffset(0)] public float w_float; - [FieldOffset(0)] public Symbol w_sym; - [FieldOffset(0)] public Pointer w_ptr; - } - - private AtomType type; - private Word word; - - public Atom(float f) - { - type = AtomType.Float; - word = new Word(); - word.w_float = f; - } - - public Atom(int i) - { - type = AtomType.Float; - word = new Word(); - word.w_float = (float)i; - } - - public Atom(Symbol s) - { - type = AtomType.Symbol; - word = new Word(); - word.w_sym = s; - } - - public Atom(string s) - { - type = AtomType.Symbol; - word = new Word(); - word.w_sym = new Symbol(s); - } - - public Atom(Pointer p) - { - type = AtomType.Pointer; - word = new Word(); - word.w_ptr = p; - } - - public bool IsFloat { get { return type == AtomType.Float; } } - public bool IsSymbol { get { return type == AtomType.Symbol; } } - public bool IsPointer { get { return type == AtomType.Pointer; } } - - public float ToFloat() - { - if(IsFloat) - return word.w_float; - else - throw new System.InvalidCastException("Can't be cast to float."); - } - - public Symbol ToSymbol() - { - if(IsSymbol) - return word.w_sym; - else - throw new System.InvalidCastException("Can't be cast to Symbol."); - } - - public Pointer ToPointer() - { - if(IsPointer) - return word.w_ptr; - else - throw new System.InvalidCastException("Can't be cast to Pointer."); - } - - override public string ToString() - { - if(IsFloat) - return word.w_float.ToString(); - else if(IsSymbol) - return word.w_sym.ToString(); - else if(IsPointer) - return word.w_ptr.ToString(); - else - // should never happen - throw new System.InvalidProgramException("Internal error."); - } - - public static explicit operator float(Atom a) - { - return a.ToFloat(); - } - - public static explicit operator Symbol(Atom a) - { - return a.ToSymbol(); - } - - public static explicit operator Pointer(Atom a) - { - return a.ToPointer(); - } - } - - public class AtomListEnum - : IEnumerator - { - public AtomList list; - - // Enumerators are positioned before the first element - // until the first MoveNext() call. - int position = -1; - - public AtomListEnum(AtomList l) - { - list = l; - } - - public bool MoveNext() - { - return ++position < list.Count; - } - - public void Reset() - { - position = -1; - } - - public object Current - { - get - { - try - { - return list[position]; - } - catch (IndexOutOfRangeException) - { - throw new InvalidOperationException(); - } - } - } - } - - - // attention: this is dangerous, because we could do the following - // AtomList l2 = l; - // with l also being an AtomList... the two private memebers will get copied, although atoms is only a temporary reference - - [StructLayout (LayoutKind.Sequential)] - unsafe public struct AtomList -#if NET_2_0 - : ICollection -#else - : ICollection -#endif - { - private readonly int len; - private readonly Atom *atoms; - - public int Count { get { return len; } } -#if NET_2_0 - public bool IsReadOnly { get { return false; } } // member of generic.ICollection (C# 2.0) -#endif - public bool IsSynchronized { get { return false; } } - public Object SyncRoot { get { return null; } } - - // protect this from being used - private AtomList(AtomList a) { len = 0; atoms = null; } - -#if NET_2_0 - public void CopyTo(Atom[] array,int start) -#else - public void CopyTo(Array array,int start) -#endif - { - if(len > array.GetUpperBound(0)+1-start) - throw new System.ArgumentException("Destination array is not long enough."); - int i; - for(i = 0; i < len-start; ++i) - array.SetValue(atoms[start+i],i); - } - - public IEnumerator GetEnumerator() - { - return new AtomListEnum(this); - } - - public Atom this[int i] - { - get - { - if(i < 0 || i >= len) - throw new System.IndexOutOfRangeException("Index outside array bounds."); - return atoms[i]; - } - set - { - if(i < 0 || i >= len) - throw new System.IndexOutOfRangeException("Index outside array bounds."); - atoms[i] = value; - } - } - -#if !NET_2_0 - public static explicit operator Atom[](AtomList l) - { - Atom[] ret = new Atom[l.Count]; - int i; - for(i = 0; i < l.Count; ++i) ret[i] = l.atoms[i]; - return ret; - } -#endif - - override public string ToString() - { - string n = "{"; - if(len > 0) { - int i; - for(i = 0; i < len-1; ++i) n += atoms[i].ToString()+","; - n += atoms[i].ToString(); - } - return n+"}"; - } - } -} diff --git a/pd/PureData.cs b/pd/PureData.cs deleted file mode 100644 index d6ad3d9..0000000 --- a/pd/PureData.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Runtime.CompilerServices; // for extern import -using System.Runtime.InteropServices; // for structures - -namespace PureData -{ - // PD core functions - public unsafe class Core - { - [MethodImplAttribute (MethodImplOptions.InternalCall)] - public extern static void Post(string message); - - [MethodImplAttribute (MethodImplOptions.InternalCall)] - public extern static void PostError(string message); - - [MethodImplAttribute (MethodImplOptions.InternalCall)] - public extern static void PostBug(string message); - - [MethodImplAttribute (MethodImplOptions.InternalCall)] - public extern static void PostVerbose(string message); - - [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 - : Core - { - // PD object pointer - private readonly void *ptr; - - protected virtual void MethodBang() { throw new System.NotImplementedException("Bang handler not defined"); } - - protected virtual void MethodFloat(float f) { throw new System.NotImplementedException("Float handler not defined"); } - - protected virtual void MethodSymbol(Symbol s) { throw new System.NotImplementedException("Symbol handler not defined"); } - - protected virtual void MethodPointer(Pointer p) { throw new System.NotImplementedException("Pointer handler not defined"); } - - protected virtual void MethodList(AtomList lst) { throw new System.NotImplementedException("List handler not defined"); } - - protected virtual void MethodAnything(Symbol tag,AtomList lst) { throw new System.NotImplementedException("Anything handler not defined"); } - } -} diff --git a/pd/README.txt b/pd/README.txt deleted file mode 100755 index 323f00c..0000000 --- a/pd/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -to compile PureData.dll execute this command: - -mcs Atom.cs pd.cs -out:PureData.dll -target:library \ No newline at end of file diff --git a/pd/pd.csproj b/pd/pd.csproj deleted file mode 100755 index 8dd510d..0000000 --- a/pd/pd.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pd/pd.sln b/pd/pd.sln deleted file mode 100755 index 2d4a44b..0000000 --- a/pd/pd.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pd", "pd.csproj", "{FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}.Debug.ActiveCfg = Debug|.NET - {FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}.Debug.Build.0 = Debug|.NET - {FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}.Release.ActiveCfg = Release|.NET - {FFBC9D2E-1FB7-4E82-B5DC-46B31F8A58A2}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal -- cgit v1.2.1