aboutsummaryrefslogtreecommitdiff
path: root/pd/Atom.cs
blob: e6c723e97b04c93c3e48936955414c0a147af381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Runtime.InteropServices; // for structures

namespace PureData
{
	public enum AtomType {Null = 0, Float=1, Symbol=2, List=3, Bang=4};

	//[StructLayout (LayoutKind.Explicit)]
	[StructLayout (LayoutKind.Sequential)]
	public struct Atom 
	{
		public AtomType type;
		public float float_value;
		public string string_value;
		public Atom(float f)
		{
			this.type = AtomType.Float;
			this.float_value = f;
			this.string_value = "float";
		}
		public Atom(int i)
		{
			this.type = AtomType.Float;
			this.float_value = (float) i;
			this.string_value = "float";
		}
		public Atom(string s)
		{
			this.type = AtomType.Symbol;
			this.float_value = 0;
			this.string_value = s;
		}
	}
	// this struct is relative to this c struct, see clr.c

	/*
		// simplyfied atom
		typedef struct atom_simple atom_simple;
		typedef enum
		{
			A_S_NULL=0,
			A_S_FLOAT=1,
			A_S_SYMBOL=2,
		}  t_atomtype_simple;
		typedef struct atom_simple
		{
			t_atomtype_simple a_type;
			union{
				float float_value;
				MonoString *string_value;
			} stuff;
		};
		*/
}