[Fxruby-commits] CVS: FXRuby/swig-interfaces FXDC.i,1.19,1.20 stubs.i,1.22,1.23 typemaps.i,1.33,1.34
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <ly...@us...> - 2002-04-03 19:04:32
|
Update of /cvsroot/fxruby/FXRuby/swig-interfaces In directory usw-pr-cvs1:/tmp/cvs-serv32356/swig-interfaces Modified Files: FXDC.i stubs.i typemaps.i Log Message: Added some new typemaps to fix the call signatures for a number of FXDC instance methods which take arrays as their inputs. Index: FXDC.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/FXDC.i,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** FXDC.i 19 Mar 2002 23:18:40 -0000 1.19 --- FXDC.i 3 Apr 2002 17:36:27 -0000 1.20 *************** *** 139,143 **** class FXRegion; ! %rename(setClipRectangle2) FXDC::setClipRectangle(const FXRectangle& rectangle); %exception FXDC::FXDC "$action FXRbRegisterRubyObj(self, result);"; --- 139,147 ---- class FXRegion; ! %rename(setStippleFromBitmap) FXDC::setStipple(FXBitmap *bitmap,FXint dx,FXint dy); ! %rename(setStippleFromPattern) FXDC::setStipple(FXStipplePattern pat,FXint dx,FXint dy); ! ! %rename(setClipRectangle1) FXDC::setClipRectangle(const FXRectangle& rectangle); ! %rename(setClipRectangle4) FXDC::setClipRectangle(FXint x,FXint y,FXint w,FXint h); %exception FXDC::FXDC "$action FXRbRegisterRubyObj(self, result);"; *************** *** 364,368 **** /// Set the stipple pattern ! // virtual void setStipple(FXBitmap *bitmap,FXint dx=0,FXint dy=0); OVERLOAD /// Get stipple bitmap --- 368,372 ---- /// Set the stipple pattern ! virtual void setStipple(FXBitmap *bitmap,FXint dx=0,FXint dy=0); /// Get stipple bitmap Index: stubs.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/stubs.i,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** stubs.i 12 Feb 2002 17:51:26 -0000 1.22 --- stubs.i 3 Apr 2002 17:36:27 -0000 1.23 *************** *** 81,88 **** %name(setFunction) void _setFunction(FXFunction func=BLT_SRC); \ %name(setTile) void _setTile(FXImage* image,FXint dx=0,FXint dy=0); \ ! %name(setStipple) void _setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0); \ %name(setClipRegion) void _setClipRegion(const FXRegion& region); \ ! %name(setClipRectangle) void _setClipRectangle(FXint x,FXint y,FXint w,FXint h); \ ! %name(setClipRectangle2) void _setClipRectangle(const FXRectangle& rectangle); \ %name(clearClipRectangle) void _clearClipRectangle(); \ %name(setClipMask) void _setClipMask(FXBitmap* bitmap,FXint dx=0,FXint dy=0); \ --- 81,89 ---- %name(setFunction) void _setFunction(FXFunction func=BLT_SRC); \ %name(setTile) void _setTile(FXImage* image,FXint dx=0,FXint dy=0); \ ! %name(setStippleFromBitmap) void _setStipple(FXBitmap* bitmap,FXint dx=0,FXint dy=0); \ ! %name(setStippleFromPattern) void _setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0); \ %name(setClipRegion) void _setClipRegion(const FXRegion& region); \ ! %name(setClipRectangle4) void _setClipRectangle(FXint x,FXint y,FXint w,FXint h); \ ! %name(setClipRectangle1) void _setClipRectangle(const FXRectangle& rectangle); \ %name(clearClipRectangle) void _clearClipRectangle(); \ %name(setClipMask) void _setClipMask(FXBitmap* bitmap,FXint dx=0,FXint dy=0); \ Index: typemaps.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/typemaps.i,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** typemaps.i 1 Apr 2002 21:29:39 -0000 1.33 --- typemaps.i 3 Apr 2002 17:36:27 -0000 1.34 *************** *** 466,467 **** --- 466,538 ---- */ } + + // Extract a C array (points) and its length (npoints) from a Ruby array of FXPoint instances + %typemap(in) (const FXPoint* points, FXuint npoints) { + Check_Type($input, T_ARRAY); + $1 = new FXPoint[RARRAY($input)->len]; + $2 = static_cast<FXuint>( RARRAY($input)->len ); + for (FXuint i = 0; i < $2; i++) { + FXPoint *p; + Data_Get_Struct(rb_ary_entry($input, i), FXPoint, p); + $1[i] = p; + } + } + + %typemap(freearg) (const FXPoint* points, FXuint npoints) { + delete [] $1; + } + + // Extract a C array (segments) and its length (nsegments) from a Ruby array of FXSegment instances + %typemap(in) (const FXSegment* segments, FXuint nsegments) { + Check_Type($input, T_ARRAY); + $1 = new FXSegment[RARRAY($input)->len]; + $2 = static_cast<FXuint>( RARRAY($input)->len ); + for (FXuint i = 0; i < $2; i++) { + FXSegment *s; + Data_Get_Struct(rb_ary_entry($input, i), FXSegment, s); + $1[i] = s; + } + } + + %typemap(freearg) (const FXSegment* segments, FXuint nsegments) { + delete [] $1; + } + + // Extract a C array (rectangles) and its length (nrectangles) from a Ruby array of FXRectangle instances + %typemap(in) (const FXRectangle* rectangles, FXuint nrectangles) { + Check_Type($input, T_ARRAY); + $1 = new FXRectangle[RARRAY($input)->len]; + $2 = static_cast<FXuint>( RARRAY($input)->len ); + for (FXuint i = 0; i < $2; i++) { + FXRectangle *r; + Data_Get_Struct(rb_ary_entry($input, i), FXRectangle, r); + $1[i] = r; + } + } + + %typemap(freearg) (const FXRectangle* rectangles, FXuint nrectangles) { + delete [] $1; + } + + // Extract a C array (arcs) and its length (narcs) from a Ruby array of FXArc instances + %typemap(in) (const FXArc* arcs, FXuint narcs) { + Check_Type($input, T_ARRAY); + $1 = new FXArc[RARRAY($input)->len]; + $2 = static_cast<FXuint>( RARRAY($input)->len ); + for (FXuint i = 0; i < $2; i++) { + FXArc *arc; + Data_Get_Struct(rb_ary_entry($input, i), FXArc, arc); + $1[i] = arc; + } + } + + %typemap(freearg) (const FXArc* rectangles, FXuint narcs) { + delete [] $1; + } + + // Extract the C string pointer and string length from a Ruby string + %typemap(in) (const FXchar* string, FXuint length) { + Check_Type($input, T_STRING); + $1 = STR2CSTR($input); + $2 = RSTRING($input)->len; + } |