From: <kk...@us...> - 2008-10-07 15:31:37
|
Revision: 1077 http://omc.svn.sourceforge.net/omc/?rev=1077&view=rev Author: kkaempf Date: 2008-10-07 15:30:48 +0000 (Tue, 07 Oct 2008) Log Message: ----------- more progress on Perl more cleanup Modified Paths: -------------- cmpi-bindings/trunk/src/cmpi_provider.c cmpi-bindings/trunk/swig/cmpi.i cmpi-bindings/trunk/swig/cmpi_defs.i cmpi-bindings/trunk/swig/cmpi_types.i cmpi-bindings/trunk/swig/perl/CMakeLists.txt Added Paths: ----------- cmpi-bindings/trunk/swig/perl/cmpi_plwbem_bindings.pl cmpi-bindings/trunk/test/perl/ cmpi-bindings/trunk/test/perl/TestAtomProvider.peg.reg cmpi-bindings/trunk/test/perl/TestAtomProvider.reg cmpi-bindings/trunk/test/perl/TestAtomProvider.sfcb.reg Modified: cmpi-bindings/trunk/src/cmpi_provider.c =================================================================== --- cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-06 17:17:46 UTC (rev 1076) +++ cmpi-bindings/trunk/src/cmpi_provider.c 2008-10-07 15:30:48 UTC (rev 1077) @@ -1137,7 +1137,3 @@ SWIG_CMPI_MI_FACTORY(Indication) #undef _CMPI_SETFAIL -#undef TARGET_THREAD_BEGIN_BLOCK -#undef TARGET_THREAD_END_BLOCK -#undef TARGET_THREAD_BEGIN_ALLOW -#undef TARGET_THREAD_END_ALLOW Modified: cmpi-bindings/trunk/swig/cmpi.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi.i 2008-10-06 17:17:46 UTC (rev 1076) +++ cmpi-bindings/trunk/swig/cmpi.i 2008-10-07 15:30:48 UTC (rev 1077) @@ -65,15 +65,24 @@ #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 -#define TARGET_THREAD_END_ALLOW +#define TARGET_THREAD_BEGIN_BLOCK do {} while(0) +#define TARGET_THREAD_END_BLOCK do {} while(0) +#define TARGET_THREAD_BEGIN_ALLOW do {} while(0) +#define TARGET_THREAD_END_ALLOW do {} while(0) #include <ruby.h> #include <rubyio.h> #endif #if defined(SWIGPERL) +#define TARGET_THREAD_BEGIN_BLOCK do {} while(0) +#define TARGET_THREAD_END_BLOCK do {} while(0) +#define TARGET_THREAD_BEGIN_ALLOW do {} while(0) +#define TARGET_THREAD_END_ALLOW do {} while(0) + +SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value); +SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr); +SWIGINTERNINLINE SV *SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value); + #define Target_Null_p(x) (x == NULL) #define Target_INCREF(x) #define Target_DECREF(x) @@ -82,19 +91,17 @@ #define Target_Null NULL #define Target_Void NULL #define Target_Type SV * -#define Target_Bool(x) (x) +#define Target_Bool(x) (x)?Target_True:Target_False #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_Int(x) SWIG_From_long(x) +#define Target_String(x) SWIG_FromCharPtr(x) +#define Target_Real(x) SWIG_From_double(x) +#define Target_Array() (SV *)newAV() +#define Target_SizedArray(len) (SV *)newAV() +#define Target_Append(x,y) av_push(((AV *)(x)), y) #define Target_DateTime(x) NULL -#define TARGET_THREAD_BEGIN_BLOCK -#define TARGET_THREAD_END_BLOCK -#define TARGET_THREAD_BEGIN_ALLOW -#define TARGET_THREAD_END_ALLOW +#include <perl.h> +#include <EXTERN.h> #endif Modified: cmpi-bindings/trunk/swig/cmpi_defs.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_defs.i 2008-10-06 17:17:46 UTC (rev 1076) +++ cmpi-bindings/trunk/swig/cmpi_defs.i 2008-10-07 15:30:48 UTC (rev 1077) @@ -14,6 +14,10 @@ %ignore _CMPIStatus::rc; %ignore _CMPIStatus::msg; +#if defined(SWIGPERL) +/* Warning(314): 'ref' is a perl keyword */ +%rename("reference") _CMPIValue::ref; +#endif %include "cmpidt.h" #----------------------------------------------------- Modified: cmpi-bindings/trunk/swig/cmpi_types.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-06 17:17:46 UTC (rev 1076) +++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-10-07 15:30:48 UTC (rev 1077) @@ -455,33 +455,33 @@ #if defined (SWIGPYTHON) PyObject* #endif +#if defined (SWIGPERL) + SV* +#endif get_key_at(int index) { CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetKeyAt($self, index, &s, &st); - -#if defined (SWIGRUBY) - 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) - + Target_Type result = Target_Null; if (st.rc) { RAISE_IF(st); - return NULL; + return result; } - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - - PyObject* pl = PyTuple_New(2); - PyTuple_SetItem(pl, 0, pydata); - PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); - SWIG_PYTHON_THREAD_END_BLOCK; - return pl; + TARGET_THREAD_BEGIN_BLOCK; + Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); +#if defined (SWIGPYTHON) + result = PyTuple_New(2); + PyTuple_SetItem(result, 0, tdata); + PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); +#else + result = Target_SizedArray(2); + Target_Append(result, tdata); + Target_Append(result, Target_String(CMGetCharPtr(s))); #endif + TARGET_THREAD_END_BLOCK; + return result; } /* Gets the number of key properties contained in this ObjectPath. */ @@ -788,34 +788,34 @@ #if defined (SWIGPYTHON) PyObject* #endif +#if defined (SWIGPERL) + SV * +#endif get_property_at(int index) { CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetPropertyAt($self, index, &s, &st); - -#if defined (SWIGRUBY) - 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) - + Target_Type result = Target_Null; if (st.rc) { RAISE_IF(st); - return NULL; + return result; } + Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - - PyObject* pl = PyTuple_New(2); - PyTuple_SetItem(pl, 0, pydata); - PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); - SWIG_PYTHON_THREAD_END_BLOCK; - return pl; + TARGET_THREAD_BEGIN_BLOCK; +#if defined (SWIGPYTHON) + result = PyTuple_New(2); + PyTuple_SetItem(result, 0, tdata); + PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); +#else + result = Target_SizedArray(2); + Target_Append(result, tdata); + Target_Append(result, Target_String(CMGetCharPtr(s))); #endif + TARGET_THREAD_END_BLOCK; + return result; } /* Gets the number of properties contained in this Instance. */ @@ -927,35 +927,35 @@ #if defined (SWIGPYTHON) PyObject* #endif +#if defined (SWIGPERL) + SV * +#endif get_arg_at(int index) { CMPIString *s = NULL; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIData data = CMGetArgAt($self, index, &s, &st); -#if defined (SWIGRUBY) - 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) - - RAISE_IF(st); - + Target_Type result = Target_Null; if (st.rc) { - return NULL; + RAISE_IF(st); + return result; } + Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - - PyObject* pl = PyTuple_New(2); - PyTuple_SetItem(pl, 0, pydata); - PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); - SWIG_PYTHON_THREAD_END_BLOCK; - return pl; + TARGET_THREAD_BEGIN_BLOCK; +#if defined (SWIGPYTHON) + result = PyTuple_New(2); + PyTuple_SetItem(result, 0, tdata); + PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); +#else + result = Target_SizedArray(2); + Target_Append(result, tdata); + Target_Append(result, Target_String(CMGetCharPtr(s))); #endif + TARGET_THREAD_END_BLOCK; + return result; } /* Gets the number of arguments contained in this Args. */ @@ -1033,7 +1033,10 @@ } return l; } - +#if defined(SWIGPERL) +/* Warning(314): 'next' is a perl keyword */ +%rename("_next") next; +#endif CMPIData next() { CMPIStatus st = { CMPI_RC_OK, NULL }; @@ -1175,25 +1178,34 @@ #if defined (SWIGPYTHON) PyObject* #endif +#if defined (SWIGPERL) + SV* +#endif get_entry_at(int index) { CMPIString *s = NULL; - CMPIData data = CMGetContextEntryAt($self, index, &s, NULL); + CMPIStatus st = { CMPI_RC_OK, NULL }; + CMPIData data = CMGetContextEntryAt($self, index, &s, &st); -#if defined (SWIGRUBY) - 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 + Target_Type result = Target_Null; + if (st.rc) + { + RAISE_IF(st); + return result; + } + Target_Type tdata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); + + TARGET_THREAD_BEGIN_BLOCK; #if defined (SWIGPYTHON) - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyObject* pydata = SWIG_NewPointerObj((void*) data_clone(&data), SWIGTYPE_p__CMPIData, 1); - - PyObject* pl = PyTuple_New(2); - PyTuple_SetItem(pl, 0, pydata); - PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); - SWIG_PYTHON_THREAD_END_BLOCK; - return pl; + result = PyTuple_New(2); + PyTuple_SetItem(result, 0, tdata); + PyTuple_SetItem(result, 1, PyString_FromString(CMGetCharPtr(s))); +#else + result = Target_SizedArray(2); + Target_Append(result, tdata); + Target_Append(result, Target_String(CMGetCharPtr(s))); #endif + TARGET_THREAD_END_BLOCK; + return result; } CMPICount get_entry_count(void) { Modified: cmpi-bindings/trunk/swig/perl/CMakeLists.txt =================================================================== --- cmpi-bindings/trunk/swig/perl/CMakeLists.txt 2008-10-06 17:17:46 UTC (rev 1076) +++ cmpi-bindings/trunk/swig/perl/CMakeLists.txt 2008-10-07 15:30:48 UTC (rev 1077) @@ -12,6 +12,8 @@ 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}") +MESSAGE(STATUS "Perl cc flags: ${PERL_CCFLAGS}") +MESSAGE(STATUS "Perl ccdl flags: ${PERL_LINK_FLAGS}") SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmpi_wrap.c" ) SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../cmpi.i" ) @@ -29,7 +31,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC ${PERL_CCFLAGS}" ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/cmpi ) @@ -39,7 +41,7 @@ ADD_DEFINITIONS(-DCMPI_PLATFORM_LINUX_GENERIC_GNU -DCMPI_VERSION=200) ADD_DEFINITIONS(-DTARGET_PERL) -ADD_DEFINITIONS( ${PERL_CCFLAGS} -Wno-unused -Wno-error ) +ADD_DEFINITIONS( ${PERL_CCFLAGS} -Wno-unused -Wno-error -Wno-nonnull) LINK_DIRECTORIES( ${PERL_CORE_DIR} ) # @@ -48,7 +50,8 @@ SET( NAME plCmpiProvider ) ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) -TARGET_LINK_LIBRARIES( ${NAME} ${PERL_LIBRARY} ) +TARGET_LINK_LIBRARIES( ${NAME} "perl" ) +SET_TARGET_PROPERTIES( ${NAME} PROPERTIES LINK_FLAGS ${PERL_LINK_FLAGS}) INSTALL(TARGETS ${NAME} LIBRARY DESTINATION ${CMPI_LIBRARY_DIR}) Added: cmpi-bindings/trunk/swig/perl/cmpi_plwbem_bindings.pl =================================================================== --- cmpi-bindings/trunk/swig/perl/cmpi_plwbem_bindings.pl (rev 0) +++ cmpi-bindings/trunk/swig/perl/cmpi_plwbem_bindings.pl 2008-10-07 15:30:48 UTC (rev 1077) @@ -0,0 +1,5 @@ +#!/usr/bin/perl +# +# cmpi_plwbem_bindings.pl +# +use cmpi; Added: cmpi-bindings/trunk/test/perl/TestAtomProvider.peg.reg =================================================================== --- cmpi-bindings/trunk/test/perl/TestAtomProvider.peg.reg (rev 0) +++ cmpi-bindings/trunk/test/perl/TestAtomProvider.peg.reg 2008-10-07 15:30:48 UTC (rev 1077) @@ -0,0 +1,28 @@ +// Provider registration for TestAtom +instance of PG_ProviderModule +{ + Name = "TestAtom_Module"; + Location = "plCmpiProvider"; + Vendor = "Novell"; + Version = "1.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +instance of PG_Provider +{ + Name = "TestAtomProvider"; + ProviderModuleName = "TestAtom_Module"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "TestAtom_Module"; + ProviderName = "TestAtomProvider"; + ClassName = "Test_Atom"; + ProviderType = { 2 }; + Namespaces = {"root/cimv2"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "TestAtom-Prov-1"; +}; Added: cmpi-bindings/trunk/test/perl/TestAtomProvider.reg =================================================================== --- cmpi-bindings/trunk/test/perl/TestAtomProvider.reg (rev 0) +++ cmpi-bindings/trunk/test/perl/TestAtomProvider.reg 2008-10-07 15:30:48 UTC (rev 1077) @@ -0,0 +1,9 @@ +// Provider registration for TestAtom +instance of OpenWBEM_PyProviderRegistration +{ + InstanceID = "<org:product:TestAtom:unique_id>"; // TODO + NamespaceNames = {"root/cimv2"}; + ClassName = "Test_Atom"; + ProviderTypes = {1}; // Instance + ModulePath = "/usr/lib/plcim/TestAtomProvider.pl"; // TODO +}; Added: cmpi-bindings/trunk/test/perl/TestAtomProvider.sfcb.reg =================================================================== --- cmpi-bindings/trunk/test/perl/TestAtomProvider.sfcb.reg (rev 0) +++ cmpi-bindings/trunk/test/perl/TestAtomProvider.sfcb.reg 2008-10-07 15:30:48 UTC (rev 1077) @@ -0,0 +1,5 @@ +[Test_Atom] + provider: TestAtomProvider + location: plCmpiProvider + type: instance + namespace: root/cimv2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |