drop SbError typedef
in favour of ErrCode. Part of a larger patch to convert ErrCode to strong_int Change-Id: Ia846bfc93c58c85c6a6cec79e9d19b9ecbd1c05f Reviewed-on: https://gerrit.libreoffice.org/38783 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
+19
-19
@@ -275,7 +275,7 @@ SbxVariable* StarBASIC::VBAFind( const OUString& rName, SbxClassType t )
|
||||
struct SFX_VB_ErrorItem
|
||||
{
|
||||
sal_uInt16 nErrorVB;
|
||||
SbError nErrorSFX;
|
||||
ErrCode nErrorSFX;
|
||||
};
|
||||
|
||||
const SFX_VB_ErrorItem SFX_VB_ErrorTab[] =
|
||||
@@ -1362,7 +1362,7 @@ bool StarBASIC::Call( const OUString& rName, SbxArray* pParam )
|
||||
SbxBase::ResetError();
|
||||
if( eErr != ERRCODE_SBX_OK )
|
||||
{
|
||||
RTError( (SbError)eErr, OUString(), 0, 0, 0 );
|
||||
RTError( (ErrCode)eErr, OUString(), 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
@@ -1469,7 +1469,7 @@ sal_uInt16 StarBASIC::GetCol1() { return GetSbData()->nCol1; }
|
||||
sal_uInt16 StarBASIC::GetCol2() { return GetSbData()->nCol2; }
|
||||
|
||||
// Specific to error handler
|
||||
SbError StarBASIC::GetErrorCode() { return GetSbData()->nCode; }
|
||||
ErrCode StarBASIC::GetErrorCode() { return GetSbData()->nCode; }
|
||||
const OUString& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; }
|
||||
|
||||
// From 1996-03-29:
|
||||
@@ -1480,7 +1480,7 @@ const OUString& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; }
|
||||
// binary search by VB Error -> Error SFX.
|
||||
|
||||
// Map back new error codes to old, Sbx-compatible
|
||||
sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
|
||||
sal_uInt16 StarBASIC::GetVBErrorCode( ErrCode nError )
|
||||
{
|
||||
sal_uInt16 nRet = 0;
|
||||
|
||||
@@ -1522,9 +1522,9 @@ sal_uInt16 StarBASIC::GetVBErrorCode( SbError nError )
|
||||
return nRet;
|
||||
}
|
||||
|
||||
SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
|
||||
ErrCode StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
|
||||
{
|
||||
SbError nRet = 0;
|
||||
ErrCode nRet = 0;
|
||||
|
||||
if( SbiRuntime::isVBAEnabled() )
|
||||
{
|
||||
@@ -1574,7 +1574,7 @@ SbError StarBASIC::GetSfxFromVBError( sal_uInt16 nError )
|
||||
}
|
||||
|
||||
// set Error- / Break-data
|
||||
void StarBASIC::SetErrorData( SbError nCode, sal_uInt16 nLine,
|
||||
void StarBASIC::SetErrorData( ErrCode nCode, sal_uInt16 nLine,
|
||||
sal_uInt16 nCol1, sal_uInt16 nCol2 )
|
||||
{
|
||||
SbiGlobals& aGlobals = *GetSbData();
|
||||
@@ -1584,7 +1584,7 @@ void StarBASIC::SetErrorData( SbError nCode, sal_uInt16 nLine,
|
||||
aGlobals.nCol2 = nCol2;
|
||||
}
|
||||
|
||||
void StarBASIC::MakeErrorText( SbError nId, const OUString& aMsg )
|
||||
void StarBASIC::MakeErrorText( ErrCode nId, const OUString& aMsg )
|
||||
{
|
||||
SolarMutexGuard aSolarGuard;
|
||||
sal_uInt16 nOldID = GetVBErrorCode( nId );
|
||||
@@ -1620,7 +1620,7 @@ void StarBASIC::MakeErrorText( SbError nId, const OUString& aMsg )
|
||||
}
|
||||
}
|
||||
|
||||
bool StarBASIC::CError( SbError code, const OUString& rMsg,
|
||||
bool StarBASIC::CError( ErrCode code, const OUString& rMsg,
|
||||
sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
|
||||
{
|
||||
SolarMutexGuard aSolarGuard;
|
||||
@@ -1646,7 +1646,7 @@ bool StarBASIC::CError( SbError code, const OUString& rMsg,
|
||||
// Implementation of the code for the string transport to SFX-Error
|
||||
if( !rMsg.isEmpty() )
|
||||
{
|
||||
code = (SbError)*new StringErrorInfo( code, rMsg );
|
||||
code = (ErrCode)*new StringErrorInfo( code, rMsg );
|
||||
}
|
||||
SetErrorData( code, l, c1, c2 );
|
||||
GetSbData()->bCompilerError = true;
|
||||
@@ -1663,11 +1663,11 @@ bool StarBASIC::CError( SbError code, const OUString& rMsg,
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
|
||||
bool StarBASIC::RTError( ErrCode code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
|
||||
{
|
||||
SolarMutexGuard aSolarGuard;
|
||||
|
||||
SbError c = code;
|
||||
ErrCode c = code;
|
||||
if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER )
|
||||
{
|
||||
c = 0;
|
||||
@@ -1685,11 +1685,11 @@ bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_In
|
||||
{
|
||||
OUString aTmp = "\'" + OUString::number(SbxErrObject::getUnoErrObject()->getNumber()) +
|
||||
"\'\n" + (!GetSbData()->aErrMsg.isEmpty() ? GetSbData()->aErrMsg : rMsg);
|
||||
code = (SbError)*new StringErrorInfo( code, aTmp );
|
||||
code = (ErrCode)*new StringErrorInfo( code, aTmp );
|
||||
}
|
||||
else
|
||||
{
|
||||
code = (SbError)*new StringErrorInfo( code, rMsg );
|
||||
code = (ErrCode)*new StringErrorInfo( code, rMsg );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1704,12 +1704,12 @@ bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_In
|
||||
}
|
||||
}
|
||||
|
||||
void StarBASIC::Error( SbError n )
|
||||
void StarBASIC::Error( ErrCode n )
|
||||
{
|
||||
Error( n, OUString() );
|
||||
}
|
||||
|
||||
void StarBASIC::Error( SbError n, const OUString& rMsg )
|
||||
void StarBASIC::Error( ErrCode n, const OUString& rMsg )
|
||||
{
|
||||
if( GetSbData()->pInst )
|
||||
{
|
||||
@@ -1717,7 +1717,7 @@ void StarBASIC::Error( SbError n, const OUString& rMsg )
|
||||
}
|
||||
}
|
||||
|
||||
void StarBASIC::FatalError( SbError n )
|
||||
void StarBASIC::FatalError( ErrCode n )
|
||||
{
|
||||
if( GetSbData()->pInst )
|
||||
{
|
||||
@@ -1725,7 +1725,7 @@ void StarBASIC::FatalError( SbError n )
|
||||
}
|
||||
}
|
||||
|
||||
void StarBASIC::FatalError( SbError _errCode, const OUString& _details )
|
||||
void StarBASIC::FatalError( ErrCode _errCode, const OUString& _details )
|
||||
{
|
||||
if( GetSbData()->pInst )
|
||||
{
|
||||
@@ -1733,7 +1733,7 @@ void StarBASIC::FatalError( SbError _errCode, const OUString& _details )
|
||||
}
|
||||
}
|
||||
|
||||
SbError StarBASIC::GetErrBasic()
|
||||
ErrCode StarBASIC::GetErrBasic()
|
||||
{
|
||||
if( GetSbData()->pInst )
|
||||
{
|
||||
|
||||
@@ -364,7 +364,7 @@ OUString implGetExceptionMsg( const EXCEPTION& e )
|
||||
|
||||
void implHandleBasicErrorException( BasicErrorException& e )
|
||||
{
|
||||
SbError nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)e.ErrorCode );
|
||||
ErrCode nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)e.ErrorCode );
|
||||
StarBASIC::Error( nError, e.ErrorMessageArgument );
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
|
||||
|
||||
BasicErrorException aBasicError;
|
||||
|
||||
SbError nError( ERRCODE_BASIC_EXCEPTION );
|
||||
ErrCode nError( ERRCODE_BASIC_EXCEPTION );
|
||||
OUStringBuffer aMessageBuf;
|
||||
|
||||
// strip any other WrappedTargetException instances, but this time preserve the error messages.
|
||||
|
||||
@@ -438,7 +438,7 @@ bool SbiParser::Parse()
|
||||
if( nSbxErr )
|
||||
{
|
||||
SbxBase::ResetError();
|
||||
Error( (SbError)nSbxErr );
|
||||
Error( (ErrCode)nSbxErr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void SbiScanner::UnlockColumn()
|
||||
nColLock--;
|
||||
}
|
||||
|
||||
void SbiScanner::GenError( SbError code )
|
||||
void SbiScanner::GenError( ErrCode code )
|
||||
{
|
||||
if( GetSbData()->bBlockCompilerError )
|
||||
{
|
||||
|
||||
@@ -230,13 +230,13 @@ void SbiTokenizer::Push( SbiToken t )
|
||||
else ePush = t;
|
||||
}
|
||||
|
||||
void SbiTokenizer::Error( SbError code, const OUString &aMsg )
|
||||
void SbiTokenizer::Error( ErrCode code, const OUString &aMsg )
|
||||
{
|
||||
aError = aMsg;
|
||||
Error( code );
|
||||
}
|
||||
|
||||
void SbiTokenizer::Error( SbError code, SbiToken tok )
|
||||
void SbiTokenizer::Error( ErrCode code, SbiToken tok )
|
||||
{
|
||||
aError = Symbol( tok );
|
||||
Error( code );
|
||||
|
||||
@@ -55,17 +55,17 @@ class SbiStream
|
||||
short nLen; // buffer length
|
||||
SbiStreamFlags nMode;
|
||||
short nChan;
|
||||
SbError nError;
|
||||
ErrCode nError;
|
||||
void MapError();
|
||||
|
||||
public:
|
||||
SbiStream();
|
||||
~SbiStream();
|
||||
SbError Open( short, const OString&, StreamMode, SbiStreamFlags, short );
|
||||
SbError Close();
|
||||
SbError Read(OString&, sal_uInt16 = 0, bool bForceReadingPerByte=false);
|
||||
SbError Read( char& );
|
||||
SbError Write( const OString& );
|
||||
ErrCode Open( short, const OString&, StreamMode, SbiStreamFlags, short );
|
||||
ErrCode Close();
|
||||
ErrCode Read(OString&, sal_uInt16 = 0, bool bForceReadingPerByte=false);
|
||||
ErrCode Read( char& );
|
||||
ErrCode Write( const OString& );
|
||||
|
||||
bool IsText() const { return !bool(nMode & SbiStreamFlags::Binary); }
|
||||
bool IsRandom() const { return bool(nMode & SbiStreamFlags::Random); }
|
||||
@@ -87,13 +87,13 @@ class SbiIoSystem
|
||||
OString aIn;
|
||||
OUString aOut;
|
||||
short nChan;
|
||||
SbError nError;
|
||||
ErrCode nError;
|
||||
void ReadCon(OString&);
|
||||
void WriteCon(const OUString&);
|
||||
public:
|
||||
SbiIoSystem();
|
||||
~SbiIoSystem();
|
||||
SbError GetError();
|
||||
ErrCode GetError();
|
||||
void Shutdown();
|
||||
void SetPrompt(const OString& r) { aPrompt = r; }
|
||||
void SetChannel( short n ) { nChan = n; }
|
||||
|
||||
@@ -145,7 +145,7 @@ class SbiInstance
|
||||
DateOrder meFormatterDateOrder;
|
||||
sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
|
||||
|
||||
SbError nErr;
|
||||
ErrCode nErr;
|
||||
OUString aErrorMsg; // last error message for $ARG
|
||||
sal_Int32 nErl; // current error line
|
||||
bool bReschedule; // Flag: sal_True = Reschedule in main loop
|
||||
@@ -164,16 +164,16 @@ public:
|
||||
SbiInstance( StarBASIC* );
|
||||
~SbiInstance();
|
||||
|
||||
void Error( SbError ); // trappable Error
|
||||
void Error( SbError, const OUString& rMsg ); // trappable Error with message
|
||||
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( SbError ); // non-trappable Error
|
||||
void FatalError( SbError, const OUString& ); // non-trappable Error
|
||||
void FatalError( ErrCode ); // non-trappable Error
|
||||
void FatalError( ErrCode, const OUString& ); // non-trappable Error
|
||||
void Abort(); // with current error code
|
||||
|
||||
void Stop();
|
||||
SbError GetErr() { return nErr; }
|
||||
ErrCode GetErr() { return nErr; }
|
||||
const OUString& GetErrorMsg() { return aErrorMsg; }
|
||||
sal_Int32 GetErl() { return nErl; }
|
||||
void EnableReschedule( bool bEnable ) { bReschedule = bEnable; }
|
||||
@@ -250,7 +250,7 @@ class SbiRuntime
|
||||
bool bBlocked; // true: blocked by next call level, #i48868
|
||||
bool bVBAEnabled;
|
||||
BasicDebugFlags nFlags; // Debugging-Flags
|
||||
SbError nError;
|
||||
ErrCode nError;
|
||||
sal_uInt16 nOps; // opcode counter
|
||||
sal_uInt32 m_nLastTime;
|
||||
|
||||
@@ -260,7 +260,7 @@ class SbiRuntime
|
||||
|
||||
|
||||
SbxVariable* FindElement
|
||||
( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, bool bLocal, bool bStatic = false );
|
||||
( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, ErrCode, bool bLocal, bool bStatic = false );
|
||||
void SetupArgs( SbxVariable*, sal_uInt32 );
|
||||
SbxVariable* CheckArray( SbxVariable* );
|
||||
|
||||
@@ -331,7 +331,7 @@ class SbiRuntime
|
||||
// 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, SbError, bool bStatic = false );
|
||||
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 );
|
||||
@@ -355,11 +355,11 @@ public:
|
||||
|
||||
SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
|
||||
~SbiRuntime();
|
||||
void Error( SbError, bool bVBATranslationAlreadyDone = false ); // set error if != 0
|
||||
void Error( SbError, const OUString& ); // set error if != 0
|
||||
void FatalError( SbError ); // error handling = standard, set error
|
||||
void FatalError( SbError, const OUString& ); // error handling = standard, set error
|
||||
static sal_Int32 translateErrorToVba( SbError nError, OUString& rMsg );
|
||||
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; }
|
||||
|
||||
@@ -91,7 +91,7 @@ struct SbiGlobals
|
||||
short nInst; // number of BASICs
|
||||
Link<StarBASIC*,bool> aErrHdl; // global error handler
|
||||
Link<StarBASIC*,BasicDebugFlags> aBreakHdl; // global break handler
|
||||
SbError nCode;
|
||||
ErrCode nCode;
|
||||
sal_Int32 nLine;
|
||||
sal_Int32 nCol1,nCol2; // from... to...
|
||||
bool bCompilerError; // flag for compiler error
|
||||
|
||||
@@ -63,7 +63,7 @@ protected:
|
||||
bool bPrevLineExtentsComment; // true: Previous line is comment and ends on "... _"
|
||||
|
||||
bool bInStatement;
|
||||
void GenError( SbError );
|
||||
void GenError( ErrCode );
|
||||
public:
|
||||
SbiScanner( const OUString&, StarBASIC* = nullptr );
|
||||
~SbiScanner();
|
||||
|
||||
@@ -124,9 +124,9 @@ public:
|
||||
SbiToken Next(); // read a token
|
||||
bool MayBeLabel( bool= false );
|
||||
|
||||
void Error( SbError c ) { GenError( c ); }
|
||||
void Error( SbError, SbiToken );
|
||||
void Error( SbError, const OUString &);
|
||||
void Error( ErrCode c ) { GenError( c ); }
|
||||
void Error( ErrCode, SbiToken );
|
||||
void Error( ErrCode, const OUString &);
|
||||
|
||||
static bool IsEoln( SbiToken t )
|
||||
{ return t == EOS || t == EOLN || t == REM; }
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define DDE_FIRSTERR 0x4000
|
||||
#define DDE_LASTERR 0x4011
|
||||
|
||||
static const SbError nDdeErrMap[] =
|
||||
static const ErrCode nDdeErrMap[] =
|
||||
{
|
||||
/* DMLERR_ADVACKTIMEOUT */ 0x4000, ERRCODE_BASIC_DDE_TIMEOUT,
|
||||
/* DMLERR_BUSY */ 0x4001, ERRCODE_BASIC_DDE_BUSY,
|
||||
@@ -49,7 +49,7 @@ static const SbError nDdeErrMap[] =
|
||||
/* DMLERR_UNFOUND_QUEUE_ID */ 0x4011, ERRCODE_BASIC_DDE_NO_CHANNEL
|
||||
};
|
||||
|
||||
SbError SbiDdeControl::GetLastErr( DdeConnection* pConv )
|
||||
ErrCode SbiDdeControl::GetLastErr( DdeConnection* pConv )
|
||||
{
|
||||
if( !pConv )
|
||||
{
|
||||
@@ -98,10 +98,10 @@ size_t SbiDdeControl::GetFreeChannel()
|
||||
return nChannel+1;
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopic,
|
||||
ErrCode SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopic,
|
||||
size_t& rnHandle )
|
||||
{
|
||||
SbError nErr;
|
||||
ErrCode nErr;
|
||||
DdeConnection* pConv = new DdeConnection( rService, rTopic );
|
||||
nErr = GetLastErr( pConv );
|
||||
if( nErr )
|
||||
@@ -118,7 +118,7 @@ SbError SbiDdeControl::Initiate( const OUString& rService, const OUString& rTopi
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::Terminate( size_t nChannel )
|
||||
ErrCode SbiDdeControl::Terminate( size_t nChannel )
|
||||
{
|
||||
if (!nChannel || nChannel > aConvList.size())
|
||||
{
|
||||
@@ -136,7 +136,7 @@ SbError SbiDdeControl::Terminate( size_t nChannel )
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::TerminateAll()
|
||||
ErrCode SbiDdeControl::TerminateAll()
|
||||
{
|
||||
for (DdeConnection* conv : aConvList)
|
||||
{
|
||||
@@ -151,7 +151,7 @@ SbError SbiDdeControl::TerminateAll()
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::Request( size_t nChannel, const OUString& rItem, OUString& rResult )
|
||||
ErrCode SbiDdeControl::Request( size_t nChannel, const OUString& rItem, OUString& rResult )
|
||||
{
|
||||
if (!nChannel || nChannel > aConvList.size())
|
||||
{
|
||||
@@ -172,7 +172,7 @@ SbError SbiDdeControl::Request( size_t nChannel, const OUString& rItem, OUString
|
||||
return GetLastErr( pConv );
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::Execute( size_t nChannel, const OUString& rCommand )
|
||||
ErrCode SbiDdeControl::Execute( size_t nChannel, const OUString& rCommand )
|
||||
{
|
||||
if (!nChannel || nChannel > aConvList.size())
|
||||
{
|
||||
@@ -190,7 +190,7 @@ SbError SbiDdeControl::Execute( size_t nChannel, const OUString& rCommand )
|
||||
return GetLastErr( pConv );
|
||||
}
|
||||
|
||||
SbError SbiDdeControl::Poke( size_t nChannel, const OUString& rItem, const OUString& rData )
|
||||
ErrCode SbiDdeControl::Poke( size_t nChannel, const OUString& rItem, const OUString& rData )
|
||||
{
|
||||
if (!nChannel || nChannel > aConvList.size())
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ class SbiDdeControl
|
||||
{
|
||||
private:
|
||||
DECL_LINK( Data, const DdeData*, void );
|
||||
static SbError GetLastErr( DdeConnection* );
|
||||
static ErrCode GetLastErr( DdeConnection* );
|
||||
size_t GetFreeChannel();
|
||||
std::vector<DdeConnection*> aConvList;
|
||||
OUString aData;
|
||||
@@ -40,13 +40,13 @@ public:
|
||||
SbiDdeControl();
|
||||
~SbiDdeControl();
|
||||
|
||||
SbError Initiate( const OUString& rService, const OUString& rTopic,
|
||||
ErrCode Initiate( const OUString& rService, const OUString& rTopic,
|
||||
size_t& rnHandle );
|
||||
SbError Terminate( size_t nChannel );
|
||||
SbError TerminateAll();
|
||||
SbError Request( size_t nChannel, const OUString& rItem, OUString& rResult );
|
||||
SbError Execute( size_t nChannel, const OUString& rCommand );
|
||||
SbError Poke( size_t nChannel, const OUString& rItem, const OUString& rData );
|
||||
ErrCode Terminate( size_t nChannel );
|
||||
ErrCode TerminateAll();
|
||||
ErrCode Request( size_t nChannel, const OUString& rItem, OUString& rResult );
|
||||
ErrCode Execute( size_t nChannel, const OUString& rCommand );
|
||||
ErrCode Poke( size_t nChannel, const OUString& rItem, const OUString& rData );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@ struct SbiDllMgr::Impl {};
|
||||
namespace {
|
||||
|
||||
// Overcome the mess of Currency vs. custom types etc.
|
||||
SbError returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
|
||||
ErrCode returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
|
||||
sal_Int64 nValue)
|
||||
{
|
||||
if (!rRetVal.PutLong(1) && !rRetVal.PutInteger(1))
|
||||
@@ -77,7 +77,7 @@ SbError returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
SbError builtin_kernel32(const OUString &aFuncName, SbxArray *pArgs,
|
||||
ErrCode builtin_kernel32(const OUString &aFuncName, SbxArray *pArgs,
|
||||
SbxVariable &rRetVal)
|
||||
{
|
||||
sal_Int64 nNanoSecsPerSec = 1000.0*1000*1000;
|
||||
@@ -96,7 +96,7 @@ SbError builtin_kernel32(const OUString &aFuncName, SbxArray *pArgs,
|
||||
|
||||
};
|
||||
|
||||
SbError SbiDllMgr::Call(
|
||||
ErrCode SbiDllMgr::Call(
|
||||
const OUString &aFuncName, const OUString &aDllName,
|
||||
SbxArray *pArgs, SbxVariable &rRetVal,
|
||||
SAL_UNUSED_PARAMETER bool /* bCDecl */)
|
||||
|
||||
@@ -65,7 +65,7 @@ char * address(std::vector< char > & blob) {
|
||||
return blob.empty() ? nullptr : &blob[0];
|
||||
}
|
||||
|
||||
SbError convert(OUString const & source, OString * target) {
|
||||
ErrCode convert(OUString const & source, OString * target) {
|
||||
return
|
||||
source.convertToString(
|
||||
target, osl_getThreadTextEncoding(),
|
||||
@@ -75,7 +75,7 @@ SbError convert(OUString const & source, OString * target) {
|
||||
//TODO: more specific errcode?
|
||||
}
|
||||
|
||||
SbError convert(char const * source, sal_Int32 length, OUString * target) {
|
||||
ErrCode convert(char const * source, sal_Int32 length, OUString * target) {
|
||||
return
|
||||
rtl_convertStringToUString(
|
||||
&target->pData, source, length, osl_getThreadTextEncoding(),
|
||||
@@ -183,16 +183,16 @@ std::size_t alignment(SbxVariable * variable) {
|
||||
}
|
||||
}
|
||||
|
||||
SbError marshal(
|
||||
ErrCode marshal(
|
||||
bool outer, SbxVariable * variable, bool special,
|
||||
std::vector< char > & blob, std::size_t offset, MarshalData & data);
|
||||
|
||||
SbError marshalString(
|
||||
ErrCode marshalString(
|
||||
SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
|
||||
{
|
||||
OSL_ASSERT(variable != nullptr && buffer != nullptr);
|
||||
OString str;
|
||||
SbError e = convert(variable->GetOUString(), &str);
|
||||
ErrCode e = convert(variable->GetOUString(), &str);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ SbError marshalString(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError marshalStruct(
|
||||
ErrCode marshalStruct(
|
||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||
MarshalData & data)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ SbError marshalStruct(
|
||||
SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
|
||||
GetProperties();
|
||||
for (sal_uInt16 i = 0; i < props->Count(); ++i) {
|
||||
SbError e = marshal(false, props->Get(i), false, blob, offset, data);
|
||||
ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ SbError marshalStruct(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError marshalArray(
|
||||
ErrCode marshalArray(
|
||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||
MarshalData & data)
|
||||
{
|
||||
@@ -232,7 +232,7 @@ SbError marshalArray(
|
||||
arr->GetDim32(i + 1, low[i], up[i]);
|
||||
}
|
||||
for (std::vector< sal_Int32 > idx = low;;) {
|
||||
SbError e = marshal(
|
||||
ErrCode e = marshal(
|
||||
false, arr->Get32(&idx[0]), false, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
@@ -251,7 +251,7 @@ SbError marshalArray(
|
||||
|
||||
// 8-aligned structs are only 4-aligned on stack, so alignment of members in
|
||||
// such structs must take that into account via "offset"
|
||||
SbError marshal(
|
||||
ErrCode marshal(
|
||||
bool outer, SbxVariable * variable, bool special,
|
||||
std::vector< char > & blob, std::size_t offset, MarshalData & data)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ SbError marshal(
|
||||
case SbxSTRING:
|
||||
{
|
||||
void * p;
|
||||
SbError e = marshalString(variable, special, data, &p);
|
||||
ErrCode e = marshalString(variable, special, data, &p);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ SbError marshal(
|
||||
case SbxOBJECT:
|
||||
{
|
||||
align(blob, outer ? 8 : alignment(variable), offset, 0);
|
||||
SbError e = marshalStruct(variable, blob, offset, data);
|
||||
ErrCode e = marshalStruct(variable, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -301,7 +301,7 @@ SbError marshal(
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
SbError e = marshalArray(variable, blob, offset, data);
|
||||
ErrCode e = marshalArray(variable, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ SbError marshal(
|
||||
{
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
void * p;
|
||||
SbError e = marshalString(variable, special, data, &p);
|
||||
ErrCode e = marshalString(variable, special, data, &p);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ SbError marshal(
|
||||
case SbxOBJECT:
|
||||
{
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
SbError e = marshalStruct(variable, *blob2, 0, data);
|
||||
ErrCode e = marshalStruct(variable, *blob2, 0, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ SbError marshal(
|
||||
}
|
||||
} else {
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
SbError e = marshalArray(variable, *blob2, 0, data);
|
||||
ErrCode e = marshalArray(variable, *blob2, 0, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
ErrCode unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
OUString str;
|
||||
if (data.buffer != nullptr) {
|
||||
char const * p = static_cast< char const * >(data.buffer);
|
||||
@@ -450,7 +450,7 @@ SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
} else {
|
||||
len = rtl_str_getLength(p);
|
||||
}
|
||||
SbError e = convert(p, len, &str);
|
||||
ErrCode e = convert(p, len, &str);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ struct ProcData {
|
||||
FARPROC proc;
|
||||
};
|
||||
|
||||
SbError call(
|
||||
ErrCode call(
|
||||
OUString const & dll, ProcData const & proc, SbxArray * arguments,
|
||||
SbxVariable & result)
|
||||
{
|
||||
@@ -482,7 +482,7 @@ SbError call(
|
||||
dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
|
||||
(proc.name == OString("GetLogicalDriveStringsA"));
|
||||
for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
|
||||
SbError e = marshal(
|
||||
ErrCode e = marshal(
|
||||
true, arguments->Get(i), special && i == 2, stack, stack.size(),
|
||||
data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
@@ -579,7 +579,7 @@ SbError call(
|
||||
{
|
||||
char const * s1 = reinterpret_cast< char const * >(iRetVal);
|
||||
OUString s2;
|
||||
SbError e = convert(s1, rtl_str_getLength(s1), &s2);
|
||||
ErrCode e = convert(s1, rtl_str_getLength(s1), &s2);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ SbError call(
|
||||
for (std::vector< StringData >::iterator i(data.unmarshalStrings.begin());
|
||||
i != data.unmarshalStrings.end(); ++i)
|
||||
{
|
||||
SbError e = unmarshalString(*i, result);
|
||||
ErrCode e = unmarshalString(*i, result);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ SbError call(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
ErrCode getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
{
|
||||
OSL_ASSERT(proc != nullptr);
|
||||
if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
|
||||
@@ -635,7 +635,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
}
|
||||
} else {
|
||||
OString name8;
|
||||
SbError e = convert(name, &name8);
|
||||
ErrCode e = convert(name, &name8);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -682,7 +682,7 @@ private:
|
||||
public:
|
||||
Dll(): handle(nullptr) {}
|
||||
|
||||
SbError getProc(OUString const & name, ProcData * proc);
|
||||
ErrCode getProc(OUString const & name, ProcData * proc);
|
||||
|
||||
HMODULE handle;
|
||||
Procs procs;
|
||||
@@ -694,13 +694,13 @@ Dll::~Dll() {
|
||||
}
|
||||
}
|
||||
|
||||
SbError Dll::getProc(OUString const & name, ProcData * proc) {
|
||||
ErrCode Dll::getProc(OUString const & name, ProcData * proc) {
|
||||
Procs::iterator i(procs.find(name));
|
||||
if (i != procs.end()) {
|
||||
*proc = i->second;
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
SbError e = getProcData(handle, name, proc);
|
||||
ErrCode e = getProcData(handle, name, proc);
|
||||
if (e == ERRCODE_NONE) {
|
||||
procs.insert(Procs::value_type(name, *proc));
|
||||
}
|
||||
@@ -745,7 +745,7 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
|
||||
return i->second.get();
|
||||
}
|
||||
|
||||
SbError SbiDllMgr::Call(
|
||||
ErrCode SbiDllMgr::Call(
|
||||
OUString const & function, OUString const & library,
|
||||
SbxArray * arguments, SbxVariable & result, bool cdeclConvention)
|
||||
{
|
||||
@@ -758,7 +758,7 @@ SbError SbiDllMgr::Call(
|
||||
return ERRCODE_BASIC_BAD_DLL_LOAD;
|
||||
}
|
||||
ProcData proc;
|
||||
SbError e = dll->getProc(function, &proc);
|
||||
ErrCode e = dll->getProc(function, &proc);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ char * address(std::vector< char > & blob) {
|
||||
return blob.empty() ? 0 : &blob[0];
|
||||
}
|
||||
|
||||
SbError convert(OUString const & source, OString * target) {
|
||||
ErrCode convert(OUString const & source, OString * target) {
|
||||
return
|
||||
source.convertToString(
|
||||
target, osl_getThreadTextEncoding(),
|
||||
@@ -83,7 +83,7 @@ SbError convert(OUString const & source, OString * target) {
|
||||
//TODO: more specific errcode?
|
||||
}
|
||||
|
||||
SbError convert(char const * source, sal_Int32 length, OUString * target) {
|
||||
ErrCode convert(char const * source, sal_Int32 length, OUString * target) {
|
||||
return
|
||||
rtl_convertStringToUString(
|
||||
&target->pData, source, length, osl_getThreadTextEncoding(),
|
||||
@@ -191,16 +191,16 @@ std::size_t alignment(SbxVariable * variable) {
|
||||
}
|
||||
}
|
||||
|
||||
SbError marshal(
|
||||
ErrCode marshal(
|
||||
bool outer, SbxVariable * variable, bool special,
|
||||
std::vector< char > & blob, std::size_t offset, MarshalData & data);
|
||||
|
||||
SbError marshalString(
|
||||
ErrCode marshalString(
|
||||
SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
|
||||
{
|
||||
OSL_ASSERT(variable != 0 && buffer != 0);
|
||||
OString str;
|
||||
SbError e = convert(variable->GetOUString(), &str);
|
||||
ErrCode e = convert(variable->GetOUString(), &str);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ SbError marshalString(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError marshalStruct(
|
||||
ErrCode marshalStruct(
|
||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||
MarshalData & data)
|
||||
{
|
||||
@@ -220,7 +220,7 @@ SbError marshalStruct(
|
||||
SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
|
||||
GetProperties();
|
||||
for (sal_uInt16 i = 0; i < props->Count(); ++i) {
|
||||
SbError e = marshal(false, props->Get(i), false, blob, offset, data);
|
||||
ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ SbError marshalStruct(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError marshalArray(
|
||||
ErrCode marshalArray(
|
||||
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
|
||||
MarshalData & data)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ SbError marshalArray(
|
||||
arr->GetDim32(i + 1, low[i], up[i]);
|
||||
}
|
||||
for (std::vector< sal_Int32 > idx = low;;) {
|
||||
SbError e = marshal(
|
||||
ErrCode e = marshal(
|
||||
false, arr->Get32(&idx[0]), false, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
@@ -260,7 +260,7 @@ SbError marshalArray(
|
||||
|
||||
// 8-aligned structs are only 4-aligned on stack, so alignment of members in
|
||||
// such structs must take that into account via "offset"
|
||||
SbError marshal(
|
||||
ErrCode marshal(
|
||||
bool outer, SbxVariable * variable, bool special,
|
||||
std::vector< char > & blob, std::size_t offset, MarshalData & data)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ SbError marshal(
|
||||
case SbxSTRING:
|
||||
{
|
||||
void * p;
|
||||
SbError e = marshalString(variable, special, data, &p);
|
||||
ErrCode e = marshalString(variable, special, data, &p);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ SbError marshal(
|
||||
case SbxOBJECT:
|
||||
{
|
||||
align(blob, outer ? 4 : alignment(variable), offset, 0);
|
||||
SbError e = marshalStruct(variable, blob, offset, data);
|
||||
ErrCode e = marshalStruct(variable, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ SbError marshal(
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
SbError e = marshalArray(variable, blob, offset, data);
|
||||
ErrCode e = marshalArray(variable, blob, offset, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ SbError marshal(
|
||||
{
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
void * p;
|
||||
SbError e = marshalString(variable, special, data, &p);
|
||||
ErrCode e = marshalString(variable, special, data, &p);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ SbError marshal(
|
||||
case SbxOBJECT:
|
||||
{
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
SbError e = marshalStruct(variable, *blob2, 0, data);
|
||||
ErrCode e = marshalStruct(variable, *blob2, 0, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ SbError marshal(
|
||||
}
|
||||
} else {
|
||||
std::vector< char > * blob2 = data.newBlob();
|
||||
SbError e = marshalArray(variable, *blob2, 0, data);
|
||||
ErrCode e = marshalArray(variable, *blob2, 0, data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
ErrCode unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
OUString str;
|
||||
if (data.buffer != 0) {
|
||||
char const * p = static_cast< char const * >(data.buffer);
|
||||
@@ -465,7 +465,7 @@ SbError unmarshalString(StringData const & data, SbxVariable & result) {
|
||||
} else {
|
||||
len = rtl_str_getLength(p);
|
||||
}
|
||||
SbError e = convert(p, len, &str);
|
||||
ErrCode e = convert(p, len, &str);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -479,7 +479,7 @@ struct ProcData {
|
||||
FARPROC proc;
|
||||
};
|
||||
|
||||
SbError call(
|
||||
ErrCode call(
|
||||
OUString const & dll, ProcData const & proc, SbxArray * arguments,
|
||||
SbxVariable & result)
|
||||
{
|
||||
@@ -492,7 +492,7 @@ SbError call(
|
||||
bool special = dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
|
||||
(proc.name == OString("GetLogicalDriveStringsA"));
|
||||
for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
|
||||
SbError e = marshal(
|
||||
ErrCode e = marshal(
|
||||
true, arguments->Get(i), special && i == 2, stack, stack.size(),
|
||||
data);
|
||||
if (e != ERRCODE_NONE) {
|
||||
@@ -528,7 +528,7 @@ SbError call(
|
||||
char const * s1 = reinterpret_cast< char const * >(
|
||||
DllMgr_call32(proc.proc, address(stack), stack.size()));
|
||||
OUString s2;
|
||||
SbError e = convert(s1, rtl_str_getLength(s1), &s2);
|
||||
ErrCode e = convert(s1, rtl_str_getLength(s1), &s2);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ SbError call(
|
||||
for (std::vector< StringData >::iterator i(data.unmarshalStrings.begin());
|
||||
i != data.unmarshalStrings.end(); ++i)
|
||||
{
|
||||
SbError e = unmarshalString(*i, result);
|
||||
ErrCode e = unmarshalString(*i, result);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -573,7 +573,7 @@ SbError call(
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
ErrCode getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
{
|
||||
OSL_ASSERT(proc != 0);
|
||||
if ( !name.isEmpty() && name[0] == '@' ) { //TODO: "@" vs. "#"???
|
||||
@@ -589,7 +589,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
|
||||
}
|
||||
} else {
|
||||
OString name8;
|
||||
SbError e = convert(name, &name8);
|
||||
ErrCode e = convert(name, &name8);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
@@ -636,7 +636,7 @@ private:
|
||||
public:
|
||||
Dll(): handle(0) {}
|
||||
|
||||
SbError getProc(OUString const & name, ProcData * proc);
|
||||
ErrCode getProc(OUString const & name, ProcData * proc);
|
||||
|
||||
HMODULE handle;
|
||||
Procs procs;
|
||||
@@ -648,13 +648,13 @@ Dll::~Dll() {
|
||||
}
|
||||
}
|
||||
|
||||
SbError Dll::getProc(OUString const & name, ProcData * proc) {
|
||||
ErrCode Dll::getProc(OUString const & name, ProcData * proc) {
|
||||
Procs::iterator i(procs.find(name));
|
||||
if (i != procs.end()) {
|
||||
*proc = i->second;
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
SbError e = getProcData(handle, name, proc);
|
||||
ErrCode e = getProcData(handle, name, proc);
|
||||
if (e == ERRCODE_NONE) {
|
||||
procs.insert(Procs::value_type(name, *proc));
|
||||
}
|
||||
@@ -699,7 +699,7 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
|
||||
return i->second.get();
|
||||
}
|
||||
|
||||
SbError SbiDllMgr::Call(
|
||||
ErrCode SbiDllMgr::Call(
|
||||
OUString const & function, OUString const & library,
|
||||
SbxArray * arguments, SbxVariable & result, bool cdeclConvention)
|
||||
{
|
||||
@@ -712,7 +712,7 @@ SbError SbiDllMgr::Call(
|
||||
return ERRCODE_BASIC_BAD_DLL_LOAD;
|
||||
}
|
||||
ProcData proc;
|
||||
SbError e = dll->getProc(function, &proc);
|
||||
ErrCode e = dll->getProc(function, &proc);
|
||||
if (e != ERRCODE_NONE) {
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
~SbiDllMgr();
|
||||
|
||||
SbError Call(
|
||||
ErrCode Call(
|
||||
OUString const & function, OUString const & library,
|
||||
SbxArray * arguments, SbxVariable & result, bool cdeclConvention);
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ void UCBStream::SetSize( sal_uInt64 nSize )
|
||||
}
|
||||
|
||||
|
||||
SbError SbiStream::Open
|
||||
ErrCode SbiStream::Open
|
||||
( short nCh, const OString& rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL )
|
||||
{
|
||||
nMode = nFlags;
|
||||
@@ -526,7 +526,7 @@ SbError SbiStream::Open
|
||||
return nError;
|
||||
}
|
||||
|
||||
SbError SbiStream::Close()
|
||||
ErrCode SbiStream::Close()
|
||||
{
|
||||
if( pStrm )
|
||||
{
|
||||
@@ -537,7 +537,7 @@ SbError SbiStream::Close()
|
||||
return nError;
|
||||
}
|
||||
|
||||
SbError SbiStream::Read(OString& rBuf, sal_uInt16 n, bool bForceReadingPerByte)
|
||||
ErrCode SbiStream::Read(OString& rBuf, sal_uInt16 n, bool bForceReadingPerByte)
|
||||
{
|
||||
nExpandOnWriteTo = 0;
|
||||
if( !bForceReadingPerByte && IsText() )
|
||||
@@ -569,7 +569,7 @@ SbError SbiStream::Read(OString& rBuf, sal_uInt16 n, bool bForceReadingPerByte)
|
||||
return nError;
|
||||
}
|
||||
|
||||
SbError SbiStream::Read( char& ch )
|
||||
ErrCode SbiStream::Read( char& ch )
|
||||
{
|
||||
nExpandOnWriteTo = 0;
|
||||
if (aLine.isEmpty())
|
||||
@@ -614,7 +614,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
SbError SbiStream::Write( const OString& rBuf )
|
||||
ErrCode SbiStream::Write( const OString& rBuf )
|
||||
{
|
||||
ExpandFile();
|
||||
if( IsAppend() )
|
||||
@@ -666,9 +666,9 @@ SbiIoSystem::~SbiIoSystem()
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
SbError SbiIoSystem::GetError()
|
||||
ErrCode SbiIoSystem::GetError()
|
||||
{
|
||||
SbError n = nError; nError = 0;
|
||||
ErrCode n = nError; nError = 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ void SbiIoSystem::Shutdown()
|
||||
{
|
||||
if( pChan[ i ] )
|
||||
{
|
||||
SbError n = pChan[ i ]->Close();
|
||||
ErrCode n = pChan[ i ]->Close();
|
||||
delete pChan[ i ];
|
||||
pChan[ i ] = nullptr;
|
||||
if( n && !nError )
|
||||
@@ -821,7 +821,7 @@ void SbiIoSystem::CloseAll()
|
||||
{
|
||||
if( pChan[ i ] )
|
||||
{
|
||||
SbError n = pChan[ i ]->Close();
|
||||
ErrCode n = pChan[ i ]->Close();
|
||||
delete pChan[ i ];
|
||||
pChan[ i ] = nullptr;
|
||||
if( n && !nError )
|
||||
|
||||
@@ -206,7 +206,7 @@ RTLFUNC(Error)
|
||||
else
|
||||
{
|
||||
OUString aErrorMsg;
|
||||
SbError nErr = ERRCODE_NONE;
|
||||
ErrCode nErr = ERRCODE_NONE;
|
||||
sal_Int32 nCode = 0;
|
||||
if( rPar.Count() == 1 )
|
||||
{
|
||||
@@ -4025,7 +4025,7 @@ RTLFUNC(DDEInitiate)
|
||||
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
size_t nChannel;
|
||||
SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel );
|
||||
ErrCode nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel );
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
@@ -4050,7 +4050,7 @@ RTLFUNC(DDETerminate)
|
||||
}
|
||||
size_t nChannel = rPar.Get(1)->GetInteger();
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
SbError nDdeErr = pDDE->Terminate( nChannel );
|
||||
ErrCode nDdeErr = pDDE->Terminate( nChannel );
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
@@ -4071,7 +4071,7 @@ RTLFUNC(DDETerminateAll)
|
||||
}
|
||||
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
SbError nDdeErr = pDDE->TerminateAll();
|
||||
ErrCode nDdeErr = pDDE->TerminateAll();
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
@@ -4093,7 +4093,7 @@ RTLFUNC(DDERequest)
|
||||
const OUString& rItem = rPar.Get(2)->GetOUString();
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
OUString aResult;
|
||||
SbError nDdeErr = pDDE->Request( nChannel, rItem, aResult );
|
||||
ErrCode nDdeErr = pDDE->Request( nChannel, rItem, aResult );
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
@@ -4119,7 +4119,7 @@ RTLFUNC(DDEExecute)
|
||||
size_t nChannel = rPar.Get(1)->GetInteger();
|
||||
const OUString& rCommand = rPar.Get(2)->GetOUString();
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
SbError nDdeErr = pDDE->Execute( nChannel, rCommand );
|
||||
ErrCode nDdeErr = pDDE->Execute( nChannel, rCommand );
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
@@ -4142,7 +4142,7 @@ RTLFUNC(DDEPoke)
|
||||
const OUString& rItem = rPar.Get(2)->GetOUString();
|
||||
const OUString& rData = rPar.Get(3)->GetOUString();
|
||||
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
|
||||
SbError nDdeErr = pDDE->Poke( nChannel, rItem, rData );
|
||||
ErrCode nDdeErr = pDDE->Poke( nChannel, rItem, rData );
|
||||
if( nDdeErr )
|
||||
{
|
||||
StarBASIC::Error( nDdeErr );
|
||||
|
||||
@@ -333,7 +333,7 @@ RTLFUNC(CDbl) // JSM
|
||||
{
|
||||
// #41690
|
||||
OUString aScanStr = pSbxVariable->GetOUString();
|
||||
SbError Error = SbxValue::ScanNumIntnl( aScanStr, nVal );
|
||||
ErrCode Error = SbxValue::ScanNumIntnl( aScanStr, nVal );
|
||||
if( Error != ERRCODE_SBX_OK )
|
||||
{
|
||||
StarBASIC::Error( Error );
|
||||
@@ -402,7 +402,7 @@ RTLFUNC(CSng) // JSM
|
||||
// #41690
|
||||
double dVal = 0.0;
|
||||
OUString aScanStr = pSbxVariable->GetOUString();
|
||||
SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/true );
|
||||
ErrCode Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/true );
|
||||
if( SbxBase::GetError() == ERRCODE_SBX_OK && Error != ERRCODE_SBX_OK )
|
||||
{
|
||||
StarBASIC::Error( Error );
|
||||
@@ -2283,7 +2283,7 @@ RTLFUNC(DateDiff)
|
||||
double implGetDateOfFirstDayInFirstWeek
|
||||
( sal_Int16 nYear, sal_Int16& nFirstDay, sal_Int16& nFirstWeek, bool* pbError = nullptr )
|
||||
{
|
||||
SbError nError = ERRCODE_NONE;
|
||||
ErrCode nError = ERRCODE_NONE;
|
||||
if( nFirstDay < 0 || nFirstDay > 7 )
|
||||
nError = ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
|
||||
@@ -3256,7 +3256,7 @@ RTLFUNC(Input)
|
||||
}
|
||||
|
||||
OString aByteBuffer;
|
||||
SbError err = pSbStrm->Read( aByteBuffer, nByteCount, true );
|
||||
ErrCode err = pSbStrm->Read( aByteBuffer, nByteCount, true );
|
||||
if( !err )
|
||||
err = pIosys->GetError();
|
||||
|
||||
|
||||
@@ -460,12 +460,12 @@ void setBasicWatchMode( bool bOn )
|
||||
bWatchMode = bOn;
|
||||
}
|
||||
|
||||
void SbiInstance::Error( SbError n )
|
||||
void SbiInstance::Error( ErrCode n )
|
||||
{
|
||||
Error( n, OUString() );
|
||||
}
|
||||
|
||||
void SbiInstance::Error( SbError n, const OUString& rMsg )
|
||||
void SbiInstance::Error( ErrCode n, const OUString& rMsg )
|
||||
{
|
||||
if( !bWatchMode )
|
||||
{
|
||||
@@ -478,7 +478,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
|
||||
{
|
||||
if( !bWatchMode )
|
||||
{
|
||||
SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
|
||||
ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
|
||||
if ( !n )
|
||||
{
|
||||
n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
|
||||
@@ -493,7 +493,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg )
|
||||
|
||||
void SbiInstance::setErrorVB( sal_Int32 nVBNumber )
|
||||
{
|
||||
SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
|
||||
ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) );
|
||||
if( !n )
|
||||
{
|
||||
n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
|
||||
@@ -505,12 +505,12 @@ void SbiInstance::setErrorVB( sal_Int32 nVBNumber )
|
||||
}
|
||||
|
||||
|
||||
void SbiInstance::FatalError( SbError n )
|
||||
void SbiInstance::FatalError( ErrCode n )
|
||||
{
|
||||
pRun->FatalError( n );
|
||||
}
|
||||
|
||||
void SbiInstance::FatalError( SbError _errCode, const OUString& _details )
|
||||
void SbiInstance::FatalError( ErrCode _errCode, const OUString& _details )
|
||||
{
|
||||
pRun->FatalError( _errCode, _details );
|
||||
}
|
||||
@@ -774,11 +774,11 @@ bool SbiRuntime::Step()
|
||||
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
SbError nSbError = SbxBase::GetError();
|
||||
Error( ERRCODE_TOERROR(nSbError) );
|
||||
ErrCode nErrCode = SbxBase::GetError();
|
||||
Error( ERRCODE_TOERROR(nErrCode) );
|
||||
|
||||
// from 13.2.1997, new error handling:
|
||||
// ATTENTION: nError can be set already even if !nSbError
|
||||
// ATTENTION: nError can be set already even if !nErrCode
|
||||
// since nError can now also be set from other RT-instances
|
||||
|
||||
if( nError )
|
||||
@@ -790,7 +790,7 @@ bool SbiRuntime::Step()
|
||||
// (especially not after compiler errors at the runtime)
|
||||
if( nError && bRun )
|
||||
{
|
||||
SbError err = nError;
|
||||
ErrCode err = nError;
|
||||
ClearExprStack();
|
||||
nError = ERRCODE_NONE;
|
||||
pInst->nErr = err;
|
||||
@@ -873,7 +873,7 @@ bool SbiRuntime::Step()
|
||||
return bRun;
|
||||
}
|
||||
|
||||
void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
|
||||
void SbiRuntime::Error( ErrCode n, bool bVBATranslationAlreadyDone )
|
||||
{
|
||||
if( n )
|
||||
{
|
||||
@@ -894,7 +894,7 @@ void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
|
||||
}
|
||||
}
|
||||
|
||||
void SbiRuntime::Error( SbError _errCode, const OUString& _details )
|
||||
void SbiRuntime::Error( ErrCode _errCode, const OUString& _details )
|
||||
{
|
||||
if ( _errCode )
|
||||
{
|
||||
@@ -912,19 +912,19 @@ void SbiRuntime::Error( SbError _errCode, const OUString& _details )
|
||||
}
|
||||
}
|
||||
|
||||
void SbiRuntime::FatalError( SbError n )
|
||||
void SbiRuntime::FatalError( ErrCode n )
|
||||
{
|
||||
StepSTDERROR();
|
||||
Error( n );
|
||||
}
|
||||
|
||||
void SbiRuntime::FatalError( SbError _errCode, const OUString& _details )
|
||||
void SbiRuntime::FatalError( ErrCode _errCode, const OUString& _details )
|
||||
{
|
||||
StepSTDERROR();
|
||||
Error( _errCode, _details );
|
||||
}
|
||||
|
||||
sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, OUString& rMsg )
|
||||
sal_Int32 SbiRuntime::translateErrorToVba( ErrCode nError, OUString& rMsg )
|
||||
{
|
||||
// If a message is defined use that ( in preference to
|
||||
// the defined one for the error ) NB #TODO
|
||||
@@ -935,7 +935,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, OUString& rMsg )
|
||||
{
|
||||
// TEST, has to be vb here always
|
||||
#ifdef DBG_UTIL
|
||||
SbError nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError );
|
||||
ErrCode nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError );
|
||||
SAL_WARN_IF( nTmp == 0, "basic", "No VB error!" );
|
||||
#endif
|
||||
|
||||
@@ -1247,7 +1247,7 @@ void SbiRuntime::DllCall
|
||||
|
||||
SbxVariable* pRes = new SbxVariable( eResType );
|
||||
SbiDllMgr* pDllMgr = pInst->GetDllMgr();
|
||||
SbError nErr = pDllMgr->Call( aFuncName, aDLLName, pArgs, *pRes, bCDecl );
|
||||
ErrCode nErr = pDllMgr->Call( aFuncName, aDLLName, pArgs, *pRes, bCDecl );
|
||||
if( nErr )
|
||||
{
|
||||
Error( nErr );
|
||||
@@ -2406,7 +2406,7 @@ void SbiRuntime::StepINPUT()
|
||||
OUStringBuffer sin;
|
||||
OUString s;
|
||||
char ch = 0;
|
||||
SbError err;
|
||||
ErrCode err;
|
||||
// Skip whitespace
|
||||
while( ( err = pIosys->GetError() ) == ERRCODE_NONE )
|
||||
{
|
||||
@@ -2737,7 +2737,7 @@ void SbiRuntime::StepERROR()
|
||||
{
|
||||
SbxVariableRef refCode = PopVar();
|
||||
sal_uInt16 n = refCode->GetUShort();
|
||||
SbError error = StarBASIC::GetSfxFromVBError( n );
|
||||
ErrCode error = StarBASIC::GetSfxFromVBError( n );
|
||||
if ( bVBAEnabled )
|
||||
{
|
||||
pInst->Error( error );
|
||||
@@ -3120,7 +3120,7 @@ void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
|
||||
// close channel (+channel, 0=all)
|
||||
void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
|
||||
{
|
||||
SbError err;
|
||||
ErrCode err;
|
||||
if( !nOp1 )
|
||||
pIosys->Shutdown();
|
||||
else
|
||||
@@ -3299,7 +3299,7 @@ void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
|
||||
// 0x8000 - Argv is reserved
|
||||
|
||||
SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2,
|
||||
SbError nNotFound, bool bLocal, bool bStatic )
|
||||
ErrCode nNotFound, bool bLocal, bool bStatic )
|
||||
{
|
||||
bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
|
||||
if( bIsVBAInterOp )
|
||||
@@ -3932,7 +3932,7 @@ void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
|
||||
}
|
||||
|
||||
void SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2,
|
||||
SbError nNotFound, bool bStatic )
|
||||
ErrCode nNotFound, bool bStatic )
|
||||
{
|
||||
if( !refLocals.is() )
|
||||
{
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
|
||||
#include <basic/sbxdef.hxx>
|
||||
|
||||
#ifndef __RSC
|
||||
typedef ErrCode SbError;
|
||||
#endif
|
||||
|
||||
// Mapping to SbxError
|
||||
#define ERRCODE_BASIC_SYNTAX ERRCODE_SBX_SYNTAX // unspecified syntax error
|
||||
#define ERRCODE_BASIC_BAD_ARGUMENT ERRCODE_SBX_NOTIMP // Invalid procedure call
|
||||
|
||||
+12
-12
@@ -69,9 +69,9 @@ class BASIC_DLLPUBLIC StarBASIC : public SbxObject
|
||||
BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
|
||||
|
||||
protected:
|
||||
bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
|
||||
bool CError( ErrCode, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
|
||||
private:
|
||||
BASIC_DLLPRIVATE bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
|
||||
BASIC_DLLPRIVATE bool RTError( ErrCode, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
|
||||
BASIC_DLLPRIVATE BasicDebugFlags BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
|
||||
BASIC_DLLPRIVATE BasicDebugFlags StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
|
||||
virtual bool LoadData( SvStream&, sal_uInt16 ) override;
|
||||
@@ -101,12 +101,12 @@ public:
|
||||
SbModule* MakeModule( const OUString& rName, const OUString& rSrc );
|
||||
SbModule* MakeModule( const OUString& rName, const css::script::ModuleInfo& mInfo, const OUString& rSrc );
|
||||
static void Stop();
|
||||
static void Error( SbError );
|
||||
static void Error( SbError, const OUString& rMsg );
|
||||
static void FatalError( SbError );
|
||||
static void FatalError( SbError, const OUString& rMsg );
|
||||
static void Error( ErrCode );
|
||||
static void Error( ErrCode, const OUString& rMsg );
|
||||
static void FatalError( ErrCode );
|
||||
static void FatalError( ErrCode, const OUString& rMsg );
|
||||
static bool IsRunning();
|
||||
static SbError GetErrBasic();
|
||||
static ErrCode GetErrBasic();
|
||||
// #66536 make additional message accessible by RTL function Error
|
||||
static OUString GetErrorMsg();
|
||||
static sal_Int32 GetErl();
|
||||
@@ -126,15 +126,15 @@ public:
|
||||
static sal_uInt16 GetLine();
|
||||
static sal_uInt16 GetCol1();
|
||||
static sal_uInt16 GetCol2();
|
||||
static void SetErrorData( SbError nCode, sal_uInt16 nLine,
|
||||
static void SetErrorData( ErrCode nCode, sal_uInt16 nLine,
|
||||
sal_uInt16 nCol1, sal_uInt16 nCol2 );
|
||||
|
||||
// Specific to error handler
|
||||
static void MakeErrorText( SbError, const OUString& aMsg );
|
||||
static void MakeErrorText( ErrCode, const OUString& aMsg );
|
||||
static const OUString& GetErrorText();
|
||||
static SbError GetErrorCode();
|
||||
static sal_uInt16 GetVBErrorCode( SbError nError );
|
||||
static SbError GetSfxFromVBError( sal_uInt16 nError );
|
||||
static ErrCode GetErrorCode();
|
||||
static sal_uInt16 GetVBErrorCode( ErrCode nError );
|
||||
static ErrCode GetSfxFromVBError( sal_uInt16 nError );
|
||||
bool IsBreak() const { return bBreak; }
|
||||
|
||||
static Link<StarBASIC*,bool> GetGlobalErrorHdl();
|
||||
|
||||
Reference in New Issue
Block a user