From: <mik...@us...> - 2008-08-29 17:43:01
|
Revision: 890 http://omc.svn.sourceforge.net/omc/?rev=890&view=rev Author: mike-brasher Date: 2008-08-29 17:43:11 +0000 (Fri, 29 Aug 2008) Log Message: ----------- Fixed problem with failing cmpi.CMPIBroker() (needs to return _BROKER). Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/swig/python/pycmpi_provider.py Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-08-29 16:15:57 UTC (rev 889) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-08-29 17:43:11 UTC (rev 890) @@ -9,7 +9,7 @@ %extend CMPIBroker { - CMPIBroker() { } + CMPIBroker() { return _BROKER; } ~CMPIBroker() { } void LogMessage(int severity, const char *id, const char *text) { CMLogMessage(_BROKER, severity, id, text, NULL); @@ -78,4 +78,4 @@ CMPIData getProperty(const CMPIContext * ctx, const CMPIObjectPath *op, const char *name) { return CBGetProperty(_BROKER, ctx, op, name, NULL); } -} \ No newline at end of file +} Modified: cmpi-bindings/trunk/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 16:15:57 UTC (rev 889) +++ cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 17:43:11 UTC (rev 890) @@ -112,6 +112,7 @@ def __init__(self, miname, broker): print 'called CMPIProvider(', miname, ',', broker, ')' + broker = cmpi.CMPIBroker() self.broker = broker self.miname = miname self.env = ProviderEnvironment(self.broker) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-09-02 08:46:38
|
Revision: 898 http://omc.svn.sourceforge.net/omc/?rev=898&view=rev Author: kkaempf Date: 2008-09-02 08:46:44 +0000 (Tue, 02 Sep 2008) Log Message: ----------- don't force '-g' as cflags Modified Paths: -------------- cmpi-bindings/trunk/swig/python/CMakeLists.txt cmpi-bindings/trunk/swig/ruby/CMakeLists.txt Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-09-02 08:46:14 UTC (rev 897) +++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-09-02 08:46:44 UTC (rev 898) @@ -30,7 +30,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.c ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} ) Modified: cmpi-bindings/trunk/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2008-09-02 08:46:14 UTC (rev 897) +++ cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2008-09-02 08:46:44 UTC (rev 898) @@ -23,7 +23,7 @@ ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/cmpi ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-09-02 10:31:11
|
Revision: 901 http://omc.svn.sourceforge.net/omc/?rev=901&view=rev Author: kkaempf Date: 2008-09-02 10:31:06 +0000 (Tue, 02 Sep 2008) Log Message: ----------- remove empty constructors/destructors Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/swig/cmpi_types.i Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-09-02 09:57:14 UTC (rev 900) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-09-02 10:31:06 UTC (rev 901) @@ -9,8 +9,6 @@ %extend CMPIBroker { - CMPIBroker() { return _BROKER; } - ~CMPIBroker() { } void LogMessage(int severity, const char *id, const char *text) { CMLogMessage(_BROKER, severity, id, text, NULL); } Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2008-09-02 09:57:14 UTC (rev 900) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-09-02 10:31:06 UTC (rev 901) @@ -123,7 +123,7 @@ ~CMPIError() { } /* Gets the type of this Error */ CMPIErrorType type() { - CMGetErrorType( $self, NULL ); + return CMGetErrorType( $self, NULL ); } /* Sets the error type of this error object. */ #if defined(SWIGRUBY) @@ -282,9 +282,11 @@ %extend _CMPIMsgFileHandle { CMPIMsgFileHandle(const char *msgFile) { - CMPIMsgFileHandle handle; - CMPIStatus st = CMOpenMessageFile(_BROKER, msgFile, &handle); - /* FIXME */ + CMPIMsgFileHandle *handle = calloc(1, sizeof( CMPIMsgFileHandle )); + CMPIStatus st = CMOpenMessageFile(_BROKER, msgFile, handle); + if (st.rc != CMPI_RC_OK) + abort(); + return handle; } ~CMPIMsgFileHandle() { CMCloseMessageFile( _BROKER, $self ); @@ -766,8 +768,6 @@ # CMPISelectCond %extend _CMPISelectCond { - CMPISelectCond() { } - ~CMPISelectCond() { } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -779,8 +779,6 @@ # CMPISubCond %extend _CMPISubCond { - CMPISubCond() { } - ~CMPISubCond() { } } #----------------------------------------------------- @@ -788,8 +786,6 @@ # CMPIPredicate %extend _CMPIPredicate { - CMPIPredicate() { } - ~CMPIPredicate() { } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -801,8 +797,6 @@ # CMPIEnumeration %extend _CMPIEnumeration { - CMPIEnumeration() { } - ~CMPIEnumeration() { } #if defined(SWIGRUBY) %alias length "size"; #endif @@ -846,7 +840,6 @@ CMPIArray(int count, CMPIType type ) { return CMNewArray( _BROKER, count, type, NULL); } - CMPIArray( ) { } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -883,7 +876,6 @@ CMPIString(const char *s) { return CMNewString(_BROKER, s, NULL); } - CMPIString() { } const char* to_s() { return CMGetCharPtr($self); } @@ -894,8 +886,6 @@ # CMPIContext %extend _CMPIContext { - CMPIContext() { } - ~CMPIContext() { } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-02 14:05:10
|
Revision: 1063 http://omc.svn.sourceforge.net/omc/?rev=1063&view=rev Author: kkaempf Date: 2008-10-02 14:00:50 +0000 (Thu, 02 Oct 2008) Log Message: ----------- initial add of Perl target (incomplete!) Modified Paths: -------------- cmpi-bindings/trunk/swig/CMakeLists.txt cmpi-bindings/trunk/swig/cmpi.i Added Paths: ----------- cmpi-bindings/trunk/swig/perl/ cmpi-bindings/trunk/swig/perl/CMakeLists.txt Modified: cmpi-bindings/trunk/swig/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/CMakeLists.txt 2008-10-02 14:00:08 UTC (rev 1062) +++ cmpi-bindings/trunk/swig/CMakeLists.txt 2008-10-02 14:00:50 UTC (rev 1063) @@ -20,3 +20,10 @@ ADD_SUBDIRECTORY(python) ENDIF (PYTHON_LINK_LIBS) ENDIF (PYTHON_LIBRARY) + +FIND_PACKAGE(Perl) +IF (PERL_EXECUTABLE) + MESSAGE(STATUS "Building Perl...") + ADD_SUBDIRECTORY(perl) +ENDIF (PERL_EXECUTABLE) + \ No newline at end of file Modified: cmpi-bindings/trunk/swig/cmpi.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi.i 2008-10-02 14:00:08 UTC (rev 1062) +++ cmpi-bindings/trunk/swig/cmpi.i 2008-10-02 14:00:50 UTC (rev 1063) @@ -72,10 +72,11 @@ #define Target_True (&PL_sv_yes) #define Target_False (&PL_sv_no) #define Target_Null NULL +#define Target_Void NULL #define Target_Type SV * #define Target_Bool(x) (x) -#define Target_Int(x) 0 /* should be Target_From_long(x), but Swig declares it too late. FIXME */ -#define Target_String(x) "" /* Target_FromCharPtr(x), also */ +#define Target_Int(x) NULL /* should be Target_From_long(x), but Swig declares it too late. FIXME */ +#define Target_String(x) NULL /* Target_FromCharPtr(x), also */ #define Target_Array(x) NULL #define Target_Append(x,y) av_create_and_push(&x, y) #define TARGET_THREAD_BEGIN_BLOCK Added: cmpi-bindings/trunk/swig/perl/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/perl/CMakeLists.txt (rev 0) +++ cmpi-bindings/trunk/swig/perl/CMakeLists.txt 2008-10-02 14:00:50 UTC (rev 1063) @@ -0,0 +1,60 @@ +# +# CMakeLists.txt for cmpi-bindings/swig/perl +# + +EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{ccflags}" OUTPUT_VARIABLE PERL_CCFLAGS) +EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{archlib}.\"/CORE\"" OUTPUT_VARIABLE PERL_CORE_DIR) +EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorarch}" OUTPUT_VARIABLE PERL_VENDOR_ARCH) +EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{installvendorlib}" OUTPUT_VARIABLE PERL_VENDOR_LIB) +EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{ccdlflags}" OUTPUT_VARIABLE PERL_LINK_FLAGS) + +MESSAGE(STATUS "Perl executable: ${PERL_EXECUTABLE}") +MESSAGE(STATUS "Perl core dir: ${PERL_CORE_DIR}") +MESSAGE(STATUS "Perl vendor arch dir: ${PERL_VENDOR_ARCH}") +MESSAGE(STATUS "Perl vendor lib dir: ${PERL_VENDOR_LIB}") + +SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmpi_wrap.c" ) +SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../cmpi.i" ) + +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + +ADD_CUSTOM_COMMAND ( + OUTPUT ${SWIG_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Perl ..." + COMMAND ${SWIG_EXECUTABLE} -perl -shadow -features autodoc -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} + COMMAND ${CMAKE_COMMAND} -E echo "Done." + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i +) + +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) + +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) +INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/cmpi ) +INCLUDE_DIRECTORIES( ${CMPI_INCLUDE_DIR} ) +INCLUDE_DIRECTORIES( ${PERL_CORE_DIR} ) + +ADD_DEFINITIONS(-DCMPI_PLATFORM_LINUX_GENERIC_GNU -DCMPI_VERSION=200) +ADD_DEFINITIONS(-DTARGET_PERL) + +ADD_DEFINITIONS( ${PERL_CCFLAGS} -Wno-unused -Wno-error ) +LINK_DIRECTORIES( ${PERL_CORE_DIR} ) + +# +# cmpi_instance: provider .so +# + +SET( NAME plCmpiProvider ) +ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) +TARGET_LINK_LIBRARIES( ${NAME} ${PERL_LIBRARY} ) + +INSTALL(TARGETS ${NAME} LIBRARY DESTINATION ${CMPI_LIBRARY_DIR}) + +# +# cmpi_rbwbem_bindings: provider implementation +# +INSTALL(FILES cmpi_plwbem_bindings.pl DESTINATION ${PERL_VENDOR_LIB}) + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmpi.pm DESTINATION ${PERL_VENDOR_LIB} ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-03 12:33:06
|
Revision: 1068 http://omc.svn.sourceforge.net/omc/?rev=1068&view=rev Author: kkaempf Date: 2008-10-03 12:33:03 +0000 (Fri, 03 Oct 2008) Log Message: ----------- major improvements in CMPIData bindings (overloading its struct elements is still a hassle, maybe we should move CMPIData out of cmpi_defs.h in our local copy ?!) Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi.i cmpi-bindings/trunk/swig/cmpi_defs.i cmpi-bindings/trunk/swig/cmpi_types.i Modified: cmpi-bindings/trunk/swig/cmpi.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi.i 2008-10-03 12:31:35 UTC (rev 1067) +++ cmpi-bindings/trunk/swig/cmpi.i 2008-10-03 12:33:03 UTC (rev 1068) @@ -32,10 +32,14 @@ #define Target_Void Py_None #define Target_Type PyObject* #define Target_Bool(x) PyBool_FromLong(x) +#define Target_WChar(x) PyInt_FromLong(x) #define Target_Int(x) PyInt_FromLong(x) #define Target_String(x) PyString_FromString(x) +#define Target_Real(x) Py_None #define Target_Array() PyList_New(0) +#define Target_SizedArray(len) PyList_New(len) #define Target_Append(x,y) PyList_Append(x,y) +#define Target_DateTime(x) Py_None #include <Python.h> #define TARGET_THREAD_BEGIN_BLOCK SWIG_PYTHON_THREAD_BEGIN_BLOCK #define TARGET_THREAD_END_BLOCK SWIG_PYTHON_THREAD_END_BLOCK @@ -53,10 +57,14 @@ #define Target_Void Qnil #define Target_Type VALUE #define Target_Bool(x) ((x)?Qtrue:Qfalse) +#define Target_WChar(x) INT2FIX(x) #define Target_Int(x) INT2FIX(x) #define Target_String(x) rb_str_new2(x) +#define Target_Real(x) rb_float_new(x) #define Target_Array() rb_ary_new() +#define Target_SizedArray(len) rb_ary_new2(len) #define Target_Append(x,y) rb_ary_push(x,y) +#define Target_DateTime(x) Qnil #define TARGET_THREAD_BEGIN_BLOCK #define TARGET_THREAD_END_BLOCK #define TARGET_THREAD_BEGIN_ALLOW @@ -75,10 +83,14 @@ #define Target_Void NULL #define Target_Type SV * #define Target_Bool(x) (x) +#define Target_WChar(x) NULL #define Target_Int(x) NULL /* should be Target_From_long(x), but Swig declares it too late. FIXME */ #define Target_String(x) NULL /* Target_FromCharPtr(x), also */ +#define Target_Real(x) NULL #define Target_Array(x) NULL +#define Target_SizedArray(len) NULL #define Target_Append(x,y) av_create_and_push(&x, y) +#define Target_DateTime(x) NULL #define TARGET_THREAD_BEGIN_BLOCK #define TARGET_THREAD_END_BLOCK #define TARGET_THREAD_BEGIN_ALLOW @@ -99,8 +111,113 @@ #include <pthread.h> +/* + * value_value + * convert CMPIValue to target value + * Attn: CMPIValue must be of non-array type ! + */ + +static Target_Type +value_value(const CMPIValue *value, const CMPIType type) +{ + Target_Type result; + switch (type) + { + case CMPI_null: + result = Target_Null; + break; + + case CMPI_boolean: /* (2+0) */ + result = Target_Bool(value->boolean); + break; + case CMPI_char16: /* (2+1) */ + result = Target_WChar(value->char16); + break; + + case CMPI_real32: /* ((2+0)<<2) */ + result = Target_Real(value->real32); + break; + case CMPI_real64: /* ((2+1)<<2) */ + result = Target_Real(value->real64); + break; + + case CMPI_uint8: /* ((8+0)<<4) */ + result = Target_Int(value->uint8); + break; + case CMPI_uint16: /* ((8+1)<<4) */ + result = Target_Int(value->uint16); + break; + case CMPI_uint32: /* ((8+2)<<4) */ + result = Target_Int(value->uint32); + break; + case CMPI_uint64: /* ((8+3)<<4) */ + result = Target_Int(value->uint64); + break; + + case CMPI_sint8: /* ((8+4)<<4) */ + result = Target_Int(value->sint8); + break; + case CMPI_sint16: /* ((8+5)<<4) */ + result = Target_Int(value->sint16); + break; + case CMPI_sint32: /* ((8+6)<<4) */ + result = Target_Int(value->sint32); + break; + case CMPI_sint64: /* ((8+7)<<4) */ + result = Target_Int(value->sint64); + break; + + case CMPI_instance: /* ((16+0)<<8) */ + return SWIG_NewPointerObj((void*) (value->inst), SWIGTYPE_p__CMPIInstance, 1); + break; + case CMPI_ref: /* ((16+1)<<8) */ + return SWIG_NewPointerObj((void*) (value->ref), SWIGTYPE_p__CMPIObjectPath, 1); + break; + case CMPI_args: /* ((16+2)<<8) */ + return SWIG_NewPointerObj((void*) (value->args), SWIGTYPE_p__CMPIArgs, 1); + break; + case CMPI_class: /* ((16+3)<<8) */ + return SWIG_NewPointerObj((void*) (value->inst), SWIGTYPE_p__CMPIInstance, 1); + break; + case CMPI_filter: /* ((16+4)<<8) */ + return SWIG_NewPointerObj((void*) (value->filter), SWIGTYPE_p__CMPISelectExp, 1); + break; + case CMPI_enumeration: /* ((16+5)<<8) */ + return SWIG_NewPointerObj((void*) (value->Enum), SWIGTYPE_p__CMPIEnumeration, 1); + break; + case CMPI_string: /* ((16+6)<<8) */ + result = Target_String(CMGetCharPtr(value->string)); + break; + case CMPI_chars: /* ((16+7)<<8) */ + result = Target_String(value->chars); + break; + case CMPI_dateTime: /* ((16+8)<<8) */ + result = Target_DateTime(value->dateTime); + break; + case CMPI_ptr: /* ((16+9)<<8) */ + return SWIG_NewPointerObj((void*) &(value->dataPtr), SWIGTYPE_p__CMPIValuePtr, 1); + break; + case CMPI_charsptr: /* ((16+10)<<8) */ + /* FIXME: unused ? */ + result = Target_Null; + break; + default: + /* FIXME: raise ! */ + result = Target_Null; + break; + } + Target_INCREF(result); + return result; +} + + +/* + * data_clone + * clone CMPIData + */ + static CMPIData * -clone_data(const CMPIData *dp) +data_clone(const CMPIData *dp) { CMPIData *data = (CMPIData *)calloc(1, sizeof(CMPIData)); memcpy(data, dp, sizeof(CMPIData)); @@ -109,6 +226,36 @@ /* + * data_value + * Convert CMPIValue to target type + */ + +static Target_Type +data_value(const CMPIData *dp) +{ + Target_Type result = Target_Null; + + if ((dp->type) & CMPI_ARRAY) + { + int size = CMGetArrayCount(dp->value.array, NULL); + int i; + result = Target_SizedArray(size); + for (i = 0; i < size; --i) + { + CMPIData data = CMGetArrayElementAt(dp->value.array, i, NULL); + Target_Append(result, value_value(&(data.value), (dp->type) & ~CMPI_ARRAY)); + } + Target_INCREF(result); + } + else + { + result = value_value(&(dp->value), dp->type); + } + + return result; +} + +/* **============================================================================== ** ** struct _CMPIException Modified: cmpi-bindings/trunk/swig/cmpi_defs.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_defs.i 2008-10-03 12:31:35 UTC (rev 1067) +++ cmpi-bindings/trunk/swig/cmpi_defs.i 2008-10-03 12:33:03 UTC (rev 1068) @@ -4,9 +4,9 @@ # %nodefault CMPIData; -#%ignore _CMPIData::type; -#%ignore _CMPIData::state; -#%ignore _CMPIData::value; +%ignore _CMPIData::type; +%ignore _CMPIData::state; +%ignore _CMPIData::value; %rename(CMPIData) _CMPIData; %nodefault CMPIStatus; @@ -75,15 +75,66 @@ # %extend CMPIData { - CMPIData() + CMPIData(CMPIData *data) { - CMPIData *data = (CMPIData *)calloc(1, sizeof(CMPIData)); - return data; + return data_clone(data); } ~CMPIData() { - free( $self ); + free($self); } + +#ifdef SWIGRUBY + VALUE to_s() + { + Target_Type value = data_value($self); + return rb_funcall(value, rb_intern("to_s"), 0); + } +#endif + +#if defined(SWIGRUBY) + %rename("null?") is_null; +#endif + + int is_null() + { + return CMIsNullValue((*($self))); + } +#if defined(SWIGRUBY) + %rename("key?") is_key; +#endif + int is_key() + { + return CMIsKeyValue((*($self))); + } +#if defined(SWIGRUBY) + %rename("array?") is_array; +#endif + int is_array() + { + return CMIsArray((*($self))); + } + int _type() + { + return $self->type; + } + int _state() + { + return $self->state; + } +#if defined(SWIGRUBY) + VALUE +#endif +#if defined(SWIGPYTHON) + PyObject * +#endif +#if defined(SWIGPERL5) + SV * +#endif + _value() + { + return data_value($self); + } } @@ -114,4 +165,3 @@ return CMGetCharPtr(s); } } - Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-03 12:31:35 UTC (rev 1067) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-03 12:33:03 UTC (rev 1068) @@ -461,7 +461,7 @@ CMPIData data = CMGetKeyAt($self, index, &s, &st); #if defined (SWIGRUBY) - VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rbdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); return rb_ary_push(rb_ary_push(rl, rbdata), rb_str_new2(CMGetCharPtr(s))); #endif @@ -474,7 +474,7 @@ } SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 1); + PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); PyObject* pl = PyTuple_New(2); PyTuple_SetItem(pl, 0, pydata); @@ -495,7 +495,35 @@ return result; } - + /* iterate over keys as [<value>,<name>] pairs */ +#if defined(SWIGRUBY) + void keys() + { + int i; + int count = CMGetKeyCount($self, NULL); + CMPIString *name; + for (i = 0; i < count; ++i ) + { + VALUE yield = rb_ary_new2(2); + name = NULL; + CMPIData data = CMGetKeyAt($self, i, &name, NULL); + VALUE rbdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + rb_ary_push(yield, rbdata); + rb_ary_push(yield, rb_str_new2(CMGetCharPtr(name))); + + rb_yield(yield); + } + } +#endif +#if defined(SWIGPYTHON) + %pythoncode %{ + def keys(self): + r = range(0,self.key_count()) + while r: + yield self.get_key_at(r.pop(0)) + %} +#endif + /* Set/replace namespace and classname components from <src>. */ void replace_from(const CMPIObjectPath * src) { @@ -768,7 +796,7 @@ CMPIData data = CMGetPropertyAt($self, index, &s, &st); #if defined (SWIGRUBY) - VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rbdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); return rb_ary_push(rb_ary_push(rl, rbdata), rb_str_new2(CMGetCharPtr(s))); #endif @@ -781,7 +809,7 @@ } SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 1); + PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); PyObject* pl = PyTuple_New(2); PyTuple_SetItem(pl, 0, pydata); @@ -907,7 +935,7 @@ CMPIData data = CMGetArgAt($self, index, &s, &st); #if defined (SWIGRUBY) - VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rbdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); return rb_ary_push(rb_ary_push(rl, rbdata), rb_str_new2(CMGetCharPtr(s))); #endif @@ -921,7 +949,7 @@ } SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 1); + PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); PyObject* pl = PyTuple_New(2); PyTuple_SetItem(pl, 0, pydata); @@ -1153,13 +1181,13 @@ CMPIData data = CMGetContextEntryAt($self, index, &s, NULL); #if defined (SWIGRUBY) - VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rbdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); return rb_ary_push(rb_ary_push(rl, rbdata), rb_str_new2(CMGetCharPtr(s))); #endif #if defined (SWIGPYTHON) SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 1); + PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); PyObject* pl = PyTuple_New(2); PyTuple_SetItem(pl, 0, pydata); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2009-01-27 22:42:18
|
Revision: 1164 http://omc.svn.sourceforge.net/omc/?rev=1164&view=rev Author: bartw Date: 2009-01-27 21:42:25 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Fix for swig-1.3.37. Swig no longer deposits the language-specific files in the current directory, hence the addition of outdir. Thanks to Mihai Ibanescu. Modified Paths: -------------- cmpi-bindings/trunk/swig/perl/CMakeLists.txt cmpi-bindings/trunk/swig/python/CMakeLists.txt cmpi-bindings/trunk/swig/ruby/CMakeLists.txt Modified: cmpi-bindings/trunk/swig/perl/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/perl/CMakeLists.txt 2009-01-16 13:34:31 UTC (rev 1163) +++ cmpi-bindings/trunk/swig/perl/CMakeLists.txt 2009-01-27 21:42:25 UTC (rev 1164) @@ -25,7 +25,7 @@ ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Perl ..." - COMMAND ${SWIG_EXECUTABLE} -perl5 -shadow -features autodoc -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} + COMMAND ${SWIG_EXECUTABLE} -perl5 -shadow -features autodoc -o ${SWIG_OUTPUT} -outdir ${CMAKE_CURRENT_BINARY_DIR} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2009-01-16 13:34:31 UTC (rev 1163) +++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2009-01-27 21:42:25 UTC (rev 1164) @@ -27,7 +27,7 @@ ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Python ..." - COMMAND ${SWIG_EXECUTABLE} -python -threads -features autodoc -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} + COMMAND ${SWIG_EXECUTABLE} -python -threads -features autodoc -o ${SWIG_OUTPUT} -outdir ${CMAKE_CURRENT_BINARY_DIR} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i Modified: cmpi-bindings/trunk/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2009-01-16 13:34:31 UTC (rev 1163) +++ cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2009-01-27 21:42:25 UTC (rev 1164) @@ -25,7 +25,7 @@ ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for ruby..." - COMMAND ${SWIG_EXECUTABLE} -ruby -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} + COMMAND ${SWIG_EXECUTABLE} -ruby -o ${SWIG_OUTPUT} -outdir ${CMAKE_CURRENT_BINARY_DIR} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-09-29 13:38:48
|
Revision: 1049 http://omc.svn.sourceforge.net/omc/?rev=1049&view=rev Author: kkaempf Date: 2008-09-29 13:38:37 +0000 (Mon, 29 Sep 2008) Log Message: ----------- fix type errors (gcc warnings) Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi.i cmpi-bindings/trunk/swig/cmpi_callbacks.i Modified: cmpi-bindings/trunk/swig/cmpi.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi.i 2008-09-29 13:28:51 UTC (rev 1048) +++ cmpi-bindings/trunk/swig/cmpi.i 2008-09-29 13:38:37 UTC (rev 1049) @@ -83,13 +83,11 @@ ex = (CMPIException*)malloc(sizeof(CMPIException)); ex->error_code = st->rc; - const char* chars; - if (st->msg) - chars = CMGetCharsPtr(st->msg, NULL); - - if (chars) + if (st->msg) { + const char* chars = CMGetCharsPtr(st->msg, NULL); ex->description = strdup(chars); + } else ex->description = NULL; Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-09-29 13:28:51 UTC (rev 1048) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-09-29 13:38:37 UTC (rev 1049) @@ -14,10 +14,7 @@ const char *id, const char *text) { - CMPIStatus st = { CMPI_RC_OK, NULL }; - - CMLogMessage($self, severity, id, text, &st); - RAISE_IF(st); + CMLogMessage($self, severity, id, text, NULL); } unsigned long capabilities() @@ -312,7 +309,7 @@ CMPIString* new_string(const char *s) { CMPIStatus st = { CMPI_RC_OK, NULL }; - CMPIStatus* result; + CMPIString* result; result = CMNewString($self, s, &st); RAISE_IF(st); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-10-02 14:04:29
|
Revision: 1062 http://omc.svn.sourceforge.net/omc/?rev=1062&view=rev Author: kkaempf Date: 2008-10-02 14:00:08 +0000 (Thu, 02 Oct 2008) Log Message: ----------- add comment, remove C++ flags Modified Paths: -------------- cmpi-bindings/trunk/swig/python/CMakeLists.txt cmpi-bindings/trunk/swig/ruby/CMakeLists.txt Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-10-02 13:31:15 UTC (rev 1061) +++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-10-02 14:00:08 UTC (rev 1062) @@ -1,11 +1,11 @@ # -# CMakeLists.txt for cmpi-bindings +# CMakeLists.txt for cmpi-bindings/swig/ruby # + enable_testing() add_subdirectory(tests) SET (BUILD_SHARED_LIBS ON) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") FIND_PACKAGE(PythonInterp REQUIRED) Modified: cmpi-bindings/trunk/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2008-10-02 13:31:15 UTC (rev 1061) +++ cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2008-10-02 14:00:08 UTC (rev 1062) @@ -1,6 +1,7 @@ +# +# CMakeLists.txt for cmpi-bindings/swig/ruby +# -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" OUTPUT_VARIABLE RUBY_ARCH_DIR) EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']" OUTPUT_VARIABLE RUBY_LIB_DIR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-06 18:30:47
|
Revision: 1075 http://omc.svn.sourceforge.net/omc/?rev=1075&view=rev Author: bartw Date: 2008-10-06 17:06:55 +0000 (Mon, 06 Oct 2008) Log Message: ----------- logging enhancements Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-06 17:05:07 UTC (rev 1074) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-06 17:06:55 UTC (rev 1075) @@ -14,7 +14,7 @@ const char *id, const char *text) { - CMLogMessage($self, severity, id, text, NULL); + RAISE_IF(CMLogMessage($self, severity, id, text, NULL)); } unsigned long capabilities() Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-06 17:05:07 UTC (rev 1074) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-06 17:06:55 UTC (rev 1075) @@ -37,6 +37,7 @@ from pywbem.cim_provider2 import ProviderProxy import pywbem import types +import syslog ##============================================================================== ## @@ -357,25 +358,40 @@ def bummer(self): self.broker.bummer() +_log_pri_map = { + cmpi.CMPI_SEV_ERROR :syslog.LOG_ERR, + cmpi.CMPI_SEV_INFO :syslog.LOG_INFO, + cmpi.CMPI_SEV_WARNING :syslog.LOG_WARNING, + cmpi.CMPI_DEV_DEBUG :syslog.LOG_DEBUG, + } + class Logger(object): - def __init__(self, broker): + def __init__(self, broker, miname): #self.broker = ExceptionClassWrapper(broker) self.broker = broker + self.miname = miname + def __log_message(self, severity, msg): + try: + self.broker.LogMessage(severity, self.miname, msg); + except cmpi.CMPIException, e: + if e.get_error_code() == cmpi.CMPI_RC_ERR_NOT_SUPPORTED: + syslog.syslog(syslog.LOG_DAEMON | _log_pri_map[severity], + '%s: %s' % (self.miname, msg)) def log_error(self, msg): - self.broker.LogMessage(1, "ERROR", msg); + self.__log_message(cmpi.CMPI_SEV_ERROR, msg); def log_info(self, msg): - self.broker.LogMessage(2, "INFO", msg); + self.__log_message(cmpi.CMPI_SEV_INFO, msg); def log_warn(self, msg): - self.broker.LogMessage(3, "WARN", msg); + self.__log_message(cmpi.CMPI_SEV_WARNING, msg); def log_debug(self, msg): - self.broker.LogMessage(4, "DEBUG", msg); + self.__log_message(cmpi.CMPI_DEV_DEBUG, msg); class ProviderEnvironment(object): def __init__(self, proxy, ctx): self.proxy = proxy self.ctx = ContextWrap(proxy, ctx) def get_logger(self): - return Logger(self.proxy.broker) + return Logger(self.proxy.broker, self.proxy.miname) def get_cimom_handle(self): return BrokerCIMOMHandle(self.proxy, self.ctx.cmpicontext) def get_user_name(self): @@ -411,8 +427,6 @@ #print '*** broker.name()', broker.name() #print '*** broker.capabilities()', broker.capabilities() #print '*** broker.version()', broker.version() - #broker.LogMessage(1, 'LogID', - # '** This should go through broker.LogMessage()') def enum_instance_names(self, ctx, rslt, objname): print 'provider.py: In enum_instance_names()' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-10-21 23:29:54
|
Revision: 1120 http://omc.svn.sourceforge.net/omc/?rev=1120&view=rev Author: bartw Date: 2008-10-21 23:29:48 +0000 (Tue, 21 Oct 2008) Log Message: ----------- allow some instances to be created without a namespace, if the broker allows this. This is a workaround for sblim-sfcb bug 2185410 Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-21 23:04:10 UTC (rev 1119) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-21 23:29:48 UTC (rev 1120) @@ -250,7 +250,7 @@ return result; } - CMPIInstance* new_instance(const CMPIObjectPath* path) + CMPIInstance* new_instance(const CMPIObjectPath* path, int allow_null_ns) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIInstance* result; @@ -259,13 +259,16 @@ /* Raise exception if no namespace */ - if (!(ns = CMGetNameSpace(path, &st)) || st.rc || - !(str = CMGetCharsPtr(ns, NULL)) || *str == '\0') + if (!allow_null_ns) { - CMSetStatusWithChars($self, &st, CMPI_RC_ERR_FAILED, - "object path has no namespace"); - _raise_ex(&st); - return NULL; + if (!(ns = CMGetNameSpace(path, &st)) || st.rc || + !(str = CMGetCharsPtr(ns, NULL)) || *str == '\0') + { + CMSetStatusWithChars($self, &st, CMPI_RC_ERR_FAILED, + "object path has no namespace"); + _raise_ex(&st); + return NULL; + } } result = CMNewInstance($self, path, &st); Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-21 23:04:10 UTC (rev 1119) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-21 23:29:48 UTC (rev 1120) @@ -346,8 +346,17 @@ return self.broker.modifyInstance(self.ctx, cop, inst) def DeliverIndication(self, ns, instance): - inst = self.proxy.pywbem2cmpi_inst(instance) - return self.broker.deliverIndication(self.ctx, ns, inst) + if self.broker.name() == 'Pegasus': + allow_null_ns = False + else: + allow_null_ns = True + if self.broker.name() == 'RequestHandler': + # Check sblim bug #2185410. + if instance.path is not None: + instance.path.namespace = None + inst = self.proxy.pywbem2cmpi_inst(instance, allow_null_ns) + rv = self.broker.deliverIndication(self.ctx, ns, inst) + return rv def is_subclass(self, ns, super, sub): subObjPath=self.broker.new_object_path(ns, sub) @@ -696,12 +705,17 @@ return cargs - def pywbem2cmpi_inst(self, pinst): + def pywbem2cmpi_inst(self, pinst, allow_null_ns=False): pcop = pinst.path - if pcop is None: - pcop = pywbem.CIMInstanceName(pinst.classname) + if not allow_null_ns: + if pcop is None or pcop.namespace is None: + raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_NAMESPACE, + "Instance must have a namespace") + else: + if pcop is None: + pcop = pywbem.CIMInstanceName(pinst.classname) cop = self.pywbem2cmpi_instname(pcop) - cinst = self.broker.new_instance(cop) + cinst = self.broker.new_instance(cop, allow_null_ns) if pinst.property_list is not None: cinst.set_property_filter(pinst.property_list) for prop in pinst.properties.values(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2009-03-30 13:56:09
|
Revision: 1169 http://omc.svn.sourceforge.net/omc/?rev=1169&view=rev Author: kkaempf Date: 2009-03-30 13:56:02 +0000 (Mon, 30 Mar 2009) Log Message: ----------- enable 'rdoc' documentation and adapt comments appropriately Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi.i cmpi-bindings/trunk/swig/cmpi_types.i cmpi-bindings/trunk/swig/ruby/CMakeLists.txt Modified: cmpi-bindings/trunk/swig/cmpi.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi.i 2009-03-18 20:29:45 UTC (rev 1168) +++ cmpi-bindings/trunk/swig/cmpi.i 2009-03-30 13:56:02 UTC (rev 1169) @@ -16,6 +16,8 @@ %include "typemaps.i" %include exception.i +#define __type + %{ /* Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2009-03-18 20:29:45 UTC (rev 1168) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2009-03-30 13:56:02 UTC (rev 1169) @@ -110,6 +110,11 @@ %rename(CMPIException) CMPIException; typedef struct _CMPIException {} CMPIException; +/* + * Container for a fault, contains numeric error_code and textual + * description + * + */ %extend CMPIException { CMPIException() @@ -121,12 +126,25 @@ { free($self->description); } - +#if defined(SWIGRUBY) +%rename("error_code") get_error_code(); +#endif + /* + * Numerical error code + * + */ int get_error_code() { return $self->error_code; } +#if defined(SWIGRUBY) +%rename("description") get_description(); +#endif + /* + * Textual error description + * + */ const char* get_description() { return $self->description; @@ -161,128 +179,152 @@ %extend _CMPIError { ~CMPIError() { } - /* Gets the type of this Error */ + +/* Gets the type of this Error */ CMPIErrorType type() { return CMGetErrorType($self, NULL); } - /* Sets the error type of this error object. */ + #if defined(SWIGRUBY) %rename("type=") set_type(const CMPIErrorType et); #endif + /* Sets the error type of this error object. */ void set_type(const CMPIErrorType et) { CMSetErrorType($self, et); } - /* Returns a string which describes the alternate error type. */ + +/* Returns a string which describes the alternate error type. */ const char *other_type() { return CMGetCharPtr(CMGetOtherErrorType($self, NULL)); } - /* Sets the 'other' error type of this error object. */ + #if defined(SWIGRUBY) %rename("other_type=") set_other_type(const char *ot); #endif + /* Sets the 'other' error type of this error object. */ void set_other_type(const char *ot) { CMSetOtherErrorType($self, ot); } + /* Returns a string which describes the owning entity. */ const char *owning_entity() { return CMGetCharPtr(CMGetOwningEntity($self, NULL)); } + /* Returns a string which is the message ID. */ const char *message_id() { return CMGetCharPtr(CMGetMessageID($self, NULL)); } + /* Returns a string comnating an error message. */ const char *message() { return CMGetCharPtr(CMGetErrorMessage($self, NULL)); } + /* Returns the perceieved severity of this error. */ CMPIErrorSeverity severity() { return CMGetPerceivedSeverity($self, NULL); } + /* Returns the probable cause of this error. */ CMPIErrorProbableCause probable_cause() { return CMGetProbableCause($self, NULL); } - /* Sets the description of the probable cause. */ + #if defined(SWIGRUBY) %rename("probable_cause=") set_probable_cause(const char *pcd); #endif + /* Sets the description of the probable cause. */ void set_probable_cause(const char *pcd) { CMSetProbableCauseDescription($self, pcd); } + /* Returns a string which describes the probable cause. */ const char *probable_cause_description() { return CMGetCharPtr(CMGetProbableCauseDescription($self, NULL)); } + /* Returns an array of strings which describes recomended actions. */ CMPIArray *recommended_actions() { return CMGetRecommendedActions($self, NULL); } - /* Sets the recomended actions array. */ + #if defined(SWIGRUBY) %rename("recommended_actions=") set_recommended_actions(const CMPIArray* ra); #endif + /* Sets the recomended actions array. */ void set_recommended_actions(const CMPIArray* ra) { CMSetRecommendedActions($self, ra); } + /* Returns a string which describes the Error source. */ const char *source() { return CMGetCharPtr(CMGetErrorSource($self, NULL)); } - /* Specifies a string which specifes The identifying information of - the entity (i.e., the instance) generating the error. */ + #if defined(SWIGRUBY) %rename("source=") set_source(const char *es); #endif + /* Specifies a string which specifes The identifying information of + the entity (i.e., the instance) generating the error. */ void set_source(const char *es) { CMSetErrorSource($self, es); } + /* Returns a the format that the error src is in. */ CMPIErrorSrcFormat source_format() { return CMGetErrorSourceFormat($self, NULL); } - /* Sets the source format of the error object. */ + #if defined(SWIGRUBY) %rename("source_format=") set_source_format(const CMPIErrorSrcFormat esf); #endif + /* Sets the source format of the error object. */ void set_source_format(const CMPIErrorSrcFormat esf) { CMSetErrorSourceFormat($self, esf); } + /* Returns a string which describes the 'other' format, only available if the error source is OTHER. */ const char *other_format() { return CMGetCharPtr(CMGetOtherErrorSourceFormat($self, NULL)); } - /* specifies A string defining "Other" values for ErrorSourceFormat */ + #if defined(SWIGRUBY) %rename("other_format=") set_other_format(const char *oesf); #endif + /* specifies A string defining "Other" values for ErrorSourceFormat */ void set_other_format(const char *oesf) { CMSetOtherErrorSourceFormat($self, oesf); } + /* Returns the status code of this error. */ CMPIrc status_code() { return CMGetCIMStatusCode($self, NULL); } + /* Returns a string which describes the status code error. */ const char *status_description() { return CMGetCharPtr(CMGetCIMStatusCodeDescription($self, NULL)); } - /* Sets the description of the status code. */ + #if defined(SWIGRUBY) %rename("status_description=") set_status_description(const char *cd); #endif + /* Sets the description of the status code. */ void set_status_description(const char *cd) { CMSetCIMStatusCodeDescription($self, cd); } + /* Returns an array which contains the dynamic content of the message. */ CMPIArray *message_arguments() { return CMGetMessageArguments($self, NULL); } - /* Sets an array of strings for the dynamic content of the message. */ + #if defined(SWIGRUBY) %rename("message_arguments=") set_message_arguments(CMPIArray* ma); #endif + /* Sets an array of strings for the dynamic content of the message. */ void set_message_arguments(CMPIArray* ma) { CMSetMessageArguments($self, ma); } @@ -297,6 +339,7 @@ { /* no con-/destructor, the broker handles this */ + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -308,16 +351,19 @@ return CMGetCharPtr(result); } + /* Add the +instance+ to the result */ void return_instance(CMPIInstance *instance) { RAISE_IF(CMReturnInstance($self, instance)); } + /* Add the +objectpath+ to the result */ void return_objectpath(CMPIObjectPath *path) { RAISE_IF(CMReturnObjectPath($self, path)); } + /* Add typed value to the result */ void return_data(const CMPIValue* value, const CMPIType type) { RAISE_IF(CMReturnData($self, value, type)); @@ -361,16 +407,12 @@ #ifdef SWIGRUBY %rename ("to_s") string(); #endif + /* Return string representation */ const char *string() { return CMGetCharPtr($self->ft->toString($self, NULL)); } - /* Adds/replaces a named key property. - * name: Key property name. - * value: Address of value structure. - * type: Value type. - */ #if 0 /* TODO: FIXME: No global _BROKER */ #if defined(SWIGRUBY) %alias set "[]="; @@ -425,6 +467,11 @@ #endif #endif + /* Adds/replaces a named key property. + * name: Key property name. + * value: Address of value structure. + * type: Value type. + */ void add_key( const char *name, const CMPIValue* value, @@ -433,6 +480,9 @@ RAISE_IF(CMAddKey($self, name, value, type)); } +#if defined(SWIGRUBY) + %rename("key") get_key(const char *name); +#endif /* Gets a named key property value. * name: Key property name. */ @@ -446,10 +496,8 @@ return result; } - /* Gets a key property value defined by its index. - * name: [out] Key property name - */ #if defined (SWIGRUBY) + %rename("key_at") get_key_at(int index); VALUE #endif #if defined (SWIGPYTHON) @@ -458,7 +506,10 @@ #if defined (SWIGPERL) SV* #endif - get_key_at(int index) { + /* Gets a key property value defined by its index. + * name: [out] Key property name + */ + __type get_key_at(int index) { Target_Type tdata; CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -496,8 +547,9 @@ return result; } + +#if defined(SWIGRUBY) /* iterate over keys as [<value>,<name>] pairs */ -#if defined(SWIGRUBY) void keys() { int i; @@ -524,13 +576,13 @@ %} #endif - /* Set/replace namespace and classname components from <src>. */ + /* Set/replace namespace and classname components from +src+. */ void replace_from(const CMPIObjectPath * src) { RAISE_IF(CMSetNameSpaceFromObjectPath($self, src)); } - /* Set/replace hostname, namespace and classname components from <src>. + /* Set/replace hostname, namespace and classname components from +src+. */ void replace_all_from(const CMPIObjectPath * src) { @@ -538,7 +590,7 @@ } /* Get class qualifier value. - * qName: Qualifier name. + * +qName+: Qualifier name. */ CMPIData qualifier(const char *qname) { @@ -552,8 +604,8 @@ } /* Get property qualifier value. - * pName Property name. - * qName Qualifier name. + * +pName+: Property name. + * +qName+: Qualifier name. */ CMPIData property_qualifier(const char *pName, const char *qName) { @@ -675,11 +727,6 @@ { } - /* Adds/replaces a named Property. - * name: Entry name. - * value: Address of value structure. - * type: Value type. - */ #if 0 /* TODO: FIXME: No global _BROKER */ #if defined(SWIGRUBY) %alias set "[]="; @@ -734,6 +781,11 @@ #endif #endif + /* Adds/replaces a named Property. + * name: Entry name. + * value: Address of value structure. + * type: Value type. + */ void set_property( const char *name, const CMPIValue * value, @@ -742,10 +794,10 @@ RAISE_IF(CMSetProperty($self, name, value, type)); } - /* get a named property value */ #if defined(SWIGRUBY) %alias get "[]"; /* + * get a named property value * Property access in Ruby: * data = instance[:propname] # access by name (symbol) * data = instance["propname" # access by name (string) @@ -769,6 +821,11 @@ } #endif + +#if defined(SWIGRUBY) + %rename("property") get_property(const char *name); +#endif + /* Get property by name */ CMPIData get_property(const char *name) { CMPIData result; @@ -780,9 +837,6 @@ return result; } - /** Gets a Property value defined by its index. - * index: Position in the internal Data array. - */ #if defined (SWIGRUBY) VALUE #endif @@ -792,7 +846,10 @@ #if defined (SWIGPERL) SV * #endif - get_property_at(int index) + /** Gets a Property value defined by its index. + * index: Position in the internal Data array. + */ + __type get_property_at(int index) { Target_Type tdata; Target_Type result; @@ -820,10 +877,10 @@ return result; } - /* Gets the number of properties contained in this Instance. */ #if defined(SWIGRUBY) %alias property_count "size"; #endif + /* Gets the number of properties contained in this Instance. */ int property_count() { int result; @@ -850,13 +907,13 @@ return result; } +#if defined(SWIGRUBY) + %alias set_objectpath "objectpath="; +#endif /* Replaces the ObjectPath of the instance. * The passed objectpath shall contain the namespace, classname, * as well as all keys for the specified instance. */ -#if defined(SWIGRUBY) - %alias set_objectpath "objectpath="; -#endif void set_objectpath(const CMPIObjectPath *path) { RAISE_IF(CMSetObjectPath($self, path)); @@ -976,10 +1033,10 @@ RAISE_IF(CMAddArg($self, name, value, type)); } - /* Gets a named argument value. */ #if defined(SWIGRUBY) %alias get "[]"; #endif + /* Gets a named argument value. */ CMPIData get(const char *name) { CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -991,8 +1048,6 @@ return result; } - /* Gets a Argument value defined by its index. - */ #if defined (SWIGRUBY) VALUE #endif @@ -1002,7 +1057,9 @@ #if defined (SWIGPERL) SV * #endif - get_arg_at(int index) + /* Gets a Argument value defined by its index. + */ + __type get_arg_at(int index) { Target_Type tdata; Target_Type result; @@ -1032,7 +1089,6 @@ } /* Gets the number of arguments contained in this Args. */ - int arg_count() { CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -1049,11 +1105,13 @@ # # CMPISelectExp -%extend _CMPISelectExp { /* This structure encompasses queries * and provides mechanism to operate on the query. */ +%extend _CMPISelectExp { ~CMPISelectExp() { } + + /* Return string representation */ const char* to_s() { return CMGetCharPtr(CMGetSelExpString($self, NULL)); } @@ -1064,6 +1122,7 @@ # CMPISelectCond %extend _CMPISelectCond { + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIString *s = CDToString(broker, $self, NULL); return CMGetCharPtr(s); @@ -1082,6 +1141,7 @@ # CMPIPredicate %extend _CMPIPredicate { + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIString *s = CDToString(broker, $self, NULL); return CMGetCharPtr(s); @@ -1149,6 +1209,7 @@ return result; } + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -1167,6 +1228,7 @@ %extend _CMPIArray { + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIString *s = CDToString(broker, $self, NULL); @@ -1190,10 +1252,10 @@ return result; } - /* Gets an element value defined by its index. */ #if defined(SWIGRUBY) %alias at "[]"; #endif + /* Gets an element value defined by its index. */ CMPIData at(int index) { CMPIData result; @@ -1205,10 +1267,10 @@ return result; } - /* Sets an element value defined by its index. */ #if defined(SWIGRUBY) %alias set "[]="; #endif + /* Sets an element value defined by its index. */ void set(int index, const CMPIValue * value, CMPIType type) { RAISE_IF(CMSetArrayElementAt($self, index, value, type)); @@ -1232,10 +1294,12 @@ # CMPIContext %extend _CMPIContext { + /* Return string representation */ const char* to_s(const CMPIBroker* broker) { CMPIString *s = CDToString(broker, $self, NULL); return CMGetCharPtr(s); } + void add_entry(const char* name, const CMPIValue* data, const CMPIType type) { CMAddContextEntry($self, name, data, type); @@ -1254,7 +1318,7 @@ #if defined (SWIGPERL) SV* #endif - get_entry_at(int index) { + __type get_entry_at(int index) { Target_Type tdata; Target_Type result; CMPIString *s = NULL; @@ -1295,16 +1359,21 @@ %extend _CMPIDateTime { ~CMPIDateTime() { } + + /* Return string representation */ const char* to_s() { return CMGetCharPtr(CMGetStringFormat($self, NULL)); } + + /* Return integer representation */ uint64_t to_i() { return CMGetBinaryFormat($self, NULL); } - /* Tests whether DateTime is an interval value. */ + #if defined(SWIGRUBY) %rename("interval?") is_interval; #endif + /* Tests whether DateTime is an interval value. */ int is_interval() { return CMIsInterval($self, NULL); } Modified: cmpi-bindings/trunk/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2009-03-18 20:29:45 UTC (rev 1168) +++ cmpi-bindings/trunk/swig/ruby/CMakeLists.txt 2009-03-30 13:56:02 UTC (rev 1169) @@ -57,3 +57,21 @@ # cmpi_rbwbem_bindings: provider implementation # INSTALL(FILES cmpi_rbwbem_bindings.rb DESTINATION ${RUBY_LIB_DIR}) + +# rdoc +SET(rdoc_dir "${CMAKE_CURRENT_BINARY_DIR}/html") +ADD_CUSTOM_COMMAND ( + OUTPUT ${rdoc_dir} + COMMAND ${CMAKE_COMMAND} -E echo_append "Creating rdoc documentation ..." + COMMAND rm -rf ${rdoc_dir} + COMMAND rdoc -o ${rdoc_dir} cmpi.i *.i + COMMAND ${CMAKE_COMMAND} -E echo "Done." + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/swig + DEPENDS ${CMAKE_SOURCE_DIR}/swig/*.i +) +ADD_CUSTOM_TARGET(ruby_rdoc ALL DEPENDS "${rdoc_dir}") +ADD_DEPENDENCIES(ruby_rdoc ${NAME}) + +# +# Leave this to %doc in the .spec file +#INSTALL(DIRECTORY "${rdoc_dir}" DESTINATION ${DOC_INSTALL_DIR}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |