aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2006-03-10 01:01:20 +0000
committerThomas Grill <xovo@users.sourceforge.net>2006-03-10 01:01:20 +0000
commit4e7353f45954a8a5d9aaa3dd40eed3f9f62c2062 (patch)
tree97f1276c5c2dd6cee63abd44cf619912ef558cbd
parent2a3de2593da93042ce4ea2725909a92967962b79 (diff)
small cleanups
svn path=/trunk/externals/clr/; revision=4676
-rwxr-xr-xclr.cpp18
-rwxr-xr-xmakefile26
-rw-r--r--test/test.cs1
3 files changed, 24 insertions, 21 deletions
diff --git a/clr.cpp b/clr.cpp
index 201300b..5f0a96b 100755
--- a/clr.cpp
+++ b/clr.cpp
@@ -29,20 +29,24 @@ extern "C" {
#include <vector>
#include <list>
+
+// main class library
#define CORELIB "PureData"
#define DLLEXT "dll"
+// symbol for inter-object messages
+#define SYM_OBJECT "clr-object"
-// cached mono data
+static t_symbol *sym_object;
+
+// cached mono data
static MonoDomain *monodomain;
static MonoClass *clr_symbol,*clr_pointer,*clr_atom,*clr_atomlist,*clr_external;
static MonoMethodDesc *clr_desc_tostring,*clr_desc_ctor;
static MonoMethod *clr_meth_invoke;
static MonoProperty *clr_prop_method;
-static t_symbol *sym_object;
-
struct AtomList
{
@@ -55,9 +59,9 @@ struct AtomList
// transforms a pointer (like MonoObject *) into a 3 element-list
struct ObjectAtom
{
- enum { size = 3,bitshift = 22 };
-
// 64-bit safe...
+ enum { bitshift = 22,size = sizeof(void*)*8/bitshift+1 };
+
t_atom msg[size];
ObjectAtom() {}
@@ -119,7 +123,9 @@ struct Delegate
inline void init(MonoObject *method,Kind k)
{
methodinfo = mono_property_get_value(clr_prop_method,method,NULL,NULL);
+ assert(methodinfo);
virtmethod = mono_object_get_virtual_method(methodinfo,clr_meth_invoke);
+ assert(virtmethod);
kind = k;
}
@@ -1021,7 +1027,7 @@ void clr_setup(void)
class_addanything(proxy_class,clr_method_proxy);
// symbol for Mono object handling
- sym_object = gensym("clr-object");
+ sym_object = gensym(SYM_OBJECT);
// install loader hook
sys_register_loader(classloader);
diff --git a/makefile b/makefile
index 7d99f07..12f458e 100755
--- a/makefile
+++ b/makefile
@@ -2,12 +2,10 @@ current: cygwin
clean: ; rm -f *.dll *.o
-
cygwin: clr.dll
.SUFFIXES: .dll
-
# where are the PD header files?
# leave it blank if it is a system directory (like /usr/local/include),
# since gcc 3.2 complains about it
@@ -15,18 +13,16 @@ cygwin: clr.dll
PDPATH=/cygdrive/c/data/pd/pd-cvs
MONOPATH=/cygdrive/c/programme/prog/mono
+CFLAGS = -DPD -mno-cygwin
+CFLAGS += -O2
+#CFLAGS += -g
-CFLAGS = -DPD -O2 -mno-cygwin
-
-PDINC= -I$(PDPATH)/src
+PDINC= -I$(PDPATH)/src
PDLIB= $(PDPATH)/bin/pd.dll
-
-MONOINC = -I$(MONOPATH)/include -I$(MONOPATH)/include/glib-2.0 -I$(MONOPATH)/lib/glib-2.0/include
-MONOLIB = -L$(MONOPATH)/lib -lmono.dll -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv
-
-.cpp.dll:
- g++ $(CFLAGS) $(PDINC) $(MONOINC) -o $*.o -c $*.cpp
- g++ -export_dynamic -shared -mno-cygwin $(PDLIB) $(MONOLIB) -o $*.dll $*.o -lm
-# ld -export_dynamic $(MONOLIB) -o $*.dll $*.o -lm pd.dll
-# strip --strip-unneeded $*.pd_linux
-# rm $*.o
+
+MONOINC = -I$(MONOPATH)/include -I$(MONOPATH)/include/glib-2.0 -I$(MONOPATH)/lib/glib-2.0/include
+MONOLIB = -L$(MONOPATH)/lib -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv -lmono
+
+.cpp.dll:
+ g++ $(CFLAGS) $(PDINC) $(MONOINC) -o $*.o -c $*.cpp
+ g++ -export_dynamic -shared -mno-cygwin $(PDLIB) -o $*.dll $*.o $(MONOLIB) -lm
diff --git a/test/test.cs b/test/test.cs
index 0171275..beac897 100644
--- a/test/test.cs
+++ b/test/test.cs
@@ -95,6 +95,7 @@ public class test:
protected virtual void MyObject(int ix,object obj)
{
Post("OBJECT "+obj.ToString());
+ OutletEx(0,obj);
}
protected virtual void MyAnything(int ix,PureData.Symbol s,PureData.AtomList l)