diff --git a/ext/fox16_c/FXRuby.cpp b/ext/fox16_c/FXRuby.cpp index 4d014fdaa39b3811768b90203246df51d65c63db..4f5016f83e24af61d3fc41b3f32dd8ede5ca504a 100644 --- a/ext/fox16_c/FXRuby.cpp +++ b/ext/fox16_c/FXRuby.cpp @@ -1308,7 +1308,7 @@ static VALUE handle_rescue(VALUE args,VALUE error){ // Call the designated function and return its result (which should be a long). -long FXRbHandleMessage(FXObject* recv,ID func,FXObject* sender,FXSelector key,void* ptr){ +long FXRbHandleMessage_gvlcb(FXObject* recv,ID func,FXObject* sender,FXSelector key,void* ptr){ FXRbHandleArgs hArgs; hArgs.recv=to_ruby(recv); hArgs.sender=to_ruby(sender); @@ -1436,21 +1436,21 @@ FXint FXRbCallIntMethod_gvlcb(const FXObject* recv,ID func){ //---------------------------------------------------------------------- // Call function with "FXGLObject*" return value -FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func){ +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLObject* recv,ID func){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,0,NULL); return NIL_P(result) ? 0 : reinterpret_cast<FXGLObject*>(DATA_PTR(result)); } -FXGLObject* FXRbCallGLObjectMethod(FXGLViewer* recv,ID func,FXint x,FXint y){ +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLViewer* recv,ID func,FXint x,FXint y){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,INT2NUM(x),INT2NUM(y)); return NIL_P(result) ? 0 : reinterpret_cast<FXGLObject*>(DATA_PTR(result)); } -FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func,FXuint* path,FXint n){ +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLObject* recv,ID func,FXuint* path,FXint n){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,1,FXRbMakeArray(path,n)); @@ -1460,7 +1460,7 @@ FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func,FXuint* path,FXint n //---------------------------------------------------------------------- // Call function with "FXGLObject**" return value -FXGLObject** FXRbCallGLObjectArrayMethod(FXGLViewer* recv,ID func,FXint x,FXint y,FXint w,FXint h){ +FXGLObject** FXRbCallGLObjectArrayMethod_gvlcb(FXGLViewer* recv,ID func,FXint x,FXint y,FXint w,FXint h){ FXGLObject** objects=NULL; VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); @@ -1479,7 +1479,7 @@ FXGLObject** FXRbCallGLObjectArrayMethod(FXGLViewer* recv,ID func,FXint x,FXint //---------------------------------------------------------------------- -FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,const FXString& text,FXIcon* icon,void* ptr){ +FXTableItem* FXRbCallTableItemMethod_gvlcb(FXTable* recv,ID func,const FXString& text,FXIcon* icon,void* ptr){ VALUE itemData=(ptr==0)?Qnil:reinterpret_cast<VALUE>(ptr); VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); @@ -1488,7 +1488,7 @@ FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,const FXString& text, return NIL_P(result)?0:reinterpret_cast<FXTableItem*>(DATA_PTR(result)); } -FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,FXint row,FXint col,FXbool notify){ +FXTableItem* FXRbCallTableItemMethod_gvlcb(FXTable* recv,ID func,FXint row,FXint col,FXbool notify){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,3,to_ruby(row),to_ruby(col),to_ruby(notify)); @@ -1497,7 +1497,7 @@ FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,FXint row,FXint col,F //---------------------------------------------------------------------- -FXTreeItem* FXRbCallTreeItemMethod(const FXTreeList* recv,ID func,FXint x,FXint y){ +FXTreeItem* FXRbCallTreeItemMethod_gvlcb(const FXTreeList* recv,ID func,FXint x,FXint y){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,INT2NUM(x),INT2NUM(y)); @@ -1506,7 +1506,7 @@ FXTreeItem* FXRbCallTreeItemMethod(const FXTreeList* recv,ID func,FXint x,FXint //---------------------------------------------------------------------- -FXFoldingItem* FXRbCallFoldingItemMethod(const FXFoldingList* recv,ID func,FXint x,FXint y){ +FXFoldingItem* FXRbCallFoldingItemMethod_gvlcb(const FXFoldingList* recv,ID func,FXint x,FXint y){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,INT2NUM(x),INT2NUM(y)); @@ -1515,7 +1515,7 @@ FXFoldingItem* FXRbCallFoldingItemMethod(const FXFoldingList* recv,ID func,FXint //---------------------------------------------------------------------- -FXFileAssoc* FXRbCallFileAssocMethod(const FXFileDict* recv,ID func,const FXchar* pathname){ +FXFileAssoc* FXRbCallFileAssocMethod_gvlcb(const FXFileDict* recv,ID func,const FXchar* pathname){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,1,to_ruby(pathname)); @@ -1524,7 +1524,7 @@ FXFileAssoc* FXRbCallFileAssocMethod(const FXFileDict* recv,ID func,const FXchar //---------------------------------------------------------------------- -FXIcon* FXRbCallIconMethod(const FXTableItem* recv,ID func){ +FXIcon* FXRbCallIconMethod_gvlcb(const FXTableItem* recv,ID func){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); if(!NIL_P(obj)){ @@ -1538,7 +1538,7 @@ FXIcon* FXRbCallIconMethod(const FXTableItem* recv,ID func){ //---------------------------------------------------------------------- -FXWindow* FXRbCallWindowMethod(const FXTableItem* recv,ID func,FXTable* table){ +FXWindow* FXRbCallWindowMethod_gvlcb(const FXTableItem* recv,ID func,FXTable* table){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,1,to_ruby(table)); @@ -1549,7 +1549,7 @@ FXWindow* FXRbCallWindowMethod(const FXTableItem* recv,ID func,FXTable* table){ //---------------------------------------------------------------------- // Call function with "FXRange" return value -FXRangef FXRbCallRangeMethod(FXObject* recv,ID func){ +FXRangef FXRbCallRangeMethod_gvlcb(FXObject* recv,ID func){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,0,NULL); @@ -1559,7 +1559,7 @@ FXRangef FXRbCallRangeMethod(FXObject* recv,ID func){ //---------------------------------------------------------------------- // Call functions with FXString return value -FXString FXRbCallStringMethod(const FXObject* recv, ID func){ +FXString FXRbCallStringMethod_gvlcb(const FXObject* recv, ID func){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,0,NULL); @@ -1569,7 +1569,7 @@ FXString FXRbCallStringMethod(const FXObject* recv, ID func){ //---------------------------------------------------------------------- // Call functions with const FXchar* return value -const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar* message, const FXchar* hint){ +const FXchar* FXRbCallCStringMethod_gvlcb(const FXObject* recv, ID func, const FXchar* message, const FXchar* hint){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,to_ruby(message),to_ruby(hint)); @@ -1577,7 +1577,7 @@ const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar* } // Call functions with const FXchar* return value -const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar* context, const FXchar* message, const FXchar* hint){ +const FXchar* FXRbCallCStringMethod_gvlcb(const FXObject* recv, ID func, const FXchar* context, const FXchar* message, const FXchar* hint){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,3,to_ruby(context),to_ruby(message),to_ruby(hint)); @@ -1586,17 +1586,25 @@ const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar* //---------------------------------------------------------------------- // Call functions with FXwchar return value -FXwchar FXRbCallWCharMethod(const FXObject* recv, ID func){ +FXwchar FXRbCallWCharMethod_gvlcb(const FXObject* recv, ID func){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,0,NULL); return static_cast<FXwchar>(NUM2ULONG(result)); } -void FXRbCallSetDashes(FXDC* recv,ID func,FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength){ +void FXRbCallSetDashes_gvlcb(FXDC* recv,ID func,FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength){ rb_funcall(FXRbGetRubyObj(recv,false),func,2,to_ruby(dashoffset),FXRbMakeArray(dashpattern,dashlength)); } +void FXRbCallDCDrawMethod_gvlcb(FXDC* recv, const char * func, FXint x,FXint y,const FXString& string){ + rb_funcall(FXRbGetRubyObj(recv,false),rb_intern(func),3,to_ruby(x),to_ruby(y),to_ruby(string)); \ + } + +void FXRbCallDCDrawMethod_gvlcb(FXDC* recv, const char * func, FXint x,FXint y,const FXchar* string,FXuint length){ + rb_funcall(FXRbGetRubyObj(recv,false),rb_intern(func),3,to_ruby(x),to_ruby(y),to_ruby(string,length)); \ + } + //---------------------------------------------------------------------- // Special destructors to handle order dependencies @@ -1711,59 +1719,25 @@ void FXRbFoldingList::enumerateItems(FXFoldingItem* fm,FXFoldingItem* to,FXObjec static ID id_cmp; -// Sort function stand-in for FXComboBox -FXint FXRbComboBox::sortFunc(const FXListItem* a,const FXListItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *"); - VALUE result=rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - - -// Sort function stand-in for FXFoldingList -FXint FXRbFoldingList::sortFunc(const FXFoldingItem* a,const FXFoldingItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXFoldingItem*>(a), "FXFoldingItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXFoldingItem*>(b), "FXFoldingItem *"); - VALUE result=rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - - -// Sort function stand-in for FXIconList -FXint FXRbIconList::sortFunc(const FXIconItem* a,const FXIconItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXIconItem*>(a), "FXIconItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXIconItem*>(b), "FXIconItem *"); - VALUE result = rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - - -// Sort function stand-in for FXList -FXint FXRbList::sortFunc(const FXListItem* a,const FXListItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *"); - VALUE result=rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - - -// Sort function stand-in for FXListBox -FXint FXRbListBox::sortFunc(const FXListItem* a,const FXListItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXListItem*>(a), "FXListItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXListItem*>(b), "FXListItem *"); - VALUE result=rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - - -// Sort function stand-in for FXTreeList -FXint FXRbTreeList::sortFunc(const FXTreeItem* a,const FXTreeItem* b){ - VALUE itemA = FXRbGetRubyObj(const_cast<FXTreeItem*>(a), "FXTreeItem *"); - VALUE itemB = FXRbGetRubyObj(const_cast<FXTreeItem*>(b), "FXTreeItem *"); - VALUE result=rb_funcall(itemA,id_cmp,1,itemB); - return static_cast<FXint>(NUM2INT(result)); - } - +#define SORTFUNC(list, item) \ +FXint list::sortFunc(const item* a,const item* b){ \ + return list##_sortFunc(a, b); \ + } \ +FXint list##_sortFunc_gvlcb(const item* a,const item* b){ \ + VALUE itemA = FXRbGetRubyObj(const_cast<item*>(a), #item " *"); \ + VALUE itemB = FXRbGetRubyObj(const_cast<item*>(b), #item " *"); \ + VALUE result=rb_funcall(itemA,id_cmp,1,itemB); \ + return static_cast<FXint>(NUM2INT(result)); \ + } + +SORTFUNC( FXRbComboBox, FXListItem ) +SORTFUNC( FXRbFoldingList, FXFoldingItem ) +SORTFUNC( FXRbIconList, FXIconItem ) +SORTFUNC( FXRbList, FXListItem ) +SORTFUNC( FXRbListBox, FXListItem ) +SORTFUNC( FXRbTreeList, FXTreeItem ) + +#undef SORTFUNC // Feedback buffer sort routine stand-in for FXGLViewer FXbool FXRbGLViewer::sortProc(FXfloat*& buffer,FXint& used,FXint& size){ diff --git a/ext/fox16_c/include/FXRbDC.h b/ext/fox16_c/include/FXRbDC.h index 479afe78448b6160865e5a5b8b946096d097b629..01977444df10332e9432791a37cccf4b5bdeea00 100644 --- a/ext/fox16_c/include/FXRbDC.h +++ b/ext/fox16_c/include/FXRbDC.h @@ -329,16 +329,16 @@ inline void klass ## _clipChildren(klass* self,FXbool yes){ \ FXRbCallVoidMethod(this,rb_intern("drawIconSunken"),icon,dx,dy); \ } \ void cls::drawText(FXint x,FXint y,const FXString& string){ \ - rb_funcall(FXRbGetRubyObj(this,false),rb_intern("drawText"),3,to_ruby(x),to_ruby(y),to_ruby(string)); \ + FXRbCallDCDrawMethod(this, "drawText", x, y, string); \ } \ void cls::drawText(FXint x,FXint y,const FXchar* string,FXuint length){ \ - rb_funcall(FXRbGetRubyObj(this,false),rb_intern("drawText"),3,to_ruby(x),to_ruby(y),to_ruby(string,length)); \ + FXRbCallDCDrawMethod(this, "drawText", x, y, string, length); \ } \ void cls::drawImageText(FXint x,FXint y,const FXString& string){ \ - rb_funcall(FXRbGetRubyObj(this,false),rb_intern("drawImageText"),3,to_ruby(x),to_ruby(y),to_ruby(string)); \ + FXRbCallDCDrawMethod(this, "drawImageText", x, y, string); \ } \ void cls::drawImageText(FXint x,FXint y,const FXchar* string,FXuint length){ \ - rb_funcall(FXRbGetRubyObj(this,false),rb_intern("drawImageText"),3,to_ruby(x),to_ruby(y),to_ruby(string,length)); \ + FXRbCallDCDrawMethod(this, "drawImageText", x, y, string, length); \ } \ void cls::setForeground(FXColor clr){ \ FXRbCallVoidMethod(this,rb_intern("setForeground"),clr); \ diff --git a/ext/fox16_c/include/FXRuby.h b/ext/fox16_c/include/FXRuby.h index c601e36abca323ec513725b85a5838249ea96ded..7a6ca5558ab00ef05ec882eea74e602e066c0589 100644 --- a/ext/fox16_c/include/FXRuby.h +++ b/ext/fox16_c/include/FXRuby.h @@ -178,7 +178,7 @@ extern void* FXRbGetExpectedData(VALUE recv,FXSelector key,VALUE data); ID FXRbLookupHandler(FXObject* recv,FXSelector key); // Handle this message -long FXRbHandleMessage(FXObject* recv,ID func,FXObject* sender,FXSelector key,void* data); +long FXRbHandleMessage_gvlcb(FXObject* recv,ID func,FXObject* sender,FXSelector key,void* data); // Convert a signal name string to its corresponding signal number FXint FXRbSignalNameToNumber(const char* name); @@ -680,34 +680,34 @@ FXuint FXRbCallUIntMethod_gvlcb(FXObject* recv, ID func, TYPE arg){ } // Call functions with FXString return value -FXString FXRbCallStringMethod(const FXObject* recv, ID func); +FXString FXRbCallStringMethod_gvlcb(const FXObject* recv, ID func); // Call functions with const FXchar* return value -const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar*, const FXchar*); -const FXchar* FXRbCallCStringMethod(const FXObject* recv, ID func, const FXchar*, const FXchar*, const FXchar*); +const FXchar* FXRbCallCStringMethod_gvlcb(const FXObject* recv, ID func, const FXchar*, const FXchar*); +const FXchar* FXRbCallCStringMethod_gvlcb(const FXObject* recv, ID func, const FXchar*, const FXchar*, const FXchar*); // Call functions with "FXGLObject*" return value -FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func); -FXGLObject* FXRbCallGLObjectMethod(FXGLObject* recv,ID func,FXuint* path,FXint n); -FXGLObject* FXRbCallGLObjectMethod(FXGLViewer* recv,ID func,FXint x,FXint y); +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLObject* recv,ID func); +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLObject* recv,ID func,FXuint* path,FXint n); +FXGLObject* FXRbCallGLObjectMethod_gvlcb(FXGLViewer* recv,ID func,FXint x,FXint y); // Call functions with "FXGLObject**" return value -FXGLObject** FXRbCallGLObjectArrayMethod(FXGLViewer* recv,ID func,FXint x,FXint y,FXint w,FXint h); +FXGLObject** FXRbCallGLObjectArrayMethod_gvlcb(FXGLViewer* recv,ID func,FXint x,FXint y,FXint w,FXint h); // Call functions with "FXTreeItem*" return value -FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,const FXString& text,FXIcon* icon,void* ptr); +FXTableItem* FXRbCallTableItemMethod_gvlcb(FXTable* recv,ID func,const FXString& text,FXIcon* icon,void* ptr); // Call functions with "FXTreeItem*" return value -FXTableItem* FXRbCallTableItemMethod(FXTable* recv,ID func,FXint,FXint,FXbool); +FXTableItem* FXRbCallTableItemMethod_gvlcb(FXTable* recv,ID func,FXint,FXint,FXbool); // Call functions with "FXFileAssoc*" return value -FXFileAssoc* FXRbCallFileAssocMethod(const FXFileDict* recv,ID func,const FXchar* pathname); +FXFileAssoc* FXRbCallFileAssocMethod_gvlcb(const FXFileDict* recv,ID func,const FXchar* pathname); // Call functions with "FXIcon*" return value -FXIcon* FXRbCallIconMethod(const FXTableItem* recv,ID func); +FXIcon* FXRbCallIconMethod_gvlcb(const FXTableItem* recv,ID func); template<class TYPE1, class TYPE2> -FXIcon* FXRbCallIconMethod(const FXIconSource *recv,ID func,TYPE1& arg1,const TYPE2& arg2){ +FXIcon* FXRbCallIconMethod_gvlcb(const FXIconSource *recv,ID func,TYPE1& arg1,const TYPE2& arg2){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,to_ruby(arg1),to_ruby(arg2)); @@ -715,7 +715,7 @@ FXIcon* FXRbCallIconMethod(const FXIconSource *recv,ID func,TYPE1& arg1,const TY } template<class TYPE1, class TYPE2, class TYPE3, class TYPE4> -FXIcon* FXRbCallIconMethod(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 arg2,TYPE3 arg3,const TYPE4& arg4){ +FXIcon* FXRbCallIconMethod_gvlcb(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 arg2,TYPE3 arg3,const TYPE4& arg4){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,4,to_ruby(arg1),to_ruby(arg2),to_ruby(arg3),to_ruby(arg4)); @@ -724,7 +724,7 @@ FXIcon* FXRbCallIconMethod(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 ar // Call functions with FXImage* return value template<class TYPE1, class TYPE2> -FXImage* FXRbCallImageMethod(const FXIconSource *recv,ID func,TYPE1& arg1,const TYPE2& arg2){ +FXImage* FXRbCallImageMethod_gvlcb(const FXIconSource *recv,ID func,TYPE1& arg1,const TYPE2& arg2){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,2,to_ruby(arg1),to_ruby(arg2)); @@ -732,7 +732,7 @@ FXImage* FXRbCallImageMethod(const FXIconSource *recv,ID func,TYPE1& arg1,const } template<class TYPE1, class TYPE2, class TYPE3, class TYPE4> -FXImage* FXRbCallImageMethod(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 arg2,TYPE3 arg3,const TYPE4& arg4){ +FXImage* FXRbCallImageMethod_gvlcb(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 arg2,TYPE3 arg3,const TYPE4& arg4){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE result=rb_funcall(obj,func,4,to_ruby(arg1),to_ruby(arg2),to_ruby(arg3),to_ruby(arg4)); @@ -740,11 +740,11 @@ FXImage* FXRbCallImageMethod(const FXIconSource *recv,ID func,TYPE1& arg1,TYPE2 } // Call functions with "FXWindow*" return value -FXWindow* FXRbCallWindowMethod(const FXTableItem* recv,ID func,FXTable* table); +FXWindow* FXRbCallWindowMethod_gvlcb(const FXTableItem* recv,ID func,FXTable* table); // Call functions with "FXColor" return value template<class TYPE1, class TYPE2> -FXColor FXRbCallColorMethod(FXDC* recv, ID func, TYPE1 arg1, TYPE2 arg2){ +FXColor FXRbCallColorMethod_gvlcb(FXDC* recv, ID func, TYPE1 arg1, TYPE2 arg2){ VALUE obj=FXRbGetRubyObj(recv,false); FXASSERT(!NIL_P(obj)); VALUE v=rb_funcall(obj,func,2,to_ruby(arg1),to_ruby(arg2)); @@ -752,12 +752,15 @@ FXColor FXRbCallColorMethod(FXDC* recv, ID func, TYPE1 arg1, TYPE2 arg2){ } // Call functions with "FXRangef" return value -FXRangef FXRbCallRangeMethod(FXObject* recv,ID func); +FXRangef FXRbCallRangeMethod_gvlcb(FXObject* recv,ID func); // Call functions with FXwchar return value -FXwchar FXRbCallWCharMethod(const FXObject* recv,ID func); +FXwchar FXRbCallWCharMethod_gvlcb(const FXObject* recv,ID func); -void FXRbCallSetDashes(FXDC* recv,ID func,FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); +void FXRbCallSetDashes_gvlcb(FXDC* recv,ID func,FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); + +void FXRbCallDCDrawMethod_gvlcb(FXDC* recv, const char * func, FXint x,FXint y,const FXString& string); +void FXRbCallDCDrawMethod_gvlcb(FXDC* recv, const char * func, FXint x,FXint y,const FXchar* string,FXuint length); /** * Macro to set up class implementation. @@ -783,6 +786,18 @@ void FXRbCallSetDashes(FXDC* recv,ID func,FXuint dashoffset,const FXchar *dashpa } +#define SORTFUNC(list, item) \ + FXint list##_sortFunc_gvlcb(const item* a,const item* b); + +SORTFUNC( FXRbComboBox, FXListItem ) +SORTFUNC( FXRbFoldingList, FXFoldingItem ) +SORTFUNC( FXRbIconList, FXIconItem ) +SORTFUNC( FXRbList, FXListItem ) +SORTFUNC( FXRbListBox, FXListItem ) +SORTFUNC( FXRbTreeList, FXTreeItem ) + +#undef SORTFUNC + // FXRuby classes #include "FXRbStream.h" #include "FXRbObject.h" diff --git a/ext/fox16_c/include/gvl_wrappers.h b/ext/fox16_c/include/gvl_wrappers.h index e93a4afd986fda4259f7fdf33aad1e019b0fcd2f..1a12c4ff29abd1ddb03705e95763565f9601c691 100644 --- a/ext/fox16_c/include/gvl_wrappers.h +++ b/ext/fox16_c/include/gvl_wrappers.h @@ -118,7 +118,7 @@ extern __thread int g_fxrb_thread_has_gvl; return name##_gvlcb( firstparamname FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST1) ); \ } else { \ struct gvl_wrapper_##name##_##paramcount##_params<firstparamtype FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST5)> params = { \ - {firstparamname FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST1)}, when_non_void((rettype)0) \ + {firstparamname FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST1)} \ }; \ g_fxrb_thread_has_gvl = 1; \ rb_thread_call_with_gvl(gvl_##name##_##paramcount##_skeleton<firstparamtype FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST5)>, ¶ms); \ @@ -329,6 +329,135 @@ FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL ) param(ID, , func) \ param(TYPE1, , arg1) +#define FOR_EACH_PARAM_OF_FXRbCallGLObjectMethod_2(param) \ + param(ID, , func) + +#define FOR_EACH_PARAM_OF_FXRbCallGLObjectMethod_3(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) + +#define FOR_EACH_PARAM_OF_FXRbCallGLObjectMethod_4(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) + +#define FOR_EACH_PARAM_OF_FXRbCallStringMethod_2(param) \ + param(ID, , func) + +#define FOR_EACH_PARAM_OF_FXRbCallCStringMethod_4(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) + +#define FOR_EACH_PARAM_OF_FXRbCallCStringMethod_5(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) + +#define FOR_EACH_PARAM_OF_FXRbCallGLObjectArrayMethod_6(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) \ + param(TYPE4, , arg4) + +#define FOR_EACH_PARAM_OF_FXRbCallTableItemMethod_5(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) + +#define FOR_EACH_PARAM_OF_FXRbCallFileAssocMethod_3(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) + +#define FOR_EACH_PARAM_OF_FXRbCallIconMethod_2(param) \ + param(ID, , func) + +#define FOR_EACH_PARAM_OF_FXRbCallIconMethod_4(param) \ + param(ID, , func) \ + param(TYPE1, &, arg1) \ + param(TYPE2, &, arg2) + +#define FOR_EACH_PARAM_OF_FXRbCallIconMethod_6(param) \ + param(ID, , func) \ + param(TYPE1, &, arg1) \ + param(TYPE2, &, arg2) \ + param(TYPE3, &, arg3) \ + param(TYPE4, &, arg4) + +#define FOR_EACH_PARAM_OF_FXRbCallImageMethod_4(param) \ + param(ID, , func) \ + param(TYPE1, &, arg1) \ + param(TYPE2, &, arg2) + +#define FOR_EACH_PARAM_OF_FXRbCallImageMethod_6(param) \ + param(ID, , func) \ + param(TYPE1, &, arg1) \ + param(TYPE2, &, arg2) \ + param(TYPE3, &, arg3) \ + param(TYPE4, &, arg4) + +#define FOR_EACH_PARAM_OF_FXRbCallWindowMethod_3(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) + +#define FOR_EACH_PARAM_OF_FXRbCallColorMethod_4(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) + +#define FOR_EACH_PARAM_OF_FXRbCallRangeMethod_2(param) \ + param(ID, , func) + +#define FOR_EACH_PARAM_OF_FXRbCallWCharMethod_2(param) \ + param(ID, , func) + +#define FOR_EACH_PARAM_OF_FXRbCallSetDashes_5(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) + +#define FOR_EACH_PARAM_OF_FXRbHandleMessage_5(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) + +#define FOR_EACH_PARAM_OF_FXRbComboBox_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbFoldingList_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbIconList_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbList_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbListBox_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbTreeList_sortFunc_2(param) \ + param(ITEMB, , itemb) + +#define FOR_EACH_PARAM_OF_FXRbCallDCDrawMethod_5(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, &, arg3) + +#define FOR_EACH_PARAM_OF_FXRbCallDCDrawMethod_6(param) \ + param(ID, , func) \ + param(TYPE1, , arg1) \ + param(TYPE2, , arg2) \ + param(TYPE3, , arg3) \ + param(TYPE4, , arg4) + + /* function( name, void_or_nonvoid, returntype, firstparamtype, firstparamname, paramcount ) */ #define FOR_EACH_CALLBACK_FUNCTION(function) \ function(FXRbCallVoidMethod, GVL_TYPE_VOID, void, RECV, recv, 2) \ @@ -351,6 +480,35 @@ FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL ) function(FXRbCallIntMethod, GVL_TYPE_NONVOID, FXint, RECV, recv, 7) \ function(FXRbCallLongMethod, GVL_TYPE_NONVOID, FXint, RECV, recv, 5) \ function(FXRbCallUIntMethod, GVL_TYPE_NONVOID, FXint, RECV, recv, 3) \ + function(FXRbCallGLObjectMethod, GVL_TYPE_NONVOID, FXGLObject*, RECV, recv, 2) \ + function(FXRbCallGLObjectMethod, GVL_TYPE_NONVOID, FXGLObject*, RECV, recv, 3) \ + function(FXRbCallGLObjectMethod, GVL_TYPE_NONVOID, FXGLObject*, RECV, recv, 4) \ + function(FXRbCallStringMethod, GVL_TYPE_NONVOID, FXString, RECV, recv, 2) \ + function(FXRbCallCStringMethod, GVL_TYPE_NONVOID, const FXchar*, RECV, recv, 4) \ + function(FXRbCallCStringMethod, GVL_TYPE_NONVOID, const FXchar*, RECV, recv, 5) \ + function(FXRbCallGLObjectArrayMethod, GVL_TYPE_NONVOID, FXGLObject**, RECV, recv, 6) \ + function(FXRbCallTableItemMethod, GVL_TYPE_NONVOID, FXTableItem*, RECV, recv, 5) \ + function(FXRbCallFileAssocMethod, GVL_TYPE_NONVOID, FXFileAssoc*, RECV, recv, 3) \ + function(FXRbCallIconMethod, GVL_TYPE_NONVOID, FXIcon*, RECV, recv, 2) \ + function(FXRbCallIconMethod, GVL_TYPE_NONVOID, FXIcon*, RECV, recv, 4) \ + function(FXRbCallIconMethod, GVL_TYPE_NONVOID, FXIcon*, RECV, recv, 6) \ + function(FXRbCallImageMethod, GVL_TYPE_NONVOID, FXImage*, RECV, recv, 4) \ + function(FXRbCallImageMethod, GVL_TYPE_NONVOID, FXImage*, RECV, recv, 6) \ + function(FXRbCallWindowMethod, GVL_TYPE_NONVOID, FXWindow*, RECV, recv, 3) \ + function(FXRbCallColorMethod, GVL_TYPE_NONVOID, FXColor, RECV, recv, 4) \ + function(FXRbCallRangeMethod, GVL_TYPE_NONVOID, FXRangef, RECV, recv, 2) \ + function(FXRbCallWCharMethod, GVL_TYPE_NONVOID, FXwchar, RECV, recv, 2) \ + function(FXRbCallSetDashes, GVL_TYPE_VOID, void, RECV, recv, 5) \ + function(FXRbHandleMessage, GVL_TYPE_NONVOID, long, RECV, recv, 5) \ + function(FXRbComboBox_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbFoldingList_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbIconList_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbList_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbListBox_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbTreeList_sortFunc, GVL_TYPE_NONVOID, FXint, ITEMA, itema, 2) \ + function(FXRbCallDCDrawMethod, GVL_TYPE_VOID, void, RECV, recv, 5) \ + function(FXRbCallDCDrawMethod, GVL_TYPE_VOID, void, RECV, recv, 6) \ + FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_STUB_DECL ) FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_WRAPPER_STRUCT )