ext/cdio/rubycdio_wrap.c in rbcdio-0.04 vs ext/cdio/rubycdio_wrap.c in rbcdio-0.05

- old
+ new

@@ -1,16 +1,17 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.36 + * Version 1.3.40 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make * changes to this file unless you know what you are doing--modify the SWIG * interface file instead. * ----------------------------------------------------------------------------- */ #define SWIGRUBY + /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. * ----------------------------------------------------------------------------- */ @@ -228,11 +229,11 @@ /* ----------------------------------------------------------------------------- * swigrun.swg * - * This file contains generic CAPI SWIG runtime support for pointer + * This file contains generic C API SWIG runtime support for pointer * type checking. * ----------------------------------------------------------------------------- */ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ @@ -247,15 +248,15 @@ # define SWIG_TYPE_TABLE_NAME #endif /* You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the swig runtime code. - In 99.9% of the cases, swig just needs to declare them as 'static'. + creating a static or dynamic library from the SWIG runtime code. + In 99.9% of the cases, SWIG just needs to declare them as 'static'. - But only do this if is strictly necessary, ie, if you have problems - with your compiler or so. + But only do this if strictly necessary, ie, if you have problems + with your compiler or suchlike. */ #ifndef SWIGRUNTIME # define SWIGRUNTIME SWIGINTERN #endif @@ -278,35 +279,35 @@ /* Flags/methods for returning states. - The swig conversion methods, as ConvertPtr, return and integer + The SWIG conversion methods, as ConvertPtr, return and integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). Use the following macros/flags to set or process the returning states. - In old swig versions, you usually write code as: + In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { // success code } else { //fail code } - Now you can be more explicit as: + Now you can be more explicit: int res = SWIG_ConvertPtr(obj,vptr,ty.flags); if (SWIG_IsOK(res)) { // success code } else { // fail code } - that seems to be the same, but now you can also do + which is the same really, but now you can also do Type *ptr; int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); if (SWIG_IsOK(res)) { // success code @@ -320,11 +321,11 @@ // fail code } I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that - requires also to SWIG_ConvertPtr to return new result values, as + also requires SWIG_ConvertPtr to return new result values, such as int SWIG_ConvertPtr(obj, ptr,...) { if (<obj is ok>) { if (<need new object>) { *ptr = <ptr to new allocated object>; @@ -338,11 +339,11 @@ } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - swig errors code. + SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code allows to return the 'cast rank', for example, if you have this int food(double) @@ -352,13 +353,12 @@ food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() +*/ - - */ #define SWIG_OK (0) #define SWIG_ERROR (-1) #define SWIG_IsOK(r) (r >= 0) #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) @@ -379,11 +379,10 @@ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - /* Cast-Rank Mode */ #if defined(SWIG_CASTRANK_MODE) # ifndef SWIG_TypeRank # define SWIG_TypeRank unsigned long # endif @@ -402,12 +401,10 @@ # define SWIG_AddCast # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif - - #include <string.h> #ifdef __cplusplus extern "C" { #endif @@ -500,44 +497,62 @@ } return equiv; } -/* think of this as a c++ template<> or a scheme macro */ -#define SWIG_TypeCheck_Template(comparison, ty) \ - if (ty) { \ - swig_cast_info *iter = ty->cast; \ - while (iter) { \ - if (comparison) { \ - if (iter == ty->cast) return iter; \ - /* Move iter to the top of the linked list */ \ - iter->prev->next = iter->next; \ - if (iter->next) \ - iter->next->prev = iter->prev; \ - iter->next = ty->cast; \ - iter->prev = 0; \ - if (ty->cast) ty->cast->prev = iter; \ - ty->cast = iter; \ - return iter; \ - } \ - iter = iter->next; \ - } \ - } \ - return 0 - /* Check the typename */ SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty) { - SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (strcmp(iter->type->name, c) == 0) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; } -/* Same as previous function, except strcmp is replaced with a pointer comparison */ +/* + Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison +*/ SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { - SWIG_TypeCheck_Template(iter->type == from, into); +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { + if (ty) { + swig_cast_info *iter = ty->cast; + while (iter) { + if (iter->type == from) { + if (iter == ty->cast) + return iter; + /* Move iter to the top of the linked list */ + iter->prev->next = iter->next; + if (iter->next) + iter->next->prev = iter->prev; + iter->next = ty->cast; + iter->prev = 0; + if (ty->cast) ty->cast->prev = iter; + ty->cast = iter; + return iter; + } + iter = iter->next; + } + } + return 0; } /* Cast a pointer up an inheritance hierarchy */ @@ -821,10 +836,19 @@ # undef write #endif #ifdef read # undef read #endif +#ifdef bind +# undef bind +#endif +#ifdef close +# undef close +#endif +#ifdef connect +# undef connect +#endif /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */ #ifndef NUM2LL #define NUM2LL(x) NUM2LONG((x)) @@ -1788,11 +1812,11 @@ #define SWIG_RUBY_THREAD_BEGIN_BLOCK #define SWIG_RUBY_THREAD_END_BLOCK -#define SWIGVERSION 0x010336 +#define SWIGVERSION 0x010340 #define SWIG_VERSION SWIGVERSION #define SWIG_as_voidptr(a) (void *)((const void *)(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) @@ -2061,11 +2085,18 @@ #ifdef __cplusplus extern "C" { #endif + +// Ruby 1.9 changed the file name of this header +#ifdef HAVE_RUBY_IO_H +#include "ruby/io.h" +#else #include "rubyio.h" +#endif + #ifdef __cplusplus } #endif @@ -2721,11 +2752,11 @@ audio_stop(cdio)->status Stop playing an audio CD.. */ -swig_class cBuf_triple_t; +swig_class SwigClassBuf_triple_t; /* Document-method: Rubycdio::Buf_triple_t.data @@ -5306,11 +5337,11 @@ Find out if media has changed since the last call. Return 1 if media has changed since last call, 0 if not. Error return codes are the same as driver_return_code_t. */ -swig_class cHWInfo_t; +swig_class SwigClassHWInfo_t; /* Document-method: Rubycdio::HWInfo_t.hw @@ -6253,23 +6284,23 @@ rb_define_const(mRubycdio, "READ_MODE_M1F1", SWIG_From_long((long)(CDIO_READ_MODE_M1F1))); rb_define_const(mRubycdio, "READ_MODE_M1F2", SWIG_From_long((long)(CDIO_READ_MODE_M1F2))); rb_define_const(mRubycdio, "READ_MODE_M2F1", SWIG_From_long((long)(CDIO_READ_MODE_M2F1))); rb_define_const(mRubycdio, "READ_MODE_M2F2", SWIG_From_long((long)(CDIO_READ_MODE_M2F2))); - cBuf_triple_t.klass = rb_define_class_under(mRubycdio, "Buf_triple_t", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_Buf_triple_t, (void *) &cBuf_triple_t); - rb_define_alloc_func(cBuf_triple_t.klass, _wrap_Buf_triple_t_allocate); - rb_define_method(cBuf_triple_t.klass, "initialize", _wrap_new_Buf_triple_t, -1); - rb_define_method(cBuf_triple_t.klass, "data=", _wrap_Buf_triple_t_data_set, -1); - rb_define_method(cBuf_triple_t.klass, "data", _wrap_Buf_triple_t_data_get, -1); - rb_define_method(cBuf_triple_t.klass, "size=", _wrap_Buf_triple_t_size_set, -1); - rb_define_method(cBuf_triple_t.klass, "size", _wrap_Buf_triple_t_size_get, -1); - rb_define_method(cBuf_triple_t.klass, "drc=", _wrap_Buf_triple_t_drc_set, -1); - rb_define_method(cBuf_triple_t.klass, "drc", _wrap_Buf_triple_t_drc_get, -1); - cBuf_triple_t.mark = 0; - cBuf_triple_t.destroy = (void (*)(void *)) free_Buf_triple_t; - cBuf_triple_t.trackObjects = 0; + SwigClassBuf_triple_t.klass = rb_define_class_under(mRubycdio, "Buf_triple_t", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_Buf_triple_t, (void *) &SwigClassBuf_triple_t); + rb_define_alloc_func(SwigClassBuf_triple_t.klass, _wrap_Buf_triple_t_allocate); + rb_define_method(SwigClassBuf_triple_t.klass, "initialize", _wrap_new_Buf_triple_t, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "data=", _wrap_Buf_triple_t_data_set, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "data", _wrap_Buf_triple_t_data_get, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "size=", _wrap_Buf_triple_t_size_set, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "size", _wrap_Buf_triple_t_size_get, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "drc=", _wrap_Buf_triple_t_drc_set, -1); + rb_define_method(SwigClassBuf_triple_t.klass, "drc", _wrap_Buf_triple_t_drc_get, -1); + SwigClassBuf_triple_t.mark = 0; + SwigClassBuf_triple_t.destroy = (void (*)(void *)) free_Buf_triple_t; + SwigClassBuf_triple_t.trackObjects = 0; rb_define_module_function(mRubycdio, "lseek", _wrap_lseek, -1); rb_define_module_function(mRubycdio, "read_cd", _wrap_read_cd, -1); rb_define_module_function(mRubycdio, "read_sectors", _wrap_read_sectors, -1); rb_define_module_function(mRubycdio, "read_data_bytes", _wrap_read_data_bytes, -1); rb_define_const(mRubycdio, "TRACK_FORMAT_AUDIO", SWIG_From_long((long)(TRACK_FORMAT_AUDIO))); @@ -6452,20 +6483,20 @@ rb_define_module_function(mRubycdio, "device?", _wrap_deviceq___, -1); rb_define_module_function(mRubycdio, "nrg?", _wrap_nrgq___, -1); rb_define_module_function(mRubycdio, "tocfile?", _wrap_tocfileq___, -1); rb_define_module_function(mRubycdio, "get_media_changed", _wrap_get_media_changed, -1); - cHWInfo_t.klass = rb_define_class_under(mRubycdio, "HWInfo_t", rb_cObject); - SWIG_TypeClientData(SWIGTYPE_p_HWInfo_t, (void *) &cHWInfo_t); - rb_define_alloc_func(cHWInfo_t.klass, _wrap_HWInfo_t_allocate); - rb_define_method(cHWInfo_t.klass, "initialize", _wrap_new_HWInfo_t, -1); - rb_define_method(cHWInfo_t.klass, "hw=", _wrap_HWInfo_t_hw_set, -1); - rb_define_method(cHWInfo_t.klass, "hw", _wrap_HWInfo_t_hw_get, -1); - rb_define_method(cHWInfo_t.klass, "result=", _wrap_HWInfo_t_result_set, -1); - rb_define_method(cHWInfo_t.klass, "result", _wrap_HWInfo_t_result_get, -1); - cHWInfo_t.mark = 0; - cHWInfo_t.destroy = (void (*)(void *)) free_HWInfo_t; - cHWInfo_t.trackObjects = 0; + SwigClassHWInfo_t.klass = rb_define_class_under(mRubycdio, "HWInfo_t", rb_cObject); + SWIG_TypeClientData(SWIGTYPE_p_HWInfo_t, (void *) &SwigClassHWInfo_t); + rb_define_alloc_func(SwigClassHWInfo_t.klass, _wrap_HWInfo_t_allocate); + rb_define_method(SwigClassHWInfo_t.klass, "initialize", _wrap_new_HWInfo_t, -1); + rb_define_method(SwigClassHWInfo_t.klass, "hw=", _wrap_HWInfo_t_hw_set, -1); + rb_define_method(SwigClassHWInfo_t.klass, "hw", _wrap_HWInfo_t_hw_get, -1); + rb_define_method(SwigClassHWInfo_t.klass, "result=", _wrap_HWInfo_t_result_set, -1); + rb_define_method(SwigClassHWInfo_t.klass, "result", _wrap_HWInfo_t_result_get, -1); + SwigClassHWInfo_t.mark = 0; + SwigClassHWInfo_t.destroy = (void (*)(void *)) free_HWInfo_t; + SwigClassHWInfo_t.trackObjects = 0; rb_define_module_function(mRubycdio, "get_hwinfo", _wrap_get_hwinfo, -1); rb_define_module_function(mRubycdio, "set_blocksize", _wrap_set_blocksize, -1); rb_define_module_function(mRubycdio, "set_speed", _wrap_set_speed, -1); rb_define_module_function(mRubycdio, "open_cd", _wrap_open_cd, -1); rb_define_const(mRubycdio, "DISC_MODE_CD_DA", SWIG_From_long((long)(CDIO_DISC_MODE_CD_DA)));