[Libreoffice-commits] core.git: Branch 'ports/macosx10.5/master' - 73 commits - accessibility/inc accessibility/source android/Bootstrap apple_remote/Library_AppleRemote.mk apple_remote/source avmedia/Library_avmediaQuickTime.mk avmedia/Module_avmedia.mk avmedia/source basctl/source basic/source bridges/Library_cpp_uno.mk bridges/source chart2/source clew/Library_clew.mk clew/Module_clew.mk codemaker/source comphelper/inc comphelper/source config_host/config_version.h.in config_host.mk.in configure.ac connectivity/inc connectivity/source cppuhelper/qa cppuhelper/source cppuhelper/test cui/inc cui/source dbaccess/inc dbaccess/source desktop/inc desktop/Library_sofficeapp.mk desktop/source desktop/test desktop/util desktop/win32 desktop/WinResTarget_sbase.mk desktop/WinResTarget_scalc.mk desktop/WinResTarget_sdraw.mk desktop/WinResTarget_simpress.mk desktop/WinResTarget_smath.mk desktop/WinResTarget_sofficebin.mk desktop/WinResTarget_soffice.mk desktop/WinResTarget_sweb.mk desktop/WinResTarget_swri ter.mk drawinglayer/inc drawinglayer/source editeng/inc editeng/source eventattacher/source extensions/source external/apache-commons external/beanshell external/curl external/hsqldb external/jfreereport external/languagetool external/nss external/openssl external/python3 external/rhino extras/source filter/qa forms/inc forms/source fpicker/Library_fps_aqua.mk fpicker/source include/apple_remote include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppuhelper include/dbaccess include/default.rc include/drawinglayer include/editeng include/formula include/sal include/sax include/sfx2 include/svl include/svtools include/svx include/toolkit include/ucbhelper include/unotools include/version.hrc include/xmloff include/xmlscript instsetoo_native/CustomTarget_install.mk instsetoo_native/CustomTarget_setup.mk instsetoo_native/util io/source lingucomponent/Module_lingucomponent.mk lingucomponent/source lotuswordpro/inc lotuswordpro/source m ysqlc/source odk/CustomTarget_settings.mk odk/examples odk/Package_odk_headers.mk officecfg/registry oox/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk readlicense_oo/docs remotebridges/examples reportdesign/source Repository.mk sal/Library_sal.mk sal/osl sal/qa scaddins/source sc/inc sc/Module_sc.mk sc/source sc/uiconfig sd/source setup_native/install_name_patcher.app setup_native/source sfx2/source shell/Library_macbe.mk shell/source slideshow/source solenv/bin solenv/gbuild sot/inc stoc/source svgio/inc svgio/source svl/source svtools/inc svtools/source svx/inc svx/Library_svxcore.mk svx/source sw/CppunitTest_sw_ooxmlimport.mk sw/inc sw/Module_sw.mk sw/qa sw/source sysui/CustomTarget_deb.mk sysui/CustomTarget_rpm.mk sysui/desktop toolkit/Library_tk.mk toolkit/source translations unotools/source ure/source uui/inc vcl/inc vcl/Library_vcl.mk vcl/osx vcl/quartz vcl/source vcl/StaticLibrary_vclmain.mk vcl/unx vcl/workben writerfilter/inc xmloff/inc xmloff/sou rce

Douglas Mencken dougmencken at gmail.com
Sun Oct 18 03:05:57 PDT 2015


Rebased ref, commits from common ancestor:
commit 3161a57f3be545d065e5c05ee33035e9de276697
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Fri Oct 16 16:12:46 2015 -0400

    temporarily(?) disable ww8export & ww8import qa-tests for Mac OS X 10.5
    
    Change-Id: If4ac2239c3f6ed9d992072a537e3728e1fdbee4e

diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 7dfd541..03fa9a9 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -62,8 +62,8 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_ooxmlfieldexport \
     CppunitTest_sw_ooxmlw14export \
     CppunitTest_sw_ooxmlimport \
-    CppunitTest_sw_ww8export \
-    CppunitTest_sw_ww8import \
+    $(if $(filter-out 1050,$(MACOSX_SDK_VERSION)),CppunitTest_sw_ww8export) \
+    $(if $(filter-out 1050,$(MACOSX_SDK_VERSION)),CppunitTest_sw_ww8import) \
     CppunitTest_sw_rtfexport \
     CppunitTest_sw_rtfimport \
     CppunitTest_sw_odfexport \
commit 291adee53ac47e6a3d4ab5f68d6e504ae050954c
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Thu Oct 15 11:00:00 2015 -0400

    [UNO~C++] [WiP] try to fix UNO bridge for gcc3_macosx_powerpc part

diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx
index 81bae49f..556e87c 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx
@@ -49,7 +49,7 @@ static typelib_TypeClass cpp2uno_call(
 
         // gpreg:  [ret *], this, [gpr params]
         // fpreg:  [fpr params]
-        // ovrflw: [gpr or fpr params (properly aligned)]
+        // ovrflw: [gpr or fpr params (space for entire parameter list aligned)]
 
     // return
     typelib_TypeDescription * pReturnTypeDescr = 0;
@@ -83,11 +83,14 @@ static typelib_TypeClass cpp2uno_call(
 
     // stack space
     assert( sizeof(void *) == sizeof(sal_Int32) && "### unexpected size!" );
+
     // parameters
     void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
     void ** pCppArgs = pUnoArgs + nParams;
+
     // indices of values this have to be converted (interface conversion cpp<=>uno)
     sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+
     // type descriptions for reconversions
     typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
 
@@ -102,7 +105,6 @@ static typelib_TypeClass cpp2uno_call(
         if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
                 // value
         {
-
             switch (pParamTypeDescr->eTypeClass)
             {
 
@@ -524,8 +526,8 @@ static void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** gpreg
 
 int const codeSnippetSize = 136;
 
-unsigned char *  codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset,
-                              bool simpleRetType)
+unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex,
+                  sal_Int32 vtableOffset, bool simpleRetType )
 {
 
   // fprintf(stderr,"in codeSnippet functionIndex is %x\n", functionIndex);
@@ -679,8 +681,9 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
     typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
     sal_Int32 functionCount, sal_Int32 vtableOffset)
 {
-     (*slots) -= functionCount;
-     Slot * s = *slots;
+    (*slots) -= functionCount;
+    Slot * s = *slots;
+
   // fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
   // fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
   // fflush(stderr);
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous
index 7fb88fe..b2d22f0 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous
@@ -46,7 +46,7 @@ static typelib_TypeClass cpp2uno_call(
 
         // gpreg:  [ret *], this, [gpr params]
         // fpreg:  [fpr params]
-        // ovrflw: [gpr or fpr params (space for entire parameter list in structure format properly aligned)]
+        // ovrflw: [gpr or fpr params (space for entire parameter list aligned)]
 
     // return
     typelib_TypeDescription * pReturnTypeDescr = 0;
@@ -59,11 +59,13 @@ static typelib_TypeClass cpp2uno_call(
     sal_Int32 ngpreg = 0;
     sal_Int32 nfpreg = 0;
 
-
+    // handle optional return pointer
     if (pReturnTypeDescr)
     {
         if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
+        {
             pUnoReturn = pRegisterReturn; // direct way for simple types
+        }
         else // complex return via ptr (pCppReturn)
         {
             pCppReturn = *gpreg;
@@ -141,19 +143,19 @@ static typelib_TypeClass cpp2uno_call(
     pCppStack = (char *)ovrflw;
 
     // stack space
-    OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+    assert( sizeof(void *) == sizeof(sal_Int32) && "### unexpected size!" );
 
     // parameters
     void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
     void ** pCppArgs = pUnoArgs + nParams;
 
-    // indizes of values this have to be converted (interface conversion cpp<=>uno)
-    sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+    // indices of values this have to be converted (interface conversion cpp<=>uno)
+    sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
 
     // type descriptions for reconversions
     typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
 
-    sal_Int32 nTempIndizes   = 0;
+    sal_Int32 nTempIndices   = 0;
 
     for ( nPos = 0; nPos < nParams; ++nPos )
     {
@@ -199,9 +201,9 @@ static typelib_TypeClass cpp2uno_call(
             {
                 // uno out is unconstructed mem!
                 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
-                pTempIndizes[nTempIndizes] = nPos;
+                pTempIndices[nTempIndices] = nPos;
                 // will be released at reconversion
-                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
             }
             // is in/inout
             else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
@@ -209,9 +211,9 @@ static typelib_TypeClass cpp2uno_call(
                 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
                                         *(void **)pCppStack, pParamTypeDescr,
                                         pThis->getBridge()->getCpp2Uno() );
-                pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
+                pTempIndices[nTempIndices] = nPos; // has to be reconverted
                 // will be released at reconversion
-                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
             }
             else // direct way
             {
@@ -223,26 +225,24 @@ static typelib_TypeClass cpp2uno_call(
         pCppStack += sizeof(sal_Int32); // standard parameter length
     }
 
-
     // ExceptionHolder
     uno_Any aUnoExc; // Any will be constructed by callee
     uno_Any * pUnoExc = &aUnoExc;
 
     // invoke uno dispatch call
-    (*pThis->getUnoI()->pDispatcher)(
-         pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
+    (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
 
     // in case an exception occurred...
     if (pUnoExc)
     {
         // destruct temporary in/inout params
-        for ( ; nTempIndizes--; )
+        for ( ; nTempIndices--; )
         {
-            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+            sal_Int32 nIndex = pTempIndices[nTempIndices];
 
             if (pParams[nIndex].bIn) // is in/inout => was constructed
-                uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 );
-            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
+                uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
+            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
         }
         if (pReturnTypeDescr)
             TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
@@ -256,10 +256,10 @@ static typelib_TypeClass cpp2uno_call(
     else // else no exception occurred...
     {
         // temporary params
-        for ( ; nTempIndizes--; )
+        for ( ; nTempIndices--; )
         {
-            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
-            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
+            sal_Int32 nIndex = pTempIndices[nTempIndices];
+            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
 
             if (pParams[nIndex].bOut) // inout/out
             {
@@ -305,7 +305,7 @@ static typelib_TypeClass cpp_mediate(
         void ** gpreg, void ** fpreg, void ** ovrflw,
     sal_Int64 * pRegisterReturn /* space for register return */ )
 {
-    OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" );
+    assert( sizeof(sal_Int32)==sizeof(void *) && "### unexpected!" );
 
     // gpreg:  [ret *], this, [other gpr params]
     // fpreg:  [fpr params]
@@ -329,7 +329,7 @@ static typelib_TypeClass cpp_mediate(
 
     typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
 
-    OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
+    assert( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex && "### illegal vtable index!" );
     if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
     {
         throw RuntimeException(
@@ -339,7 +339,7 @@ static typelib_TypeClass cpp_mediate(
 
     // determine called method
     sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
-    OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
+    assert( nMemberPos < pTypeDescr->nAllMembers && "### illegal member index!" );
 
     TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
 
@@ -516,7 +516,7 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex,
     if (! simpleRetType )
         functionIndex |= 0x80000000;
 
-    // OSL_ASSERT( sizeof (long) == 4 );
+    // assert( sizeof (long) == 4 );
 
     // FIXME: why are we leaving an 8k gap in the stack here
     // FIXME: is this to allow room for signal handling frames?
@@ -652,7 +652,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
 
 bridges::cpp_uno::shared::VtableFactory::Slot *
 bridges::cpp_uno::shared::VtableFactory::initializeBlock(
-    void * block, sal_Int32 slotCount)
+    void * block, sal_Int32 slotCount, sal_Int32,
+    typelib_InterfaceTypeDescription *)
 {
     Slot * slots = mapBlockToVtable(block);
     slots[-2].fn = 0;
@@ -675,7 +676,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
     for (sal_Int32 i = 0; i < type->nMembers; ++i) {
         typelib_TypeDescription * member = 0;
         TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
-        OSL_ASSERT(member != 0);
+        assert(member != 0);
         switch (member->eTypeClass) {
         case typelib_TypeClass_INTERFACE_ATTRIBUTE:
             // Getter:
@@ -708,7 +709,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
             break;
 
         default:
-            OSL_ASSERT(false);
+            assert(false);
             break;
         }
         TYPELIB_DANGER_RELEASE(member);
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
index 9c09999..b0a4e3f 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
@@ -303,7 +303,7 @@ static void callVirtualMethod(
 
 static void cpp_call(
     bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
-    bridges::cpp_uno::shared::VtableSlot  aVtableSlot,
+    bridges::cpp_uno::shared::VtableSlot aVtableSlot,
     typelib_TypeDescriptionReference * pReturnTypeRef,
     sal_Int32 nParams, typelib_MethodParameter * pParams,
     void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
@@ -320,7 +320,7 @@ static void cpp_call(
     // return
     typelib_TypeDescription * pReturnTypeDescr = 0;
     TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
-    // assert( pReturnTypeDescr && "### expected return type description!" );
+    //assert( pReturnTypeDescr && "### expected return type description!" );
 
     void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
 
@@ -341,13 +341,13 @@ static void cpp_call(
         }
     }
     // push this
-        void* pAdjustedThisPtr = reinterpret_cast< void **>(pThis->getCppI()) + aVtableSlot.offset;
+    void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI()) + aVtableSlot.offset;
     *(void**)pCppStack = pAdjustedThisPtr;
     pCppStack += sizeof( void* );
         *pPT++ = 'I';
 
     // stack space
-    // assert( sizeof(void *) == sizeof(sal_Int32) && "### unexpected size!" );
+    //assert( sizeof(void *) == sizeof(sal_Int32) && "### unexpected size!" );
     // args
     void ** pCppArgs  = (void **)alloca( 3 * sizeof(void *) * nParams );
     // indices of values this have to be converted (interface conversion cpp<=>uno)
@@ -430,8 +430,7 @@ static void cpp_call(
             {
                 uno_copyAndConvertData(
                     *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
-                    pUnoArgs[nPos], pParamTypeDescr,
-                                        pThis->getBridge()->getUno2Cpp() );
+                    pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
 
                 pTempIndices[nTempIndices] = nPos; // has to be reconverted
                 // will be released at reconversion
@@ -499,8 +498,7 @@ static void cpp_call(
      catch (...)
      {
           // fill uno exception
-        fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions,
-                                  *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+        fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
 
         // temporary params
         for ( ; nTempIndices--; )
@@ -525,8 +523,8 @@ void unoInterfaceProxyDispatch(
     void * pReturn, void * pArgs[], uno_Any ** ppException )
 {
     // is my surrogate
-        bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
-            = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI);
+    bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
+            = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * > (pUnoI);
 
     switch (pMemberDescr->eTypeClass)
     {
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous
index 0f5e0bc..67435c0 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous
@@ -38,7 +38,7 @@ using namespace ::com::sun::star::uno;
 namespace
 {
 
-//==================================================================================================
+
 static void callVirtualMethod(
     void * pAdjustedThisPtr,
     sal_Int32 nVtableIndex,
@@ -77,9 +77,6 @@ static void callVirtualMethod(
      // Note: This keeps us from having to decode the signature twice and
      // prevents problems with later local variables.
 
-     // FIXME: I do not believe the following is true but we will keep the
-     // FIXME: extra space just to be safe until proven otherwise
-
      // Note: could require up to  2*nStackLongs words of parameter stack area
      // if the call has many float parameters (i.e. floats take up only 1
      // word on the stack but take 2 words in parameter area in the
@@ -267,16 +264,16 @@ static void callVirtualMethod(
         case typelib_TypeClass_CHAR:
         case typelib_TypeClass_SHORT:
         case typelib_TypeClass_UNSIGNED_SHORT:
-                *(unsigned short*)pRegisterReturn = (unsigned short)iret;
+            *(unsigned short*)pRegisterReturn = (unsigned short)iret;
             break;
 
         case typelib_TypeClass_BOOLEAN:
         case typelib_TypeClass_BYTE:
-                *(unsigned char*)pRegisterReturn = (unsigned char)iret;
+            *(unsigned char*)pRegisterReturn = (unsigned char)iret;
             break;
 
         case typelib_TypeClass_FLOAT:
-                *(float*)pRegisterReturn = (float)dret;
+            *(float*)pRegisterReturn = (float)dret;
             break;
 
         case typelib_TypeClass_DOUBLE:
@@ -288,7 +285,6 @@ static void callVirtualMethod(
 }
 
 
-//==================================================================================================
 static void cpp_call(
     bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
     bridges::cpp_uno::shared::VtableSlot aVtableSlot,
@@ -308,7 +304,7 @@ static void cpp_call(
     // return
     typelib_TypeDescription * pReturnTypeDescr = 0;
     TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
-    OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
+    //assert( pReturnTypeDescr && "### expected return type description!" );
 
     void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
 
@@ -330,22 +326,21 @@ static void cpp_call(
         }
     }
     // push this
-        void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI())
-      + aVtableSlot.offset;
+    void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI()) + aVtableSlot.offset;
     *(void**)pCppStack = pAdjustedThisPtr;
     pCppStack += sizeof( void* );
         *pPT++ = 'I';
 
     // stack space
-    OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+    //assert( sizeof(void *) == sizeof(sal_Int32) && "### unexpected size!" );
     // args
     void ** pCppArgs  = (void **)alloca( 3 * sizeof(void *) * nParams );
-    // indizes of values this have to be converted (interface conversion cpp<=>uno)
-    sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams);
+    // indices of values this have to be converted (interface conversion cpp<=>uno)
+    sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
     // type descriptions for reconversions
     typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
 
-    sal_Int32 nTempIndizes   = 0;
+    sal_Int32 nTempIndices   = 0;
 
     for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
     {
@@ -353,8 +348,7 @@ static void cpp_call(
         typelib_TypeDescription * pParamTypeDescr = 0;
         TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
 
-        if (!rParam.bOut
-                    && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
+        if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
         {
             uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
                                     pThis->getBridge()->getUno2Cpp() );
@@ -412,9 +406,9 @@ static void cpp_call(
                 uno_constructData(
                     *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
                     pParamTypeDescr );
-                pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call
+                pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
                 // will be released at reconversion
-                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
             }
             // is in/inout
             else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
@@ -423,9 +417,9 @@ static void cpp_call(
                     *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
                     pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
 
-                pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
+                pTempIndices[nTempIndices] = nPos; // has to be reconverted
                 // will be released at reconversion
-                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+                ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
             }
             else // direct way
             {
@@ -444,7 +438,7 @@ static void cpp_call(
 
     try
     {
-        OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
+        assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" );
         callVirtualMethod(
             pAdjustedThisPtr, aVtableSlot.index,
             pCppReturn, pReturnTypeDescr->eTypeClass, pParamType,
@@ -453,10 +447,10 @@ static void cpp_call(
         *ppUnoExc = 0;
 
         // reconvert temporary params
-        for ( ; nTempIndizes--; )
+        for ( ; nTempIndices--; )
         {
-            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
-            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
+            sal_Int32 nIndex = pTempIndices[nTempIndices];
+            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
 
             if (pParams[nIndex].bIn)
             {
@@ -491,12 +485,12 @@ static void cpp_call(
         fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
 
         // temporary params
-        for ( ; nTempIndizes--; )
+        for ( ; nTempIndices--; )
         {
-            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+            sal_Int32 nIndex = pTempIndices[nTempIndices];
             // destroy temp cpp param => cpp: every param was constructed
-            uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release );
-            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
+            uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
+            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
         }
         // return type
         if (pReturnTypeDescr)
@@ -514,8 +508,7 @@ void unoInterfaceProxyDispatch(
 {
     // is my surrogate
     bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
-           = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * > (pUnoI);
-        //  typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
+            = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * > (pUnoI);
 
     switch (pMemberDescr->eTypeClass)
     {
commit eee13605ec9d517778b1d5962403cef477333d43
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Thu Oct 15 10:46:53 2015 -0400

    [UNO~C++] restore vintage versions of cpp2uno.cxx and uno2cpp.cxx
    
    ... from famous commit 7aa6f1b01481c1d0f1a12f56ad197c797056c37b

diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous
new file mode 100644
index 0000000..7fb88fe
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx.previous
@@ -0,0 +1,719 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <com/sun/star/uno/genfunc.hxx>
+#include <uno/data.h>
+#include <typelib/typedescription.hxx>
+
+#include "bridges/cpp_uno/shared/bridge.hxx"
+#include "bridges/cpp_uno/shared/cppinterfaceproxy.hxx"
+#include "bridges/cpp_uno/shared/types.hxx"
+#include "bridges/cpp_uno/shared/vtablefactory.hxx"
+
+#include "share.hxx"
+
+using namespace ::com::sun::star::uno;
+
+namespace
+{
+
+//==================================================================================================
+static typelib_TypeClass cpp2uno_call(
+    bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
+    const typelib_TypeDescription * pMemberTypeDescr,
+    typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
+    sal_Int32 nParams, typelib_MethodParameter * pParams,
+        void ** gpreg, void ** fpreg, void ** ovrflw,
+    sal_Int64 * pRegisterReturn /* space for register return */ )
+{
+
+        // gpreg:  [ret *], this, [gpr params]
+        // fpreg:  [fpr params]
+        // ovrflw: [gpr or fpr params (space for entire parameter list in structure format properly aligned)]
+
+    // return
+    typelib_TypeDescription * pReturnTypeDescr = 0;
+    if (pReturnTypeRef)
+        TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
+
+    void * pUnoReturn = 0;
+    void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
+
+    sal_Int32 ngpreg = 0;
+    sal_Int32 nfpreg = 0;
+
+
+    if (pReturnTypeDescr)
+    {
+        if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
+            pUnoReturn = pRegisterReturn; // direct way for simple types
+        else // complex return via ptr (pCppReturn)
+        {
+            pCppReturn = *gpreg;
+            ngpreg++;
+            ++ovrflw;
+
+            pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
+                          ? alloca( pReturnTypeDescr->nSize )
+                          : pCppReturn); // direct way
+        }
+    }
+    // pop this
+    ngpreg++;
+    ++ovrflw;
+
+        // after handling optional return pointer and "this"
+        // make use of the space that is allocated to store all parameters in the callers stack
+        // by comying the proper registers filled with parameters to that space
+    char * pCppStack = (char *)ovrflw;
+
+
+    sal_Int32 nPos;
+
+    for ( nPos = 0; nPos < nParams; ++nPos )
+    {
+        const typelib_MethodParameter & rParam = pParams[nPos];
+        if (rParam.bOut)
+        {
+            if (ngpreg < 8)
+            {
+                *(sal_Int32 *)pCppStack = ((sal_Int32 *)gpreg)[ngpreg++];
+            }
+            pCppStack += sizeof (sal_Int32);
+        }
+        else
+        {
+        switch (rParam.pTypeRef->eTypeClass)
+        {
+        case typelib_TypeClass_FLOAT:
+            if (nfpreg < 13)
+            {
+                *(float *)pCppStack = ((double *)fpreg)[nfpreg++];
+            }
+            pCppStack += sizeof (float);
+            ngpreg += 1;
+            break;
+        case typelib_TypeClass_DOUBLE:
+            if (nfpreg < 13)
+            {
+                *(double *)pCppStack = ((double *)fpreg)[nfpreg++];
+            }
+            pCppStack += sizeof (double);
+            ngpreg += 2;
+            break;
+        case typelib_TypeClass_UNSIGNED_HYPER:
+        case typelib_TypeClass_HYPER:
+            if (ngpreg < 8)
+            {
+                *(sal_Int32 *)pCppStack = ((sal_Int32 *)gpreg)[ngpreg++];
+            }
+            pCppStack += sizeof (sal_Int32);
+                        // fall through on purpose
+        default:
+            if (ngpreg < 8)
+            {
+                *(sal_Int32 *)pCppStack = ((sal_Int32 *)gpreg)[ngpreg++];
+            }
+            pCppStack += sizeof (sal_Int32);
+        }
+        }
+    }
+
+        // now the stack has all of the parameters stored in it ready to be processed
+        // so we are ready to build the uno call stack
+    pCppStack = (char *)ovrflw;
+
+    // stack space
+    OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+
+    // parameters
+    void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
+    void ** pCppArgs = pUnoArgs + nParams;
+
+    // indizes of values this have to be converted (interface conversion cpp<=>uno)
+    sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+
+    // type descriptions for reconversions
+    typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
+
+    sal_Int32 nTempIndizes   = 0;
+
+    for ( nPos = 0; nPos < nParams; ++nPos )
+    {
+        const typelib_MethodParameter & rParam = pParams[nPos];
+        typelib_TypeDescription * pParamTypeDescr = 0;
+        TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
+
+        if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
+                // value
+        {
+            switch (pParamTypeDescr->eTypeClass)
+            {
+            case typelib_TypeClass_BOOLEAN:
+            case typelib_TypeClass_BYTE:
+                pCppArgs[nPos] = pCppStack +3;
+                pUnoArgs[nPos] = pCppStack +3;
+                break;
+            case typelib_TypeClass_CHAR:
+            case typelib_TypeClass_SHORT:
+            case typelib_TypeClass_UNSIGNED_SHORT:
+                pCppArgs[nPos] = pCppStack +2;
+                pUnoArgs[nPos] = pCppStack +2;
+                break;
+            case typelib_TypeClass_HYPER:
+            case typelib_TypeClass_UNSIGNED_HYPER:
+            case typelib_TypeClass_DOUBLE:
+                pCppArgs[nPos] = pCppStack;
+                pUnoArgs[nPos] = pCppStack;
+                pCppStack += sizeof(sal_Int32); // extra long (two regs)
+                break;
+            default:
+                pCppArgs[nPos] = pCppStack;
+                pUnoArgs[nPos] = pCppStack;
+            }
+            // no longer needed
+            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+        }
+        else // ptr to complex value | ref
+        {
+            pCppArgs[nPos] = *(void **)pCppStack;
+
+            if (! rParam.bIn) // is pure out
+            {
+                // uno out is unconstructed mem!
+                pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
+                pTempIndizes[nTempIndizes] = nPos;
+                // will be released at reconversion
+                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+            }
+            // is in/inout
+            else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
+            {
+                uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
+                                        *(void **)pCppStack, pParamTypeDescr,
+                                        pThis->getBridge()->getCpp2Uno() );
+                pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
+                // will be released at reconversion
+                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+            }
+            else // direct way
+            {
+                pUnoArgs[nPos] = *(void **)pCppStack;
+                // no longer needed
+                TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+            }
+        }
+        pCppStack += sizeof(sal_Int32); // standard parameter length
+    }
+
+
+    // ExceptionHolder
+    uno_Any aUnoExc; // Any will be constructed by callee
+    uno_Any * pUnoExc = &aUnoExc;
+
+    // invoke uno dispatch call
+    (*pThis->getUnoI()->pDispatcher)(
+         pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
+
+    // in case an exception occurred...
+    if (pUnoExc)
+    {
+        // destruct temporary in/inout params
+        for ( ; nTempIndizes--; )
+        {
+            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+
+            if (pParams[nIndex].bIn) // is in/inout => was constructed
+                uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 );
+            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
+        }
+        if (pReturnTypeDescr)
+            TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+
+        CPPU_CURRENT_NAMESPACE::raiseException(
+                    &aUnoExc, pThis->getBridge()->getUno2Cpp() );
+                // has to destruct the any
+        // is here for dummy
+        return typelib_TypeClass_VOID;
+    }
+    else // else no exception occurred...
+    {
+        // temporary params
+        for ( ; nTempIndizes--; )
+        {
+            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
+
+            if (pParams[nIndex].bOut) // inout/out
+            {
+                // convert and assign
+                uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
+                uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
+                                        pThis->getBridge()->getUno2Cpp() );
+            }
+            // destroy temp uno param
+            uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
+
+            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+        }
+        // return
+        if (pCppReturn) // has complex return
+        {
+            if (pUnoReturn != pCppReturn) // needs reconversion
+            {
+                uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
+                                        pThis->getBridge()->getUno2Cpp() );
+                // destroy temp uno return
+                uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
+            }
+            // complex return ptr is set to return reg
+            *(void **)pRegisterReturn = pCppReturn;
+        }
+        if (pReturnTypeDescr)
+        {
+            typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
+            TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+            return eRet;
+        }
+        else
+            return typelib_TypeClass_VOID;
+    }
+}
+
+
+//==================================================================================================
+static typelib_TypeClass cpp_mediate(
+    sal_Int32 nFunctionIndex,
+        sal_Int32 nVtableOffset,
+        void ** gpreg, void ** fpreg, void ** ovrflw,
+    sal_Int64 * pRegisterReturn /* space for register return */ )
+{
+    OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" );
+
+    // gpreg:  [ret *], this, [other gpr params]
+    // fpreg:  [fpr params]
+    // ovrflw: [gpr or fpr params (in space allocated for all params properly aligned)]
+
+        void * pThis;
+    if( nFunctionIndex & 0x80000000 )
+    {
+        nFunctionIndex &= 0x7fffffff;
+        pThis = gpreg[1];
+    }
+    else
+        {
+        pThis = gpreg[0];
+        }
+
+        pThis = static_cast< char * >(pThis) - nVtableOffset;
+        bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
+    = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(pThis);
+
+
+    typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
+
+    OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
+    if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
+    {
+        throw RuntimeException(
+            rtl::OUString( "illegal vtable index!" ),
+            (XInterface *)pThis );
+    }
+
+    // determine called method
+    sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
+    OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
+
+    TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
+
+    typelib_TypeClass eRet;
+    switch (aMemberDescr.get()->eTypeClass)
+    {
+    case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+    {
+        if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
+        {
+            // is GET method
+            eRet = cpp2uno_call(
+                pCppI, aMemberDescr.get(),
+                ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
+                0, 0, // no params
+                gpreg, fpreg, ovrflw, pRegisterReturn );
+        }
+        else
+        {
+            // is SET method
+            typelib_MethodParameter aParam;
+            aParam.pTypeRef =
+                ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
+            aParam.bIn      = sal_True;
+            aParam.bOut     = sal_False;
+
+            eRet = cpp2uno_call(
+                pCppI, aMemberDescr.get(),
+                0, // indicates void return
+                1, &aParam,
+                gpreg, fpreg, ovrflw, pRegisterReturn );
+        }
+        break;
+    }
+    case typelib_TypeClass_INTERFACE_METHOD:
+    {
+        // is METHOD
+        switch (nFunctionIndex)
+        {
+        case 1: // acquire()
+            pCppI->acquireProxy(); // non virtual call!
+            eRet = typelib_TypeClass_VOID;
+            break;
+        case 2: // release()
+            pCppI->releaseProxy(); // non virtual call!
+            eRet = typelib_TypeClass_VOID;
+            break;
+        case 0: // queryInterface() opt
+        {
+            typelib_TypeDescription * pTD = 0;
+            TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
+            if (pTD)
+            {
+                XInterface * pInterface = 0;
+                (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
+                    pCppI->getBridge()->getCppEnv(),
+                    (void **)&pInterface, pCppI->getOid().pData, (typelib_InterfaceTypeDescription *)pTD );
+
+                if (pInterface)
+                {
+                    ::uno_any_construct(
+                        reinterpret_cast< uno_Any * >( gpreg[0] ),
+                        &pInterface, pTD, cpp_acquire );
+                    pInterface->release();
+                    TYPELIB_DANGER_RELEASE( pTD );
+                    *(void **)pRegisterReturn = gpreg[0];
+                    eRet = typelib_TypeClass_ANY;
+                    break;
+                }
+                TYPELIB_DANGER_RELEASE( pTD );
+            }
+        } // else perform queryInterface()
+        default:
+            eRet = cpp2uno_call(
+                pCppI, aMemberDescr.get(),
+                ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
+                ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
+                ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
+                gpreg, fpreg, ovrflw, pRegisterReturn );
+        }
+        break;
+    }
+    default:
+    {
+        throw RuntimeException(
+            rtl::OUString( "no member description found!" ),
+            (XInterface *)pThis );
+    }
+    }
+
+    return eRet;
+}
+
+//==================================================================================================
+/**
+ * is called on incoming vtable calls
+ * (called by asm snippets)
+ */
+static void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** gpregptr, void** fpregptr, void** ovrflw)
+{
+        sal_Int32     gpreg[8];
+        double        fpreg[13];
+
+        // FIXME: why are we restoring the volatile ctr register here
+    sal_Int32   ctrsave = ((sal_Int32*)gpregptr)[-1];
+
+        memcpy( gpreg, gpregptr, 32);
+        memcpy( fpreg, fpregptr, 104);
+
+    volatile long nRegReturn[2];
+
+        // sal_Bool bComplex = nFunctionIndex & 0x80000000 ? sal_True : sal_False;
+
+    typelib_TypeClass aType =
+             cpp_mediate( nFunctionIndex, nVtableOffset, (void**)gpreg, (void**)fpreg, ovrflw, (sal_Int64*)nRegReturn );
+
+        // FIXME: why are we restoring the volatile ctr register here
+        // FIXME: and why are we putting back the values for r4, r5, and r6 as well
+        // FIXME: this makes no sense to me, all of these registers are volatile!
+    __asm__( "lwz r4, %0\n\t"
+        "mtctr r4\n\t"
+        "lwz r4, %1\n\t"
+        "lwz r5, %2\n\t"
+        "lwz r6, %3\n\t"
+         : : "m"(ctrsave), "m"(gpreg[1]), "m"(gpreg[2]), "m"(gpreg[3]) );
+
+    switch( aType )
+    {
+
+                // move return value into register space
+                // (will be loaded by machine code snippet)
+
+                case typelib_TypeClass_BOOLEAN:
+                case typelib_TypeClass_BYTE:
+                  __asm__( "lbz r3,%0\n\t" : :
+               "m"(nRegReturn[0]) );
+                  break;
+
+                case typelib_TypeClass_CHAR:
+                case typelib_TypeClass_SHORT:
+                case typelib_TypeClass_UNSIGNED_SHORT:
+                  __asm__( "lhz r3,%0\n\t" : :
+               "m"(nRegReturn[0]) );
+                  break;
+
+        case typelib_TypeClass_FLOAT:
+                  __asm__( "lfs f1,%0\n\t" : :
+                           "m" (*((float*)nRegReturn)) );
+          break;
+
+        case typelib_TypeClass_DOUBLE:
+          __asm__( "lfd f1,%0\n\t" : :
+                           "m" (*((double*)nRegReturn)) );
+          break;
+
+        case typelib_TypeClass_HYPER:
+        case typelib_TypeClass_UNSIGNED_HYPER:
+          __asm__( "lwz r4,%0\n\t" : :
+                           "m"(nRegReturn[1]) );  // fall through
+
+        default:
+          __asm__( "lwz r3,%0\n\t" : :
+                           "m"(nRegReturn[0]) );
+          break;
+    }
+}
+
+
+int const codeSnippetSize = 136;
+
+unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex,
+                  sal_Int32 vtableOffset, bool simpleRetType )
+{
+    if (! simpleRetType )
+        functionIndex |= 0x80000000;
+
+    // OSL_ASSERT( sizeof (long) == 4 );
+
+    // FIXME: why are we leaving an 8k gap in the stack here
+    // FIXME: is this to allow room for signal handling frames?
+    // FIXME: seems like overkill here but this is what was done for Mac OSX for gcc2
+    // FIXME: also why no saving of the non-volatile CR pieces here, to be safe
+    // FIXME: we probably should
+
+    /* generate this code */
+
+    // # so first save gpr 3 to gpr 10 (aligned to 4)
+    //  stw   r3, -8000(r1)
+    //  stw   r4, -7996(r1)
+    //  stw   r5, -7992(r1)
+    //  stw   r6, -7988(r1)
+    //  stw   r7, -7984(r1)
+    //  stw   r8, -7980(r1)
+    //  stw   r9, -7976(r1)
+    //  stw   r10,-7972(r1)
+
+    // # next save fpr 1 to fpr 13 (aligned to 8)
+    //  stfd  f1, -7968(r1)
+    //  stfd  f2, -7960(r1)
+    //  stfd  f3, -7952(r1)
+    //  stfd  f4, -7944(r1)
+    //  stfd  f5, -7936(r1)
+    //  stfd  f6, -7928(r1)
+    //  stfd  f7, -7920(r1)
+    //  stfd  f8, -7912(r1)
+    //  stfd  f9, -7904(r1)
+    //  stfd  f10,-7896(r1)
+    //  stfd  f11,-7888(r1)
+    //  stfd  f12,-7880(r1)
+    //  stfd  f13,-7872(r1)
+
+    // FIXME: ctr is volatile, while are we saving it and not CR?
+    // mfctr r3
+    // stw r3, -8004(r1)
+
+    // # now here is where cpp_vtable_call must go
+    // lis r3,0xdead
+    // ori r3,r3,0xbeef
+    // mtctr r3
+
+    // # now load up the functionIndex number
+    // lis r3, 0xdead
+    // ori r3,r3,0xbeef
+
+    // # now load up the vtableOffset
+    // lis r4, 0xdead
+    // ori r4,r4,0xbeef
+
+    // #now load up the pointer to the saved gpr registers
+    // addi r5,r1,-8000
+
+    // #now load up the pointer to the saved fpr registers
+    // addi r6,r1,-7968
+
+    // #now load up the pointer to the overflow call stack
+    // addi r7,r1,24 # frame pointer plus 24
+
+    // bctr
+
+    unsigned long * p = (unsigned long *) code;
+
+    * p++ = 0x9061e0c0;
+    * p++ = 0x9081e0c4;
+    * p++ = 0x90a1e0c8;
+    * p++ = 0x90c1e0cc;
+    * p++ = 0x90e1e0d0;
+    * p++ = 0x9101e0d4;
+    * p++ = 0x9121e0d8;
+    * p++ = 0x9141e0dc;
+    * p++ = 0xd821e0e0;
+    * p++ = 0xd841e0e8;
+    * p++ = 0xd861e0f0;
+    * p++ = 0xd881e0f8;
+    * p++ = 0xd8a1e100;
+    * p++ = 0xd8c1e108;
+    * p++ = 0xd8e1e110;
+    * p++ = 0xd901e118;
+    * p++ = 0xd921e120;
+    * p++ = 0xd941e128;
+    * p++ = 0xd961e130;
+    * p++ = 0xd981e138;
+    * p++ = 0xd9a1e140;
+    * p++ = 0x7c6902a6;
+    * p++ = 0x9061e0bc;
+    * p++ = 0x3c600000 | (((unsigned long)cpp_vtable_call) >> 16);
+    * p++ = 0x60630000 | (((unsigned long)cpp_vtable_call) & 0x0000FFFF);
+    * p++ = 0x7c6903a6;
+    * p++ = 0x3c600000 | (((unsigned long)functionIndex) >> 16);
+    * p++ = 0x60630000 | (((unsigned long)functionIndex) & 0x0000FFFF);
+    * p++ = 0x3c800000 | (((unsigned long)vtableOffset) >> 16);
+    * p++ = 0x60840000 | (((unsigned long)vtableOffset) & 0x0000FFFF);
+    * p++ = 0x38a1e0c0;
+    * p++ = 0x38c1e0e0;
+    * p++ = 0x38e10018;
+    * p++ = 0x4e800420;
+
+    return (code + codeSnippetSize);
+
+}
+
+
+}
+
+void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const * bptr, unsigned char const * eptr)
+{
+    int const lineSize = 32;
+    for (unsigned char const * p = bptr; p < eptr + lineSize; p += lineSize) {
+        __asm__ volatile ("dcbst 0, %0" : : "r"(p) : "memory");
+    }
+    __asm__ volatile ("sync" : : : "memory");
+    for (unsigned char const * p = bptr; p < eptr + lineSize; p += lineSize) {
+        __asm__ volatile ("icbi 0, %0" : : "r"(p) : "memory");
+    }
+    __asm__ volatile ("isync" : : : "memory");
+}
+
+struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
+
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
+{
+    return static_cast< Slot * >(block) + 2;
+}
+
+sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
+    sal_Int32 slotCount)
+{
+    return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
+}
+
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::initializeBlock(
+    void * block, sal_Int32 slotCount)
+{
+    Slot * slots = mapBlockToVtable(block);
+    slots[-2].fn = 0;
+    slots[-1].fn = 0;
+    return slots + slotCount;
+}
+
+unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
+    Slot ** slots, unsigned char * code,
+    typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
+    sal_Int32 functionCount, sal_Int32 vtableOffset)
+{
+    (*slots) -= functionCount;
+    Slot * s = *slots;
+
+  // fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
+  // fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
+  // fflush(stderr);
+
+    for (sal_Int32 i = 0; i < type->nMembers; ++i) {
+        typelib_TypeDescription * member = 0;
+        TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
+        OSL_ASSERT(member != 0);
+        switch (member->eTypeClass) {
+        case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+            // Getter:
+            (s++)->fn = code;
+            code = codeSnippet(
+                code, functionOffset++, vtableOffset,
+                bridges::cpp_uno::shared::isSimpleType(
+                    reinterpret_cast<
+                    typelib_InterfaceAttributeTypeDescription * >(
+                        member)->pAttributeTypeRef));
+
+            // Setter:
+            if (!reinterpret_cast<
+                typelib_InterfaceAttributeTypeDescription * >(
+                    member)->bReadOnly)
+            {
+                (s++)->fn = code;
+                code = codeSnippet(code, functionOffset++, vtableOffset, true);
+            }
+            break;
+
+        case typelib_TypeClass_INTERFACE_METHOD:
+            (s++)->fn = code;
+            code = codeSnippet(
+                code, functionOffset++, vtableOffset,
+                bridges::cpp_uno::shared::isSimpleType(
+                    reinterpret_cast<
+                    typelib_InterfaceMethodTypeDescription * >(
+                        member)->pReturnTypeRef));
+            break;
+
+        default:
+            OSL_ASSERT(false);
+            break;
+        }
+        TYPELIB_DANGER_RELEASE(member);
+    }
+    return code;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous
new file mode 100644
index 0000000..0f5e0bc
--- /dev/null
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx.previous
@@ -0,0 +1,636 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <sys/types.h>
+#include <sys/malloc.h>
+
+#include <com/sun/star/uno/genfunc.hxx>
+#include <uno/data.h>
+
+#include "bridges/cpp_uno/shared/bridge.hxx"
+#include "bridges/cpp_uno/shared/types.hxx"
+#include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
+#include "bridges/cpp_uno/shared/vtables.hxx"
+
+#include "share.hxx"
+
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+namespace
+{
+
+//==================================================================================================
+static void callVirtualMethod(
+    void * pAdjustedThisPtr,
+    sal_Int32 nVtableIndex,
+    void * pRegisterReturn,
+    typelib_TypeClass eReturnType,
+    char * pPT,
+    sal_Int32 * pStackLongs,
+    sal_Int32 /* nStackLongs */)
+{
+
+  // parameter list is mixed list of * and values
+  // reference parameters are pointers
+
+  // the basic idea here is to use gpr[8] as a storage area for
+  // the future values of registers r3 to r10 needed for the call,
+  // and similarly fpr[13] as a storage area for the future values
+  // of floating point registers f1 to f13
+
+     unsigned long * mfunc;        // actual function to be invoked
+     int gpr[8];                   // storage for gpregisters, map to r3-r10
+     int off;                      // offset used to find function
+     double fpr[13];               // storage for fpregisters, map to f1-f13
+     int n;                        // number of gprs mapped so far
+     int f;                        // number of fprs mapped so far
+     volatile long *p;             // pointer to parameter overflow area
+     int c;                        // character of parameter type being decoded
+     volatile double dret;         // temporary function return values
+     volatile int iret, iret2;
+
+     // Because of the Power PC calling conventions we could be passing
+     // parameters in both register types and on the stack. To create the
+     // stack parameter area we need we now simply allocate local
+     // variable storage param[] that is at least the size of the parameter stack
+     // (more than enough space) which we can overwrite the parameters into.
+
+     // Note: This keeps us from having to decode the signature twice and
+     // prevents problems with later local variables.
+
+     // FIXME: I do not believe the following is true but we will keep the
+     // FIXME: extra space just to be safe until proven otherwise
+
+     // Note: could require up to  2*nStackLongs words of parameter stack area
+     // if the call has many float parameters (i.e. floats take up only 1
+     // word on the stack but take 2 words in parameter area in the
+     // stack frame .
+
+
+     // unsigned long param[(2*nStackLongs)];
+
+     /* now begin to load the C++ function arguments into storage */
+     n = 0;
+     f = 0;
+
+
+     /* set up a pointer to the stack parameter area */
+     __asm__ ( "addi %0,r1,24" : "=r" (p) : /* no inputs */ );
+
+     // #i94421#, work around compiler error:
+     volatile long * pCopy = p;
+     (void) pCopy; // avoid warning about unused variable
+
+     // never called
+     // if (! pAdjustedThisPtr )CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
+
+
+     // now we need to parse the entire signature string
+     // until we get the END indicator
+
+     // treat complex return pointer like any other parameter
+
+     // parse the argument list up to the ending )
+
+     while (*pPT != 'X') {
+       c = *pPT;
+       switch (c) {
+
+       case 'D':                   /* type is double */
+            if (f < 13) {
+               fpr[f++] = *((double *)pStackLongs);   /* store in register */
+               n+=2;
+               p+=2;
+            } else {
+               *p++ = *pStackLongs;       /* or on the parameter stack */
+               *p++ = *(pStackLongs + 1);
+            }
+            pStackLongs += 2;
+            break;
+
+       case 'F':                   /* type is float */
+         /* floats are stored as 1 32 bit word on param stack */
+            if (f < 13) {
+               fpr[f++] = *((float *)pStackLongs);
+               n+=1;
+           p++;
+            } else {
+               *((float *)p) = *((float *)pStackLongs);
+               p += 1;
+            }
+            pStackLongs += 1;
+            break;
+
+       case 'H':                /* type is long long */
+            if (n < 8)
+            {
+               gpr[n++] = *pStackLongs;
+               p++;
+            }
+        else
+               *p++ = *pStackLongs;
+            if(n < 8)
+            {
+               gpr[n++] = *(pStackLongs+1);
+               p++;
+            }
+            else
+               *p++ = *(pStackLongs+1);
+            pStackLongs += 2;
+            break;
+
+       case 'S':
+            if (n < 8) {
+               gpr[n++] = *((unsigned short*)pStackLongs);
+               p++;
+            } else {
+               *p++ = *((unsigned short *)pStackLongs);
+            }
+            pStackLongs += 1;
+            break;
+
+       case 'B':
+            if (n < 8) {
+               gpr[n++] = *((char *)pStackLongs);
+               p++;
+            } else {
+               *p++ = *((char *)pStackLongs);
+            }
+            pStackLongs += 1;
+            break;
+
+       default:
+            if (n < 8) {
+               gpr[n++] = *pStackLongs;
+               p++;
+            } else {
+               *p++ = *pStackLongs;
+            }
+            pStackLongs += 1;
+            break;
+       }
+       pPT++;
+     }
+
+
+     /* figure out the address of the function we need to invoke */
+     off = nVtableIndex;
+     off = off * 4;                         // 4 bytes per slot
+     mfunc = *((unsigned long **)pAdjustedThisPtr);    // get the address of the vtable
+     mfunc = (unsigned long *)((char *)mfunc + off); // get the address from the vtable entry at offset
+     mfunc = *((unsigned long **)mfunc);                 // the function is stored at the address
+     typedef void (*FunctionCall)(sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32, sal_uInt32);
+     FunctionCall ptr = (FunctionCall)mfunc;
+
+    /* Set up the machine registers and invoke the function */
+
+    __asm__ __volatile__ (
+                "lwz     r3,      0(%0)\n\t"
+                "lwz     r4,      4(%0)\n\t"
+                "lwz     r5,      8(%0)\n\t"
+                "lwz     r6,      12(%0)\n\t"
+                "lwz     r7,      16(%0)\n\t"
+                "lwz     r8,      20(%0)\n\t"
+                "lwz     r9,      24(%0)\n\t"
+                "lwz     r10,     28(%0)\n\t"
+                "lfd     f1,      0(%1)\n\t"
+                "lfd     f2,      8(%1)\n\t"
+                "lfd     f3,      16(%1)\n\t"
+                "lfd     f4,      24(%1)\n\t"
+                "lfd     f5,      32(%1)\n\t"
+                "lfd     f6,      40(%1)\n\t"
+                "lfd     f7,      48(%1)\n\t"
+                "lfd     f8,      56(%1)\n\t"
+                "lfd     f9,      64(%1)\n\t"
+                "lfd     f10,     72(%1)\n\t"
+                "lfd     f11,     80(%1)\n\t"
+                "lfd     f12,     88(%1)\n\t"
+                "lfd     f13,     96(%1)\n\t"
+          : : "r" (gpr), "r" (fpr)
+          : "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+            "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9",
+            "f10", "f11", "f12", "f13"
+    );
+
+    // tell gcc that r3 to r10 are not available to it for doing the TOC and exception munge on the func call
+    register sal_uInt32 r3 __asm__("r3");
+    register sal_uInt32 r4 __asm__("r4");
+    register sal_uInt32 r5 __asm__("r5");
+    register sal_uInt32 r6 __asm__("r6");
+    register sal_uInt32 r7 __asm__("r7");
+    register sal_uInt32 r8 __asm__("r8");
+    register sal_uInt32 r9 __asm__("r9");
+    register sal_uInt32 r10 __asm__("r10");
+
+    (*ptr)(r3, r4, r5, r6, r7, r8, r9, r10);
+
+
+    __asm__ __volatile__ (
+                "stw     r3,      %1\n\t"
+                "stw     r4,      %2\n\t"
+                "stfd    f1,      %0\n\t"
+        : : "m" (dret), "m" (iret), "m" (iret2)
+    );
+
+
+    switch( eReturnType )
+    {
+        case typelib_TypeClass_HYPER:
+        case typelib_TypeClass_UNSIGNED_HYPER:
+            ((long*)pRegisterReturn)[1] = iret2;
+                        // fall thru on purpose
+        case typelib_TypeClass_LONG:
+        case typelib_TypeClass_UNSIGNED_LONG:
+        case typelib_TypeClass_ENUM:
+            ((long*)pRegisterReturn)[0] = iret;
+            break;
+
+        case typelib_TypeClass_CHAR:
+        case typelib_TypeClass_SHORT:
+        case typelib_TypeClass_UNSIGNED_SHORT:
+                *(unsigned short*)pRegisterReturn = (unsigned short)iret;
+            break;
+
+        case typelib_TypeClass_BOOLEAN:
+        case typelib_TypeClass_BYTE:
+                *(unsigned char*)pRegisterReturn = (unsigned char)iret;
+            break;
+
+        case typelib_TypeClass_FLOAT:
+                *(float*)pRegisterReturn = (float)dret;
+            break;
+
+        case typelib_TypeClass_DOUBLE:
+            *(double*)pRegisterReturn = dret;
+            break;
+        default:
+            break;
+    }
+}
+
+
+//==================================================================================================
+static void cpp_call(
+    bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
+    bridges::cpp_uno::shared::VtableSlot aVtableSlot,
+    typelib_TypeDescriptionReference * pReturnTypeRef,
+    sal_Int32 nParams, typelib_MethodParameter * pParams,
+    void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
+{
+      // max space for: [complex ret ptr], values|ptr ...
+      char * pCppStack      =
+          (char *)alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) );
+      char * pCppStackStart = pCppStack;
+
+        // need to know parameter types for callVirtualMethod so generate a signature string
+        char * pParamType = (char *) alloca(nParams+2);
+        char * pPT = pParamType;
+
+    // return
+    typelib_TypeDescription * pReturnTypeDescr = 0;
+    TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
+    OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
+
+    void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
+
+    if (pReturnTypeDescr)
+    {
+        if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
+        {
+            pCppReturn = pUnoReturn; // direct way for simple types
+        }
+        else
+        {
+            // complex return via ptr
+            pCppReturn = *(void **)pCppStack
+                           = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
+               ? alloca( pReturnTypeDescr->nSize )
+               : pUnoReturn); // direct way
+                        *pPT++ = 'C'; //signify that a complex return type on stack
+            pCppStack += sizeof(void *);
+        }
+    }
+    // push this
+        void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI())
+      + aVtableSlot.offset;
+    *(void**)pCppStack = pAdjustedThisPtr;
+    pCppStack += sizeof( void* );
+        *pPT++ = 'I';
+
+    // stack space
+    OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+    // args
+    void ** pCppArgs  = (void **)alloca( 3 * sizeof(void *) * nParams );
+    // indizes of values this have to be converted (interface conversion cpp<=>uno)
+    sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams);
+    // type descriptions for reconversions
+    typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
+
+    sal_Int32 nTempIndizes   = 0;
+
+    for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
+    {
+        const typelib_MethodParameter & rParam = pParams[nPos];
+        typelib_TypeDescription * pParamTypeDescr = 0;
+        TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
+
+        if (!rParam.bOut
+                    && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
+        {
+            uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
+                                    pThis->getBridge()->getUno2Cpp() );
+
+            switch (pParamTypeDescr->eTypeClass)
+            {
+
+                          // we need to know type of each param so that we know whether to use
+                          // gpr or fpr to pass in parameters:
+                          // Key: I - int, long, pointer, etc means pass in gpr
+                          //      B - byte value passed in gpr
+                          //      S - short value passed in gpr
+                          //      F - float value pass in fpr
+                          //      D - double value pass in fpr
+                          //      H - long long int pass in proper pairs of gpr (3,4) (5,6), etc
+                          //      X - indicates end of parameter description string
+
+                  case typelib_TypeClass_LONG:
+                  case typelib_TypeClass_UNSIGNED_LONG:
+                  case typelib_TypeClass_ENUM:
+                *pPT++ = 'I';
+                break;
+                   case typelib_TypeClass_SHORT:
+                  case typelib_TypeClass_CHAR:
+                  case typelib_TypeClass_UNSIGNED_SHORT:
+                            *pPT++ = 'S';
+                            break;
+                  case typelib_TypeClass_BOOLEAN:
+                  case typelib_TypeClass_BYTE:
+                            *pPT++ = 'B';
+                            break;
+                  case typelib_TypeClass_FLOAT:
+                            *pPT++ = 'F';
+                break;
+                case typelib_TypeClass_DOUBLE:
+                *pPT++ = 'D';
+                pCppStack += sizeof(sal_Int32); // extra long
+                break;
+            case typelib_TypeClass_HYPER:
+            case typelib_TypeClass_UNSIGNED_HYPER:
+                *pPT++ = 'H';
+                pCppStack += sizeof(sal_Int32); // extra long
+            default:
+                break;
+            }
+
+            // no longer needed
+            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+        }
+        else // ptr to complex value | ref
+        {
+            if (! rParam.bIn) // is pure out
+            {
+                // cpp out is constructed mem, uno out is not!
+                uno_constructData(
+                    *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
+                    pParamTypeDescr );
+                pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call
+                // will be released at reconversion
+                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+            }
+            // is in/inout
+            else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
+            {
+                uno_copyAndConvertData(
+                    *(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
+                    pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
+
+                pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
+                // will be released at reconversion
+                ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
+            }
+            else // direct way
+            {
+                *(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
+                // no longer needed
+                TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+            }
+                        *pPT++='I';
+        }
+        pCppStack += sizeof(sal_Int32); // standard parameter length
+    }
+
+        // terminate the signature string
+        *pPT++='X';
+        *pPT=0;
+
+    try
+    {
+        OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
+        callVirtualMethod(
+            pAdjustedThisPtr, aVtableSlot.index,
+            pCppReturn, pReturnTypeDescr->eTypeClass, pParamType,
+            (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
+        // NO exception occurred...
+        *ppUnoExc = 0;
+
+        // reconvert temporary params
+        for ( ; nTempIndizes--; )
+        {
+            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+            typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
+
+            if (pParams[nIndex].bIn)
+            {
+                if (pParams[nIndex].bOut) // inout
+                {
+                    uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
+                    uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
+                                            pThis->getBridge()->getCpp2Uno() );
+                }
+            }
+            else // pure out
+            {
+                uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
+                                        pThis->getBridge()->getCpp2Uno() );
+            }
+            // destroy temp cpp param => cpp: every param was constructed
+            uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
+
+            TYPELIB_DANGER_RELEASE( pParamTypeDescr );
+        }
+        // return value
+        if (pCppReturn && pUnoReturn != pCppReturn)
+        {
+            uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
+                                    pThis->getBridge()->getCpp2Uno() );
+            uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
+        }
+    }
+     catch (...)
+     {
+          // fill uno exception
+        fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+
+        // temporary params
+        for ( ; nTempIndizes--; )
+        {
+            sal_Int32 nIndex = pTempIndizes[nTempIndizes];
+            // destroy temp cpp param => cpp: every param was constructed
+            uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release );
+            TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
+        }
+        // return type
+        if (pReturnTypeDescr)
+            TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
+    }
+}
+
+}
+
+namespace bridges { namespace cpp_uno { namespace shared {
+
+void unoInterfaceProxyDispatch(
+    uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
+    void * pReturn, void * pArgs[], uno_Any ** ppException )
+{
+    // is my surrogate
+    bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
+           = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * > (pUnoI);
+        //  typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
+
+    switch (pMemberDescr->eTypeClass)
+    {
+    case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+    {
+
+        VtableSlot aVtableSlot(
+            getVtableSlot(
+                reinterpret_cast<
+                    typelib_InterfaceAttributeTypeDescription const * >(
+                        pMemberDescr)));
+
+        if (pReturn)
+        {
+            // dependent dispatch
+            cpp_call(
+                pThis, aVtableSlot,
+                ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
+                0, 0, // no params
+                pReturn, pArgs, ppException );
+        }
+        else
+        {
+            // is SET
+            typelib_MethodParameter aParam;
+            aParam.pTypeRef =
+                ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
+            aParam.bIn      = sal_True;
+            aParam.bOut     = sal_False;
+
+            typelib_TypeDescriptionReference * pReturnTypeRef = 0;
+            OUString aVoidName("void");
+            typelib_typedescriptionreference_new(
+                &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
+
+            // dependent dispatch
+                        aVtableSlot.index += 1; //get then set method
+            cpp_call(
+                pThis, aVtableSlot,
+                pReturnTypeRef,
+                1, &aParam,
+                pReturn, pArgs, ppException );
+
+            typelib_typedescriptionreference_release( pReturnTypeRef );
+        }
+
+        break;
+    }
+    case typelib_TypeClass_INTERFACE_METHOD:
+    {
+
+        VtableSlot aVtableSlot(
+            getVtableSlot(
+                reinterpret_cast<
+                    typelib_InterfaceMethodTypeDescription const * >(
+                        pMemberDescr)));
+        switch (aVtableSlot.index)
+        {
+            // standard calls
+        case 1: // acquire uno interface
+            (*pUnoI->acquire)( pUnoI );
+            *ppException = 0;
+            break;
+        case 2: // release uno interface
+            (*pUnoI->release)( pUnoI );
+            *ppException = 0;
+            break;
+        case 0: // queryInterface() opt
+        {
+            typelib_TypeDescription * pTD = 0;
+            TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
+            if (pTD)
+            {
+                uno_Interface * pInterface = 0;
+                (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
+                    pThis->pBridge->getUnoEnv(),
+                    (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
+
+                if (pInterface)
+                {
+                    ::uno_any_construct(
+                        reinterpret_cast< uno_Any * >( pReturn ),
+                        &pInterface, pTD, 0 );
+                    (*pInterface->release)( pInterface );
+                    TYPELIB_DANGER_RELEASE( pTD );
+                    *ppException = 0;
+                    break;
+                }
+                TYPELIB_DANGER_RELEASE( pTD );
+            }
+        } // else perform queryInterface()
+        default:
+            // dependent dispatch
+            cpp_call(
+                pThis, aVtableSlot,
+                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
+                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
+                ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
+                pReturn, pArgs, ppException );
+        }
+        break;
+    }
+    default:
+    {
+        ::com::sun::star::uno::RuntimeException aExc(
+            OUString("illegal member type description!"),
+            ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
+
+        Type const & rExcType = ::getCppuType( &aExc );
+        // binary identical null reference
+        ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
+    }
+    }
+}
+
+} } }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f1544c3c44de2ddb6e22db5d0b62dbf41cc4c95c
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Fri Oct 9 15:53:20 2015 -0400

    add install_name_patcher.app
    
    Change-Id: I47e3e0a950c8070cf44dff36c0586896f159d847

diff --git a/setup_native/install_name_patcher.app/Contents/Info.plist b/setup_native/install_name_patcher.app/Contents/Info.plist
new file mode 100644
index 0000000..933dedc
--- /dev/null
+++ b/setup_native/install_name_patcher.app/Contents/Info.plist
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>UTExportedTypeDeclarations</key>
+
+	<key>UTImportedTypeDeclarations</key>
+
+	<key>CFBundleExecutable</key>
+	<string>Patcher.sh</string>
+	<key>CFBundleIconFile</key>
+	<string>lo_patcher.icns</string>
+	<key>CFBundleShortVersionString</key>
+	<string>9</string>
+	<key>CFBundleIdentifier</key>
+	<string>${BUNDLEIDENTIFIER}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleSignature</key>
+	<string>OOo3</string>
+	<key>LSRequiresCarbon</key>
+	<string>1</string>
+	<key>NSPrincipalClass</key>
+	<string>VCL_NSApplication</string>
+</dict>
+</plist>
diff --git a/setup_native/install_name_patcher.app/Contents/Patcher.sh b/setup_native/install_name_patcher.app/Contents/Patcher.sh
new file mode 100755
index 0000000..1ee9078
--- /dev/null
+++ b/setup_native/install_name_patcher.app/Contents/Patcher.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+MYDIR=$(dirname "$0")
+
+osascript "$MYDIR/patch.applescript"
diff --git a/setup_native/install_name_patcher.app/Contents/Resources/lo_patcher.icns b/setup_native/install_name_patcher.app/Contents/Resources/lo_patcher.icns
new file mode 100644
index 0000000..45fca0f
Binary files /dev/null and b/setup_native/install_name_patcher.app/Contents/Resources/lo_patcher.icns differ
diff --git a/setup_native/install_name_patcher.app/Contents/Tools/install-name-tool b/setup_native/install_name_patcher.app/Contents/Tools/install-name-tool
new file mode 100755
index 0000000..5ab176e
Binary files /dev/null and b/setup_native/install_name_patcher.app/Contents/Tools/install-name-tool differ
diff --git a/setup_native/install_name_patcher.app/Contents/Tools/otool b/setup_native/install_name_patcher.app/Contents/Tools/otool
new file mode 100755
index 0000000..29b67d1
Binary files /dev/null and b/setup_native/install_name_patcher.app/Contents/Tools/otool differ
diff --git a/setup_native/install_name_patcher.app/Contents/package.tar.bz2 b/setup_native/install_name_patcher.app/Contents/package.tar.bz2
new file mode 100644
index 0000000..e5e4905
Binary files /dev/null and b/setup_native/install_name_patcher.app/Contents/package.tar.bz2 differ
diff --git a/setup_native/install_name_patcher.app/Contents/patch.applescript b/setup_native/install_name_patcher.app/Contents/patch.applescript
new file mode 100755
index 0000000..d322056
--- /dev/null
+++ b/setup_native/install_name_patcher.app/Contents/patch.applescript
@@ -0,0 +1,586 @@
+(*
+
+ This file is part of the LibreOffice project.
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ This file incorporates work covered by the following license notice:
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements. See the NOTICE file distributed
+   with this work for additional information regarding copyright
+   ownership. The ASF licenses this file to you under the Apache
+   License, Version 2.0 (the "License"); you may not use this file
+   except in compliance with the License. You may obtain a copy of
+   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+*)
+
+global frameworksRelativePath
+global macosRelativePath
+set frameworksRelativePath to "/Contents/Frameworks"
+set macosRelativePath to "/Contents/MacOS"
+
+set tarballName to "package.tar.bz2"
+
+set libsSystemDefaultBasepath to "/usr/lib/"
+set libsSystemBasepaths to {libsSystemDefaultBasepath}
+
+set libNameStdcxx to "libstdc++.6.dylib"
+set libNameGccS to "libgcc_s.1.dylib"
+set listOfLibNames to {libNameStdcxx, libNameGccS}
+set newPathForLibs to "@loader_path/"
+set newPathForProgs to "@executable_path/../Frameworks/"
+
+set toolname to "install-name-tool"
+set toobindir to "Tools/"
+set otoolname to "otool"
+set isOtoolHere to false
+
+set path2me to POSIX path of ((path to me as text) & "::") -- path to this script's parent folder
+
+set OKLabel to "Ok"
+set doItLabel to "Do it"
+set PatchLabel to "Patch"
+set BreakLabel to "Break"
+set ByeLabel to "Bye"
+
+set welcomeMsg to "Welcome to Patcher!
+
+It may be used to fix your versions of LibreOffice"
+
+set chooseMyOwn to "not listed here (choose location)"
+set listPrompt to "Choose LibreOffice bundle which you want to patch"
+set chooseManualMsg to "Point to your LibreOffice application"
+set listDoneLabel to "This one"
+set listCancelLabel to BreakLabel
+set appIsNotLibreOfficeMsg to "is not a real LibreOffice
+
+Run the patcher again and choose another LibreOffice bundle"
+
+set IdentifyQ to "Can't extract package, most likely your account does not have the necessary privileges
+
+Do you want to identify as administrator and try again?"
+set IdentifyYES to "Yes, identify"
+set IdentifyNO to "Nope, cancel"
+set identifyFailedMsg to "Identification failed"
+
+set installCompleteMessage to "Everything done
+
+Enjoy!"
+
+set proceedOrNotMessage to "Proceed? Below is the list of files to fix entries for shared libraries"
+set messageAfterFixing to "Fix is done. Here is the updated list of files"
+set installOrNotMessage to "Install? Contents of package to expand to"
+
+set noToolMsg to "This patcher does not include " & quote & toolname & quote & " utility, so it is useless"
+
+set noLibsProgsMsg to "Search for libraries and programs failed"
+set alreadyFixedMsg to "It looks that all entries for shared libraries are already fixed"
+
+global appBundleType
+set appBundleType to "com.apple.application-bundle"
+
+global strNewline
+set strNewline to "
+"
+global strTab
+set strTab to "	"
+
+--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--
+
+-- ++++++++++++++++++++++++
+-- common functions
+-- ++++++++++++++++++++++++
+
+on replace_chars(this_text, search_string, replacement_string)
+	set AppleScript's text item delimiters to search_string
+	set item_list to every text item of this_text
+	set AppleScript's text item delimiters to replacement_string
+	set this_text to item_list as string
+	set AppleScript's text item delimiters to ""
+	return this_text
+end replace_chars
+
+on trim_string(theString, trimming)
+	if (trimming) then
+		repeat with i from 1 to (count theString) - 1
+			if (theString begins with space) then
+				set theString to text 2 thru -1 of theString
+			else
+				exit repeat
+			end if
+		end repeat
+		repeat with i from 1 to (count theString) - 1
+			if (theString ends with space) then
+				set theString to text 1 thru -2 of theString
+			else
+				exit repeat
+			end if
+		end repeat
+		if (theString is space) then set theString to ""
+	end if
+	return theString
+end trim_string
+
+on list2string(theList, itemSeparator, addBrackets)
+	set resultString to ""
+	if addBrackets as boolean then
+		set resultString to resultString & "{ "
+	end if
+	set isFirstItem to true
+	repeat with itemString in theList
+		if not isFirstItem then
+			set resultString to resultString & itemSeparator
+		else
+			set isFirstItem to false
+		end if
+		set resultString to resultString & itemString as string
+	end repeat
+	if addBrackets as boolean then
+		set resultString to resultString & " }"
+	end if
+	return resultString
+end list2string
+
+-- ++++++++++++++++++++++++
+-- special functions
+-- ++++++++++++++++++++++++
+
+on choose_bundle_dialog(theMessage)
+	choose file with prompt theMessage of type appBundleType without showing package contents and invisibles
+end choose_bundle_dialog
+
+on isValidLibreOfficeBundle(pathToBundle)
+	if pathToBundle is "" then
+		return false
+	end if
+	
+	set pathToLibs to (pathToBundle as string) & frameworksRelativePath
+	set pathToProgs to (pathToBundle as string) & macosRelativePath
+	set pathToLibs to replace_chars(pathToLibs, "//", "/")
+	set pathToProgs to replace_chars(pathToProgs, "//", "/")
+	
+	set stringForGreping to "<string>LibreOffice"
+	set whereIsPlist to "/Contents/Info.plist"
+	set grepingScript to "grep " & quoted form of stringForGreping & " " & quoted form of ((pathToBundle as string) & whereIsPlist)
+	set findSofficeScript to "find " & quoted form of (pathToProgs as string) & " -iname soffice -type f -print"
+	set findLibappScript to "find " & quoted form of (pathToLibs as string) & " -iname libsofficeapp* -type f -print"
+	
+	try
+		set grepLOresult to (do shell script grepingScript)
+		---display dialog grepLOresult
+		
+		set foundSoffice to (do shell script findSofficeScript)
+		if foundSoffice is "" then
+			return false
+		end if
+		---display dialog foundSoffice
+		
+		set foundLibapp to (do shell script findLibappScript)
+		if foundLibapp is "" then
+			return false
+		end if
+		return true
+	on error
+		-- fall thru
+	end try
+	return false
+end isValidLibreOfficeBundle
+
+on libfile_to_entriesFromList(fillPath2Lib, listOfLibNames, path2otool)
+	set theResult to {}
+	set shellLine to quoted form of (path2otool as string) & " -L " & quoted form of fillPath2Lib
+	set otoolResult to ""
+	try
+		set otoolResult to (do shell script shellLine)
+	end try
+	if otoolResult is not "" then
+		repeat with aLibName in listOfLibNames
+			repeat with aLine in (paragraphs in otoolResult)
+				if aLine contains aLibName then
+					if aLine does not contain fillPath2Lib then -- it is that library itself
+						set theLine to replace_chars(aLine, strTab, " ") -- tabs to spaces
+						set theLine to replace_chars(theLine, ")", "") -- no closing brackets
+						set theLine to replace_chars(theLine, " (", strNewline) -- opening brackets to new lines
+						---set theLine to replace_chars(theLine, ",", strNewline) -- commas to new lines
+						set entryList to {}
+						repeat with lineInTheLine in (paragraphs in theLine)
+							set lineInTheLine to trim_string(lineInTheLine, true)
+							if lineInTheLine is not "" then
+								copy lineInTheLine to the end of entryList
+							end if
+						end repeat
+						copy first item in entryList to the end of theResult
+					else
+						exit repeat -- second entry is this library's id, skip it too
+					end if
+				end if
+			end repeat
+		end repeat
+	end if
+	if (count of theResult) is not 0 then
+		return list2string(theResult, strNewline, false) -- newline-separated string full of entries
+	end if
+	return ""
+end libfile_to_entriesFromList
+
+on libfile_to_entriesFromList_withBasepathList(fillPath2Lib, listOfLibNames, basePathList, path2otool)
+	set stringOfEntries to libfile_to_entriesFromList(fillPath2Lib, listOfLibNames, path2otool)
+	if stringOfEntries is "" then
+		return ""
+	end if
+	set listOfEntries to paragraphs in stringOfEntries
+	set listOfEntriesWithBasenames to {}
+	repeat with entry in listOfEntries
+		repeat with aBasepath in basePathList
+			if entry starts with aBasepath then
+				copy entry to the end of listOfEntriesWithBasenames
+			end if
+		end repeat
+	end repeat
+	if (count of listOfEntriesWithBasenames) is not 0 then
+		return list2string(listOfEntriesWithBasenames, strNewline, false)
+	end if
+	return ""
+end libfile_to_entriesFromList_withBasepathList
+
+on toResultStringOfIdentifyError(errNumber)
+	if errNumber is 2 then
+		return "tarball not found"
+	else if errNumber is -128 then
+		return "cancelled by user"
+	else if errNumber is -60005 then
+		return "username/password wrong"
+	end if
+	return "unknown error #" & errNumber as string
+end toResultStringOfIdentifyError
+
+--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--
+
+activate
+
+display dialog welcomeMsg buttons {BreakLabel, PatchLabel} default button 2 without icon
+if (button returned of result) is BreakLabel then
+	return 2 -- nevermind bye
+end if
+
+-- ************************
+-- see if "install name tool" is here
+-- ************************
+set path2tool to POSIX path of ((path2me as string) & toobindir & toolname)
+try
+	do shell script "test -f " & quoted form of (path2tool as string)
+on error
+	display dialog noToolMsg buttons {OKLabel} default button 1 with icon 0
+	return 1
+end try
+
+-- ************************
+-- see if "otool" is here
+-- ************************
+set path2otool to POSIX path of ((path2me as string) & toobindir & otoolname)
+try
+	do shell script "test -f " & quoted form of (path2otool as string)
+	set isOtoolHere to true
+on error
+	set isOtoolHere to false
+end try
+
+if not isOtoolHere then
+	-- without otool it's not possible to get actual basepath from the dylib
+	-- so assume it is only default /usr/lib/
+	set libsSystemBasepaths to {libsSystemDefaultBasepath}
+end if
+
+-- ************************
+-- check if tar is installed
+-- ************************
+set tarname to "tar"
+set fullPath2tar to ""
+try
+	set fullPath2tar to (do shell script "which " & tarname)
+on error
+	set noTarMsg to "Your system does not have " & quote & tarname & quote & " utility"
+	display dialog noTarMsg buttons {OKLabel} default button 1 with icon 1
+	return 1
+end try
+
+-- ************************
+-- search for LibreOffice app bundles
+-- ************************
+set found_LOes_all to ""
+
+try -- 'mdfind' may return an error when Spotlight is disabled
+	---set searchForAppBundlesScript to "mdfind \"kMDItemContentType == " & quoted form of appBundleType & "\"" -- find all bundles
+	set appBundleName to "LibreOffice*"
+	set searchForAppBundlesScript to "mdfind \"kMDItemContentType == " & quoted form of appBundleType & " && kMDItemDisplayName == " & quoted form of appBundleName & "\""
+	set found_LOes_all to do shell script searchForAppBundlesScript
+end try
+
+set found_LOes to {} -- empty AppleScript list
+repeat with currentApp in paragraphs in found_LOes_all
+	if currentApp does not start with "/Volumes" then
+		if isValidLibreOfficeBundle(currentApp) then
+			copy currentApp to the end of found_LOes
+		end if
+	end if
+end repeat
+
+if (count of found_LOes) is not 0 then
+	copy chooseMyOwn to the end of found_LOes
+end if
+
+-- ************************
+-- show file dialog if no LibreOffice found or show list of bundles to choose from
+-- ************************
+set didManualSelection to false
+if (count of found_LOes) is 0 then -- no LibreOffices found
+	-- yeah, one is supposed to "choose file"
+	set chosenLObundle to POSIX path of choose_bundle_dialog(chooseManualMsg)
+	set didManualSelection to true
+	---
+	---else if (get second item of found_LOes as string) is chooseMyOwn then -- only one LibreOffice found
+	---set chosenLObundle to (get first item of found_LOes) -- don't show dialog with list of choices
+else
+	set chosenLObundle to (choose from list found_LOes default items (get first item of found_LOes) with prompt listPrompt OK button name listDoneLabel cancel button name listCancelLabel)
+	if chosenLObundle is false then
+		return 2 -- cancelled by user
+	else if (chosenLObundle as string) is chooseMyOwn then
+		set chosenLObundle to POSIX path of choose_bundle_dialog(chooseManualMsg)
+		set didManualSelection to true
+	end if
+end if
+
+-- ************************
+-- check whether chosen path is really a LibreOffice bundle
+-- ************************
+if didManualSelection then
+	---set loBundleNameWithoutTrailingSlash to replace_chars(chosenLObundle as string, ".app/", ".app")
+	set loBundleNameWithoutTrailingSlash to text 1 through -2 of chosenLObundle as string
+	if not isValidLibreOfficeBundle(chosenLObundle) then
+		display dialog loBundleNameWithoutTrailingSlash & " " & appIsNotLibreOfficeMsg buttons {OKLabel} default button 1 with icon 1
+		return 3 -- wrong target-directory
+	end if
+end if
+
+-- ************************
+-- search for dylibs, jnilibs, programs
+-- ************************
+set search_path_libs to (chosenLObundle as string) & frameworksRelativePath
+set search_path_progs to (chosenLObundle as string) & macosRelativePath
+set search_path_libs to replace_chars(search_path_libs, "//", "/")
+set search_path_progs to replace_chars(search_path_progs, "//", "/")
+
+try
+	set found_dylibs_all to (do shell script "find " & quoted form of (search_path_libs as string) & " -iname *dylib* -type f -print")
+	---(do shell script "mdfind -onlyin " & quoted form of (search_path_libs as string) & " \" kMDItemDisplayName == '*dylib*' \" ")
+	set found_jnilibs_all to (do shell script "find " & quoted form of (search_path_libs as string) & " -iname *jnilib* -type f -print")
+	set found_programs_all to (do shell script "find " & quoted form of (search_path_progs as string) & " -type f -print | grep -v \".framework\" ")
+on error
+	display dialog noLibsProgsMsg buttons {OKLabel} default button 1 with icon 1
+	return 1
+end try
+
+set libraries_list to {}
+repeat with currentEntry in paragraphs in found_dylibs_all
+	if currentEntry does not end with ".py" and currentEntry does not end with ".pyc" and currentEntry does not end with ".pyo" then -- filter python stuff out
+		copy currentEntry to the end of libraries_list
+	end if
+end repeat
+repeat with currentEntry in paragraphs in found_jnilibs_all
+	copy currentEntry to the end of libraries_list
+end repeat
+
+set programs_list to {}
+repeat with currentEntry in paragraphs in found_programs_all
+	set file_result to (do shell script "file " & quoted form of (currentEntry as string))
+	if file_result contains "executable" and file_result does not contain "script" then
+		copy currentEntry to the end of programs_list
+	end if
+	---if file_result contains "shared library" then
+	-----last chance for this library
+	-----copy currentEntry to the end of executables_list
+	---end if
+end repeat
+
+-- ************************
+-- read actual basepath from one of dylibs
+-- ************************
+if isOtoolHere then
+	-- libsofficeapp.dylib is guaranteed to exist by isValidLibreOfficeBundle
+	set search_path_libs to (chosenLObundle as string) & frameworksRelativePath
+	set search_path_libs to replace_chars(search_path_libs, "//", "/")
+	set libToFind to "libsofficeapp*"
+	set findLibappScript to "find " & quoted form of (search_path_libs as string) & " -iname " & quote & libToFind & quote & " -type f -print"
+	set foundLibapp to (do shell script findLibappScript)
+	if foundLibapp is not "" then
+		set stringOfEntries to libfile_to_entriesFromList(foundLibapp, {libNameStdcxx}, path2otool)
+		if stringOfEntries is not "" then
+			set listOfEntries to paragraphs in stringOfEntries
+			set libEntry to first item of listOfEntries -- hope there's always only one entry for libstdc++
+			set libBasename to replace_chars(libEntry, libNameStdcxx, "") -- path without lib's name
+			---set libBasenameNoTrailingSlash to text 1 through -2 of libBasename
+			if libBasename is newPathForLibs then
+				-- looks like libsofficeapp dylib has already been fixed together with remaining libs
+				copy "/tmp/" to the end of libsSystemBasepaths
+			else
+				if libBasename is not libsSystemDefaultBasepath then -- not "/usr/lib/"
+					-- wow here is the real basepath
+					copy libBasename to the end of libsSystemBasepaths
+				end if
+			end if
+		else
+			-- it's unusual to have no entries at all but ...
+		end if
+	end if
+end if
+
+-- ************************
+-- show the list of files
+-- ************************
+set full_list_of_files to programs_list & libraries_list -- concatenate two separate lists into one
+set list_of_files_to_fix to {}
+
+set listToShowToUser to {}
+repeat with currentEntry in full_list_of_files
+	if not isOtoolHere then
+		copy currentEntry to the end of listToShowToUser -- just copy names
+		copy currentEntry to the end of list_of_files_to_fix
+	else
+		set stringOfEntries to libfile_to_entriesFromList_withBasepathList(currentEntry, listOfLibNames, libsSystemBasepaths, path2otool)
+		if stringOfEntries is not "" then
+			set listOfEntries to paragraphs in stringOfEntries
+			copy currentEntry & ": " & list2string(listOfEntries, ", ", false) to the end of listToShowToUser
+			copy currentEntry to the end of list_of_files_to_fix
+		else
+			---copy currentEntry & ": ¥ there's no shared library entries to fix ¥" to the end of listToShowToUser
+		end if
+	end if
+end repeat
+
+set needToFix to true
+if (count of list_of_files_to_fix) is not 0 then
+	set proceedOrNotFullMessage to proceedOrNotMessage & " " & list2string(listOfLibNames, " & ", false) & " from " & list2string(libsSystemBasepaths, ", ", true) & " using " & quote & toolname & quote
+	set the listchoice to (choose from list listToShowToUser with prompt proceedOrNotFullMessage OK button name OKLabel cancel button name BreakLabel with empty selection allowed)
+	if listchoice is false then
+		return 2 -- cancelled by user
+	end if
+else
+	set needToFix to false
+	display dialog alreadyFixedMsg & " for " & quoted form of (chosenLObundle as string) buttons {OKLabel} default button 1 with icon 1
+end if
+
+-- ************************
+-- fix programs & libraries
+-- ************************
+if needToFix then
+	repeat with currentFile in list_of_files_to_fix
+		set newPath to ""
+		if currentFile contains macosRelativePath then -- it is program
+			set newPath to newPathForProgs
+		else if currentFile contains frameworksRelativePath then -- it is library
+			set newPath to newPathForLibs
+		end if
+		
+		if newPath is not "" then
+			repeat with libName in listOfLibNames
+				repeat with libSysBasepath in libsSystemBasepaths
+					set nametool_call to quoted form of (path2tool as string) & " -change " & quoted form of (libSysBasepath & libName) & " " & quoted form of (newPath & libName) & " " & quoted form of (currentFile as string)
+					try
+						set nametool_result to (do shell script nametool_call)
+					on error
+						-- just ignore it
+					end try
+				end repeat
+			end repeat
+		end if
+	end repeat
+end if
+
+-- ************************
+-- check if everything is fixed
+-- show updated list of files
+-- ************************
+if needToFix then
+	if not isOtoolHere then
+		-- without otool it's not possible to check if install_name_tool succeeded
+		-- let's just hope that everything is okay
+	else
+		set listToShowToUser to {}
+		repeat with currentEntry in list_of_files_to_fix
+			set stringOfEntries to libfile_to_entriesFromList(currentEntry, listOfLibNames, path2otool)
+			---display dialog currentEntry & strNewline & "----------------------------------------" & strNewline & stringOfEntries
+			if stringOfEntries is not "" then
+				set listOfEntries to paragraphs in stringOfEntries
+				copy currentEntry & ": " & list2string(listOfEntries, ", ", false) to the end of listToShowToUser
+			end if
+		end repeat
+		if (count of listToShowToUser) is 0 then
+			copy "¥ there's no files ¥" to the end of listToShowToUser
+		end if
+		set the listchoice to (choose from list listToShowToUser with prompt messageAfterFixing OK button name OKLabel cancel button name BreakLabel with empty selection allowed)
+		if listchoice is false then
+			return 2
+		end if
+	end if
+end if
+
+-- ************************
+-- now unpack patch's package
+-- ************************
+
+set tarListCommand to quoted form of fullPath2tar & " -tjf " & quoted form of ((path2me as string) & "/" & tarballName)
+set tarExtractCommand to quoted form of fullPath2tar & " -C " & quoted form of (chosenLObundle as string) & " -xjf " & quoted form of ((path2me as string) & "/" & tarballName)
+set tarListCommand to replace_chars(tarListCommand, "//", "/")
+set tarExtractCommand to replace_chars(tarExtractCommand, "//", "/")
+
+try
+	set tarball_list_all to (do shell script tarListCommand)
+	set tarball_list_files to {}
+	repeat with currentEntry in (paragraphs in tarball_list_all)
+		if currentEntry does not end with "/" then
+			copy currentEntry to the end of tarball_list_files
+		end if
+	end repeat

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list