[Gridflow-cvs] [svn] commit: r6265 - in /trunk/src: classes2.cxx classes_gui.cxx grid.cxx gridflow.cxx gridflow.hxx hack.hxx number.cxx sdl.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Tue Sep 14 17:32:33 EDT 2010


Author: mescalinum
Date: Tue Sep 14 17:32:31 2010
New Revision: 6265

Log:
MINGW64 fixes - 64-bit model is different between Linux (LP64) and Windows (LLP64) only in the size of long type; let's avoid those casts to long as much as possible

Modified:
    trunk/src/classes2.cxx
    trunk/src/classes_gui.cxx
    trunk/src/grid.cxx
    trunk/src/gridflow.cxx
    trunk/src/gridflow.hxx
    trunk/src/hack.hxx
    trunk/src/number.cxx
    trunk/src/sdl.cxx

Modified: trunk/src/classes2.cxx
==============================================================================
--- trunk/src/classes2.cxx (original)
+++ trunk/src/classes2.cxx Tue Sep 14 17:32:31 2010
@@ -725,7 +725,7 @@
 		pd_bind((t_pd *)bself,name);
 	}
 	~GFCanvasXID () {pd_unbind((t_pd *)bself,name);}
-	\decl 0 bang () {MOM; sys_vgui("pd %s xid [winfo id .x%lx.c] [winfo id .x%lx]\\;\n",name->s_name,long(m),long(m));}
+	\decl 0 bang () {MOM; sys_vgui("pd %s xid [winfo id .x%p.c] [winfo id .x%p]\\;\n",name->s_name,m,m);}
 	\decl 0 xid (t_symbol *t, t_symbol *u) {MOM
 		out[2](symprintf(".x%lx",m));
 		out[1](u);
@@ -744,7 +744,7 @@
 		if (m->gl_screeny2-m->gl_screeny1 < int(y)) m->gl_screeny2 = m->gl_screeny1+int(y);
 		int  sx = int(m->gl_screenx2-m->gl_screenx1); // new size x
 		int  sy = int(m->gl_screeny2-m->gl_screeny1); // new size y
-		if (osx!=sx || osy!=sy) sys_vgui("wm geometry .x%lx %dx%d\n",long(m),sx,sy);
+		if (osx!=sx || osy!=sy) sys_vgui("wm geometry .x%p %dx%d\n",m,sx,sy);
 	}
 };
 \end class {install("gf/canvas_hehehe",1,1);}
@@ -756,11 +756,11 @@
 	t_canvas *last;
 	\constructor (int n) {this->n=n; last=0;}
 	~GFCanvasHoHoHo () {_0_hide();}
-	\decl 0 hide () {if (last) sys_vgui(".x%lx.c delete %lxRECT\n",long(last),long(bself));}
+	\decl 0 hide () {if (last) sys_vgui(".x%p.c delete %pRECT\n",last,bself);}
 	\decl 0 list (int x1, int y1, int x2, int y2) {MOM;
 		_0_hide();
 		last = m;
-		sys_vgui(".x%lx.c create rectangle %d %d %d %d "DASHRECT" -tags %lxRECT\n",long(m),x1,y1,x2,y2,long(bself));
+		sys_vgui(".x%p.c create rectangle %d %d %d %d "DASHRECT" -tags %pRECT\n",m,x1,y1,x2,y2,bself);
 	}
 };
 \end class {install("gf/canvas_hohoho",1,0);}
@@ -812,7 +812,7 @@
 	\constructor (int n) {this->n=n;}
 	\decl 0 wire_dotted  (int r, int g, int b) {BEGIN
 		wire_each(wire,ouch) {
-			sys_vgui(".x%lx.c itemconfigure l%lx -fill #%02x%02x%02x -dash {3 3 3 3}\n",long(can),long(wire),r,g,b);
+			sys_vgui(".x%p.c itemconfigure l%p -fill #%02x%02x%02x -dash {3 3 3 3}\n",can,wire,r,g,b);
 		}
 	}
 	\decl 0 wire_bracket (int r, int g, int b) {BEGIN
@@ -820,14 +820,14 @@
 		// lt.tr_ob = (t_object *)mom; lt.tr_nextoc = wire; // would like this shortcut but can't use it
 		while ((wire = linetraverser_next(&lt))) if (lt.tr_outlet==ouch) {
 			int x1=lt.tr_lx1, y1=lt.tr_ly1, x2=lt.tr_lx2, y2=lt.tr_ly2;
-			sys_vgui(".x%lx.c itemconfigure l%lx -fill #%02x%02x%02x -dash {}\n; "
-				".x%lx.c coords l%lx %d %d %d %d %d %d %d %d %d %d\n",
-				long(can),long(wire),r,g,b,
-				long(can),long(wire), x1,y1, x1,y1+3, x1+7,y1+3, x1+7,y2+8, x2-2,y2+8);
+			sys_vgui(".x%p.c itemconfigure l%p -fill #%02x%02x%02x -dash {}\n; "
+				".x%p.c coords l%p %d %d %d %d %d %d %d %d %d %d\n",
+				can,wire,r,g,b,
+				can,wire, x1,y1, x1,y1+3, x1+7,y1+3, x1+7,y2+8, x2-2,y2+8);
 		}
 	}
 	\decl 0 wire_hide () {BEGIN
-		wire_each(wire,ouch) sys_vgui(".x%lx.c delete l%lx\n",long(can),long(wire));
+		wire_each(wire,ouch) sys_vgui(".x%p.c delete l%p\n",can,wire);
 	}
 	\decl 0  box_dotted (int r, int g, int b) {BEGIN
 		wire_each(wire,ouch) {
@@ -835,8 +835,8 @@
 			int x1,y1,x2,y2;
 			gobj_getrect((t_gobj *)wire->to,can,&x1,&y1,&x2,&y2);
 			// was #00aa66 {3 5 3 5}
-			sys_vgui(".x%lx.c delete %lxRECT; .x%lx.c create rectangle %d %d %d %d "DASHRECT" -tags %lxRECT\n",
-				long(can),long(t),long(can),x1,y1,x2,y2,long(t));
+			sys_vgui(".x%p.c delete %pRECT; .x%p.c create rectangle %d %d %d %d "DASHRECT" -tags %pRECT\n",
+				can,t,can,x1,y1,x2,y2,t);
 			}
 	}
 	\decl 0  box_align (t_symbol *s, int x_start, int y_start, int incr);

Modified: trunk/src/classes_gui.cxx
==============================================================================
--- trunk/src/classes_gui.cxx (original)
+++ trunk/src/classes_gui.cxx Tue Sep 14 17:32:31 2010
@@ -82,7 +82,7 @@
 		self->vis = !!flag;
 		if (flag) self->changed();
 		else { // can't call deletefn directly
-			sys_vgui(".x%lx.c delete %s\n",long(c),self->rsym->s_name);
+			sys_vgui(".x%p.c delete %s\n",c,self->rsym->s_name);
 			sys_unqueuegui(x);
 		}
 	}
@@ -92,16 +92,16 @@
 	}
 	static void displacefn(BLAH, int dx, int dy) {INIT L
 		bself->te_xpix+=dx; bself->te_ypix+=dy;
-		sys_vgui(".x%lx.c move %s %d %d\n",long(glist_getcanvas(glist)),self->rsym->s_name,dx,dy);
+		sys_vgui(".x%p.c move %s %d %d\n",glist_getcanvas(glist),self->rsym->s_name,dx,dy);
 		canvas_fixlinesfor(glist, (t_text *)x);
 	}
 	static void selectfn(BLAH, int state) {INIT L
 		self->selected=!!state;
-		sys_vgui(".x%lx.c itemconfigure {%sR || %sTEXT} -outline %s\n",long(c),
+		sys_vgui(".x%p.c itemconfigure {%sR || %sTEXT} -outline %s\n",c,
 			self->rsym->s_name,self->rsym->s_name,self->selected?"#0000ff":self->outline.data());
 	}
 	static void deletefn(BLAH) {INIT L
-		/* if (self->vis) */ sys_vgui(".x%lx.c delete %s\n",long(c),self->rsym->s_name);
+		/* if (self->vis) */ sys_vgui(".x%p.c delete %s\n",c,self->rsym->s_name);
 		canvas_deletelinesfor(glist,(t_object *)bself); // hein ?
 		sys_unqueuegui(x);
 	}
@@ -167,20 +167,20 @@
 			else quoted << (char)s[i];
 		}
 		// used to have {Courier -12} but this changed to use pdtk_canvas_new
-		if (vis) sys_vgui("display_update %s .x%lx.c %d %d #000000 #ffffc8 %s %d \"%s\"\n",
-			rsym->s_name,long(glist_getcanvas(mom)),text_xpix(bself,mom),text_ypix(bself,mom),
+		if (vis) sys_vgui("display_update %s .x%p.c %d %d #000000 #ffffc8 %s %d \"%s\"\n",
+			rsym->s_name,glist_getcanvas(mom),text_xpix(bself,mom),text_ypix(bself,mom),
 			selected?"#0000ff":"#aaaaaa", sys_hostfontsize(glist_getfont(mom)),quoted.str().data());
 		else {
 			t_canvas *c = glist_getcanvas(mom);
-			sys_vgui(".x%lx.c delete %s\n",long(c),rsym->s_name);
+			sys_vgui(".x%p.c delete %s\n",c,rsym->s_name);
 		}
 	}
 	NEWWB
 	static void redraw(BLAH) {INIT1 self->show();}
 	static void selectfn(BLAH, int state) {INIT L
 		self->selected=!!state;
-		sys_vgui(".x%lx.c itemconfigure %sR -outline %s\n",long(c),self->rsym->s_name,self->selected?"#0000ff":"#aaaaaa");
-		sys_vgui(".x%lx.c itemconfigure %sTEXT -fill %s\n",long(c),self->rsym->s_name,self->selected?"#0000ff":"#000000");
+		sys_vgui(".x%p.c itemconfigure %sR -outline %s\n",c,self->rsym->s_name,self->selected?"#0000ff":"#aaaaaa");
+		sys_vgui(".x%p.c itemconfigure %sTEXT -fill %s\n",c,self->rsym->s_name,self->selected?"#0000ff":"#000000");
 	}
 	\decl void anything (...) {
 		t_symbol *sel = argv[1];
@@ -409,7 +409,7 @@
 		if (buf) sendbuf();
 		t_glist *c = glist_getcanvas(mom);
 		if (osx!=sx || osy!=sy) canvas_fixlinesfor(c,(t_object *)bself);
-		sys_vgui("gridsee_update %s .x%lx.c %d %d %d %d %d %d %d %d #cccccc %s\n",rsym->s_name,long(c),
+		sys_vgui("gridsee_update %s .x%p.c %d %d %d %d %d %d %d %d #cccccc %s\n",rsym->s_name,c,
 			text_xpix(bself,mom),text_ypix(bself,mom),sx,sy,mx1,my1,mx2,my2,selected?"#0000ff":"#aaaaaa");
 		out[0](gensym("shown"),0,0);
 	}
@@ -480,13 +480,13 @@
 	void show () {
 		//if (osx!=sx || osy!=sy) canvas_fixlinesfor(c,(t_object *)bself);
 		t_glist *c = glist_getcanvas(mom);
-		sys_vgui("gf/tk_button.update %s .x%lx.c %d %d %d %d #ffffff %s\n",rsym->s_name,long(c),
+		sys_vgui("gf/tk_button.update %s .x%p.c %d %d %d %d #ffffff %s\n",rsym->s_name,c,
 			text_xpix(bself,mom),text_ypix(bself,mom),sx,sy,selected?"#0000ff":outline.data());
 	}
 	static void visfn(BLAH, int flag) {INIT
-		if (flag && !self->vis) sys_vgui("gf/tk_button.create %s .x%lx.c %d %d {%s}\n",self->rsym->s_name,long(c),
+		if (flag && !self->vis) sys_vgui("gf/tk_button.create %s .x%p.c %d %d {%s}\n",self->rsym->s_name,c,
 			text_xpix(bself,self->mom),text_ypix(bself,self->mom),self->text->s_name);
-		if (!flag && self->vis) sys_vgui("gf/tk_button.destroy %s .x%lx.c\n",self->rsym->s_name,long(c));
+		if (!flag && self->vis) sys_vgui("gf/tk_button.destroy %s .x%p.c\n",self->rsym->s_name,c);
 		GUI_FObject::visfn(x,glist,flag);//super
 	}
 	NEWWB

Modified: trunk/src/grid.cxx
==============================================================================
--- trunk/src/grid.cxx (original)
+++ trunk/src/grid.cxx Tue Sep 14 17:32:31 2010
@@ -36,7 +36,7 @@
 		number_type_table[NumberTypeE_type_of(&d)].name, number_type_table[NT].name);
 #define CHECK_BUSY1(s) if (!this->sender) RAISE(#s " not busy");
 #define CHECK_BUSY(s)  if (!this->sender) RAISE(#s " not busy (wanting to write %ld values)",(long)n);
-#define CHECK_ALIGN(d,nt) {int bytes = number_type_table[nt].size/8; int align = ((long)(void*)d)%bytes; \
+#define CHECK_ALIGN(d,nt) {int bytes = number_type_table[nt].size/8; int align = ((uintptr_t)(void*)d)%bytes; \
 	if (align) {post("(%s): Alignment Warning: %p is not %d-aligned: %d", __PRETTY_FUNCTION__, (void*)d,bytes,align);}}
 
 // **************** Grid ******************************************

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Tue Sep 14 17:32:31 2010
@@ -166,7 +166,7 @@
 		case A_FLOAT:   self << a.a_float; break;
 		case A_SYMBOL:  self << a.a_symbol->s_name; break; // i would rather show backslashes here...
 		case A_DOLLSYM: self << a.a_symbol->s_name; break; // for real, it's the same thing as A_SYMBOL in pd >= 0.40
-		case A_POINTER: self << "\\p(0x" << std::hex << (unsigned long)a.a_gpointer << std::dec << ")"; break;
+		case A_POINTER: self << "\\p(0x" << std::hex << (uintptr_t)a.a_gpointer << std::dec << ")"; break;
 		case A_COMMA:   self << ","; break;
 		case A_SEMI:    self << ";"; break;
 		case A_DOLLAR:  self << "$" << a.a_w.w_index; break;

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Tue Sep 14 17:32:31 2010
@@ -794,7 +794,7 @@
 
 #define CHECK_ALIGN16(d,nt) \
 	{int bytes = 16; \
-	int align = ((unsigned long)(void*)d)%bytes; \
+	int align = ((uintptr_t)(void*)d)%bytes; \
 	if (align) {_L_;post("%s(%s): Alignment Warning: %s=%p is not %d-aligned: %d", \
 		ARGS(this), __PRETTY_FUNCTION__,#d,(void*)d,bytes,align);}}
 
@@ -841,8 +841,7 @@
 	void operator () ()              {outlet_bang(   p  );}
 	void operator () (int f)         {outlet_float(  p,f);}
 	void operator () (long f)        {outlet_float(  p,f);}
-	void operator () (unsigned int f){outlet_float(  p,f);} // is also size_t in 32-bit mode
-	void operator () (unsigned long f){outlet_float(  p,f);} // is also size_t in 64-bit mode
+	void operator () (size_t f)      {outlet_float(  p,f);}
 	void operator () (float f)       {outlet_float(  p,f);}
 	void operator () (double f)      {outlet_float(  p,f);}
 	void operator () (t_symbol *s)   {outlet_symbol( p,s);}

Modified: trunk/src/hack.hxx
==============================================================================
--- trunk/src/hack.hxx (original)
+++ trunk/src/hack.hxx Tue Sep 14 17:32:31 2010
@@ -19,8 +19,8 @@
         strcat(namebuf, ")");
     }
     else namebuf[0] = 0;
-    sys_vgui("wm title .x%lx {%s%c%s - %s}\n",
-        long(x), x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
+    sys_vgui("wm title .x%p {%s%c%s - %s}\n",
+        x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
             canvas_getdir(x)->s_name);
 }
 #else

Modified: trunk/src/number.cxx
==============================================================================
--- trunk/src/number.cxx (original)
+++ trunk/src/number.cxx Tue Sep 14 17:32:31 2010
@@ -110,12 +110,12 @@
 
 #ifdef PASS1
 void quick_put_map (long n, int16 *as, int16 b) {
-	if ((n&1)!=0 && ((long)as&4)!=0) {*as++=b; n--;}
+	if ((n&1)!=0 && ((intptr_t)as&4)!=0) {*as++=b; n--;}
 	quick_put_map(n>>1, (int32 *)as, (int32)(b<<16)+b);
 	if ((n&1)!=0) *as++=b;
 }
 void quick_put_map (long n, uint8 *as, uint8 b) {
-	while ((n&3)!=0 && ((long)as&4)!=0) {*as++=b; n--;}
+	while ((n&3)!=0 && ((intptr_t)as&4)!=0) {*as++=b; n--;}
 	int32 c=(b<<8)+b; c+=c<<16;
 	quick_put_map(n>>2, (int32 *)as, c);
 	while ((n&3)!=0) *as++=b;

Modified: trunk/src/sdl.cxx
==============================================================================
--- trunk/src/sdl.cxx (original)
+++ trunk/src/sdl.cxx Tue Sep 14 17:32:31 2010
@@ -27,6 +27,11 @@
 #include <sys/time.h>
 #include <signal.h>
 #include <SDL/SDL.h>
+
+#if !defined(SDLK_LAST)
+/* mescalinum: my SDL doesn't define any SDLK_LAST */
+#define SDLK_LAST 324
+#endif
 
 #define pd_anything pd_typedmess
 



More information about the Gridflow-cvs mailing list