[Libreoffice-commits] .: pyuno/source
Joseph Powers
jpowers at kemper.freedesktop.org
Thu Feb 3 21:35:38 PST 2011
pyuno/source/module/pyuno_runtime.cxx | 52 +++++++++++++++++-----------------
1 file changed, 27 insertions(+), 25 deletions(-)
New commits:
commit b12f6b899ecfcdfb5e93192a0a4bcfd3fe8862b3
Author: Joseph Powers <jpowers27 at cox.net>
Date: Thu Feb 3 21:35:13 2011 -0800
Add missing #include <vector> to the file.
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index eff4dc2..ed34ddf 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -64,6 +64,8 @@ using com::sun::star::script::XInvocation;
using com::sun::star::beans::XMaterialHolder;
using com::sun::star::beans::XIntrospection;
+#include <vector>
+
namespace pyuno
{
#define USTR_ASCII(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
@@ -201,9 +203,9 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
if( bootstrapHandle.getFrom( USTR_ASCII( "PYUNO_LOGTARGET" ), str ) )
{
if( str.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "stdout" ) ) )
- *ppFile = stdout;
+ *ppFile = stdout;
else if( str.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "stderr" ) ) )
- *ppFile = stderr;
+ *ppFile = stderr;
else
{
oslProcessInfo data;
@@ -214,18 +216,18 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
OString o = OUStringToOString( str, osl_getThreadTextEncoding() );
o += ".";
o += OString::valueOf( (sal_Int32)data.Ident );
-
+
*ppFile = fopen( o.getStr() , "w" );
if ( *ppFile )
{
// do not buffer (useful if e.g. analyzing a crash)
- setvbuf( *ppFile, 0, _IONBF, 0 );
+ setvbuf( *ppFile, 0, _IONBF, 0 );
}
else
{
fprintf( stderr, "couldn't create file %s\n",
OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() );
-
+
}
}
}
@@ -249,7 +251,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
RuntimeCargo *c = new RuntimeCargo();
readLoggingConfig( &(c->logLevel) , &(c->logFile) );
log( c, LogLevel::CALL, "Instantiating pyuno bridge" );
-
+
c->valid = 1;
c->xContext = ctx;
c->xInvocation = Reference< XSingleServiceFactory > (
@@ -301,7 +303,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate introspection service" )),
Reference< XInterface > () );
-
+
Any a = ctx->getValueByName(OUString(
RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theTypeDescriptionManager" )) );
a >>= c->xTdMgr;
@@ -309,7 +311,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't retrieve typedescriptionmanager" )),
Reference< XInterface > () );
-
+
me->cargo =c;
return PyRef( reinterpret_cast< PyObject * > ( me ), SAL_NO_ACQUIRE );
}
@@ -330,7 +332,7 @@ void Runtime::initialize( const Reference< XComponentContext > & ctx )
PyRef globalDict, runtime;
getRuntimeImpl( globalDict , runtime );
RuntimeImpl *impl = reinterpret_cast< RuntimeImpl * > (runtime.get());
-
+
if( runtime.is() && impl->cargo->valid )
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
@@ -415,7 +417,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
"pyuno runtime must be initialized before calling any2PyObject" )),
Reference< XInterface > () );
}
-
+
switch (a.getValueTypeClass ())
{
case typelib_TypeClass_VOID:
@@ -432,7 +434,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
sal_Bool b = sal_Bool();
if ((a >>= b) && b)
- return Py_True;
+ return Py_True;
else
return Py_False;
}
@@ -542,7 +544,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
// add the message in a standard python way !
PyRef args( PyTuple_New( 1 ), SAL_NO_ACQUIRE );
-
+
// assuming that the Message is always the first member, wuuuu
void *pData = (void*)a.getValue();
OUString message = *(OUString * )pData;
@@ -740,7 +742,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
else
{
Runtime runtime;
- // should be removed, in case ByteSequence gets derived from String
+ // should be removed, in case ByteSequence gets derived from String
if( PyObject_IsInstance( o, getByteSequenceClass( runtime ).get() ) )
{
PyRef str(PyObject_GetAttrString( o , const_cast< char * >("value") ),SAL_NO_ACQUIRE);
@@ -750,7 +752,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
seq = Sequence<sal_Int8 > (
(sal_Int8*) PyString_AsString(str.get()), PyString_Size(str.get()));
}
- a <<= seq;
+ a <<= seq;
}
else
if( PyObject_IsInstance( o, getTypeClass( runtime ).get() ) )
@@ -836,7 +838,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
{
Reference< XInterface > mappedObject;
Reference< XInvocation > adapterObject;
-
+
// instance already mapped out to the world ?
PyRef2Adapter::iterator ii = impl->cargo->mappedObjects.find( PyRef( o ) );
if( ii != impl->cargo->mappedObjects.end() )
@@ -848,25 +850,25 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
{
// object got already bridged !
Reference< com::sun::star::lang::XUnoTunnel > tunnel( adapterObject, UNO_QUERY );
-
+
Adapter *pAdapter = ( Adapter * )
sal::static_int_cast< sal_IntPtr >(
tunnel->getSomething(
::pyuno::Adapter::getUnoTunnelImplementationId() ) );
-
+
mappedObject = impl->cargo->xAdapterFactory->createAdapter(
adapterObject, pAdapter->getWrappedTypes() );
}
- else
+ else
{
Sequence< Type > interfaces = invokeGetTypes( *this, o );
if( interfaces.getLength() )
{
Adapter *pAdapter = new Adapter( o, interfaces );
- mappedObject =
+ mappedObject =
getImpl()->cargo->xAdapterFactory->createAdapter(
pAdapter, interfaces );
-
+
// keep a list of exported objects to ensure object identity !
impl->cargo->mappedObjects[ PyRef(o) ] =
com::sun::star::uno::WeakReference< XInvocation > ( pAdapter );
@@ -901,7 +903,7 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
{
PyRef extractTraceback(
PyDict_GetItemString(unoModule.get(),"_uno_extract_printable_stacktrace" ) );
-
+
if( extractTraceback.is() )
{
PyRef args( PyTuple_New( 1), SAL_NO_ACQUIRE );
@@ -928,7 +930,7 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
// it may occur, that no traceback is given (e.g. only native code below)
str = PyRef( PyString_FromString( "no traceback available" ), SAL_NO_ACQUIRE);
}
-
+
if( isInstanceOfStructOrException( excValue.get() ) )
{
ret = pyObject2Any( excValue );
@@ -1020,7 +1022,7 @@ PyThreadAttach::~PyThreadAttach()
PyThreadState_Clear( tstate );
PyEval_ReleaseThread( tstate );
PyThreadState_Delete( tstate );
-
+
}
PyThreadDetach::PyThreadDetach() throw ( com::sun::star::uno::RuntimeException )
@@ -1044,7 +1046,7 @@ PyThreadDetach::~PyThreadDetach()
// python requires C LC_NUMERIC locale,
// always set even when it is already "C"
- setlocale( LC_NUMERIC, "C" );
+ setlocale( LC_NUMERIC, "C" );
}
More information about the Libreoffice-commits
mailing list