[Gridflow-cvs] [svn] commit: r3651 - in /trunk: format/main.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 12:56:57 EDT 2008


Author: matju
Date: Fri Apr 25 12:56:56 2008
New Revision: 3651

Log:
fix for Format constructor (affecting refresh of [#out x11])

Modified:
    trunk/format/main.c
    trunk/gridflow.h

Modified: trunk/format/main.c
==============================================================================
--- trunk/format/main.c (original)
+++ trunk/format/main.c Fri Apr 25 12:56:56 2008
@@ -100,15 +100,16 @@
 \end class FormatLookup {install("gf.format_lookup",1,1);}
 
 \class Format : GridObject
-//\def void initialize (t_symbol *mode, ...) {
-//	if (mode==gensym("out")) this->mode=2; else
-//	if (mode==gensym("in"))  this->mode=4; else RAISE("unknown mode");
+Format::Format (MESSAGE) : GridObject(MESSAGE2) {
+	mode=0; fd=-1; f=0; cast=int32_e; frame=0;
+	if (argv[0]==gensym("out")) this->mode=2; else
+	if (argv[0]==gensym("in"))  this->mode=4; else RAISE("unknown mode");
 //	case mode
 //	when  :in; flags[2]==1
 //	when :out; flags[1]==1
 //	else raise "Format opening mode is incorrect"
-//	//end or raise "Format '#{self.class.instance_eval{@symbol_name}}' does not support mode '#{mode}'"
-//}
+	//end or raise "Format '#{self.class.instance_eval{@symbol_name}}' does not support mode '#{mode}'"
+}
 
 \def 0 open(t_symbol *mode, string filename) {
 	const char *fmode;

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 25 12:56:56 2008
@@ -44,12 +44,18 @@
 #include <malloc.h>
 #endif
 
+#ifndef a_float
+#define a_float    a_w.w_float
+#define a_symbol   a_w.w_symbol
+#define a_gpointer a_w.w_gpointer
+#endif
+
 #ifndef DESIREDATA
 #define A_LIST t_atomtype(13) /* (t_binbuf *) */
 #endif
 // the use of w_gpointer here is fake, just because there's no suitable member in the union
-static inline void SETLIST(t_atom *a, t_binbuf *b) {a->a_type = A_LIST; a->a_w.w_gpointer = (t_gpointer *)b;}
-static inline void SETNULL(t_atom *a)              {a->a_type = A_NULL; a->a_w.w_gpointer = 0;}
+static inline void SETLIST(t_atom *a, t_binbuf *b) {a->a_type = A_LIST; a->a_gpointer = (t_gpointer *)b;}
+static inline void SETNULL(t_atom *a)              {a->a_type = A_NULL; a->a_gpointer = 0;}
 
 typedef char       int8; typedef unsigned char      uint8;
 typedef short     int16; typedef unsigned short     uint16;
@@ -221,13 +227,9 @@
 #define INT(x)  convert(x,(int32*)0)
 #define TO(T,x) convert(x,(T*)0)
 
-#define a_float    a_w.w_float
-#define a_symbol   a_w.w_symbol
-#define a_gpointer a_w.w_gpointer
-
 // trick to be able to define methods in t_atom
 struct t_atom2 : t_atom {
-	bool operator == (t_symbol *b) {return this->a_type==A_SYMBOL && this->a_w.w_symbol==b;}
+	bool operator == (t_symbol *b) {return this->a_type==A_SYMBOL && this->a_symbol==b;}
 	bool operator != (t_symbol *b) {return !(*this==b);}
 	operator bool () const {
 		if (a_type!=A_FLOAT) RAISE("expected float");
@@ -559,7 +561,7 @@
 extern std::map<string,Numop *> vop_dict;
 
 static inline NumberTypeE convert(const t_atom &x, NumberTypeE *bogus) {
-	if (x.a_type!=A_SYMBOL) RAISE("expected number-type"); return NumberTypeE_find(string(x.a_w.w_symbol->s_name));}
+	if (x.a_type!=A_SYMBOL) RAISE("expected number-type"); return NumberTypeE_find(string(x.a_symbol->s_name));}
 
 
 static Numop *convert(const t_atom &x, Numop **bogus) {
@@ -827,7 +829,7 @@
 };
 
 // represents objects that have inlets/outlets
-\class FObject : CObject {
+struct FObject : CObject {
 	BFObject *bself; // point to PD peer
 	FObject(MESSAGE) : bself(0) {}
 	template <class T> void send_out(int outlet, int argc, T *argv) {
@@ -836,9 +838,8 @@
 		outlet_list(bself->outlets[outlet],&s_list,argc,foo);
 	}
 };
-\end class FObject
-
-\class GridObject : FObject {
+
+struct GridObject : FObject {
 	std::vector<P<GridInlet> > in;
 	P<GridOutlet> out;
 	GridObject(MESSAGE) : FObject(MESSAGE2) {}
@@ -848,7 +849,6 @@
 		return false;
 	}
 };
-\end class GridObject
 
 uint64 gf_timeofday();
 extern "C" void Init_gridflow ();
@@ -884,7 +884,7 @@
 	FILE *f;
 	NumberTypeE cast;
 	long frame;
-	Format(MESSAGE) : GridObject(MESSAGE2), mode(0), fd(-1), f(0), cast(int32_e), frame(0) {}
+	Format(MESSAGE);
 	\decl 0 open (t_symbol *mode, string filename);
 	\decl 0 close ();
 	\decl 0 cast (NumberTypeE nt);



More information about the Gridflow-cvs mailing list