Files
libreoffice/basic/source/inc/runtime.hxx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

421 lines
17 KiB
C++
Raw Normal View History

2010-10-27 13:11:31 +01:00
/* -*- 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 .
*/
2000-09-18 15:18:56 +00:00
#ifndef INCLUDED_BASIC_SOURCE_INC_RUNTIME_HXX
#define INCLUDED_BASIC_SOURCE_INC_RUNTIME_HXX
2000-09-18 15:18:56 +00:00
#include <basic/sberrors.hxx>
#include <basic/sbmeth.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbx.hxx>
#include <rtl/ustring.hxx>
2000-09-18 15:18:56 +00:00
#include <com/sun/star/uno/Sequence.hxx>
2000-09-26 08:02:02 +00:00
#include <osl/file.hxx>
#include <rtl/math.hxx>
#include <i18nlangtag/lang.h>
2000-09-18 15:18:56 +00:00
#include <vector>
#include <memory>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <unotools/localedatawrapper.hxx>
#include <o3tl/deleter.hxx>
#include <o3tl/typed_flags_set.hxx>
class SbiInstance; // active StarBASIC process
class SbiRuntime; // active StarBASIC procedure instance
2000-09-18 15:18:56 +00:00
struct SbiArgv; // Argv stack element
struct SbiGosub; // GOSUB stack element
2000-09-18 15:18:56 +00:00
class SbiImage; // Code-Image
class SbiIoSystem;
class SbiDdeControl;
class SbiDllMgr;
class SvNumberFormatter; // time/date functions
enum class SbiImageFlags;
2000-09-18 15:18:56 +00:00
enum class ForType {
To,
EachArray,
EachCollection,
EachXEnumeration
};
2000-09-18 15:18:56 +00:00
struct SbiForStack { // for/next stack:
SbiForStack* pNext; // Chain
SbxVariableRef refVar; // loop variable
SbxVariableRef refEnd; // end expression / for each: Array/BasicCollection object
SbxVariableRef refInc; // increment expression
// For each support
ForType eForType;
sal_Int32 nCurCollectionIndex;
std::unique_ptr<sal_Int32[]>
pArrayCurIndices;
std::unique_ptr<sal_Int32[]>
pArrayLowerBounds;
std::unique_ptr<sal_Int32[]>
pArrayUpperBounds;
css::uno::Reference< css::container::XEnumeration > xEnumeration;
SbiForStack()
: pNext(nullptr)
, eForType(ForType::To)
, nCurCollectionIndex(0)
{}
2000-09-18 15:18:56 +00:00
};
#define MAXRECURSION 500 //to prevent dead-recursions
enum class SbAttributes {
NONE = 0x0000,
READONLY = 0x0001,
HIDDEN = 0x0002,
DIRECTORY = 0x0010
};
2000-09-18 15:18:56 +00:00
namespace o3tl
{
template<> struct typed_flags<SbAttributes> : is_typed_flags<SbAttributes, 0x13> {};
}
2000-09-18 15:18:56 +00:00
class WildCard;
2000-09-18 15:18:56 +00:00
class SbiRTLData
{
public:
2000-09-26 08:02:02 +00:00
std::unique_ptr<osl::Directory> pDir;
SbAttributes nDirFlags;
short nCurDirPos;
2000-09-26 08:02:02 +00:00
OUString sFullNameToBeChecked;
std::unique_ptr<WildCard> pWildCard;
css::uno::Sequence< OUString > aDirSeq;
2000-09-18 15:18:56 +00:00
SbiRTLData();
~SbiRTLData();
};
// The instance matches a running StarBASIC. Many basics running at the same
// time are managed by chained instances. There is all the data that only lives
// when the BASIC is living too, like the I/O-system.
2000-09-18 15:18:56 +00:00
typedef std::vector< css::uno::Reference< css::lang::XComponent > > ComponentVector_t;
2000-09-18 15:18:56 +00:00
class SbiInstance
{
friend class SbiRuntime;
SbiRTLData aRTLData;
// file system
std::unique_ptr<SbiIoSystem, o3tl::default_delete<SbiIoSystem>> pIosys;
// DDE
std::unique_ptr<SbiDdeControl> pDdeCtrl;
// DLL-Calls (DECLARE)
std::unique_ptr<SbiDllMgr> pDllMgr;
std::shared_ptr<SvNumberFormatter> pNumberFormatter;
2000-09-18 15:18:56 +00:00
StarBASIC* pBasic;
LanguageType meFormatterLangType;
DateOrder meFormatterDateOrder;
sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
2000-09-18 15:18:56 +00:00
ErrCode nErr;
OUString aErrorMsg; // last error message for $ARG
sal_Int32 nErl; // current error line
bool bReschedule; // Flag: sal_True = Reschedule in main loop
bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
2000-09-18 15:18:56 +00:00
ComponentVector_t ComponentVector;
2000-09-18 15:18:56 +00:00
public:
SbiRuntime* pRun; // Call-Stack
// #31460 new concept for StepInto/Over/Out,
// explanation see runtime.cxx at SbiInstance::CalcBreakCallLevel()
sal_uInt16 nCallLvl;
sal_uInt16 nBreakCallLvl;
void CalcBreakCallLevel( BasicDebugFlags nFlags );
2000-09-18 15:18:56 +00:00
SbiInstance( StarBASIC* );
~SbiInstance();
void Error( ErrCode ); // trappable Error
void Error( ErrCode, const OUString& rMsg ); // trappable Error with message
void ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg );
void setErrorVB( sal_Int32 nVBNumber );
void FatalError( ErrCode ); // non-trappable Error
void FatalError( ErrCode, const OUString& ); // non-trappable Error
void Abort(); // with current error code
2000-09-18 15:18:56 +00:00
void Stop();
ErrCode const & GetErr() const { return nErr; }
const OUString& GetErrorMsg() const { return aErrorMsg; }
sal_Int32 GetErl() const { return nErl; }
void EnableReschedule( bool bEnable ) { bReschedule = bEnable; }
bool IsReschedule() const { return bReschedule; }
void EnableCompatibility( bool bEnable ) { bCompatibility = bEnable; }
bool IsCompatibility() const { return bCompatibility; }
2000-09-18 15:18:56 +00:00
ComponentVector_t& getComponentVector() { return ComponentVector; }
SbMethod* GetCaller( sal_uInt16 );
2000-09-18 15:18:56 +00:00
SbModule* GetActiveModule();
SbiIoSystem* GetIoSystem() { return pIosys.get(); }
SbiDdeControl* GetDdeControl() { return pDdeCtrl.get(); }
StarBASIC* GetBasic() { return pBasic; }
2000-09-18 15:18:56 +00:00
SbiDllMgr* GetDllMgr();
SbiRTLData& GetRTLData() const { return const_cast<SbiRTLData&>(aRTLData); }
2000-09-18 15:18:56 +00:00
std::shared_ptr<SvNumberFormatter> const & GetNumberFormatter();
sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
2000-09-18 15:18:56 +00:00
// offer NumberFormatter also static
static std::shared_ptr<SvNumberFormatter> PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx,
sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType const * peFormatterLangType=nullptr, DateOrder const * peFormatterDateOrder=nullptr );
2000-09-18 15:18:56 +00:00
};
// There's one instance of this class for every executed sub-program.
// This instance is the heart of the BASIC-machine and contains only local data.
2000-09-18 15:18:56 +00:00
class SbiRuntime
{
friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, bool bWrite );
2000-09-18 15:18:56 +00:00
typedef void( SbiRuntime::*pStep0 )();
typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 );
typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 );
static pStep0 aStep0[]; // opcode-table group 0
static pStep1 aStep1[];
static pStep2 aStep2[];
StarBASIC& rBasic; // StarBASIC instance
SbiInstance* pInst; // current thread
SbModule* pMod; // current module
SbMethod* pMeth; // method instance
SbiIoSystem* pIosys; // I/O-System
const SbiImage* pImg; // Code-Image
SbxArrayRef refExprStk; // expression stack
SbxArrayRef refCaseStk; // CASE expression stack
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
SbxVariableRef refRedim; // Array saved to use for REDIM
SbxVariableRef xDummyVar; // substitute for variables that weren't found
SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
SbiForStack* pForStk; // FOR/NEXT-Stack
sal_uInt16 nExprLvl; // depth of the expr-stack
sal_uInt16 nForLvl; // #118235: Maintain for level
const sal_uInt8* pCode; // current Code-Pointer
const sal_uInt8* pStmnt; // beginning of the last statement
const sal_uInt8* pError; // address of the current error handler
const sal_uInt8* pRestart; // restart-address
const sal_uInt8* pErrCode; // restart-address RESUME NEXT
const sal_uInt8* pErrStmnt; // restart-address RESUME 0
OUString aLibName; // Lib-name for declare-call
SbxArrayRef refParams; // current procedure parameters
SbxArrayRef refLocals; // local variable
SbxArrayRef refArgv;
// #74254, one refSaveObj is not enough! new: pRefSaveList (see above)
short nArgc;
bool bRun;
bool bError; // true: handle errors
bool bInError; // true: in an error handler
bool bBlocked; // true: blocked by next call level, #i48868
bool bVBAEnabled;
BasicDebugFlags nFlags; // Debugging-Flags
ErrCode nError;
sal_uInt16 nOps; // opcode counter
sal_uInt32 m_nLastTime;
2000-09-18 15:18:56 +00:00
std::vector<SbxVariableRef> aRefSaved; // #74254 save temporary references
std::vector<SbiGosub> pGosubStk; // GOSUB stack
std::vector<SbiArgv> pArgvStk; // ARGV-Stack
2000-09-18 15:18:56 +00:00
SbxVariable* FindElement
( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, ErrCode, bool bLocal, bool bStatic = false );
void SetupArgs( SbxVariable*, sal_uInt32 );
2000-09-18 15:18:56 +00:00
SbxVariable* CheckArray( SbxVariable* );
void PushVar( SbxVariable* );
SbxVariableRef PopVar();
SbxVariable* GetTOS();
void TOSMakeTemp();
void ClearExprStack();
2000-09-18 15:18:56 +00:00
void PushGosub( const sal_uInt8* );
void PopGosub();
2000-09-18 15:18:56 +00:00
void PushArgv();
void PopArgv();
void ClearArgvStack();
2000-09-18 15:18:56 +00:00
void PushFor();
void PushForEach();
void PopFor();
void ClearForStack();
2000-09-18 15:18:56 +00:00
void StepArith( SbxOperator );
void StepUnary( SbxOperator );
void StepCompare( SbxOperator );
2000-09-18 15:18:56 +00:00
void SetParameters( SbxArray* );
2000-09-18 15:18:56 +00:00
// HAS TO BE IMPLEMENTED SOME TIME
void DllCall( const OUString&, const OUString&, SbxArray*, SbxDataType, bool );
2000-09-18 15:18:56 +00:00
// #56204 swap out DIM-functionality into help method (step0.cxx)
void DimImpl(const SbxVariableRef& refVar);
2000-09-18 15:18:56 +00:00
static bool implIsClass( SbxObject const * pObj, const OUString& aClass );
void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt );
// the following routines are called by the single
// stepper and implement the single opcodes
2000-09-18 15:18:56 +00:00
void StepNOP(), StepEXP(), StepMUL(), StepDIV();
void StepMOD(), StepPLUS(), StepMINUS(), StepNEG();
void StepEQ(), StepNE(), StepLT(), StepGT();
void StepLE(), StepGE(), StepIDIV(), StepAND();
void StepOR(), StepXOR(), StepEQV(), StepIMP();
void StepNOT(), StepCAT(), StepLIKE(), StepIS();
void StepARGC();
2000-09-18 15:18:56 +00:00
void StepARGV(), StepINPUT(), StepLINPUT(), StepSTOP();
void StepGET(), StepSET(), StepVBASET(), StepPUT(), StepPUTC();
void StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bDefaultHandling = false );
2000-09-18 15:18:56 +00:00
void StepDIM(), StepREDIM(), StepREDIMP(), StepERASE();
void StepINITFOR(), StepNEXT(), StepERROR(), StepINITFOREACH();
2000-09-18 15:18:56 +00:00
void StepCASE(), StepENDCASE(), StepSTDERROR();
void StepNOERROR(), StepCHANNEL(), StepCHANNEL0(), StepPRINT();
void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT();
void StepRESTART(), StepEMPTY(), StepLEAVE();
void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR();
void StepARRAYACCESS(), StepBYVAL();
// all opcodes with one operand
void StepLOADNC( sal_uInt32 ), StepLOADSC( sal_uInt32 ), StepLOADI( sal_uInt32 );
void StepARGN( sal_uInt32 ), StepBASED( sal_uInt32 ), StepPAD( sal_uInt32 );
void StepJUMP( sal_uInt32 ), StepJUMPT( sal_uInt32 );
void StepJUMPF( sal_uInt32 ), StepONJUMP( sal_uInt32 );
void StepGOSUB( sal_uInt32 ), StepRETURN( sal_uInt32 );
void StepTESTFOR( sal_uInt32 ), StepCASETO( sal_uInt32 ), StepERRHDL( sal_uInt32 );
void StepRESUME( sal_uInt32 ), StepSETCLASS( sal_uInt32 ), StepVBASETCLASS( sal_uInt32 ), StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 );
bool checkClass_Impl( const SbxVariableRef& refVal, const OUString& aClass, bool bRaiseErrors, bool bDefault );
void StepCLOSE( sal_uInt32 ), StepPRCHAR( sal_uInt32 ), StepARGTYP( sal_uInt32 );
// all opcodes with two operands
void StepRTL( sal_uInt32, sal_uInt32 ), StepPUBLIC( sal_uInt32, sal_uInt32 ), StepPUBLIC_P( sal_uInt32, sal_uInt32 );
void StepPUBLIC_Impl( sal_uInt32, sal_uInt32, bool bUsedForClassModule );
void StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, ErrCode, bool bStatic = false );
void StepFIND( sal_uInt32, sal_uInt32 ), StepELEM( sal_uInt32, sal_uInt32 );
void StepGLOBAL( sal_uInt32, sal_uInt32 ), StepLOCAL( sal_uInt32, sal_uInt32 );
void StepPARAM( sal_uInt32, sal_uInt32), StepCREATE( sal_uInt32, sal_uInt32 );
void StepCALL( sal_uInt32, sal_uInt32 ), StepCALLC( sal_uInt32, sal_uInt32 );
void StepCASEIS( sal_uInt32, sal_uInt32 ), StepSTMNT( sal_uInt32, sal_uInt32 );
Call implHandleSbxFlags also from StepSTATIC_Impl ...similarly to how it is called from StepLOCAL and StepPUBLIC_Impl. Now that there's basic/qa/vba_tests/mirr.vb containing Static Values(5) As Double ' Set up array. that caused CppunitTest_basic_macros to fail in UBSan builds with > /basic/source/runtime/runtime.cxx:4613:34: runtime error: load of value 262149, which is not a valid value for type 'SbxDataType' > #0 0x2b25aa72d3f5 in SbiRuntime::StepSTATIC_Impl(rtl::OUString&, SbxDataType&) /basic/source/runtime/runtime.cxx:4613:34 > #1 0x2b25aa6e821f in SbiRuntime::StepSTATIC(unsigned int, unsigned int) /basic/source/runtime/runtime.cxx:4629:5 > #2 0x2b25aa6ff0cf in SbiRuntime::Step() /basic/source/runtime/runtime.cxx:770:13 > #3 0x2b25aa237cba in SbModule::Run(SbMethod*) /basic/source/classes/sbxmod.cxx:1144:20 > #4 0x2b25aa232916 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) /basic/source/classes/sbxmod.cxx:809:21 > #5 0x2b259b0f51f1 in SfxBroadcaster::Broadcast(SfxHint const&) /svl/source/notify/SfxBroadcaster.cxx:49:13 > #6 0x2b25aa267165 in SbMethod::Broadcast(SfxHintId) /basic/source/classes/sbxmod.cxx:2126:9 > #7 0x2b25aaa96fb9 in SbxValue::SbxValue(SbxValue const&) /basic/source/sbx/sbxvalue.cxx:62:9 > #8 0x2b25aaae16ec in SbxVariable::SbxVariable(SbxVariable const&) /basic/source/sbx/sbxvar.cxx:73:7 > #9 0x2b25aaa51afd in SbxMethod::SbxMethod(SbxMethod const&) /basic/source/sbx/sbxobj.cxx:869:7 > #10 0x2b25aa72c12b in SbiRuntime::FindElement(SbxObject*, unsigned int, unsigned int, unsigned long, bool, bool) /basic/source/runtime/runtime.cxx:3518:37 > #11 0x2b25aa735314 in SbiRuntime::StepFIND_Impl(SbxObject*, unsigned int, unsigned int, unsigned long, bool) /basic/source/runtime/runtime.cxx:3941:14 > #12 0x2b25aa6da643 in SbiRuntime::StepFIND(unsigned int, unsigned int) /basic/source/runtime/runtime.cxx:3947:5 > #13 0x2b25aa6ff0cf in SbiRuntime::Step() /basic/source/runtime/runtime.cxx:770:13 > #14 0x2b25aa237cba in SbModule::Run(SbMethod*) /basic/source/classes/sbxmod.cxx:1144:20 > #15 0x2b25aa232916 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) /basic/source/classes/sbxmod.cxx:809:21 > #16 0x2b259b0f51f1 in SfxBroadcaster::Broadcast(SfxHint const&) /svl/source/notify/SfxBroadcaster.cxx:49:13 > #17 0x2b25aa267165 in SbMethod::Broadcast(SfxHintId) /basic/source/classes/sbxmod.cxx:2126:9 > #18 0x2b25aaa96fb9 in SbxValue::SbxValue(SbxValue const&) /basic/source/sbx/sbxvalue.cxx:62:9 > #19 0x2b25aaae16ec in SbxVariable::SbxVariable(SbxVariable const&) /basic/source/sbx/sbxvar.cxx:73:7 > #20 0x2b25aaa51afd in SbxMethod::SbxMethod(SbxMethod const&) /basic/source/sbx/sbxobj.cxx:869:7 > #21 0x2b25a9010a4a in MacroSnippet::Run(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) /basic/qa/cppunit/basictest.cxx:95:23 > #22 0x2b25a9012797 in MacroSnippet::Run() /basic/qa/cppunit/basictest.cxx:103:12 > #23 0x2b25a908e336 in (anonymous namespace)::VBATest::testMiscVBAFunctions() /basic/qa/cppunit/test_vba.cxx:125:34 > #24 0x2b25a90964a8 in void std::_Mem_fn_base<void ((anonymous namespace)::VBATest::*)(), true>::operator()<, void>((anonymous namespace)::VBATest*) const /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:600:11 > #25 0x2b25a90961d3 in void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1073:11 > #26 0x2b25a9095c81 in void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)>::operator()<, void>() /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1131:11 > #27 0x2b25a9094a79 in std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void ((anonymous namespace)::VBATest::*)()> ((anonymous namespace)::VBATest*)> >::_M_invoke(std::_Any_data const&) /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:1871:2 > #28 0x2b25a9046710 in std::function<void ()>::operator()() const /home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/functional:2271:14 > #29 0x2b25a9093175 in CppUnit::TestCaller<(anonymous namespace)::VBATest>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 > #30 0x2b256430d0ad in CppUnit::TestCaseMethodFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5 > #31 0x2b257d507ea6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /test/source/vclbootstrapprotector.cxx:39:14 > #32 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12 > #33 0x2b2573b757f6 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12 > #34 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12 > #35 0x2b256fd37d83 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16 > #36 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12 > #37 0x2b256424750f in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12 > #38 0x2b25642cbb77 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12 > #39 0x2b25642c1da0 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18 > #40 0x2b2564396efb in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:10 > #41 0x2b256430a12d in CppUnit::TestCase::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:5 > #42 0x2b25643102e3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5 > #43 0x2b256430f24d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 > #44 0x2b25643102e3 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5 > #45 0x2b256430f24d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 > #46 0x2b25643d68b6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:5 > #47 0x2b2564395049 in CppUnit::TestResult::runTest(CppUnit::Test*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:3 > #48 0x2b25643d7d57 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:3 > #49 0x5161f2 in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:306:13 > #50 0x510c8f in sal_main() /sal/cppunittester/cppunittester.cxx:456:14 > #51 0x50eda2 in main /sal/cppunittester/cppunittester.cxx:363:1 > #52 0x2b2565ff6b14 in __libc_start_main (/lib64/libc.so.6+0x21b14) > #53 0x433a04 in _start (/workdir/LinkTarget/Executable/cppunittester+0x433a04) (where 262149 = 0x40005, i.e., SbxDOUBLE|SBX_TYPE_VAR_TO_DIM_FLAG) Change-Id: Ib35a5c66c9b3266c13616f4cb896d533378a8eb0
2017-04-18 17:01:30 +02:00
SbxVariable* StepSTATIC_Impl(
OUString const & aName, SbxDataType t, sal_uInt32 nOp2 );
void StepOPEN( sal_uInt32, sal_uInt32 ), StepSTATIC( sal_uInt32, sal_uInt32 );
void StepTCREATE(sal_uInt32,sal_uInt32), StepDCREATE(sal_uInt32,sal_uInt32);
void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 );
void StepDCREATE_REDIMP(sal_uInt32,sal_uInt32), StepDCREATE_IMPL(sal_uInt32,sal_uInt32);
void StepFIND_CM( sal_uInt32, sal_uInt32 );
void StepFIND_STATIC( sal_uInt32, sal_uInt32 );
static void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 );
2000-09-18 15:18:56 +00:00
public:
void SetVBAEnabled( bool bEnabled );
bool IsImageFlag( SbiImageFlags n ) const;
sal_uInt16 GetBase() const;
sal_Int32 nLine,nCol1,nCol2;
2000-09-18 15:18:56 +00:00
SbiRuntime* pNext; // Stack-Chain
// tdf#79426, tdf#125180 - adds the information about a missing parameter
static void SetIsMissing( SbxVariable* );
// tdf#79426, tdf#125180 - checks if a variable contains the information about a missing parameter
static bool IsMissing( SbxVariable*, sal_uInt16 );
SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
2000-09-18 15:18:56 +00:00
~SbiRuntime();
void Error( ErrCode, bool bVBATranslationAlreadyDone = false ); // set error if != 0
void Error( ErrCode, const OUString& ); // set error if != 0
void FatalError( ErrCode ); // error handling = standard, set error
void FatalError( ErrCode, const OUString& ); // error handling = standard, set error
static sal_Int32 translateErrorToVba( ErrCode nError, OUString& rMsg );
bool Step(); // single step (one opcode)
void Stop() { bRun = false; }
void block() { bBlocked = true; }
void unblock() { bBlocked = false; }
2000-09-18 15:18:56 +00:00
SbModule* GetModule() { return pMod; }
BasicDebugFlags GetDebugFlags() const { return nFlags; }
void SetDebugFlags( BasicDebugFlags nFl ) { nFlags = nFl; }
SbMethod* GetCaller() { return pMeth;}
SbxVariable* GetExternalCaller(){ return mpExtCaller; }
2000-09-18 15:18:56 +00:00
SbiForStack* FindForStackItemForCollection( class BasicCollection const * pCollection );
SbxBase* FindElementExtern( const OUString& rName );
static bool isVBAEnabled();
2000-09-18 15:18:56 +00:00
};
inline void checkArithmeticOverflow( double d )
{
if( !std::isfinite( d ) )
StarBASIC::Error( ERRCODE_BASIC_MATH_OVERFLOW );
}
inline void checkArithmeticOverflow( SbxVariable const * pVar )
{
if( pVar->GetType() == SbxDOUBLE )
{
double d = pVar->GetDouble();
checkArithmeticOverflow( d );
}
}
2000-09-18 15:18:56 +00:00
StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic );
// Returns true if UNO is available, otherwise the old
2000-09-18 15:18:56 +00:00
// file system implementation has to be used
// (Implemented in iosys.cxx)
bool hasUno();
2000-09-18 15:18:56 +00:00
// Converts possibly relative paths to absolute paths
// according to the setting done by ChDir/ChDrive
// (Implemented in methods.cxx)
OUString getFullPath( const OUString& aRelPath );
2000-09-18 15:18:56 +00:00
// Implementation of StepRENAME with UCB
// (Implemented in methods.cxx, so step0.cxx
// has not to be infected with UNO)
void implStepRenameUCB( const OUString& aSource, const OUString& aDest );
2000-09-18 15:18:56 +00:00
void implStepRenameOSL( const OUString& aSource, const OUString& aDest );
bool IsBaseIndexOne();
2000-09-26 08:02:02 +00:00
void removeDimAsNewRecoverItem( SbxVariable* pVar );
2000-09-18 15:18:56 +00:00
#endif
2010-10-27 13:11:31 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */