diff options
Diffstat (limited to 'basic')
50 files changed, 84 insertions, 1363 deletions
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx index 27db4508e592..057b4e0a261b 100644 --- a/basic/inc/basic/sbxbase.hxx +++ b/basic/inc/basic/sbxbase.hxx @@ -30,7 +30,6 @@ #define _SBXBASE_HXX #include <i18npool/lang.h> -#include "tools/list.hxx" #include "svl/svarray.hxx" #include <basic/sbxdef.hxx> diff --git a/basic/inc/pch/precompiled_basic.hxx b/basic/inc/pch/precompiled_basic.hxx index dd755b1294bf..6538399a28ea 100644 --- a/basic/inc/pch/precompiled_basic.hxx +++ b/basic/inc/pch/precompiled_basic.hxx @@ -213,7 +213,6 @@ #include "tools/fsys.hxx" #include "tools/gen.hxx" #include "tools/link.hxx" -#include "tools/list.hxx" #include "tools/rc.hxx" #include "tools/rcid.h" #include "tools/ref.hxx" diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 7cb4f2ab5751..e82261084a70 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -74,13 +74,15 @@ using namespace comphelper; using namespace cppu; -using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::ucb; using namespace com::sun::star::beans; +using ::rtl::OUString; +using ::rtl::OUStringToOString; + #endif /* _USE_UNO */ IMPL_GEN_RES_STR; @@ -237,7 +239,7 @@ int BasicApp::Main( ) DBG_INSTOUTERROR( DBG_OUT_TESTTOOL ); if ( osl_setDebugMessageFunc( osl_TestToolDebugMessageFilter ) ) - DBG_ERROR("osl_setDebugMessageFunc returns non NULL pointer"); + OSL_FAIL("osl_setDebugMessageFunc returns non NULL pointer"); #endif ResMgr::SetReadStringHook( ReplaceStringHookProc ); diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx index 120feafb7fb0..e39d6c8e95b3 100644 --- a/basic/source/app/appwin.cxx +++ b/basic/source/app/appwin.cxx @@ -390,7 +390,7 @@ BOOL AppWin::DiskFileChanged( USHORT nWhat ) // uncomment to avoid compiler warning // break; default: - DBG_ERROR("Not Implemented in AppWin::DiskFileChanged"); + OSL_FAIL("Not Implemented in AppWin::DiskFileChanged"); } return TRUE; } @@ -415,7 +415,7 @@ void AppWin::UpdateFileInfo( USHORT nWhat ) } break; default: - DBG_ERROR("Not Implemented in AppWin::UpdateFileInfo"); + OSL_FAIL("Not Implemented in AppWin::UpdateFileInfo"); } } @@ -590,7 +590,7 @@ USHORT AppWin::QuerySave( QueryBits nBits ) nReturn = SAVE_RES_CANCEL; break; default: - DBG_ERROR("switch default where no default should be: Internal error"); + OSL_FAIL("switch default where no default should be: Internal error"); nReturn = SAVE_RES_CANCEL; } SkipReload( FALSE ); @@ -619,7 +619,7 @@ BOOL AppWin::Close() // uncomment to avoid compiler warning // break; default: - DBG_ERROR("Not Implemented in AppWin::Close"); + OSL_FAIL("Not Implemented in AppWin::Close"); return FALSE; } } diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index 86176a764345..a09480c80dc3 100644 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_basic.hxx" -#include <tools/list.hxx> #include <basic/sbx.hxx> #include <basic/sbmod.hxx> #include <basic/sbstar.hxx> diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index ba2a523944aa..178455cb9e77 100644 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -301,7 +301,7 @@ IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl ) case RID_TP_FON: pNewTabPage = new FontOptions( pTabCtrl, aConfig ); break; - default: DBG_ERROR( "PageHdl: Unbekannte ID!" ); + default: OSL_FAIL( "PageHdl: Unbekannte ID!" ); } DBG_ASSERT( pNewTabPage, "Keine Page!" ); pTabCtrl->SetTabPage( nId, pNewTabPage ); diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx index 743949b64898..677bef1962be 100644 --- a/basic/source/app/dialogs.hxx +++ b/basic/source/app/dialogs.hxx @@ -38,7 +38,6 @@ #include <vcl/tabctrl.hxx> #include <vcl/tabpage.hxx> #include <tools/config.hxx> -#include <tools/list.hxx> #include <vcl/lstbox.hxx> #include <vcl/floatwin.hxx> #include <vcl/toolbox.hxx> diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 16e8639c7430..34b59d50ed9b 100644 --- a/basic/source/app/msgedit.cxx +++ b/basic/source/app/msgedit.cxx @@ -167,7 +167,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) case LOG_ASSERTION: AddAssertion( aUILogMsg, LogMsg->aDebugData ); break; case LOG_ASSERTION_STACK: AddAssertionStack( aUILogMsg, LogMsg->aDebugData ); break; case LOG_QA_ERROR: AddQAError( aUILogMsg, LogMsg->aDebugData ); break; - default:DBG_ERROR("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust"); + default:OSL_FAIL("Unbekannter Typ in ResultFile. Speichern des ResultFile resultiert in Informationsverlust"); } if ( !bFileLoading ) @@ -486,7 +486,7 @@ String MsgEdit::Impl_MakeText( SvLBoxEntry *pEntry ) const case LOG_ASSERTION: break; case LOG_ASSERTION_STACK:aRet.AppendAscii("--> "); break; case LOG_QA_ERROR: break; - default:DBG_ERROR("Unknown type in ResultWindow!"); + default:OSL_FAIL("Unknown type in ResultWindow!"); } aRet += aEditTree.GetEntryText( pEntry ); return aRet; @@ -543,10 +543,9 @@ String MsgEdit::GetSelected() TextSelection MsgEdit::GetSelection() const { - ULONG nStart=0,nEnd=0; - if ( aEditTree.FirstSelected() ) { + ULONG nStart=0,nEnd=0; nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() ); if ( aEditTree.LastSelected() ) nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() ); @@ -585,7 +584,7 @@ void MsgEdit::ReplaceSelected( const String& rStr ) { (void) rStr; /* avoid warning about unused parameter */ Sound::Beep(); - DBG_ERROR("Not Implemented"); + OSL_FAIL("Not Implemented"); } BOOL MsgEdit::IsModified(){ return bModified; } @@ -609,7 +608,7 @@ void MsgEdit::SetText( const String& rStr ) { (void) rStr; /* avoid warning about unused parameter */ Sound::Beep(); - DBG_ERROR("Not Implemented"); + OSL_FAIL("Not Implemented"); } BOOL MsgEdit::HasText() const @@ -917,7 +916,7 @@ TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry ) case LOG_QA_ERROR: return HasQAError; default: - DBG_ERROR("Unknown type in ResultWindow"); + OSL_FAIL("Unknown type in ResultWindow"); } return HasNothing; } diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx index 397eaadbdfee..91e28de22a6a 100644 --- a/basic/source/app/process.cxx +++ b/basic/source/app/process.cxx @@ -31,9 +31,8 @@ #ifdef WNT -#include <tools/prewin.h> -#include "winbase.h" -#include <tools/postwin.h> +#include <prewin.h> +#include <postwin.h> #endif #include <tools/errcode.hxx> #include <basic/sbxcore.hxx> diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx index 0972ed3f5269..32e486b0ffd8 100644 --- a/basic/source/app/processw.hxx +++ b/basic/source/app/processw.hxx @@ -39,12 +39,12 @@ class ProcessWrapper : public SbxObject using SbxVariable::GetInfo; // Definition of a table entry. This is done here because // through this methods and property can declared as private. -#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 ) +#if defined ( ICC ) || defined ( C50 ) || defined ( C52 ) public: #endif typedef void( ProcessWrapper::*pMeth ) ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); -#if defined ( ICC ) || defined ( HPUX ) +#if defined ( ICC ) private: #endif diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx index 30d1f7a24038..2891cf5e7a16 100644 --- a/basic/source/app/textedit.cxx +++ b/basic/source/app/textedit.cxx @@ -201,7 +201,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) if ( rLast.nStart > rLast.nEnd ) // Only up to the bug of MD repaired { #if OSL_DEBUG_LEVEL > 1 - DBG_ERROR( "MD-Bug is not repaired!" ); + OSL_FAIL( "MD-Bug is not repaired!" ); #endif nCount--; aPortionList.Remove( nCount); @@ -324,7 +324,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) default: { aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) ); - DBG_ERROR( "Unknown syntax color" ); + OSL_FAIL( "Unknown syntax color" ); } } pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 ); diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index c49ebeeeaa37..2057a065e96c 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -348,7 +348,7 @@ namespace basic if ( pos != m_aCreationListeners.end() ) m_aCreationListeners.erase( pos ); else { - DBG_ERROR( "ImplRepository::revokeCreationListener: listener is not registered!" ); + OSL_FAIL( "ImplRepository::revokeCreationListener: listener is not registered!" ); } } diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 3b798597e168..dde988b50d38 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1460,7 +1460,7 @@ void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const // cause modified if( !bModified && bReference ) { - DBG_ERROR( "Per Reference eingebundene Basic-Library ist nicht compiliert!" ); + OSL_FAIL( "Per Reference eingebundene Basic-Library ist nicht compiliert!" ); pLib->SetModified( FALSE ); } } diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx index fdef98bce335..24cc000edfe7 100644 --- a/basic/source/classes/disas.cxx +++ b/basic/source/classes/disas.cxx @@ -36,7 +36,6 @@ #include "sb.hxx" #include "iosys.hxx" #include "disas.hxx" -#include "sbtrace.hxx" static const char* pOp1[] = { @@ -364,10 +363,6 @@ BOOL SbiDisas::DisasLine( String& rText ) if( !Fetch() ) return FALSE; -#ifdef DBG_TRACE_BASIC - String aTraceStr_STMNT; -#endif - // New line? if( eOp == _STMNT && nOp1 != nLine ) { @@ -400,10 +395,6 @@ BOOL SbiDisas::DisasLine( String& rText ) rText.AppendAscii( "; " ); rText += s; rText.AppendAscii( _crlf() ); - -#ifdef DBG_TRACE_BASIC - aTraceStr_STMNT = s; -#endif } } @@ -463,10 +454,6 @@ BOOL SbiDisas::DisasLine( String& rText ) rText += aPCodeStr; -#ifdef DBG_TRACE_BASIC - dbg_RegisterTraceTextForPC( pMod, nPC, aTraceStr_STMNT, aPCodeStr ); -#endif - return TRUE; } @@ -611,13 +598,6 @@ void SbiDisas::OffOp( String& rText ) } // Data type -#ifdef HP9000 // TODO: remove this! -static char* SbiDisas_TypeOp_pTypes[13] = { - "Empty","Null","Integer","Long","Single","Double", - "Currency","Date","String","Object","Error","Boolean", - "Variant" }; -#define pTypes SbiDisas_TypeOp_pTypes -#endif void SbiDisas::TypeOp( String& rText ) { // From 1996-01-19: type can contain flag for BYVAL (StepARGTYP) @@ -628,12 +608,11 @@ void SbiDisas::TypeOp( String& rText ) } if( nOp1 < 13 ) { -#ifndef HP9000 static char pTypes[][13] = { "Empty","Null","Integer","Long","Single","Double", "Currency","Date","String","Object","Error","Boolean", "Variant" }; -#endif + rText.AppendAscii( pTypes[ nOp1 ] ); } else @@ -642,9 +621,6 @@ void SbiDisas::TypeOp( String& rText ) rText += (USHORT)nOp1; } } -#ifdef HP9000 -#undef pTypes -#endif // TRUE-Label, condition Opcode void SbiDisas::CaseOp( String& rText ) diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 654ad79df750..716cbe0497d7 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -149,7 +149,6 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) ULONG nNext; while( ( nNext = r.Tell() ) < nLast ) { - short i; r >> nSign >> nLen >> nCount; nNext += nLen + 8; @@ -217,6 +216,7 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) case B_STRINGPOOL: if( bBadVer ) break; MakeStrings( nCount ); + short i; for( i = 0; i < nStrings && SbiGood( r ); i++ ) { r >> nOff; diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 07c429769df0..5e53bfb49e1b 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -37,7 +37,6 @@ #include <tools/stream.hxx> #include <tools/errinf.hxx> #include <basic/sbx.hxx> -#include <tools/list.hxx> #include <tools/shl.hxx> #include <tools/rc.hxx> #include <vcl/svapp.hxx> @@ -56,7 +55,7 @@ #include <osl/mutex.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include "errobject.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/ModuleInfo.hpp> @@ -375,12 +374,12 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj ) SbxBase* pParObj = pVar->GetObject(); SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj); SbxDimArray* pDest = new SbxDimArray( pVar->GetType() ); - INT32 lb = 0; - INT32 ub = 0; pDest->setHasFixedSize( pSource->hasFixedSize() ); if ( pSource->GetDims() && pSource->hasFixedSize() ) { + INT32 lb = 0; + INT32 ub = 0; for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j ) { pSource->GetDim32( (INT32)j, lb, ub ); @@ -502,7 +501,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbMethod* pImplMethod = pIfaceMethod->getImplMethod(); if( !pImplMethod ) { - DBG_ERROR( "No ImplMethod" ); + OSL_FAIL( "No ImplMethod" ); continue; } @@ -512,7 +511,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbMethod* pImplMethodCopy = p ? PTR_CAST(SbMethod,p) : NULL; if( !pImplMethodCopy ) { - DBG_ERROR( "Found no ImplMethod copy" ); + OSL_FAIL( "Found no ImplMethod copy" ); continue; } SbIfaceMapperMethod* pNewIfaceMethod = @@ -946,7 +945,7 @@ struct ClassModuleRunInitItem {} }; -typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem, +typedef boost::unordered_map< ::rtl::OUString, ClassModuleRunInitItem, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; static ModuleInitDependencyMap* GpMIDMap = NULL; @@ -976,7 +975,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) if( rParentItem.m_bProcessing ) { // TODO: raise error? - DBG_ERROR( "Cyclic module dependency detected" ); + OSL_FAIL( "Cyclic module dependency detected" ); continue; } diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src index 73cc1c3a0b2c..df916c64b031 100644 --- a/basic/source/classes/sb.src +++ b/basic/source/classes/sb.src @@ -47,17 +47,14 @@ Resource RID_BASIC_START }; String SbERR_BAD_ARGUMENT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiger Prozeduraufruf : Ungltiger Prozeduraufruf */ Text [ en-US ] = "Invalid procedure call." ; }; String SbERR_MATH_OVERFLOW & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? berlauf : berlauf */ Text [ en-US ] = "Overflow." ; }; String SbERR_NO_MEMORY & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Nicht gengend Speicher : Nicht gengend Speicher */ Text [ en-US ] = "Not enough memory." ; }; String SbERR_ALREADY_DIM & ERRCODE_RES_MASK @@ -66,7 +63,6 @@ Resource RID_BASIC_START }; String SbERR_OUT_OF_RANGE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Index auerhalb des definierten Bereichs : Index auerhalb des definierten Bereichs */ Text [ en-US ] = "Index out of defined range." ; }; String SbERR_DUPLICATE_DEF & ERRCODE_RES_MASK @@ -83,12 +79,10 @@ Resource RID_BASIC_START }; String SbERR_CONVERSION & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Datentypen unvertrglich : Datentypen unvertrglich */ Text [ en-US ] = "Data type mismatch." ; }; String SbERR_BAD_PARAMETER & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiger Parameter : Ungltiger Parameter */ Text [ en-US ] = "Invalid parameter." ; }; String SbERR_USER_ABORT & ERRCODE_RES_MASK @@ -101,7 +95,6 @@ Resource RID_BASIC_START }; String SbERR_STACK_OVERFLOW & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Nicht gengend Stapelspeicher : Nicht gengend Stapelspeicher */ Text [ en-US ] = "Not enough stack memory." ; }; String SbERR_PROC_UNDEFINED & ERRCODE_RES_MASK @@ -134,12 +127,10 @@ Resource RID_BASIC_START }; String SbERR_FILE_ALREADY_OPEN & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Datei bereits geffnet : Datei bereits geffnet */ Text [ en-US ] = "File already open." ; }; String SbERR_IO_ERROR & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Gerte-E/A-Fehler : Gerte-E/A-Fehler */ Text [ en-US ] = "Device I/O error." ; }; String SbERR_FILE_EXISTS & ERRCODE_RES_MASK @@ -148,7 +139,6 @@ Resource RID_BASIC_START }; String SbERR_BAD_RECORD_LENGTH & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Falsche Datensatzlnge : Falsche Datensatzlnge */ Text [ en-US ] = "Incorrect record length." ; }; String SbERR_DISK_FULL & ERRCODE_RES_MASK @@ -157,7 +147,6 @@ Resource RID_BASIC_START }; String SbERR_READ_PAST_EOF & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Lesen ber das Ende der Datei hinaus : Lesen ber das Ende der Datei hinaus */ Text [ en-US ] = "Reading exceeds EOF." ; }; String SbERR_BAD_RECORD_NUMBER & ERRCODE_RES_MASK @@ -170,7 +159,6 @@ Resource RID_BASIC_START }; String SbERR_NO_DEVICE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Gert nicht verfgbar : Gert nicht verfgbar */ Text [ en-US ] = "Device not available." ; }; String SbERR_ACCESS_DENIED & ERRCODE_RES_MASK @@ -187,7 +175,6 @@ Resource RID_BASIC_START }; String SbERR_DIFFERENT_DRIVE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Umbenennen auf verschiedenen Laufwerken nicht mglich : Umbenennen auf verschiedenen Laufwerken nicht mglich */ Text [ en-US ] = "Renaming on different drives impossible." ; }; String SbERR_ACCESS_ERROR & ERRCODE_RES_MASK @@ -204,12 +191,10 @@ Resource RID_BASIC_START }; String SbERR_BAD_PATTERN & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Zeichenfolgenmuster unzulssig : Zeichenfolgenmuster unzulssig */ Text [ en-US ] = "Invalid string pattern." ; }; String SBERR_IS_NULL & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Verwendung von Null unzulssig : Verwendung von Null unzulssig */ Text [ en-US ] = "Use of zero not permitted." ; }; String SbERR_DDE_ERROR & ERRCODE_RES_MASK @@ -222,7 +207,6 @@ Resource RID_BASIC_START }; String SbERR_DDE_OUTOFCHANNELS & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Keine freien DDE-Kanle : Keine freien DDE-Kanle */ Text [ en-US ] = "No DDE channels available." ; }; String SbERR_DDE_NO_RESPONSE & ERRCODE_RES_MASK @@ -239,17 +223,14 @@ Resource RID_BASIC_START }; String SbERR_DDE_NOTPROCESSED & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Fremdapplikation kann DDE-Operation nicht ausfhren : Fremdapplikation kann DDE-Operation nicht ausfhren */ Text [ en-US ] = "External application cannot execute DDE operation." ; }; String SbERR_DDE_TIMEOUT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Zeitberschreitung whrend des Wartens auf DDE-Antwort : Zeitberschreitung whrend des Wartens auf DDE-Antwort */ Text [ en-US ] = "Timeout while waiting for DDE response." ; }; String SbERR_DDE_USER_INTERRUPT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Benutzer drckte ESCAPE whrend der DDE-Operation : Benutzer drckte ESCAPE whrend der DDE-Operation */ Text [ en-US ] = "User pressed ESCAPE during DDE operation." ; }; String SbERR_DDE_BUSY & ERRCODE_RES_MASK @@ -270,7 +251,6 @@ Resource RID_BASIC_START }; String SbERR_DDE_CONV_CLOSED & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? DDE-Verbindung ist unterbrochen oder gendert worden : DDE-Verbindung ist unterbrochen oder gendert worden */ Text [ en-US ] = "DDE connection interrupted or modified." ; }; String SbERR_DDE_NO_CHANNEL & ERRCODE_RES_MASK @@ -279,7 +259,6 @@ Resource RID_BASIC_START }; String SbERR_DDE_INVALID_LINK & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiges DDE-Linkformat : Ungltiges DDE-Linkformat */ Text [ en-US ] = "Invalid DDE link format." ; }; String SbERR_DDE_QUEUE_OVERFLOW & ERRCODE_RES_MASK @@ -288,52 +267,42 @@ Resource RID_BASIC_START }; String SbERR_DDE_LINK_ALREADY_EST & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Paste Link bereits durchgefhrt : Paste Link bereits durchgefhrt */ Text [ en-US ] = "Paste link already performed." ; }; String SbERR_DDE_LINK_INV_TOPIC & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? LinkMode kann wegen ungltigen Link-Topics nicht gesetzt werden : LinkMode kann wegen ungltigen Link-Topics nicht gesetzt werden */ Text [ en-US ] = "Link mode cannot be set due to invalid link topic." ; }; String SbERR_DDE_DLL_NOT_FOUND & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Fr DDE wird DDEML.DLL bentigt : Fr DDE wird DDEML.DLL bentigt */ Text [ en-US ] = "DDE requires the DDEML.DLL file." ; }; String SbERR_CANNOT_LOAD & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Das Modul kann nicht geladen werden, ungltiges Format : Das Modul kann nicht geladen werden, ungltiges Format */ Text [ en-US ] = "Module cannot be loaded; invalid format." ; }; String SbERR_BAD_INDEX & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiger Objektindex : Ungltiger Objektindex */ Text [ en-US ] = "Invalid object index." ; }; String SbERR_NO_ACTIVE_OBJECT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Objekt ist nicht verfgbar : Objekt ist nicht verfgbar */ Text [ en-US ] = "Object is not available." ; }; String SbERR_BAD_PROP_VALUE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Falscher Wert fr Eigenschaft : Falscher Wert fr Eigenschaft */ Text [ en-US ] = "Incorrect property value." ; }; String SbERR_PROP_READONLY & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist schreibgeschtzt : Eigenschaft ist schreibgeschtzt */ Text [ en-US ] = "This property is read-only." ; }; String SbERR_PROP_WRITEONLY & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist lesegeschtzt : Eigenschaft ist lesegeschtzt */ Text [ en-US ] = "This property is write only." ; }; String SbERR_INVALID_OBJECT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltige Objektreferenz : Ungltige Objektreferenz */ Text [ en-US ] = "Invalid object reference." ; }; String SbERR_NO_METHOD & ERRCODE_RES_MASK @@ -350,12 +319,10 @@ Resource RID_BASIC_START }; String SbERR_NO_OLE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? OLE-Automatisierung wird von diesem Objekt nicht untersttzt : OLE-Automatisierung wird von diesem Objekt nicht untersttzt */ Text [ en-US ] = "OLE Automation is not supported by this object." ; }; String SbERR_BAD_METHOD & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Objekt untersttzt diese Eigenschaft oder Methode nicht : Objekt untersttzt diese Eigenschaft oder Methode nicht */ Text [ en-US ] = "This property or method is not supported by the object." ; }; String SbERR_OLE_ERROR & ERRCODE_RES_MASK @@ -364,17 +331,14 @@ Resource RID_BASIC_START }; String SbERR_BAD_ACTION & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Diese Aktion wird vom angegebenen Objekt nicht untersttzt : Diese Aktion wird vom angegebenen Objekt nicht untersttzt */ Text [ en-US ] = "This action is not supported by given object." ; }; String SbERR_NO_NAMED_ARGS & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Benannte Argumente werden vom angegebenen Objekt nicht untersttzt : Benannte Argumente werden vom angegebenen Objekt nicht untersttzt */ Text [ en-US ] = "Named arguments are not supported by given object." ; }; String SbERR_BAD_LOCALE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht untersttzt : Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht untersttzt */ Text [ en-US ] = "The current locale setting is not supported by the given object." ; }; String SbERR_NAMED_NOT_FOUND & ERRCODE_RES_MASK @@ -395,7 +359,6 @@ Resource RID_BASIC_START }; String SbERR_BAD_ORDINAL & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ordnungszahl ungltig : Ordnungszahl ungltig */ Text [ en-US ] = "Invalid ordinal number." ; }; String SbERR_DLLPROC_NOT_FOUND & ERRCODE_RES_MASK @@ -404,7 +367,6 @@ Resource RID_BASIC_START }; String SbERR_BAD_CLIPBD_FORMAT & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiges Clipboard-Format : Ungltiges Clipboard-Format */ Text [ en-US ] = "Invalid clipboard format." ; }; String SbERR_PROPERTY_NOT_FOUND & ERRCODE_RES_MASK @@ -421,12 +383,10 @@ Resource RID_BASIC_START }; String SbERR_BAD_NUMBER_OF_ARGS & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltige Anzahl von Argumenten : Ungltige Anzahl von Argumenten */ Text [ en-US ] = "Invalid number of arguments." ; }; String SbERR_METHOD_FAILED & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Fehler in Ausfhrung einer Methode : Fehler in Ausfhrung einer Methode */ Text [ en-US ] = "Error executing a method." ; }; String SbERR_SETPROP_FAILED & ERRCODE_RES_MASK @@ -516,12 +476,10 @@ Resource RID_BASIC_START }; String SbERR_BAD_CHAR_IN_NUMBER & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Ungltiges Zeichen in Zahl : Ungltiges Zeichen in Zahl */ Text [ en-US ] = "Invalid character in number." ; }; String SbERR_MUST_HAVE_DIMS & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Array mu dimensioniert werden : Array mu dimensioniert werden */ Text [ en-US ] = "Array must be dimensioned." ; }; String SbERR_NO_IF & ERRCODE_RES_MASK @@ -530,12 +488,10 @@ Resource RID_BASIC_START }; String SbERR_NOT_IN_SUBR & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) innerhalb einer Prozedur unzulssig : $(ARG1) innerhalb einer Prozedur unzulssig */ Text [ en-US ] = "$(ARG1) not allowed within a procedure." ; }; String SbERR_NOT_IN_MAIN & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) auerhalb einer Prozedur unzulssig : $(ARG1) auerhalb einer Prozedur unzulssig */ Text [ en-US ] = "$(ARG1) not allowed outside a procedure." ; }; String SbERR_WRONG_DIMS & ERRCODE_RES_MASK @@ -552,12 +508,10 @@ Resource RID_BASIC_START }; String SbERR_PROG_TOO_LARGE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Programm ist zu gro : Programm ist zu gro */ Text [ en-US ] = "Program too large." ; }; String SbERR_NO_STRINGS_ARRAYS & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Strings oder Arrays unzulssig : Strings oder Arrays unzulssig */ Text [ en-US ] = "Strings or arrays not permitted." ; }; String ERRCODE_BASIC_EXCEPTION & ERRCODE_RES_MASK @@ -604,26 +558,14 @@ String IDS_SBERR_STOREREF }; String ERRCODE_BASMGR_LIBLOAD & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */ Text [ en-US ] = "Error loading library '$(ARG1)'." ; }; String ERRCODE_BASMGR_LIBSAVE & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */ - /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */ Text [ en-US ] = "Error saving library: '$(ARG1)'." ; }; String ERRCODE_BASMGR_MGROPEN & ERRCODE_RES_MASK { - /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ - /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ - /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ - /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ Text [ en-US ] = "The BASIC from the file '$(ARG1)' could not be initialized." ; }; String ERRCODE_BASMGR_MGRSAVE & ERRCODE_RES_MASK diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index c80bc992349f..9dffcf21361e 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -94,7 +94,7 @@ using namespace cppu; #include<runtime.hxx> #include<math.h> -#include <hash_map> +#include <boost/unordered_map.hpp> #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp> #include <com/sun/star/reflection/XConstantsTypeDescription.hpp> @@ -1743,7 +1743,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, Reference<XIdlClass> xClass = TypeToIdlClass( rType ); if( !xClass.is() ) { - DBG_ERROR("failed to get XIdlClass for type"); + OSL_FAIL("failed to get XIdlClass for type"); break; } ::rtl::OUString sClassName = xClass->getName(); @@ -1839,7 +1839,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj ) else if( xClassProvider.is() ) { - DBG_ERROR( "XClassProvider not supported in UNO3" ); + OSL_FAIL( "XClassProvider not supported in UNO3" ); } } return aRet; @@ -3218,7 +3218,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) refVar->PutBool( TRUE ); } -typedef std::hash_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash; +typedef boost::unordered_map< ::rtl::OUString, std::vector< ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleHash; // helper wrapper function to interact with TypeProvider and @@ -3245,7 +3245,7 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot, return xEnum; } -typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash; +typedef boost::unordered_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash; VBAConstantHelper& VBAConstantHelper::instance() diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 750d48a67ca1..28b783c3d7d8 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -45,7 +45,6 @@ #include "runtime.hxx" #include "token.hxx" #include "sbunoobj.hxx" -#include "sbtrace.hxx" #include <svtools/syntaxhighlight.hxx> @@ -1121,9 +1120,6 @@ USHORT SbModule::Run( SbMethod* pMeth ) StarBASICRef xBasic; if( bDelInst ) { -#ifdef DBG_TRACE_BASIC - dbg_InitTrace(); -#endif // #32779: Hold Basic during the execution xBasic = (StarBASIC*) GetParent(); @@ -1180,10 +1176,6 @@ USHORT SbModule::Run( SbMethod* pMeth ) pMOD = this; SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart ); -#ifdef DBG_TRACE_BASIC - dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl ); -#endif - pRt->pNext = pINST->pRun; if( pRt->pNext ) pRt->pNext->block(); @@ -1196,11 +1188,6 @@ USHORT SbModule::Run( SbMethod* pMeth ) if( pRt->pNext ) pRt->pNext->unblock(); -#ifdef DBG_TRACE_BASIC - bool bLeave = true; - dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave ); -#endif - // #63710 It can happen by an another thread handling at events, // that the show call returns to an dialog (by closing the // dialog per UI), before a by an event triggered further call returned, @@ -1304,19 +1291,10 @@ void SbModule::RunInit() // The init code starts always here SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 ); -#ifdef DBG_TRACE_BASIC - dbg_traceNotifyCall( this, NULL, 0 ); -#endif - pRt->pNext = pINST->pRun; pINST->pRun = pRt; while( pRt->Step() ) {} -#ifdef DBG_TRACE_BASIC - bool bLeave = true; - dbg_traceNotifyCall( this, NULL, 0, bLeave ); -#endif - pINST->pRun = pRt->pNext; delete pRt; pMOD = pOldMod; diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 8f67efd3ff7c..19c822553fac 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -33,6 +33,7 @@ #include "sbcomp.hxx" #include "image.hxx" #include <limits> +#include <algorithm> #include <com/sun/star/script/ModuleType.hpp> // nInc is the increment size of the buffers @@ -236,14 +237,14 @@ void SbiCodeGen::Save() ePropType = SbxOBJECT; break; case PROPERTY_MODE_NONE: - DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" ); + OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" ); break; } String aPropName = pProc->GetPropName(); if( nPass == 1 ) aPropName = aPropName.Copy( aIfaceName.Len() + 1 ); SbProcedureProperty* pProcedureProperty = NULL; - OSL_TRACE("*** getProcedureProperty for thing %s", + OSL_TRACE("*** getProcedureProperty for thing %s", rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() ); pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType ); } @@ -437,10 +438,7 @@ public: T result = 0 ; static const S max = std::numeric_limits< S >::max(); result = m_nNumOp0 + ( ( sizeof(S) + 1 ) * m_nNumSingleParams ) + ( (( sizeof(S) * 2 )+ 1 ) * m_nNumDoubleParams ); - if ( result > max ) - return max; - - return static_cast<S>(result); + return std::min(static_cast<T>(max), result); } virtual bool processParams(){ return false; } }; diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index 260ac341a46a..b5131c58dfaf 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -317,8 +317,7 @@ void SbiParser::OnGoto() UINT32 nLbl = 0; do { - SbiToken eTok2 = NIL; - eTok2 = Next(); // Label holen + Next(); // Label holen if( MayBeLabel() ) { UINT32 nOff = pProc->GetLabels().Reference( aSym ); diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx index e7bf0393d296..03c9a50c18da 100644 --- a/basic/source/comp/sbcomp.cxx +++ b/basic/source/comp/sbcomp.cxx @@ -32,374 +32,6 @@ #include <basic/sbx.hxx> #include "sbcomp.hxx" #include "image.hxx" -#include "sbtrace.hxx" - - -//========================================================================== -// Tracing, for debugging only - -// To activate tracing enable in sbtrace.hxx -#ifdef DBG_TRACE_BASIC - -#include <hash_map> - -// Trace Settings -static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt"; -static const bool GbIncludePCodes = false; -static const int GnIndentPerCallLevel = 4; -static const int GnIndentForPCode = 2; - -struct TraceTextData -{ - rtl::OString m_aTraceStr_STMNT; - rtl::OString m_aTraceStr_PCode; -}; -typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap; -typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap; - -ModuleTraceMap GaModuleTraceMap; -ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap; - -static void lcl_PrepareTraceForModule( SbModule* pModule ) -{ - String aModuleName = pModule->GetName(); - ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName ); - if( it != rModuleTraceMap.end() ) - { - PCToTextDataMap* pInnerMap = it->second; - delete pInnerMap; - rModuleTraceMap.erase( it ); - } - - String aDisassemblyStr; - pModule->Disassemble( aDisassemblyStr ); -} - -static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL ) -{ - const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : ""; - FILE* pFile = fopen( pFileName, "a+" ); - if( pFile != NULL ) - { - fprintf( pFile, "%s%s\n", pPrintFirst, pStr ); - fclose( pFile ); - } -} - -const char* lcl_getSpaces( int nSpaceCount ) -{ - static sal_Char Spaces[] = " " - " " - " "; - static int nAvailableSpaceCount = strlen( Spaces ); - static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount; - - if( nSpaceCount > nAvailableSpaceCount ) - nSpaceCount = nAvailableSpaceCount; - - return pSpacesEnd - nSpaceCount; -} - -static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr ) -{ - static sal_Char Buffer[1000]; - - rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ); - const sal_Char* pStr = aOStr.getStr(); - - // Skip whitespace - sal_Char c = *pStr; - while( c == ' ' || c == '\t' ) - { - pStr++; - c = *pStr; - } - - int nLen = strlen( pStr ); - strncpy( Buffer, pStr, nLen ); - Buffer[nLen] = 0; - - rtl::OString aORetStr( Buffer ); - return aORetStr; -} - -String dumpMethodParameters( SbMethod* pMethod ) -{ - String aStr; - if( pMethod == NULL ) - return aStr; - - SbxError eOld = SbxBase::GetError(); - - SbxArray* pParams = pMethod->GetParameters(); - SbxInfo* pInfo = pMethod->GetInfo(); - if ( pParams ) - { - aStr += '('; - // 0 is sub itself - for ( USHORT nParam = 1; nParam < pParams->Count(); nParam++ ) - { - SbxVariable* pVar = pParams->Get( nParam ); - DBG_ASSERT( pVar, "Parameter?!" ); - if ( pVar->GetName().Len() ) - aStr += pVar->GetName(); - else if ( pInfo ) - { - const SbxParamInfo* pParam = pInfo->GetParam( nParam ); - if ( pParam ) - aStr += pParam->aName; - } - aStr += '='; - if( pVar->GetType() & SbxARRAY ) - aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); - else - aStr += pVar->GetString(); - if ( nParam < ( pParams->Count() - 1 ) ) - aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - } - aStr += ')'; - } - - SbxBase::ResetError(); - if( eOld != SbxERR_OK ) - SbxBase::SetError( eOld ); - - return aStr; -} - -// Public functions -void dbg_InitTrace( void ) -{ - FILE* pFile = fopen( GpTraceFileName, "w" ); - if( pFile != NULL ) - fclose( pFile ); -} - -void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ) -{ - SbModule* pTraceMod = pModule; - if( pTraceMod->ISA(SbClassModuleObject) ) - { - SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod; - pTraceMod = pClassModuleObj->getClassModule(); - } - - String aModuleName = pTraceMod->GetName(); - ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName ); - if( it == rModuleTraceMap.end() ) - { - const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr(); - char Buffer[200]; - sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr ); - lcl_lineOut( GpTraceFileName, Buffer ); - return; - } - - PCToTextDataMap* pInnerMap = it->second; - if( pInnerMap == NULL ) - { - lcl_lineOut( GpTraceFileName, "TRACE INTERNAL ERROR: No inner map" ); - return; - } - - PCToTextDataMap::iterator itInner = pInnerMap->find( nPC ); - if( itInner == pInnerMap->end() ) - { - const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr(); - char Buffer[200]; - sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr ); - lcl_lineOut( GpTraceFileName, Buffer ); - return; - } - - //nCallLvl--; - //if( nCallLvl < 0 ) - // nCallLvl = 0; - int nIndent = nCallLvl * GnIndentPerCallLevel; - - const TraceTextData& rTraceTextData = itInner->second; - const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT; - if( rStr_STMNT.getLength() ) - lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) ); - - if( !GbIncludePCodes ) - return; - - nIndent += GnIndentForPCode; - const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode; - if( rStr_PCode.getLength() ) - lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) ); -} - -void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave ) -{ - static const char* pSeparator = "' ================================================================================"; - - SbModule* pTraceMod = pModule; - SbClassModuleObject* pClassModuleObj = NULL; - if( pTraceMod->ISA(SbClassModuleObject) ) - { - pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod; - pTraceMod = pClassModuleObj->getClassModule(); - } - - if( nCallLvl > 0 ) - nCallLvl--; - int nIndent = nCallLvl * GnIndentPerCallLevel; - if( !bLeave ) - { - lcl_lineOut( GpTraceFileName, "" ); - lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) ); - } - - String aStr; - if( bLeave ) - { - lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) ); - aStr.AppendAscii( "' Leaving " ); - } - else - { - aStr.AppendAscii( "Entering " ); - } - String aModuleName = pTraceMod->GetName(); - aStr += aModuleName; - if( pMethod != NULL ) - { - aStr.AppendAscii( "::" ); - String aMethodName = pMethod->GetName(); - aStr += aMethodName; - } - else - { - aStr.AppendAscii( "/RunInit" ); - } - - if( pClassModuleObj != NULL ) - { - aStr.AppendAscii( "[this=" ); - aStr += pClassModuleObj->GetName(); - aStr.AppendAscii( "]" ); - } - if( !bLeave ) - aStr += dumpMethodParameters( pMethod ); - - lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) ); - if( !bLeave ) - lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) ); - - if( bLeave ) - lcl_lineOut( GpTraceFileName, "" ); -} - -void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl ) -{ - rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US ); - - char Buffer[200]; - const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : ""; - sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() ); - int nIndent = nCallLvl * GnIndentPerCallLevel; - lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) ); -} - -void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, - const String& aTraceStr_STMNT, const String& aTraceStr_PCode ) -{ - String aModuleName = pModule->GetName(); - ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName ); - PCToTextDataMap* pInnerMap; - if( it == rModuleTraceMap.end() ) - { - pInnerMap = new PCToTextDataMap(); - rModuleTraceMap[ aModuleName ] = pInnerMap; - } - else - { - pInnerMap = it->second; - } - - TraceTextData aData; - - rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT ); - aData.m_aTraceStr_STMNT = aOTraceStr_STMNT; - - rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode ); - aData.m_aTraceStr_PCode = aOTraceStr_PCode; - - (*pInnerMap)[nPC] = aData; -} - -#endif - - -//========================================================================== -// For debugging only -//#define DBG_SAVE_DISASSEMBLY - -#ifdef DBG_SAVE_DISASSEMBLY -static bool dbg_bDisassemble = true; -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess3.hpp> -#include <com/sun/star/io/XTextOutputStream.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> - -using namespace comphelper; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::ucb; -using namespace com::sun::star::io; - -void dbg_SaveDisassembly( SbModule* pModule ) -{ - bool bDisassemble = dbg_bDisassemble; - if( bDisassemble ) - { - Reference< XSimpleFileAccess3 > xSFI; - Reference< XTextOutputStream > xTextOut; - Reference< XOutputStream > xOut; - Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); - if( xSMgr.is() ) - { - Reference< XSimpleFileAccess3 > xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance - ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY ); - if( xSFI.is() ) - { - String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") ); - StarBASIC* pBasic = (StarBASIC*)pModule->GetParent(); - if( pBasic ) - { - aFile += pBasic->GetName(); - aFile.AppendAscii( "_" ); - } - aFile += pModule->GetName(); - aFile.AppendAscii( ".txt" ); - - // String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/BasicAsm.txt") ); - if( xSFI->exists( aFile ) ) - xSFI->kill( aFile ); - xOut = xSFI->openFileWrite( aFile ); - Reference< XInterface > x = xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TextOutputStream" )) ); - Reference< XActiveDataSource > xADS( x, UNO_QUERY ); - xADS->setOutputStream( xOut ); - xTextOut = Reference< XTextOutputStream >( x, UNO_QUERY ); - } - } - - if( xTextOut.is() ) - { - String aDisassemblyStr; - pModule->Disassemble( aDisassemblyStr ); - xTextOut->writeString( aDisassemblyStr ); - } - xOut->closeOutput(); - } -} -#endif - // Diese Routine ist hier definiert, damit der Compiler als eigenes Segment // geladen werden kann. @@ -453,14 +85,6 @@ BOOL SbModule::Compile() } } -#ifdef DBG_SAVE_DISASSEMBLY - dbg_SaveDisassembly( this ); -#endif - -#ifdef DBG_TRACE_BASIC - lcl_PrepareTraceForModule( this ); -#endif - return bRet; } diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index 5778655406f8..6ab16e1abf19 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -500,7 +500,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode ) case PROPERTY_MODE_LET: aCompleteProcName.AppendAscii( "Let " ); break; case PROPERTY_MODE_SET: aCompleteProcName.AppendAscii( "Set " ); break; case PROPERTY_MODE_NONE: - DBG_ERROR( "Illegal PropertyMode PROPERTY_MODE_NONE" ); + OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" ); break; } aCompleteProcName += aName; diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 3b253952fb67..419230c1c2b6 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -29,7 +29,7 @@ #ifndef BASIC_NAMECONTAINER_HXX #define BASIC_NAMECONTAINER_HXX -#include <hash_map> +#include <boost/unordered_map.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -101,7 +101,7 @@ struct eqName_Impl } }; -typedef std::hash_map +typedef boost::unordered_map < ::rtl::OUString, sal_Int32, diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx index a6ebfdc5df20..c1fdad21d1ce 100644 --- a/basic/source/inc/object.hxx +++ b/basic/source/inc/object.hxx @@ -55,12 +55,12 @@ using SbxVariable::GetInfo; // Definition eines Tabelleneintrags. Dies wird hier gemacht, // da dadurch die Methoden und Properties als private deklariert // werden koennen. -#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) || defined ( C52 ) +#if defined ( ICC ) || defined ( C50 ) || defined ( C52 ) public: #endif typedef void( SampleObject::*pMeth ) ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); -#if defined ( ICC ) || defined ( HPUX ) +#if defined ( ICC ) private: #endif diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx index 309ff38c5564..cbc98ac22fd4 100644 --- a/basic/source/inc/opcodes.hxx +++ b/basic/source/inc/opcodes.hxx @@ -31,10 +31,6 @@ #include "sbintern.hxx" -#ifdef MTW -#undef _NUMBER -#endif - // Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen // Wert des Opcodes (s.u.). diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx deleted file mode 100644 index daa10d7f9b57..000000000000 --- a/basic/source/inc/sbtrace.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SBTRACE_HXX -#define _SBTRACE_HXX - -// #define DBG_TRACE_BASIC - -#ifdef DBG_TRACE_BASIC -void dbg_InitTrace( void ); -void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ); -void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false ); -void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl ); -void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, - const String& aTraceStr_STMNT, const String& aTraceStr_PCode ); -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 011ffb9a7e02..faf913229ad3 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -42,7 +42,8 @@ #include <com/sun/star/reflection/XServiceTypeDescription2.hpp> #include <com/sun/star/reflection/XSingletonTypeDescription.hpp> #include <rtl/ustring.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> +#include <vector> class SbUnoObject: public SbxObject { @@ -321,7 +322,7 @@ public: virtual void Clear(); }; -typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash; +typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash; typedef std::vector< rtl::OUString > VBAConstantsVector; diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx index 1b68e089c451..f7f948bd0b31 100644 --- a/basic/source/inc/scriptcont.hxx +++ b/basic/source/inc/scriptcont.hxx @@ -142,7 +142,7 @@ public: }; //============================================================================ -typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap; +typedef boost::unordered_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap; typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo > SfxScriptLibrary_BASE; diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index aa3ce5ea3e02..87be0587bb81 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -196,7 +196,7 @@ SbError marshalString( return e; } std::vector< char > * blob = data.newBlob(); - blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength()); + blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1); *buffer = address(*blob); data.unmarshalStrings.push_back(StringData(variable, *buffer, special)); return ERRCODE_NONE; diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx index 09aee07fc934..64419c9e3b6e 100644 --- a/basic/source/runtime/dllmgr-x86.cxx +++ b/basic/source/runtime/dllmgr-x86.cxx @@ -203,7 +203,7 @@ SbError marshalString( return e; } std::vector< char > * blob = data.newBlob(); - blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength()); + blob->insert(blob->begin(), str.getStr(), str.getStr() + str.getLength() + 1 ); *buffer = address(*blob); data.unmarshalStrings.push_back(StringData(variable, *buffer, special)); return ERRCODE_NONE; diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 3984a03626aa..10990fc9fb39 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -625,7 +625,7 @@ void UCBStream::SetSize( ULONG nSize ) { (void)nSize; - DBG_ERROR( "not allowed to call from basic" ); + OSL_FAIL( "not allowed to call from basic" ); SetError( ERRCODE_IO_GENERAL ); } diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk index f8c81032a20e..64d9a6ff446d 100644 --- a/basic/source/runtime/makefile.mk +++ b/basic/source/runtime/makefile.mk @@ -65,6 +65,7 @@ SLOFILES+= \ $(SLO)$/dllmgr-none.obj .ENDIF .IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI" +SLOFILES+= \ $(SLO)$/wnt-x86.obj .ELIF "$(GUI)$(COM)$(CPU)" == "WNTGCCI" SLOFILES+= \ diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index ed9b9fed8436..380064bb0da8 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -52,9 +52,8 @@ #include "runtime.hxx" #include "sbunoobj.hxx" #ifdef WNT -#include <tools/prewin.h> -#include "winbase.h" -#include <tools/postwin.h> +#include <prewin.h> +#include <postwin.h> #include <tools/fsys.hxx> #else #include <osl/file.hxx> @@ -3447,7 +3446,7 @@ RTLFUNC(Rnd) else { double nRand = (double)rand(); - nRand = ( nRand / (double)RAND_MAX ); + nRand = ( nRand / ((double)RAND_MAX + 1.0)); rPar.Get(0)->PutDouble( nRand ); } } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 3de2f480b92e..d0babeee3d96 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -45,7 +45,6 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include "sbunoobj.hxx" #include "errobject.hxx" -#include "sbtrace.hxx" SbxVariable* getDefaultProp( SbxVariable* pRef ); @@ -325,7 +324,7 @@ SbiInstance::~SbiInstance() } catch( const Exception& ) { - DBG_ERROR( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" ); + OSL_FAIL( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" ); } ComponentVector.clear(); @@ -732,11 +731,6 @@ BOOL SbiRuntime::Step() Application::Reschedule(); } -#ifdef DBG_TRACE_BASIC - UINT32 nPC = ( pCode - (const BYTE* )pImg->GetCode() ); - dbg_traceStep( pMod, nPC, pINST->nCallLvl ); -#endif - SbiOpcode eOp = (SbiOpcode ) ( *pCode++ ); UINT32 nOp1, nOp2; if( eOp <= SbOP0_END ) @@ -773,11 +767,6 @@ BOOL SbiRuntime::Step() // (insbesondere nicht nach Compiler-Fehlern zur Laufzeit) if( nError && bRun ) { -#ifdef DBG_TRACE_BASIC - SbError nTraceErr = nError; - String aTraceErrMsg = GetSbData()->aErrMsg; - bool bTraceErrHandled = true; -#endif SbError err = nError; ClearExprStack(); nError = 0; @@ -858,19 +847,12 @@ BOOL SbiRuntime::Step() // Kein Error-Hdl gefunden -> altes Vorgehen else { -#ifdef DBG_TRACE_BASIC - bTraceErrHandled = false; -#endif pInst->Abort(); } // ALT: Nur // pInst->Abort(); } - -#ifdef DBG_TRACE_BASIC - dbg_traceNotifyError( nTraceErr, aTraceErrMsg, bTraceErrHandled, pINST->nCallLvl ); -#endif } } return bRun; diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index f5f54dad8515..f2f51c4406c7 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -35,7 +35,7 @@ #include <sal/macros.h> #include "rtlproto.hxx" #include "sbintern.hxx" -#include <hash_map> +#include <boost/unordered_map.hpp> // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter // benoetigen! @@ -82,7 +82,7 @@ struct StringHashCode class VBABlacklist { friend class VBABlackListQuery; - std::hash_map< String, bool, StringHashCode > mBlackList; + boost::unordered_map< String, bool, StringHashCode > mBlackList; VBABlacklist() { const char* list[] = { "Red" }; diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 62c822af1ea7..6683fbdc56ee 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -49,18 +49,11 @@ TYPEINIT0(SbxBase) SbxAppData* GetSbxData_Impl() { -#ifndef DOS SbxAppData** ppData = (SbxAppData**) ::GetAppData( SHL_SBX ); SbxAppData* p = *ppData; if( !p ) p = *ppData = new SbxAppData; return p; -#else - SbxAppData** ppData; - SbxAppData* p; - p = *ppData = new SbxAppData; - return p; -#endif } SbxAppData::~SbxAppData() diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index 1c039ef66d59..de80ea281b16 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -488,7 +488,7 @@ start: { SbxBase::SetError( SbxERR_OVERFLOW ); val = SbxMININT; } - *p->pInteger = (INT16) r; break; + *p->pInteger = (INT16) val; break; } case SbxBYREF | SbxERROR: case SbxBYREF | SbxUSHORT: diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index ee4c18996846..282409f081d2 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -87,7 +87,6 @@ double ImpGetDate( const SbxValues* p ) nRes = 0; else { -#ifndef DOS LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); SvNumberFormatter* pFormatter; @@ -138,9 +137,6 @@ double ImpGetDate( const SbxValues* p ) } delete pFormatter; -#else - SbxBase::SetError( SbxERR_CONVERSION ); nRes = 0; -#endif } break; case SbxOBJECT: @@ -235,7 +231,6 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: -#ifndef DOS { if( !p->pOUString ) p->pOUString = new ::rtl::OUString; @@ -292,11 +287,8 @@ start: pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor ); *p->pOUString = aTmpString; delete pFormatter; -#endif break; -#ifndef DOS } -#endif case SbxOBJECT: { SbxValue* pVal = PTR_CAST(SbxValue,p->pObj); diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index fcd7edbe1bc7..5438c151e60f 100644 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -34,7 +34,7 @@ #undef WB_LEFT #undef WB_RIGHT -#include <tools/prewin.h> +#include <prewin.h> } // close extern "C" { #ifndef __MINGW32__ @@ -43,7 +43,7 @@ #include <oleauto.h> extern "C" { // reopen extern "C" { -#include <tools/postwin.h> +#include <postwin.h> #endif #endif diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 182b4e7db37c..3e6aee717283 100644 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -385,13 +385,11 @@ short SbxBasicFormater::GetDigitAtPos( double dNumber, short nPos, double& dNextNumber, BOOL& bFoundFirstDigit ) // ACHTUNG: nPos kann auch negativ werden, f"ur Stellen nach dem Dezimal-Punkt { - double dTemp = dNumber; - double dDigit,dPos; + double dDigit; short nMaxDigit; // erst mal aus der Zahl eine positive Zahl machen: dNumber = fabs( dNumber ); - dPos = (double)nPos; // "uberpr"ufe ob Zahl zu klein f"ur angegebene Stelle ist nMaxDigit = (short)get_number_of_digits( dNumber ); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 5fe1704bcc38..c7cfe6e6850e 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -289,7 +289,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, short nExp = 0; // Exponent short nDig = nPrec + 1; // Anzahl Digits in Zahl short nDec; // Anzahl Vorkommastellen - register int i, digit; + register int i; // Komma besorgen sal_Unicode cDecimalSep, cThousandSep; @@ -339,6 +339,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, // Zahl ausgeben: if( nDig > 0 ) { + register int digit; for( i = 0 ; ; ++i ) { if( i < 16 ) @@ -747,8 +748,6 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const SvNumberFormatter aFormatter( xFactory, eLangType ); sal_uInt32 nIndex; - xub_StrLen nCheckPos = 0; - short nType; double nNumber; Color* pCol; @@ -757,6 +756,8 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const // number format, use SvNumberFormatter to handle it. if( bSuccess ) { + xub_StrLen nCheckPos = 0; + short nType; String aFmtStr = *pFmt; VbaFormatInfo* pInfo = getFormatInfo( aFmtStr ); if( pInfo && pInfo->meType != VBA_FORMAT_TYPE_NULL ) diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index df4fe7b4a753..6838e68eeeaa 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -624,7 +624,7 @@ BOOL SbxValue::Put( const SbxValues& rVal ) { if ( p != this ) { - DBG_ERROR( "TheRealValue" ); + OSL_FAIL( "TheRealValue" ); } HACK(nicht bei Parent-Prop - sonst CyclicRef) SbxVariable *pThisVar = PTR_CAST(SbxVariable, this); @@ -1199,7 +1199,6 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) } else if( GetType() == SbxCURRENCY || rOp.GetType() == SbxCURRENCY ) { - double dTest; aL.eType = SbxCURRENCY; aR.eType = SbxCURRENCY; @@ -1210,6 +1209,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) if( Get( aL ) ) switch( eOp ) { + double dTest; case SbxMUL: // first overflow check: see if product will fit - test real value of product (hence 2 curr factors) dTest = (double)aL.nInt64 * (double)aR.nInt64 / (double)CURRENCY_FACTOR_SQUARE; diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 0f6e577794c6..6af1675b9175 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -70,9 +70,10 @@ using namespace com::sun::star::script; using namespace com::sun::star::xml::sax; using namespace com::sun::star; using namespace cppu; -using namespace rtl; using namespace osl; +using ::rtl::OUString; + using com::sun::star::uno::Reference; #define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" diff --git a/basic/source/uno/modsizeexceeded.cxx b/basic/source/uno/modsizeexceeded.cxx index c38fc75c4041..d36f424bb532 100644 --- a/basic/source/uno/modsizeexceeded.cxx +++ b/basic/source/uno/modsizeexceeded.cxx @@ -35,9 +35,10 @@ using namespace com::sun::star; using namespace cppu; -using namespace rtl; using namespace osl; +using ::rtl::OUString; + ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >& sModules ) { script::ModuleSizeExceededRequest aReq; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index e9672b3396da..9c65b6a5f2b8 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -90,11 +90,15 @@ using namespace com::sun::star::frame; using namespace com::sun::star::deployment; using namespace com::sun::star; using namespace cppu; -using namespace rtl; using namespace osl; using com::sun::star::uno::Reference; +using ::rtl::OUString; +using ::rtl::OStringBuffer; +using ::rtl::OUStringToOString; +using ::rtl::Uri; + // #i34411: Flag for error handling during migration static bool GbMigrationSuppressErrors = false; @@ -943,7 +947,7 @@ sal_Bool SfxLibraryContainer::init_Impl( catch( uno::Exception& ) { // TODO: error handling? - OSL_ASSERT( "Cannot access extensions!" ); + OSL_FAIL( "Cannot access extensions!" ); } } @@ -1159,7 +1163,7 @@ sal_Bool SfxLibraryContainer::init_Impl( // #i93163 if( bCleanUp ) { - DBG_ERROR( "Upgrade of Basic installation failed somehow" ); + OSL_FAIL( "Upgrade of Basic installation failed somehow" ); static char strErrorSavFolderName[] = "__basic_80_err"; INetURLObject aPrevUserBasicInetObj_Err( aUserBasicInetObj ); @@ -1399,7 +1403,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) ); // #87671 Allow encryption -//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") ); aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) ); @@ -1547,7 +1550,6 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) ); // #87671 Allow encryption -//REMOVE aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Encrypted") ); aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); xProps->setPropertyValue( aPropName, uno::makeAny( sal_True ) ); diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index ece4fdccb9d4..d6bd191cd0da 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -80,11 +80,12 @@ using namespace com::sun::star::script; using namespace com::sun::star::xml::sax; using namespace com::sun::star; using namespace cppu; -using namespace rtl; using namespace osl; using com::sun::star::uno::Reference; +using ::rtl::OUString; + //============================================================================ // Implementation class SfxScriptLibraryContainer @@ -1151,11 +1152,6 @@ sal_Bool SfxScriptLibraryContainer::implLoadPasswordLibrary } } -//REMOVE // If the password is verified the library must remain modified, because -//REMOVE // otherwise for saving the storage would be copied and that doesn't work -//REMOVE // with mtg's storages when the password is verified -//REMOVE if( !pLib->mbPasswordVerified ) -//REMOVE pLib->mbModified = sal_False; return bRet; } diff --git a/basic/workben/basmgr.src b/basic/workben/basmgr.src deleted file mode 100644 index f89c719c2399..000000000000 --- a/basic/workben/basmgr.src +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#pragma CHARSET_IBMPC - -String 300 { - Text = "Dummy"; -}; diff --git a/basic/workben/makefile.mk b/basic/workben/makefile.mk deleted file mode 100644 index 7eb5da3d912c..000000000000 --- a/basic/workben/makefile.mk +++ /dev/null @@ -1,88 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=basic -TARGET=miniapp -TARGETTYPE=GUI - -# --- Settings --------------------------------------------------- - -.INCLUDE : settings.mk - -# --- SBASIC IDE -------------------------------------------------------- - -APP1TARGET=$(PRJNAME)app -APP1STDLIBS= \ - $(SALLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(SVTOOLLIB) \ - $(SVLLIB) \ - $(VCLLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SOTLIB) \ - - -#.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC" -#APP1STDLIBS+=$(CPPULIB) -#.ENDIF -#.IF "$(GUI)"=="UNX" -#APP1STDLIBS+= \ -# \ -# $(SALLIB) -#.ENDIF - -.IF "$(GUI)"!="OS2" -APP1LIBS= \ - $(LB)$/basic.lib -.ENDIF -APP1LIBS+= \ - $(LB)$/app.lib \ - $(LB)$/sample.lib -.IF "$(GUI)"=="UNX" || "$(GUI)"=="OS2" -APP1STDLIBS+= \ - $(BASICLIB) -.ENDIF - - -APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/basic.lib $(LB)$/app.lib $(LB)$/sample.lib - -APP1OBJS = $(OBJ)$/ttbasic.obj - -.IF "$(GUI)" != "UNX" -APP1OBJS+= \ - $(OBJ)$/app.obj \ - $(SLO)$/sbintern.obj -.ENDIF - -.INCLUDE : target.mk - diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx deleted file mode 100644 index 8059cf4de3a9..000000000000 --- a/basic/workben/mgrtest.cxx +++ /dev/null @@ -1,590 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basic.hxx" -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/sound.hxx> -#include <basic/basmgr.hxx> -#include <basic/sbx.hxx> -#include <basic/sbmod.hxx> -#include <basic/basrdll.hxx> - -// Defines for ToolBox-Id's -#define TB_NEW 1 -#define TB_OPENSTORAGE 2 -#define TB_SAVESTORAGE 3 -#define TB_ORG 4 -#define TB_CREATELIB1 10 -#define TB_CREATELIB2 11 -#define TB_CREATELIB3 12 -#define TB_LOADLIB1 20 -#define TB_LOADLIB2 21 -#define TB_LOADLIB3 22 -#define TB_STORELIBX 30 -#define TB_UNLOADX 31 -#define TB_LOADX 32 -#define TB_EXECX 33 -#define TB_REMOVEX 34 -#define TB_REMOVEDELX 35 - -#define TB_LIB0 40 -#define TB_LIB1 41 -#define TB_LIB2 42 -#define TB_LIB3 43 - -const char* pLib1Str = "Lib1"; -const char* pLib2Str = "Lib2"; -const char* pLib3Str = "Lib3"; - -// Test-Application -class TestApp : public Application -{ -public: - virtual void Main( void ); - virtual void Main( int, char*[] ); -}; - -// Test-Window with a ToolBox to choose a test from -// and the typically used virtual methods -class TestWindow : public WorkWindow -{ -private: - ToolBox aToolBox; - BasicManager* pBasMgr; - - void CheckError(); - USHORT nLibX; - DECL_LINK( BasicErrorHdl, StarBASIC * ); - - -public: - TestWindow(); - ~TestWindow(); - - virtual void Paint( const Rectangle& ); - virtual void Resize(); - virtual void KeyInput( const KeyEvent& rKeyEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - - DECL_LINK( TBSelect, ToolBox * ); - void UpdateToolBox(); - void ShowInfo(); -}; - -TestWindow::~TestWindow() -{ -} - -TestWindow::TestWindow() : - WorkWindow( NULL, WB_APP | WB_STDWORK | WB_3DLOOK | WB_CLIPCHILDREN ) , - aToolBox( this, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_LINESPACING ) ) -{ - nLibX = 0; - - aToolBox.SetButtonType( BUTTON_TEXT ); - aToolBox.SetLineCount( 2 ); - aToolBox.SetPosPixel( Point( 0, 0 ) ); - aToolBox.SetSelectHdl( LINK( this, TestWindow, TBSelect ) ); - - Font aFont; - aFont.SetName( "Helv" ); - aFont.SetSize( Size( 0, 6 ) ); - aFont.SetPitch( PITCH_VARIABLE ); - aFont.SetFamily( FAMILY_SWISS ); - aFont.SetTransparent( TRUE ); - aFont.SetAlign( ALIGN_TOP ); - aToolBox.SetFont( aFont ); - SetFont( aFont ); - - aToolBox.InsertItem( TB_NEW, "New" ); - aToolBox.SetHelpText( TB_NEW, "New BasicManager" ); - aToolBox.InsertItem( TB_OPENSTORAGE, "Load" ); - aToolBox.SetHelpText( TB_OPENSTORAGE, "Load Storage D:\\MYSTORE.SVS" ); - aToolBox.InsertItem( TB_SAVESTORAGE, "Save" ); - aToolBox.SetHelpText( TB_SAVESTORAGE, "Save Storage D:\\MYSTORE.SVS" ); - - aToolBox.InsertSeparator(); - - aToolBox.InsertItem( TB_ORG, "Verwalten" ); - aToolBox.SetHelpText( TB_ORG, "Libaries verwalten" ); - - aToolBox.InsertSeparator(); - - aToolBox.InsertItem( TB_LIB0, "0" ); - aToolBox.SetHelpText( TB_LIB0, "Aktuelle Lib: STANDARD" ); - aToolBox.InsertItem( TB_LIB1, "1" ); - aToolBox.SetHelpText( TB_LIB1, "Aktuelle Lib: 1" ); - aToolBox.InsertItem( TB_LIB2, "2" ); - aToolBox.SetHelpText( TB_LIB2, "Aktuelle Lib: 2" ); - aToolBox.InsertItem( TB_LIB3, "3" ); - aToolBox.SetHelpText( TB_LIB3, "Aktuelle Lib: 3" ); - - aToolBox.InsertBreak(); - aToolBox.InsertItem( TB_CREATELIB1, "CreateLib1" ); - aToolBox.SetHelpText( TB_CREATELIB1, "Create Libary LIB1" ); - aToolBox.InsertItem( TB_CREATELIB2, "CreateLib2" ); - aToolBox.SetHelpText( TB_CREATELIB2, "Create Libary LIB2" ); - aToolBox.InsertItem( TB_CREATELIB3, "CreateLib3" ); - aToolBox.SetHelpText( TB_CREATELIB3, "Create Libary LIB3" ); - - aToolBox.InsertSeparator(); - aToolBox.InsertItem( TB_LOADLIB1, "LoadLib1" ); - aToolBox.SetHelpText( TB_LOADLIB1, "Load Libary LIB1" ); - aToolBox.InsertItem( TB_LOADLIB2, "LoadLib2" ); - aToolBox.SetHelpText( TB_LOADLIB2, "Load Libary LIB2" ); - aToolBox.InsertItem( TB_LOADLIB3, "LoadLib3" ); - aToolBox.SetHelpText( TB_LOADLIB3, "Load Libary LIB3" ); - - aToolBox.InsertSeparator(); - aToolBox.InsertItem( TB_STORELIBX, "StoreLibX" ); - aToolBox.SetHelpText( TB_STORELIBX, "Store Libary LIBX" ); - aToolBox.InsertItem( TB_UNLOADX, "UnloadX" ); - aToolBox.SetHelpText( TB_UNLOADX, "Unload Libary LIBX" ); - aToolBox.InsertItem( TB_LOADX, "LoadX" ); - aToolBox.SetHelpText( TB_LOADX, "Load Libary LIBX" ); - aToolBox.InsertItem( TB_EXECX, "ExecX" ); - aToolBox.SetHelpText( TB_EXECX, "Execute 'Libary' LIBX" ); - aToolBox.InsertItem( TB_REMOVEX, "RemoveX" ); - aToolBox.SetHelpText( TB_REMOVEX, "Remove Libary LIBX" ); - aToolBox.InsertItem( TB_REMOVEDELX, "RemDelX" ); - aToolBox.SetHelpText( TB_REMOVEDELX, "Remove and delete Libary LIBX" ); - - pBasMgr = 0; - - Show(); - UpdateToolBox(); - aToolBox.Show(); -} -void TestWindow::ShowInfo() -{ - Invalidate(); - Update(); - long nH = GetTextSize( "X" ).Height(); - if ( pBasMgr ) - { - Point aPos( 10, aToolBox.GetSizePixel().Height()+5 ); - for ( USHORT nLib = 0; nLib < pBasMgr->GetLibCount(); nLib++ ) - { - String aOutStr( nLib ); - aOutStr +=": "; - StarBASIC* pL = pBasMgr->GetLib( nLib ); - aOutStr += '['; - aOutStr += pBasMgr->GetLibName( nLib ); - aOutStr += "]<"; - if ( pL ) - aOutStr += pL->GetName(); - else - aOutStr += "NoLoaded"; - aOutStr += ">, Storage='"; - aOutStr += pBasMgr->GetLibStorageName( nLib ); - aOutStr += "', bLoaded="; - aOutStr += (USHORT)pBasMgr->IsLibLoaded( nLib ); - DrawText( aPos, aOutStr ); - aPos.Y() += nH; - } - } -} - -void TestWindow::UpdateToolBox() -{ - // View of some buttons as checked or disabled if - // wished by tests - aToolBox.EnableItem( TB_ORG, (BOOL)(ULONG)pBasMgr ); - - aToolBox.EnableItem( TB_CREATELIB1, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_CREATELIB2, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_CREATELIB3, (BOOL)(ULONG)pBasMgr ); - - aToolBox.EnableItem( TB_LOADLIB1, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_LOADLIB2, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_LOADLIB3, (BOOL)(ULONG)pBasMgr ); - - aToolBox.EnableItem( TB_STORELIBX, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_EXECX, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_UNLOADX, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_LOADX, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_REMOVEX, (BOOL)(ULONG)pBasMgr ); - aToolBox.EnableItem( TB_REMOVEDELX, (BOOL)(ULONG)pBasMgr ); - - aToolBox.CheckItem( TB_LIB0, nLibX == 0 ); - aToolBox.CheckItem( TB_LIB1, nLibX == 1 ); - aToolBox.CheckItem( TB_LIB2, nLibX == 2 ); - aToolBox.CheckItem( TB_LIB3, nLibX == 3 ); -} - -IMPL_LINK( TestWindow, TBSelect, ToolBox *, p ) -{ - USHORT nId = aToolBox.GetCurItemId(); - BOOL bChecked = aToolBox.IsItemChecked( nId ); - switch ( nId ) - { - case TB_NEW: - { - delete pBasMgr; - pBasMgr = new BasicManager( new StarBASIC ); - pBasMgr->SetStorageName( "d:\\mystore.svs" ); - } - break; - case TB_OPENSTORAGE: - { - delete pBasMgr; - SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs", STREAM_READ | STREAM_SHARE_DENYWRITE ); - DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); - pBasMgr = new BasicManager( *xStorage ); - } - break; - case TB_SAVESTORAGE: - { - if ( pBasMgr) - { - SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); - DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); - pBasMgr->Store( *xStorage ); - } - } - break; - case TB_ORG: - { - if ( pBasMgr) - { - InfoBox( 0, "Organisieren..." ).Execute(); - } - } - break; - case TB_CREATELIB1: - { - if ( pBasMgr ) - { - USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib1Str ) ); - if ( nLib != LIB_NOTFOUND ) - { - pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); - StarBASIC* pLib = pBasMgr->GetLib( pLib1Str ); - DBG_ASSERT( pLib, "Lib?!" ); - String aSource( "Sub SubInLib1Mod1\nprint\"XXX\"\nEnd Sub"); - SbModule* pM = pLib->MakeModule( "ModLib1", aSource ); - DBG_ASSERT( pM, "Modul?" ); - pLib->Compile( pM ); - } - else - InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); - } - } - break; - case TB_CREATELIB2: - { - if ( pBasMgr ) - { - USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib2Str ) ); - if ( nLib != LIB_NOTFOUND ) - { - pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); - StarBASIC* pLib = pBasMgr->GetLib( pLib2Str ); - DBG_ASSERT( pLib, "Lib?!" ); - SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub SubInLib2\n print \"Tralala\" \nEnd Sub\n" ); - pLib->Compile( pM ); - } - else - InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); - } - } - break; - case TB_CREATELIB3: - { - if ( pBasMgr ) - { - // is located in another storage !!! - USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) ); - if ( nLib != LIB_NOTFOUND ) - { - pBasMgr->SetLibStorageName( nLib, "d:\\mystore2.svs" ); - StarBASIC* pLib = pBasMgr->GetLib( pLib3Str ); - DBG_ASSERT( pLib, "Lib?!" ); - SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub XYZInLib3\n print \"?!\" \nEnd Sub\n" ); - pLib->Compile( pM ); - } - else - InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); - } - } - break; - case TB_LOADLIB1: - { - if ( pBasMgr ) - { - SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); - if ( !pBasMgr->AddLib( *xStorage, pLib1Str, FALSE ) ) - Sound::Beep(); - } - } - break; - case TB_LOADLIB2: - { - if ( pBasMgr ) - { - SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); - if ( !pBasMgr->AddLib( *xStorage, pLib2Str, FALSE ) ) - Sound::Beep(); - } - } - break; - case TB_LOADLIB3: - { - if ( pBasMgr ) - { - // is located in another storage !!! - SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" ); - if ( !pBasMgr->AddLib( *xStorage, pLib3Str, FALSE ) ) - Sound::Beep(); - } - } - break; - case TB_STORELIBX: - { - if ( pBasMgr ) - pBasMgr->StoreLib( nLibX ); - } - break; - case TB_UNLOADX: - { - if ( pBasMgr ) - pBasMgr->UnloadLib( nLibX ); - } - break; - case TB_LOADX: - { - if ( pBasMgr ) - pBasMgr->LoadLib( nLibX ); - } - break; - case TB_REMOVEX: - { - if ( pBasMgr ) - pBasMgr->RemoveLib( nLibX, FALSE ); - } - break; - case TB_REMOVEDELX: - { - if ( pBasMgr ) - pBasMgr->RemoveLib( nLibX, TRUE ); - } - break; - case TB_EXECX: - { - if ( pBasMgr ) - { - StarBASIC* pBasic = pBasMgr->GetLib( nLibX ); - if ( pBasic && pBasic->GetModules()->Count() ) - { - pBasic->SetErrorHdl( LINK( this, TestWindow, BasicErrorHdl ) ); - - SbModule* pMod = (SbModule*)pBasic->GetModules()->Get( 0 ); - if ( pMod && pMod->GetMethods()->Count() ) - pMod->GetMethods()->Get(0)->GetInteger(); - } - } - } - break; - - case TB_LIB0: nLibX = 0; - break; - case TB_LIB1: nLibX = 1; - break; - case TB_LIB2: nLibX = 2; - break; - case TB_LIB3: nLibX = 3; - break; - } - - UpdateToolBox(); - CheckError(); - ShowInfo(); - return 0; -} - -void TestWindow::CheckError() -{ - if ( pBasMgr ) - { - BasicError* pError = pBasMgr->GetFirstError(); - while ( pError ) - { - String aErrorStr; - String aReasonStr; - switch ( pError->GetErrorId() ) - { - case BASERR_ID_STDLIBOPEN: - aErrorStr = "Standard-Lib konnte nicht geoffnet werden."; - break; - case BASERR_ID_STDLIBSAVE: - aErrorStr = "Standard-Lib konnte nicht gespeichert werden."; - break; - case BASERR_ID_LIBLOAD: - aErrorStr = "Lib konnte nicht geoffnet werden."; - break; - case BASERR_ID_LIBCREATE: - aErrorStr = "Lib konnte nicht erzeugt werden."; - break; - case BASERR_ID_LIBSAVE: - aErrorStr = "Lib konnte nicht gespeichert werden."; - break; - case BASERR_ID_MGROPEN: - aErrorStr = "Manager konnte nicht geladen werden."; - break; - case BASERR_ID_MGRSAVE: - aErrorStr = "Manager konnte nicht gespeichert werden."; - break; - case BASERR_ID_UNLOADLIB: - aErrorStr = "Libary konnte nicht entladen werden."; - break; - case BASERR_ID_REMOVELIB: - aErrorStr = "Libary konnte nicht entfernt werden."; - break; - default: - aErrorStr = "Unbekannter Fehler!"; - } - - switch ( pError->GetReason() ) - { - case BASERR_REASON_OPENSTORAGE: - aReasonStr = "Der Storage konnte nicht geoeffnet werden"; - break; - case BASERR_REASON_OPENLIBSTORAGE: - aReasonStr = "Der Lib-Storage konnte nicht geoeffnet werden"; - break; - case BASERR_REASON_OPENMGRSTREAM: - aReasonStr = "Der Manager-Stream konnte nicht geoeffnet werden"; - break; - case BASERR_REASON_OPENLIBSTREAM: - aReasonStr = "Der Basic-Stream konnte nicht geoeffnet werden"; - break; - case BASERR_REASON_STDLIB: - aReasonStr = "STANDARD-Lib"; - break; - case BASERR_REASON_BASICLOADERROR: - aReasonStr = "Fehler beim Laden des Basics"; - default: - aReasonStr = " - "; - } - - String aErr( aErrorStr ); - aErr += "\nGrund: "; - aErr += aReasonStr; - InfoBox( 0, aErr ).Execute(); - - pError = pBasMgr->GetNextError(); - } - pBasMgr->ClearErrors(); - } -} - -void TestWindow::Paint( const Rectangle& rRec ) -{ -} - -void TestWindow::Resize() -{ - Size aTBSz = aToolBox.CalcWindowSizePixel(); - aToolBox.SetSizePixel( Size( GetOutputSizePixel().Width(), aTBSz.Height()) ); - Invalidate(); - ShowInfo(); -} - -void TestWindow::KeyInput( const KeyEvent& rKEvt ) -{ - char nCharCode = rKEvt.GetCharCode(); - USHORT nCode = rKEvt.GetKeyCode().GetCode(); - - // Only at Alt-Return - if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() ) - ; - else - WorkWindow::KeyInput( rKEvt ); - - UpdateToolBox(); -} - -void TestWindow::MouseMove( const MouseEvent& rMEvt ) -{ -} - -void TestWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - ShowInfo(); -} - -void TestWindow::MouseButtonUp( const MouseEvent& rMEvt ) -{ - UpdateToolBox(); -} - -IMPL_LINK( TestWindow, BasicErrorHdl, StarBASIC *, pBasic ) -{ - String aErrorText( pBasic->GetErrorText() ); - - String aErrorTextPrefix; - if( pBasic->IsCompilerError() ) - { - aErrorTextPrefix = "Compilererror: "; - } - else - { - aErrorTextPrefix = "Runtimeerror: "; - aErrorTextPrefix += pBasic->GetErrorCode(); - aErrorTextPrefix += " "; - } - - InfoBox( 0, String( aErrorTextPrefix + aErrorText ) ).Execute(); - return 0; -} - -void TestApp::Main( void ) -{ - Main( 0, NULL ); -} - -void TestApp::Main( int, char*[] ) -{ - BasicDLL aBasiDLL; - SvFactory::Init(); - EnableSVLook(); - TestWindow aWindow; - Execute(); - SvFactory::DeInit(); -} - - -TestApp aTestApp; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |