@ -60,6 +60,16 @@
# include "smokeruby.h"
# include "smoke.h"
# define HAVE_STRLCAT_PROTO 1
# define HAVE_STRLCPY_PROTO 1
# include "config.h"
# ifndef HAVE_RUBY_1_9
# define RARRAY_LEN(x) (RARRAY(x)->len)
# define RSTRING_LEN(x) (RSTRING(x)->len)
# define rb_str_catf_1 rb_str_catf
# endif
// #define DEBUG
# define QTRUBY_VERSION "1.0.13"
@ -110,7 +120,7 @@ bool application_terminated = false;
} ;
# define logger logger_backend
void rb_str_catf ( VALUE self , const char * format , . . . ) __attribute__ ( ( format ( printf , 2 , 3 ) ) ) ;
void rb_str_catf _1 ( VALUE self , const char * format , . . . ) __attribute__ ( ( format ( printf , 2 , 3 ) ) ) ;
static VALUE ( * _new_kde ) ( int , VALUE * , VALUE ) = 0 ;
static VALUE ( * _kconfigskeletonitem_immutable ) ( VALUE ) = 0 ;
@ -820,7 +830,7 @@ public:
}
} ;
void rb_str_catf ( VALUE self , const char * format , . . . )
void rb_str_catf _1 ( VALUE self , const char * format , . . . )
{
va_list ap ;
va_start ( ap , format ) ;
@ -985,16 +995,16 @@ VALUE prettyPrintMethod(Smoke::Index id)
VALUE r = rb_str_new2 ( " " ) ;
Smoke : : Method & meth = qt_Smoke - > methods [ id ] ;
const char * tname = qt_Smoke - > types [ meth . ret ] . name ;
if ( meth . flags & Smoke : : mf_static ) rb_str_catf ( r , " static " ) ;
rb_str_catf ( r , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf ( r , " %s::%s( " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
if ( meth . flags & Smoke : : mf_static ) rb_str_catf _1 ( r , " static " ) ;
rb_str_catf _1 ( r , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf _1 ( r , " %s::%s( " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
for ( int i = 0 ; i < meth . numArgs ; i + + ) {
if ( i ) rb_str_catf ( r , " , " ) ;
if ( i ) rb_str_catf _1 ( r , " , " ) ;
tname = qt_Smoke - > types [ qt_Smoke - > argumentList [ meth . args + i ] ] . name ;
rb_str_catf ( r , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf _1 ( r , " %s " , ( tname ? tname : " void " ) ) ;
}
rb_str_catf ( r , " ) " ) ;
if ( meth . flags & Smoke : : mf_const ) rb_str_catf ( r , " const " ) ;
rb_str_catf _1 ( r , " ) " ) ;
if ( meth . flags & Smoke : : mf_const ) rb_str_catf _1 ( r , " const " ) ;
return r ;
}
@ -1177,7 +1187,7 @@ inspect_qobject(VALUE self)
// Start with #<Qt::HBoxLayout:0x30139030> from the original inspect() call
// Drop the closing '>'
VALUE inspect_str = rb_call_super ( 0 , 0 ) ;
rb_str_resize ( inspect_str , RSTRING ( inspect_str ) - > len - 1 ) ;
rb_str_resize ( inspect_str , RSTRING _LEN ( inspect_str ) - 1 ) ;
smokeruby_object * o = 0 ;
Data_Get_Struct ( self , smokeruby_object , o ) ;
@ -1220,7 +1230,7 @@ pretty_print_qobject(VALUE self, VALUE pp)
// Start with #<Qt::HBoxLayout:0x30139030>
// Drop the closing '>'
VALUE inspect_str = rb_funcall ( self , rb_intern ( " to_s " ) , 0 , 0 ) ;
rb_str_resize ( inspect_str , RSTRING ( inspect_str ) - > len - 1 ) ;
rb_str_resize ( inspect_str , RSTRING _LEN ( inspect_str ) - 1 ) ;
rb_funcall ( pp , rb_intern ( " text " ) , 1 , inspect_str ) ;
rb_funcall ( pp , rb_intern ( " breakable " ) , 0 ) ;
@ -1236,7 +1246,7 @@ pretty_print_qobject(VALUE self, VALUE pp)
VALUE obj = getPointerObject ( qobject - > parent ( ) ) ;
if ( obj ! = Qnil ) {
VALUE parent_inspect_str = rb_funcall ( obj , rb_intern ( " to_s " ) , 0 , 0 ) ;
rb_str_resize ( parent_inspect_str , RSTRING ( parent_inspect_str ) - > len - 1 ) ;
rb_str_resize ( parent_inspect_str , RSTRING _LEN ( parent_inspect_str ) - 1 ) ;
parentInspectString = StringValuePtr ( parent_inspect_str ) ;
} else {
parentInspectString . sprintf ( " #<%s:0x0 " , qobject - > parent ( ) - > className ( ) ) ;
@ -1382,7 +1392,7 @@ static Smoke::Index new_qvariant_qmap = 0;
return * ( c . var ( ) ) ;
} else if ( argc = = 1
& & TYPE ( argv [ 0 ] ) = = T_ARRAY
& & RARRAY ( argv [ 0 ] ) - > len > 0
& & RARRAY _LEN ( argv [ 0 ] ) > 0
& & TYPE ( rb_ary_entry ( argv [ 0 ] , 0 ) ) ! = T_STRING )
{
_current_method = new_qvariant_qlist ;
@ -1741,7 +1751,7 @@ new_qapplication(int argc, VALUE * argv, VALUE klass)
VALUE * local_argv = ( VALUE * ) calloc ( argc + 1 , sizeof ( VALUE ) ) ;
VALUE temp = rb_ary_dup ( argv [ 0 ] ) ;
rb_ary_unshift ( temp , rb_gv_get ( " $0 " ) ) ;
local_argv [ 0 ] = INT2NUM ( RARRAY ( temp ) - > len ) ;
local_argv [ 0 ] = INT2NUM ( RARRAY _LEN ( temp ) ) ;
local_argv [ 1 ] = temp ;
result = new_qt ( 2 , local_argv , klass ) ;
free ( local_argv ) ;
@ -1772,7 +1782,7 @@ qapplication_argv(VALUE /*self*/)
VALUE
getmetainfo ( VALUE self , int & offset , int & index )
{
const char * signalname = rb_id2name ( rb_frame_ las t_func( ) ) ;
const char * signalname = rb_id2name ( rb_frame_ this _func( ) ) ;
VALUE metaObject_value = rb_funcall ( qt_internal_module , rb_intern ( " getMetaObject " ) , 1 , self ) ;
smokeruby_object * ometa = value_obj_info ( metaObject_value ) ;
@ -1862,7 +1872,7 @@ qt_invoke(int /*argc*/, VALUE * argv, VALUE self)
// Now, I need to find out if this means me
int index ;
char * slotname ;
bool isSignal = qstrcmp ( rb_id2name ( rb_frame_ las t_func( ) ) , " qt_emit " ) = = 0 ;
bool isSignal = qstrcmp ( rb_id2name ( rb_frame_ this _func( ) ) , " qt_emit " ) = = 0 ;
VALUE mocArgs = getslotinfo ( self , id , slotname , index , isSignal ) ;
if ( mocArgs = = Qnil ) {
// No ruby slot/signal found, assume the target is a C++ one
@ -2009,7 +2019,7 @@ qbytearray_setRawData(VALUE self, VALUE data)
return Qnil ;
}
TQByteArray * dataArray = ( TQByteArray * ) o - > ptr ;
dataArray - > setRawData ( StringValuePtr ( data ) , RSTRING ( data ) - > len ) ;
dataArray - > setRawData ( StringValuePtr ( data ) , RSTRING _LEN ( data ) ) ;
return self ;
}
@ -2195,7 +2205,7 @@ make_QUMethod(VALUE /*self*/, VALUE name_value, VALUE params)
m - > name = new char [ strlen ( name ) + 1 ] ; // this too
strcpy ( ( char * ) m - > name , name ) ;
m - > parameters = 0 ;
m - > count = RARRAY ( params ) - > len ;
m - > count = RARRAY _LEN ( params ) ;
if ( m - > count > 0 ) {
m - > parameters = new QUParameter [ m - > count ] ;
@ -2213,7 +2223,7 @@ make_QUMethod(VALUE /*self*/, VALUE name_value, VALUE params)
static VALUE
make_QMetaData_tbl ( VALUE /*self*/ , VALUE list )
{
long count = RARRAY ( list ) - > len ;
long count = RARRAY _LEN ( list ) ;
QMetaData * m = new QMetaData [ count ] ;
for ( long i = 0 ; i < count ; i + + ) {
@ -2281,7 +2291,7 @@ add_metaobject_methods(VALUE self, VALUE klass)
static VALUE
add_signal_methods ( VALUE self , VALUE klass , VALUE signalNames )
{
for ( long index = 0 ; index < RARRAY ( signalNames ) - > len ; index + + ) {
for ( long index = 0 ; index < RARRAY _LEN ( signalNames ) ; index + + ) {
VALUE signal = rb_ary_entry ( signalNames , index ) ;
rb_define_method ( klass , StringValuePtr ( signal ) , ( VALUE ( * ) ( . . . ) ) qt_signal , - 1 ) ;
}
@ -2597,28 +2607,28 @@ dumpCandidates(VALUE /*self*/, VALUE rmeths)
{
VALUE errmsg = rb_str_new2 ( " " ) ;
if ( rmeths ! = Qnil ) {
int count = RARRAY ( rmeths ) - > len ;
int count = RARRAY _LEN ( rmeths ) ;
for ( int i = 0 ; i < count ; i + + ) {
rb_str_catf ( errmsg , " \t " ) ;
rb_str_catf _1 ( errmsg , " \t " ) ;
int id = NUM2INT ( rb_ary_entry ( rmeths , i ) ) ;
Smoke : : Method & meth = qt_Smoke - > methods [ id ] ;
const char * tname = qt_Smoke - > types [ meth . ret ] . name ;
if ( meth . flags & Smoke : : mf_enum ) {
rb_str_catf ( errmsg , " enum " ) ;
rb_str_catf ( errmsg , " %s::%s " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
rb_str_catf ( errmsg , " \n " ) ;
rb_str_catf _1 ( errmsg , " enum " ) ;
rb_str_catf _1 ( errmsg , " %s::%s " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
rb_str_catf _1 ( errmsg , " \n " ) ;
} else {
if ( meth . flags & Smoke : : mf_static ) rb_str_catf ( errmsg , " static " ) ;
rb_str_catf ( errmsg , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf ( errmsg , " %s::%s( " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
rb_str_catf _1 ( errmsg , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf _1 ( errmsg , " %s::%s( " , qt_Smoke - > classes [ meth . classId ] . className , qt_Smoke - > methodNames [ meth . name ] ) ;
for ( int i = 0 ; i < meth . numArgs ; i + + ) {
if ( i ) rb_str_catf ( errmsg , " , " ) ;
if ( i ) rb_str_catf _1 ( errmsg , " , " ) ;
tname = qt_Smoke - > types [ qt_Smoke - > argumentList [ meth . args + i ] ] . name ;
rb_str_catf ( errmsg , " %s " , ( tname ? tname : " void " ) ) ;
rb_str_catf _1 ( errmsg , " %s " , ( tname ? tname : " void " ) ) ;
}
rb_str_catf ( errmsg , " ) " ) ;
if ( meth . flags & Smoke : : mf_const ) rb_str_catf ( errmsg , " const " ) ;
rb_str_catf ( errmsg , " \n " ) ;
rb_str_catf _1 ( errmsg , " ) " ) ;
if ( meth . flags & Smoke : : mf_const ) rb_str_catf _1 ( errmsg , " const " ) ;
rb_str_catf _1 ( errmsg , " \n " ) ;
}
}
}