[asterisk-scf-commits] asterisk-scf/integration/ice.git branch "py-vs2010" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 5 14:47:34 CDT 2011


branch "py-vs2010" has been created
        at  d5210c6714f97b53a8022eaca8526e752cd21d86 (commit)

- Log -----------------------------------------------------------------
commit d5210c6714f97b53a8022eaca8526e752cd21d86
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Tue Apr 5 14:36:51 2011 -0500

    Changes to allow Ice Python support to compile under VS 2010.
     - Changed initialization of std::pair objects.
     - Added VS100 and VS100_EXPRESS as compiler options.

diff --git a/py/config/Make.rules.mak b/py/config/Make.rules.mak
index 22aa243..99364ae 100644
--- a/py/config/Make.rules.mak
+++ b/py/config/Make.rules.mak
@@ -23,10 +23,10 @@ OPTIMIZE		= yes
 
 #
 # Specify your C++ compiler. Supported values are:
-# VC60, VC90, VC90_EXPRESS
+# VC60, VC90, VC90_EXPRESS, VC100, VC100_EXPRESS
 #
 !if "$(CPP_COMPILER)" == ""
-CPP_COMPILER            = VC90
+CPP_COMPILER            = VC100
 !endif
 
 #
@@ -71,7 +71,8 @@ install_libdir		= $(prefix)\python$(x64suffix)
 
 !if "$(CPP_COMPILER)" != "VC60" && "$(CPP_COMPILER)" != "VC71" && \
     "$(CPP_COMPILER)" != "VC80" && "$(CPP_COMPILER)" != "VC80_EXPRESS" && \
-    "$(CPP_COMPILER)" != "VC90" && "$(CPP_COMPILER)" != "VC90_EXPRESS"
+    "$(CPP_COMPILER)" != "VC90" && "$(CPP_COMPILER)" != "VC90_EXPRESS" && \
+    "$(CPP_COMPILER)" != "VC100" && "$(CPP_COMPILER)" != "VC100_EXPRESS"
 !error Invalid setting for CPP_COMPILER: $(CPP_COMPILER)
 !endif
 
diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp
index b54aeb3..b25a642 100644
--- a/py/modules/IcePy/Operation.cpp
+++ b/py/modules/IcePy/Operation.cpp
@@ -1275,6 +1275,7 @@ PyTypeObject AsyncResultType =
     0,                               /* tp_is_gc */
 };
 
+const Ice::Byte* const NullBytePtr = 0;
 }
 
 bool
@@ -1447,6 +1448,24 @@ IcePy::TypedInvocation::unmarshalResults(const pair<const Ice::Byte*, const Ice:
     return results.release();
 }
 
+static bool
+hasClasses(PyObjectHandle obj)
+{
+    if(PyObject_HasAttrString(obj.get(), "__ice_slicedData__"))
+    {
+        PyObjectHandle slicedData = PyObject_GetAttrString(obj.get(), "__ice_slicedData__");
+        if(!PyCObject_Check(slicedData.get()))
+        {
+            PyErr_Format(PyExc_ValueError, STRCAST("sliced data not found (expected even if empty)"));
+            throw AbortMarshaling();
+        }
+        Ice::SlicedDataPtr* mem = reinterpret_cast<Ice::SlicedDataPtr*>(PyCObject_AsVoidPtr(slicedData.get()));
+        Ice::SlicedDataPtr slices = *mem; 
+        return slices->containsNestedClasses();
+    }
+    return false;
+}
+
 PyObject*
 IcePy::TypedInvocation::unmarshalException(const pair<const Ice::Byte*, const Ice::Byte*>& bytes)
 {
@@ -1460,6 +1479,7 @@ IcePy::TypedInvocation::unmarshalException(const pair<const Ice::Byte*, const Ic
     string id;
     is->read(id);
     const string origId = id;
+    is->setCurrentObjectMarker();
 
     while(!id.empty())
     {
@@ -1471,6 +1491,10 @@ IcePy::TypedInvocation::unmarshalException(const pair<const Ice::Byte*, const Ic
             {
                 is->readPendingObjects();
             }
+            else if(info->isUnsliceable && hasClasses(ex))
+            {
+                is->readPendingObjects();
+            }
 
             if(validateException(ex.get()))
             {
@@ -1494,11 +1518,12 @@ IcePy::TypedInvocation::unmarshalException(const pair<const Ice::Byte*, const Ic
                 _communicator->getLogger()->trace("Slicing", "unknown exception type `" + id + "'");
             }
 
-            is->skipSlice(); // Slice off what we don't understand.
+            is->skipSlice(id); // Slice off what we don't understand.
 
             try
             {
                 is->read(id); // Read type id for next slice.
+                is->setCurrentObjectMarker();
             }
             catch(Ice::UnmarshalOutOfBoundsException& ex)
             {
@@ -1617,7 +1642,7 @@ IcePy::SyncTypedInvocation::invoke(PyObject* args, PyObject* /* kwds */)
                 //
                 // Unmarshal a user exception.
                 //
-                pair<const Ice::Byte*, const Ice::Byte*> rb(0, 0);
+                pair<const Ice::Byte*, const Ice::Byte*> rb(NullBytePtr, NullBytePtr);
                 if(!result.empty())
                 {
                     rb.first = &result[0];
@@ -1637,7 +1662,7 @@ IcePy::SyncTypedInvocation::invoke(PyObject* args, PyObject* /* kwds */)
                 // Unmarshal the results. If there is more than one value to be returned, then return them
                 // in a tuple of the form (result, outParam1, ...). Otherwise just return the value.
                 //
-                pair<const Ice::Byte*, const Ice::Byte*> rb(0, 0);
+                pair<const Ice::Byte*, const Ice::Byte*> rb(NullBytePtr, NullBytePtr);
                 if(!result.empty())
                 {
                     rb.first = &result[0];
@@ -1777,7 +1802,7 @@ IcePy::AsyncTypedInvocation::invoke(PyObject* args, PyObject* /* kwds */)
     try
     {
         checkAsyncTwowayOnly(_prx);
-        pair<const Ice::Byte*, const Ice::Byte*> pparams(0, 0);
+        pair<const Ice::Byte*, const Ice::Byte*> pparams(reinterpret_cast<const Ice::Byte*>(0), reinterpret_cast<const Ice::Byte*>(0));
         if(!params.empty())
         {
             pparams.first = &params[0];
@@ -2066,7 +2091,7 @@ IcePy::OldAsyncTypedInvocation::invoke(PyObject* args, PyObject* /* kwds */)
     try
     {
         checkTwowayOnly(_prx);
-        pair<const Ice::Byte*, const Ice::Byte*> pparams(0, 0);
+        pair<const Ice::Byte*, const Ice::Byte*> pparams(NullBytePtr, NullBytePtr);
         if(!params.empty())
         {
             pparams.first = &params[0];
@@ -2249,7 +2274,7 @@ IcePy::SyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */)
 #endif
     Py_ssize_t sz = inParams->ob_type->tp_as_buffer->bf_getcharbuffer(inParams, 0, &charBuf);
     const Ice::Byte* mem = reinterpret_cast<const Ice::Byte*>(charBuf);
-    pair<const ::Ice::Byte*, const ::Ice::Byte*> in(0, 0);
+    pair<const Ice::Byte*, const Ice::Byte*> in(NullBytePtr, NullBytePtr);
     if(sz > 0)
     {
         in.first = mem;
@@ -2434,7 +2459,7 @@ IcePy::AsyncBlobjectInvocation::invoke(PyObject* args, PyObject* kwds)
 #endif
     Py_ssize_t sz = inParams->ob_type->tp_as_buffer->bf_getcharbuffer(inParams, 0, &charBuf);
     const Ice::Byte* mem = reinterpret_cast<const Ice::Byte*>(charBuf);
-    pair<const ::Ice::Byte*, const ::Ice::Byte*> in(0, 0);
+    pair<const Ice::Byte*, const Ice::Byte*> in(NullBytePtr, NullBytePtr);
     if(sz > 0)
     {
         in.first = mem;
@@ -2708,7 +2733,7 @@ IcePy::OldAsyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */)
 #endif
     Py_ssize_t sz = inParams->ob_type->tp_as_buffer->bf_getcharbuffer(inParams, 0, &charBuf);
     const Ice::Byte* mem = reinterpret_cast<const Ice::Byte*>(charBuf);
-    pair<const ::Ice::Byte*, const ::Ice::Byte*> in(0, 0);
+    pair<const Ice::Byte*, const Ice::Byte*> in(NullBytePtr, NullBytePtr);
     if(sz > 0)
     {
         in.first = mem;
@@ -3072,7 +3097,7 @@ IcePy::TypedUpcall::response(PyObject* args)
 
             Ice::ByteSeq bytes;
             os->finished(bytes);
-            pair<const Ice::Byte*, const Ice::Byte*> ob(0, 0);
+            pair<const Ice::Byte*, const Ice::Byte*> ob(NullBytePtr, NullBytePtr);
             if(!bytes.empty())
             {
                 ob.first = &bytes[0];
@@ -3148,10 +3173,14 @@ IcePy::TypedUpcall::exception(PyException& ex)
                     {
                         os->writePendingObjects();
                     }
+                    else if(info->isUnsliceable && hasClasses(ex.ex.get()))
+                    {
+                        os->writePendingObjects();
+                    }
 
                     Ice::ByteSeq bytes;
                     os->finished(bytes);
-                    pair<const Ice::Byte*, const Ice::Byte*> ob(0, 0);
+                    pair<const Ice::Byte*, const Ice::Byte*> ob(NullBytePtr, NullBytePtr);
                     if(!bytes.empty())
                     {
                         ob.first = &bytes[0];

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/ice.git



More information about the asterisk-scf-commits mailing list