[Gridflow-cvs] [svn] commit: r3288 - in /trunk/format: quartz.m sdl.c x11.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Tue Mar 25 17:06:05 EDT 2008


Author: matju
Date: Tue Mar 25 17:06:04 2008
New Revision: 3288

Log:
adapt to new source_filter and use inlet 0 for all format methods (the latter simplifies the interface of a format, making it more like a pd 
class)

Modified:
    trunk/format/quartz.m
    trunk/format/sdl.c
    trunk/format/x11.c

Modified: trunk/format/quartz.m
==============================================================================
--- trunk/format/quartz.m (original)
+++ trunk/format/quartz.m Tue Mar 25 17:06:04 2008
@@ -114,16 +114,15 @@
 	[self display];
 }
 
-\class FormatQuartz < Format
-struct FormatQuartz : Format {
+\class FormatQuartz : Format {
 	NSWindow *window;
 	NSWindowController *wc;
 	GFView *widget; /* GridFlow's Cocoa widget */
 	NSDate *distantFuture;
 	\decl void initialize (Symbol mode);
-	\decl void delete_m ();
-	\decl void close ();
-	\decl void call ();
+	\decl 0 delete_m ();
+	\decl 0 close ();
+	\decl 0 call ();
 	\grin 0
 };
 
@@ -207,11 +206,11 @@
 	[window setBackgroundColor: color];
 }
 
-\def void delete_m () {
+\def 0 delete_m () {
 	[window autorelease];
 }
 
-\def void close () {
+\def 0 close () {
 	IEVAL(rself,"@clock.unset");
 	rb_call_super(argc,argv);
 	[window autorelease];
@@ -224,11 +223,7 @@
 	distantFuture = [NSDate distantFuture];
 	distantPast = [NSDate distantPast];
 	[NSApplication sharedApplication];
-	IEVAL(rself,
-\ruby
-	install '#io:quartz',1,1
-	@comment = "Apple Quartz/Cocoa"
-	@flags = 2
+	install_format("#io:quartz",1,1,2,"");
 \end ruby
 );}
 

Modified: trunk/format/sdl.c
==============================================================================
--- trunk/format/sdl.c (original)
+++ trunk/format/sdl.c Tue Mar 25 17:06:04 2008
@@ -32,15 +32,14 @@
 
 static bool in_use = false;
 
-\class FormatSDL < Format
-struct FormatSDL : Format {
+\class FormatSDL : Format {
 	SDL_Surface *screen;
 	P<BitPacking> bit_packing;
 	P<Dim> dim;
 	void resize_window (int sx, int sy);
 	void call ();
 	\decl void initialize (Symbol mode);
-	\decl void close ();
+	\decl 0 close ();
 	\grin 0 int
 };
 
@@ -81,7 +80,7 @@
 	SDL_UpdateRect(screen,0,0,in->dim->get(1),in->dim->get(0));
 } GRID_END
 
-\def void close () {
+\def 0 close () {
 	IEVAL(rself,"@clock.unset");
 	in_use=false;
 }
@@ -107,10 +106,7 @@
 	IEVAL(rself,"@clock = Clock.new self");
 }
 
-\classinfo {
-	IEVAL(rself,"install '#io:sdl',1,1;@flags=2;@comment='Simple Directmedia Layer'");
-}
-\end class FormatSDL
+\end class FormatSDL {install_format("#io:sdl",1,1,2,"");}
 void startup_sdl () {
 	\startall
 }

Modified: trunk/format/x11.c
==============================================================================
--- trunk/format/x11.c (original)
+++ trunk/format/x11.c Tue Mar 25 17:06:04 2008
@@ -48,8 +48,7 @@
 /* X11 Error Handler type */
 typedef int (*XEH)(Display *, XErrorEvent *);
 
-\class FormatX11 < Format
-struct FormatX11 : Format {
+\class FormatX11 : Format {
 /* at the Display/Screen level */
 	Display *display; /* connection to xserver */
 	Visual *visual;   /* screen properties */
@@ -98,17 +97,17 @@
 	void prepare_colormap();
 	Window search_window_tree (Window xid, Atom key, const char *value, int level=0);
 	\decl void initialize (...);
-	\decl void frame ();
-	\decl void close ();
+	\decl 0 bang ();
+	\decl 0 close ();
 	\decl void call ();
-	\decl void _0_out_size (int sy, int sx);
-	\decl void _0_setcursor (int shape);
-	\decl void _0_hidecursor ();
-	\decl void _0_set_geometry (int y, int x, int sy, int sx);
-	\decl void _0_move (int y, int x);
-	\decl void _0_transfer (Symbol s);
-	\decl void _0_title (String s=Qnil);
-	\decl void _0_warp (int y, int x);
+	\decl 0 out_size (int sy, int sx);
+	\decl 0 setcursor (int shape);
+	\decl 0 hidecursor ();
+	\decl 0 set_geometry (int y, int x, int sy, int sx);
+	\decl 0 move (int y, int x);
+	\decl 0 transfer (Symbol s);
+	\decl 0 title (String s=Qnil);
+	\decl 0 warp (int y, int x);
 	\grin 0 int
 };
 
@@ -222,7 +221,7 @@
 	IEVAL(rself,"@clock.delay 20");
 }
 
-\def void frame () {
+\def 0 bang () {
 	XGetSubImage(display, window, 0, 0, dim->get(1), dim->get(0),
 		(unsigned)-1, ZPixmap, ximage, 0, 0);
 	GridOutlet out(this,0,dim,NumberTypeE_find(rb_ivar_get(rself,SI(@cast))));
@@ -418,7 +417,7 @@
 	show_section(0,0,in->dim->get(1),in->dim->get(0));
 } GRID_END
 
-\def void close () {
+\def 0 close () {
 	if (!this) RAISE("stupid error: trying to close display NULL. =)");
 	bit_packing=0;
 	IEVAL(rself,"@clock.unset");
@@ -430,16 +429,16 @@
 	rb_call_super(argc,argv);
 }
 
-\def void _0_out_size (int sy, int sx) { resize_window(sx,sy); }
-
-\def void _0_setcursor (int shape) {
+\def 0 out_size (int sy, int sx) { resize_window(sx,sy); }
+
+\def 0 setcursor (int shape) {
 	shape = 2*(shape&63);
 	Cursor c = XCreateFontCursor(display,shape);
 	XDefineCursor(display,window,c);
 	XFlush(display);
 }
 
-\def void _0_hidecursor () {
+\def 0 hidecursor () {
 	Font font = XLoadFont(display,"fixed");
 	XColor color; /* bogus */
 	Cursor c = XCreateGlyphCursor(display,font,font,' ',' ',&color,&color);
@@ -529,32 +528,32 @@
 	return target;
 }
 
-\def void _0_move (int y, int x) {
+\def 0 move (int y, int x) {
 	pos[0]=y; pos[1]=x;
 	XMoveWindow(display,window,x,y);
 	XFlush(display);
 }
 
-\def void _0_set_geometry (int y, int x, int sy, int sx) {
+\def 0 set_geometry (int y, int x, int sy, int sx) {
 	pos[0]=y; pos[1]=x;
 	XMoveWindow(display,window,x,y);
 	resize_window(sx,sy);
 	XFlush(display);
 }
 
-\def void _0_transfer (Symbol s) {
+\def 0 transfer (Symbol s) {
 	if (s==SYM(plain))       transfer=0;
 	else if (s==SYM(xshm))   transfer=1;
 	else if (s==SYM(xvideo)) transfer=2;
 	else RAISE("unknown transfer mode (possible: plain xshm xvideo)");
 }
 
-\def void _0_warp (int y, int x) {
+\def 0 warp (int y, int x) {
 	XWarpPointer(display,None,None,0,0,0,0,x,y);
 	XFlush(display);
 }
 
-\def void _0_title (String s=Qnil) {
+\def 0 title (String s=Qnil) {
 	rb_ivar_set(rself,SI(@title),s);
 	set_wm_hints();
 }
@@ -662,10 +661,7 @@
 	show_section(0,0,sx,sy);
 }
 
-\classinfo {
-	IEVAL(rself,"install '#io:x11',1,1;@mode=6;@comment='X Window System Version 11.x'");
-}
-\end class FormatX11
+\end class FormatX11 {install_format("#io:x11",1,1,6,"");}
 void startup_x11 () {
 	\startall
 }



More information about the Gridflow-cvs mailing list