You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2020/12/22 15:58:33 UTC

[openoffice] branch AOO42X updated: Push latest updates: macOS, beanshell

This is an automated email from the ASF dual-hosted git repository.

jim pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new ecf1c5e  Push latest updates: macOS, beanshell
ecf1c5e is described below

commit ecf1c5e9ed4686657a2b296e936b55d484d94961
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Tue Dec 22 10:58:05 2020 -0500

    Push latest updates: macOS, beanshell
---
 main/beanshell/makefile.mk                         |  8 +++----
 main/beanshell/prj/d.lst                           |  2 +-
 .../source/cpp_uno/s5abi_macosx_x86-64/abi.cxx     |  2 +-
 .../source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx | 15 +++++-------
 .../source/cpp_uno/s5abi_macosx_x86-64/except.cxx  | 17 +++++---------
 .../source/cpp_uno/s5abi_macosx_x86-64/share.hxx   |  2 +-
 .../source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx |  3 ++-
 main/external_deps.lst                             |  8 +++----
 .../framework/provider/beanshell/template.bsh      | 27 +++++++++++++++++++---
 main/vcl/aqua/source/app/salinst.cxx               |  4 ++--
 10 files changed, 51 insertions(+), 37 deletions(-)

diff --git a/main/beanshell/makefile.mk b/main/beanshell/makefile.mk
index fddd5db..1da32f0 100644
--- a/main/beanshell/makefile.mk
+++ b/main/beanshell/makefile.mk
@@ -44,10 +44,10 @@ all:
 
 # --- Files --------------------------------------------------------
 
-TARFILE_NAME=bsh-2.0b6-src
-TARFILE_MD5=beeca87be45ec87d241ddd0e1bad80c1
-TARFILE_ROOTDIR=BeanShell-2.0b6
-PATCH_FILES=bsh-2.0b6-src.patch
+TARFILE_NAME=bsh-2.1.0-src
+TARFILE_MD5=34c726044fc4e2c7c3cf489fc239cdd5
+TARFILE_ROOTDIR=BeanShell-2.1.0
+PATCH_FILES=bsh-2.1.0-src.patch
 
 ADDITIONAL_FILES=makefile.mk
 
diff --git a/main/beanshell/prj/d.lst b/main/beanshell/prj/d.lst
index c24a063..db570fb 100644
--- a/main/beanshell/prj/d.lst
+++ b/main/beanshell/prj/d.lst
@@ -1 +1 @@
-..\%__SRC%\misc\build\BeanShell-2.0b6\dist\bsh-2.0b6.jar %_DEST%\bin%_EXT%\bsh.jar
+..\%__SRC%\misc\build\BeanShell-2.1.0\dist\bsh-2.1.0.jar %_DEST%\bin%_EXT%\bsh.jar
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.cxx
index 877eac2..201b119 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/abi.cxx
@@ -324,7 +324,7 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_
 
     n = classify_argument( pTypeRef, classes, 0 );
 
-    sal_uInt64 *pStructAlign = static_cast<sal_uInt64 *>( pStruct );
+    sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct );
     for ( n--; n >= 0; n-- )
         switch ( classes[n] )
         {
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
index 5a8dc9a..d7fd5b2 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/cpp2uno.cxx
@@ -102,7 +102,7 @@ static typelib_TypeClass cpp2uno_call(
 
 	// stack space
 	// parameters
-	void ** pUnoArgs = static_cast<void **>(alloca( 4 * sizeof(void *) * nParams ));
+	void ** pUnoArgs = reinterpret_cast<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 = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams));
@@ -340,7 +340,7 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 				case 0: // queryInterface() opt
 				{
 					typelib_TypeDescription * pTD = 0;
-					TYPELIB_DANGER_GET( &pTD, static_cast<Type *>( gpreg[2] )->getTypeLibType() );
+					TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( gpreg[2] )->getTypeLibType() );
 					if ( pTD )
 					{
 						XInterface * pInterface = 0;
@@ -352,7 +352,7 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 
 						if ( pInterface )
 						{
-							::uno_any_construct( static_cast<uno_Any *>( gpreg[0] ),
+							::uno_any_construct( reinterpret_cast<uno_Any *>( gpreg[0] ),
 												 &pInterface, pTD, cpp_acquire );
 
 							pInterface->release();
@@ -392,7 +392,7 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 }
 
 //==================================================================================================
-void privateSnippetExecutor( void )
+extern "C" void privateSnippetExecutor( void )
 {
 	asm volatile (
 		"	subq	$160, %rsp\n"
@@ -462,14 +462,11 @@ unsigned char * codeSnippet( unsigned char * code,
 
 	// movq $<nOffsetAndIndex>, %r10
     *reinterpret_cast<sal_uInt16 *>( code ) = 0xba49;
-    *reinterpret_cast<sal_uInt16 *>( code + 2 ) = nOffsetAndIndex & 0xFFFF;
-    *reinterpret_cast<sal_uInt32 *>( code + 4 ) = nOffsetAndIndex >> 16;
-    *reinterpret_cast<sal_uInt16 *>( code + 8 ) = nOffsetAndIndex >> 48;
+    *reinterpret_cast<sal_uInt64 *>( code + 2 ) = nOffsetAndIndex;
 
 	// movq $<address of the privateSnippetExecutor>, %r11
     *reinterpret_cast<sal_uInt16 *>( code + 10 ) = 0xbb49;
-    *reinterpret_cast<sal_uInt32 *>( code + 12 ) = reinterpret_cast<sal_uInt64>(privateSnippetExecutor);
-    *reinterpret_cast<sal_uInt32 *>( code + 16 ) = reinterpret_cast<sal_uInt64>(privateSnippetExecutor) >> 32;
+    *reinterpret_cast<sal_uInt64 *>( code + 12 ) = reinterpret_cast<sal_uInt64>( privateSnippetExecutor );
 
 	// jmpq *%r11
 	*reinterpret_cast<sal_uInt32 *>( code + 20 ) = 0x00e3ff49;
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
index e17cd06..2c4642d 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
@@ -156,7 +156,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
         buf.append( 'E' );
         
         OString symName( buf.makeStringAndClear() );
-        rtti = static_cast<std::type_info *>(dlsym( m_hApp, symName.getStr() ));
+        rtti = reinterpret_cast<std::type_info *>(dlsym( m_hApp, symName.getStr() ));
 
         if (rtti)
         {
@@ -193,9 +193,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
                     rtti = new __class_type_info( strdup( rttiName ) );
                 }
 
-                pair< t_rtti_map::iterator, bool > insertion(
-                    m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
-                OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" );
+                bool bOK = m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti )).second;
+                OSL_ENSURE( bOK, "### inserting new generated rtti failed?!" );
             }
             else // taking already generated rtti
             {
@@ -312,15 +311,11 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping
      * and that referenceCount is always >0 in the cases we handle
      */
     {
-        void ** oheader = reinterpret_cast<void **>(header);
         // Does this look like the struct __cxa_exception we were compiled w/?
-        // Agreed, this looks excessive, but this is wonky stuff
-        if (!*oheader && *(oheader+1) && *(oheader+2)) {
-            ; // It is... cool
-        } else {
+        // That is, is the 1st element NULL (*reserved)?
+        if (*reinterpret_cast<void **>(header)) {
             // Nope. it is pre llvm 10. So we back up a slot to offset
-            oheader--;  //
-            header = reinterpret_cast<__cxa_exception *>(oheader);  // type warnings
+            header = reinterpret_cast<__cxa_exception *>(reinterpret_cast<void **>(header) - 1);
         }
     }
 
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
index eeb118e..aa20c18 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx
@@ -109,8 +109,8 @@ public:
 
 class __si_class_type_info : public __class_type_info
 {
-public:
         const __class_type_info* mpBaseType;
+public:
         explicit __si_class_type_info( const char* pRttiName, __class_type_info* pBaseType)
         : __class_type_info( pRttiName), mpBaseType( pBaseType)
         {}
diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
index a58791c..c9f5e5d 100644
--- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
+++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/uno2cpp.cxx
@@ -150,7 +150,8 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
         : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
           "m" ( rax ), "m" ( rdx ), "m" ( xmm0 ), "m" ( xmm1 ),
           "m" (pCallStack) // dummy input to prevent the compiler from optimizing the alloca out
-        : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11",
+        : "rax", "rbx", "rcx", "rdx", "rdi", "rsi", "r8", "r9",
+          "r10", "r11", "r10", "r12", "r13", "r14", "r15", "rbx",
           "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
     );
 
diff --git a/main/external_deps.lst b/main/external_deps.lst
index b25649b..7f85648 100644
--- a/main/external_deps.lst
+++ b/main/external_deps.lst
@@ -260,10 +260,10 @@ if (RAT_JAR_HOME==BUILD)
     URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
 
 if (SOLAR_JAVA==TRUE && SYSTEM_BSH!=YES)
-    MD5 = beeca87be45ec87d241ddd0e1bad80c1
-    name = bsh-2.0b6-src.zip
-    URL1 = https://bintray.com/artifact/download/beanshell/Beanshell/org/apache-extras/beanshell/bsh/2.0b6/$(name)
-    URL2 = http://central.maven.org/maven2/org/apache-extras/beanshell/bsh/2.0b6/$(name)
+    MD5 = 34c726044fc4e2c7c3cf489fc239cdd5
+    name = bsh-2.1.0-src.zip
+#    URL1 = https://bintray.com/artifact/download/beanshell/Beanshell/org/apache-extras/beanshell/bsh/2.0b6/$(name)
+    URL2 = https://github.com/beanshell/beanshell/releases/download/2.1.0/$(name)
 
 ###############################################################################
 # Libraries with category B license
diff --git a/main/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh b/main/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
index 2e1e14a..3742583 100644
--- a/main/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
+++ b/main/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
@@ -37,7 +37,7 @@ import com.sun.star.frame.XModel;
     variable can be used to access the document for which this script
     was invoked.
 
-    Methods available are: 
+    Methods available are:
 
         XSCRIPTCONTEXT.getDocument() returns XModel
         XSCRIPTCONTEXT.getInvocationContext() returns XScriptInvocationContext or NULL
@@ -49,11 +49,12 @@ import com.sun.star.frame.XModel;
 
         http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
 */
-        
+
 // Hello World in BeanShell
 import com.sun.star.text.XTextDocument;
 import com.sun.star.text.XText;
 import com.sun.star.text.XTextRange;
+import bsh.Interpreter;
 
 oDoc = UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext());
 if ( oDoc == null )
@@ -62,7 +63,27 @@ if ( oDoc == null )
 xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
 xText = xTextDoc.getText();
 xTextRange = xText.getEnd();
-xTextRange.setString( "Hello World (in BeanShell)" );
+
+sb = new StringBuilder();
+sb.append("Hello World (in BeanShell v" + Interpreter.VERSION + ") \n\n");
+
+//
+import java.util.Map;
+import java.util.TreeMap;
+
+env=new TreeMap(System.getenv());
+
+ks=env.keySet();  // get keys
+ksit=ks.iterator(); // get iterator
+
+sb.append( "ENV Dump:\n" );
+while ( ksit.hasNext() )
+{
+      envName=ksit.next();
+      sb .append("\n[") .append(envName) .append("]=[") .append(env.get(envName)) .append("] ");
+}
+
+xText.getEnd().setString( sb.toString() );
 
 // BeanShell OpenOffice.org scripts should always return 0
 return 0;
diff --git a/main/vcl/aqua/source/app/salinst.cxx b/main/vcl/aqua/source/app/salinst.cxx
index c18f20e..4d27a87 100644
--- a/main/vcl/aqua/source/app/salinst.cxx
+++ b/main/vcl/aqua/source/app/salinst.cxx
@@ -785,9 +785,9 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
     {
         // #i103162#
         // wait until any thread (most likely the main thread)
-        // has dispatched an event, cop out at 100 ms
+        // has dispatched an event, cop out at 500 ms
         sal_uLong nCount;
-        TimeValue aVal = { 0, 100000000 };
+        TimeValue aVal = { 0, 500000000 };
         osl_resetCondition( maWaitingYieldCond );
         nCount = ReleaseYieldMutex();
         osl_waitCondition( maWaitingYieldCond, &aVal );