diff options
Diffstat (limited to 'basic/source')
34 files changed, 805 insertions, 951 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 1252c5bc22..00a7877fcf 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -192,7 +192,7 @@ BOOL IsTTSignatureForUnicodeTextfile( String aLine ) return aLine.EqualsAscii( TT_SIGNATURE_FOR_UNICODE_TEXTFILES ); } -BasicApp aBasicApp; // Applikations-Instanz +BasicApp aBasicApp; // Application instance static const char * const components[] = { @@ -202,7 +202,7 @@ static const char * const components[] = , "sax.uno" SAL_DLLEXTENSION , "stocservices.uno" SAL_DLLEXTENSION , SAL_MODULENAME( "fileacc" ) - , SAL_MODULENAME( "mcnttype" ) //Clipboard Ask Oliver Braun + , SAL_MODULENAME( "mcnttype" ) // Clipboard Ask Oliver Braun , "i18npool.uno" SAL_DLLEXTENSION // Reading of files in specific encodings like UTF-8 using // createUnoService( "com.sun.star.io.TextInputStream" ) and such @@ -408,7 +408,6 @@ void BasicApp::Main( ) PostUserEvent( LINK( this, BasicApp, LateInit ) ); Execute(); - // Loeschen der Members: // delete pHelp; delete pFrame; @@ -584,7 +583,7 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, nFlags = 0; // Icon aAppIcon; - if ( pBasic->pTestObject ) // also sid wir testtool + if ( pBasic->pTestObject ) // Are we the testtool? { // aAppIcon = Icon( ResId( RID_APPICON2 ) ); aAppName = String( SttResId( IDS_APPNAME2 ) ); @@ -608,9 +607,9 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, pFileMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); pFileMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); pFileMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - if (Basic().pTestObject ) // Wir sind also TestTool + if (Basic().pTestObject ) // Are we TestTool? { - pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) -1 ); // Der Trenner davor + pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) -1 ); // Separator before pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) ); pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILESAVELIB ) ); } @@ -625,14 +624,14 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, pRunMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); pRunMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); pRunMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); - if (Basic().pTestObject ) // Wir sind also TestTool + if (Basic().pTestObject ) // Are we TestTool? { pRunMenu->RemoveItem( pRunMenu->GetItemPos( RID_RUNDISAS ) ); pRunMenu->RemoveItem( pRunMenu->GetItemPos( RID_RUNCOMPILE ) ); } PopupMenu *pExtras; - if (Basic().pTestObject ) // Wir sind also TestTool + if (Basic().pTestObject ) // Are we TestTool? { pExtras = new PopupMenu( SttResId( RID_TT_EXTRAS ) ); pBar->InsertItem( RID_TT_EXTRAS, String( SttResId( RID_TT_EXTRAS_NAME ) ), 0, pBar->GetItemPos( RID_APPWINDOW ) ); @@ -666,7 +665,7 @@ BasicFrame::BasicFrame() : WorkWindow( NULL, UpdateTitle(); // SetIcon( aAppIcon ); - // Groesse: halbe Breite, dreiviertel Hoehe minus 2 * IconSize + // Size: half width, 0.75 * height - 2 * IconSize { Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup("WinGeom"); @@ -748,7 +747,7 @@ BasicFrame::~BasicFrame() delete pList; // delete pExecutionStatus; // delete pBasic; - pBasic.Clear(); // Da jetzt REF + pBasic.Clear(); } void BasicFrame::Command( const CommandEvent& rCEvt ) @@ -887,12 +886,12 @@ void BasicFrame::Resize() pStatus->SetSizePixel( aStatusSize ); - // Eventuell Maximized window resizen + // Resize possibly maximized window ULONG i; for( i = pList->Count(); i > 0 ; i-- ) { if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX ) - pList->GetObject( i-1 )->Maximize(); // resized auch + pList->GetObject( i-1 )->Maximize(); } } @@ -950,10 +949,8 @@ void BasicFrame::WinShow_Hide() { if ( p->pDataEdit ) { - if ( p->GetWinState() & TT_WIN_STATE_HIDE // Versteckt - || ( bWasFullscreen - && ( !p->IsPined() || p->GetWinState() & TT_WIN_STATE_MAX ) - ) + if ( p->GetWinState() & TT_WIN_STATE_HIDE // Hidden + || ( bWasFullscreen && ( !p->IsPined() || p->GetWinState() & TT_WIN_STATE_MAX )) ) p->Hide( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); else @@ -965,7 +962,7 @@ void BasicFrame::WinShow_Hide() void BasicFrame::WinMax_Restore() { - // Die ApplicationButtons + // The application buttons AppWin* p; BOOL bHasFullscreenWin = FALSE; for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() ) @@ -998,7 +995,7 @@ void BasicFrame::RemoveWindow( AppWin *pWin ) pWinMenu->RemoveItem( pWinMenu->GetItemPos( pWin->GetWinId() ) ); - // Trenner entfernen + // Remove separator if ( pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) == MENUITEM_SEPARATOR ) pWinMenu->RemoveItem( pWinMenu->GetItemCount() - 1 ); @@ -1007,13 +1004,12 @@ void BasicFrame::RemoveWindow( AppWin *pWin ) void BasicFrame::AddWindow( AppWin *pWin ) { - // Eintragen: pList->Insert( pWin, LIST_APPEND ); pWork = pWin; WinMax_Restore(); - // Hauptmenue aktivieren: + // Enable main menu MenuBar* pMenu = GetMenuBar(); if( pList->Count() > 0 ) { pMenu->EnableItem( RID_APPEDIT, TRUE ); @@ -1024,11 +1020,11 @@ void BasicFrame::AddWindow( AppWin *pWin ) PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); USHORT nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 ); - // Trenner erforderlich + // Separator necessary if ( nLastID < RID_WIN_FILE1 && pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) != MENUITEM_SEPARATOR ) pWinMenu->InsertSeparator(); - // Freie ID finden + // Find free ID USHORT nFreeID = RID_WIN_FILE1; while ( pWinMenu->GetItemPos( nFreeID ) != MENU_ITEM_NOTFOUND && nFreeID < RID_WIN_FILEn ) nFreeID++; @@ -1076,7 +1072,7 @@ BOOL BasicFrame::Close() { aLineNum.Stop(); - // Alle übrigen Dialoge schliessen um assertions zu vermeiden!! + // Close remaining dialogs to avoid assertions while ( GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP ) ) { delete GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP )->GetWindow( WINDOW_CLIENT ); @@ -1105,8 +1101,7 @@ BOOL BasicFrame::CompileAll() return TRUE; } -// Menu aufsetzen - +// Setup menu #define MENU2FILENAME( Name ) Name.Copy( Name.SearchAscii(" ") +1).EraseAllChars( '~' ) #define LRUNr( nNr ) CByteString("LRU").Append( ByteString::CreateFromInt32( nNr ) ) String FILENAME2MENU( USHORT nNr, String aName ) @@ -1121,6 +1116,7 @@ String FILENAME2MENU( USHORT nNr, String aName ) return aRet.AppendAscii(" ").Append( aName ); } + void BasicFrame::AddToLRU(String const& aFile) { Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); @@ -1203,7 +1199,7 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) BOOL bHasEdit = BOOL( /*bNormal &&*/ pWork != NULL ); -// pMenu->EnableItem( RID_FILENEW, bNormal ); // immer möglich +// pMenu->EnableItem( RID_FILENEW, bNormal ); // always possible // pMenu->EnableItem( RID_FILEOPEN, bNormal ); pMenu->EnableItem( RID_FILECLOSE, bHasEdit ); pMenu->EnableItem( RID_FILESAVE, bHasEdit ); @@ -1216,15 +1212,19 @@ IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 ); BOOL bNext = bHasErr & bNormal; BOOL bPrev = bHasErr & bNormal; - if( bHasErr ) { + if( bHasErr ) + { ULONG n = pBasic->aErrors.GetCurPos(); - if( n == 0 ) bPrev = FALSE; - if( USHORT(n+1) == pBasic->GetErrors() ) bNext = FALSE; + if( n == 0 ) + bPrev = FALSE; + if( USHORT(n+1) == pBasic->GetErrors() ) + bNext = FALSE; } pMenu->EnableItem( RID_RUNNEXTERR, bNext ); pMenu->EnableItem( RID_RUNPREVERR, bPrev ); pMenu->CheckItem( RID_RUNDISAS, bDisas ); - if( pWork ) pWork->InitMenu( pMenu ); + if( pWork ) + pWork->InitMenu( pMenu ); return TRUE; } @@ -1369,8 +1369,7 @@ BOOL BasicFrame::LoadFile( String aFilename ) return bSuccess; } -// Kommando ausfuehren - +// Execute command long BasicFrame::Command( short nID, BOOL bChecked ) { BasicError* pErr; @@ -1477,7 +1476,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) } if( bInBreak ) - // Nur das Flag zuruecksetzen + // Reset the flag bInBreak = FALSE; else { @@ -1491,12 +1490,12 @@ long BasicFrame::Command( short nID, BOOL bChecked ) Basic().ClearGlobalVars(); p->Run(); BasicDLL::SetDebugMode( FALSE ); - // Falls waehrend Interactive=FALSE abgebrochen + // If cancelled during Interactive=FALSE // BasicDLL::EnableBreak( TRUE ); } }} } -// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // nach run +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // after run break; case RID_RUNCOMPILE: if( pWork && pWork->ISA(AppBasEd) && SaveAll() ) @@ -1639,7 +1638,7 @@ long BasicFrame::Command( short nID, BOOL bChecked ) */ case RID_HELPABOUT: { SttResId aResId( IDD_ABOUT_DIALOG ); - if ( Basic().pTestObject ) // Wir sind also TestTool + if ( Basic().pTestObject ) // Are we TestTool? aResId = SttResId( IDD_TT_ABOUT_DIALOG ); else aResId = SttResId( IDD_ABOUT_DIALOG ); @@ -1785,7 +1784,7 @@ void NewFileDialog::FilterSelect() if ( aLastPath.Len() == 0 ) aLastPath = DirEntry( GetPath() ).GetPath().GetFull(); if ( aLastPath.CompareIgnoreCaseToAscii( DirEntry( GetPath() ).GetPath().GetFull() ) != COMPARE_EQUAL ) - return; // Der Benutzer entscheidet sich nachdem er den Pfad geändert hat. + return; // User decides after he has changed the path String aCurFilter = GetCurFilter(); USHORT nFilterNr = 0; @@ -1860,7 +1859,7 @@ BOOL BasicFrame::QueryFileName else aDlg.SetCurFilter( String( SttResId( IDS_BASFILTER ) ) ); - aDlg.FilterSelect(); // Setzt den Pfad vom letzten mal. + aDlg.FilterSelect(); // Selects the last used path // if ( bSave ) if ( rName.Len() > 0 ) aDlg.SetPath( rName ); @@ -1904,7 +1903,7 @@ void BasicFrame::LoadLibrary() if( pNew && pNew->ISA( MyBasic ) ) { pBasic = pNew; - // Alle Inhalte - sofern vorhanden - anzeigen + // Show all contents if existing SbxArray* pMods = pBasic->GetModules(); for( USHORT i = 0; i < pMods->Count(); i++ ) { @@ -1962,7 +1961,7 @@ String BasicFrame::GenRealString( const String &aResString ) aString = String( SttResId( (USHORT)(aValue.ToInt32()) ) ); // else { -// DBG_ERROR( "Ressource konnte nicht geladen werden" ); +// DBG_ERROR( "Could not load resource!" ); // return aResString; } nInsertPos = nStart; @@ -1970,8 +1969,9 @@ String BasicFrame::GenRealString( const String &aResString ) aResult.Erase( nStart, nEnd-nStart+1 ); bFound = TRUE; } - else if ( aType.Search(BaseArgKenn) == 0 ) // Fängt mit BaseArgKenn an + else if ( aType.Search(BaseArgKenn) == 0 ) // Starts with BaseArgKenn { + // TODO: What the hell is that for?? USHORT nArgNr = USHORT( aType.Copy( BaseArgKenn.Len() ).ToInt32() ); DBG_ASSERT( aString.Search( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")") ) != STRING_NOTFOUND, "Extra Argument given in String"); aString.SearchAndReplace( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")"), aValue ); diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx index f6d4f03549..f348689773 100644 --- a/basic/source/app/app.hxx +++ b/basic/source/app/app.hxx @@ -81,8 +81,8 @@ public: typedef USHORT FileType; -#define FT_NO_FILE (FileType)0x00 // Ein Fehler ist aufgetreten ... -#define FT_BASIC_SOURCE (FileType)0x01 +#define FT_NO_FILE (FileType)0x00 // An error has occurred ... +#define FT_BASIC_SOURCE (FileType)0x01 #define FT_BASIC_INCLUDE (FileType)0x02 #define FT_RESULT_FILE (FileType)0x04 #define FT_RESULT_FILE_TXT (FileType)0x08 @@ -98,10 +98,10 @@ class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener using SystemWindow::Notify; using Window::Command; -virtual BOOL Close(); // Schliessen - BOOL CloseAll(); // Alle Fenster schliessen - BOOL CompileAll(); // Alle Texte compilieren - AutoTimer aLineNum; // Zeigt die Zeilennummer an +virtual BOOL Close(); + BOOL CloseAll(); // Close all windows + BOOL CompileAll(); // Compile all texts + AutoTimer aLineNum; // Show the line numbers virtual void Resize(); virtual void Move(); virtual void GetFocus(); @@ -116,14 +116,14 @@ virtual void GetFocus(); - Timer aCheckFiles; // Prüfen der Dateien auf Änderungen + Timer aCheckFiles; // Checks the files for changes BOOL bAutoReload; BOOL bAutoSave; DECL_LINK( CheckAllFiles, Timer* ); MyBasicRef pBasic; // BASIC-Engine - String aAppName; // Inhalt der Titelteile der App: + String aAppName; // Title bar content String aAppFile; // AppName AppFile [AppMode] String aAppMode; void UpdateTitle(); @@ -136,14 +136,14 @@ virtual void GetFocus(); public: BOOL IsAutoRun(); void SetAutoRun( BOOL bAuto ); - BOOL bInBreak; // TRUE, wenn im Break-Handler - StatusLine* pStatus; // Statuszeile - EditList* pList; // List der Edit-Fenster - AppWin* pWork; // aktuelles Edit-Fenster - BasicPrinter* pPrn; // Drucker + BOOL bInBreak; // TRUE if in Break-Handler + StatusLine* pStatus; // Status line + EditList* pList; // List of edit windows + AppWin* pWork; // Current edit window + BasicPrinter* pPrn; // Printer BOOL bDisas; // TRUE: disassemble USHORT nFlags; // Debugging-Flags - USHORT nMaximizedWindows; // Anzahl der Fenster, die maximized sind + USHORT nMaximizedWindows; // Number of maximized windows void FocusWindow( AppWin *pWin ); void WinMax_Restore(); void WinShow_Hide(); @@ -166,10 +166,10 @@ public: DECL_LINK( Log, TTLogMsg * ); DECL_LINK( WinInfo, WinInfoRec * ); BOOL LoadFile( String aFilename ); - long Command( short,BOOL=FALSE );// Kommando-Handler - virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler - BOOL SaveAll(); // Alle Fenster speichern - BOOL QueryFileName( String& rName, FileType nFileType, BOOL bSave );// Dateinamen ermitteln + long Command( short,BOOL=FALSE ); // Command handler + virtual void Command( const CommandEvent& rCEvt ); // Command handler + BOOL SaveAll(); // Save all windows + BOOL QueryFileName( String& rName, FileType nFileType, BOOL bSave ); // Query for filename DECL_LINK( ModuleWinExists, String* ); DECL_LINK( WriteString, String* ); AppBasEd* CreateModuleWin( SbModule* pMod ); diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx index 292b97e720..657b44e55a 100644 --- a/basic/source/app/appbased.cxx +++ b/basic/source/app/appbased.cxx @@ -48,7 +48,7 @@ #include "status.hxx" #include "appbased.hxx" #include "brkpnts.hxx" -#include <basic/testtool.hxx> // defines für das Syntaxhighlighting +#include <basic/testtool.hxx> // defines for Syntaxhighlighting #include "basrid.hxx" @@ -82,21 +82,21 @@ AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p ) pBreakpoints->SetModule( pMod ); - // Icon definieren: + // Define icon: // pIcon = new Icon( ResId( RID_WORKICON ) ); // if( pIcon ) SetIcon( *pIcon ); SetText( pMod->GetName() ); pDataEdit->SetText( pMod->GetSource() ); - // Wurde ein Modul übergeben, dann den Quelltext von Platte laden + // If a module was given, load the source from harddisk if ( p ) LoadSource(); - // Erst nach Laden des Quelltextes die Events weiterleiten + // Dispatch event AFTER loading the sourcecode ((TextEdit*)pDataEdit)->SetBreakpointWindow( pBreakpoints ); - // Compiled-Flag pflegen: + // Touch compile flag pDataEdit->SetModifyHdl( LINK( this, AppBasEd, EditChange ) ); } @@ -151,7 +151,6 @@ long AppBasEd::DeInitMenu( Menu* pMenu ) } // Menu Handler - void AppBasEd::Command( const CommandEvent& rCEvt ) { switch( rCEvt.GetCommand() ) { @@ -163,27 +162,26 @@ void AppBasEd::Command( const CommandEvent& rCEvt ) } } -// Sourcecode-Datei laden - void AppBasEd::Resize() { - if( pDataEdit ) { - AppEdit::Resize(); + if( pDataEdit ) + { + AppEdit::Resize(); - // Breakpoint window einfügen - Size aEditSize = pDataEdit->GetSizePixel(); - Point aEditPos = pDataEdit->GetPosPixel(); + // Insert breakpoint window + Size aEditSize = pDataEdit->GetSizePixel(); + Point aEditPos = pDataEdit->GetPosPixel(); - pBreakpoints->SetPosPixel( aEditPos ); + pBreakpoints->SetPosPixel( aEditPos ); - aEditPos.X() += BREAKPOINTSWIDTH; - pDataEdit->SetPosPixel( aEditPos ); - aEditSize.Width() -= BREAKPOINTSWIDTH; - pDataEdit->SetSizePixel( aEditSize ); + aEditPos.X() += BREAKPOINTSWIDTH; + pDataEdit->SetPosPixel( aEditPos ); + aEditSize.Width() -= BREAKPOINTSWIDTH; + pDataEdit->SetSizePixel( aEditSize ); - aEditSize.Width() = BREAKPOINTSWIDTH; - pBreakpoints->SetSizePixel( aEditSize ); - } + aEditSize.Width() = BREAKPOINTSWIDTH; + pBreakpoints->SetSizePixel( aEditSize ); + } } void AppBasEd::PostLoad() @@ -210,7 +208,7 @@ void AppBasEd::Reload() pDataEdit->SetSelection( aSelMemo ); } -// Sourcecode-Datei nach Änderung auf Platte neu laden +// Reload source code file after change void AppBasEd::LoadSource() { BOOL bErr; @@ -226,15 +224,14 @@ void AppBasEd::LoadSource() bCompiled = FALSE; // because the code might have changed in the meantime } -// mit neuem Namen speichern +// Save as (new name) void AppBasEd::PostSaveAs() { pMod->SetName( GetText() ); AppEdit::PostSaveAs(); } -// Compilieren - +// Compile BOOL AppBasEd::Compile() { if( !pDataEdit->HasText() || bCompiled ) @@ -277,7 +274,8 @@ void AppBasEd::Run() { if ( (pAllModules->Get(i)->GetName()).Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) { - SbxVariableRef pRMod = pAllModules->Get(i); // Kleiner Hack um ums basic rumzukommen. Sollte demnächst wieder dirkt gehen. + // Little hack to get around basic + SbxVariableRef pRMod = pAllModules->Get(i); pFrame->Basic().Remove(pRMod); i--; } @@ -287,13 +285,14 @@ void AppBasEd::Run() if( pMain ) { pMain->SetDebugFlags( pFrame->nFlags ); - // Loest Call aus! + // Triggers a call! pFrame->SetAppMode( String( SttResId( IDS_APPMODE_RUN ) ) ); pMain->Run(); if (aBasicApp.pFrame) { BasicError* pErr = aBasicApp.pFrame->Basic().aErrors.First(); - if( pErr ) pErr->Show(); + if( pErr ) + pErr->Show(); aBasicApp.pFrame->SetAppMode( String() ); } pMain->SetDebugFlags( 0 ); diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx index 58ada53240..f12b805240 100644 --- a/basic/source/app/appbased.hxx +++ b/basic/source/app/appbased.hxx @@ -45,31 +45,31 @@ class BreakpointWindow; class AppBasEd : public AppEdit { // Editor-Window: using DockingWindow::Notify; - SbModuleRef pMod; // compiliertes Modul - BOOL bCompiled; // TRUE, wenn compiliert + SbModuleRef pMod; // compile module + BOOL bCompiled; // TRUE if compiled protected: DECL_LINK( EditChange, void * ); #define BREAKPOINTSWIDTH 15 BreakpointWindow *pBreakpoints; - virtual USHORT ImplSave(); // Datei speichern + virtual USHORT ImplSave(); // Save file public: TYPEINFO(); AppBasEd( BasicFrame*, SbModule* ); ~AppBasEd(); - FileType GetFileType(); // Liefert den Filetype + FileType GetFileType(); // Returns Filetype SbModule* GetModule() { return pMod; } - long InitMenu( Menu* ); // Initialisierung des Menues - virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind - virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler - virtual void Resize(); // Berücksichtigt die Breakpointleiste - virtual void PostLoad(); // Nachbearbeiten des geladenen (Source am Modul setzen) - virtual void PostSaveAs(); // Nachbearbeiten des Modils ... + long InitMenu( Menu* ); // Initialision of the menus + virtual long DeInitMenu( Menu* ); // Reset to enable all shortcuts + virtual void Command( const CommandEvent& rCEvt ); // Command handler + virtual void Resize(); // Includes the breakpoint bar + virtual void PostLoad(); // Set source of module + virtual void PostSaveAs(); // Postprocess of module... void Reload(); - void LoadSource(); // Quelltext zu Objekt laden - BOOL Compile(); // Text compilieren - void Run(); // Image laufenlassen - void Disassemble(); // Image disassemblieren + void LoadSource(); // Load source for object + BOOL Compile(); // Compile text + void Run(); // Run image + void Disassemble(); // Disassemble image const String& GetModName() const { return pMod->GetName(); } virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); }; diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx index c5b22f9ccd..122aa9c7a1 100644 --- a/basic/source/app/appedit.cxx +++ b/basic/source/app/appedit.cxx @@ -52,11 +52,11 @@ AppEdit::AppEdit( BasicFrame* pParent ) , nCurTextWidth(5) { String aEmpty; - // evtl. den Untitled-String laden: + // perhaps load the Untitled-String: pDataEdit = new TextEdit( this, WB_LEFT ); LoadIniFile(); - // Icon definieren: + // define Icon: // pIcon = new Icon( ResId( RID_WORKICON ) ); // if( pIcon ) SetIcon( *pIcon ); @@ -76,11 +76,11 @@ AppEdit::AppEdit( BasicFrame* pParent ) AppEdit::~AppEdit() { - DataEdit *pHold = pDataEdit; - pDataEdit = NULL; // Erst abklemmen, dann löschen - delete pHold; - delete pHScroll; - delete pVScroll; + DataEdit *pHold = pDataEdit; + pDataEdit = NULL; + delete pHold; + delete pHScroll; + delete pVScroll; } void AppEdit::LoadIniFile() @@ -117,7 +117,7 @@ void AppEdit::LoadIniFile() ((TextEdit*)pDataEdit)->GetBreakpointWindow()->Invalidate(); } - pTextView->GetTextEngine()->SetModified( bWasModified ); // Eventuell wieder setzen + pTextView->GetTextEngine()->SetModified( bWasModified ); // Perhaps reset the flag } void AppEdit::Command( const CommandEvent& rCEvt ) @@ -157,7 +157,7 @@ void AppEdit::InitScrollBars() return; TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; -// Kopiert und angepasst. + SetScrollBarRanges(); Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); @@ -176,23 +176,25 @@ void AppEdit::InitScrollBars() void AppEdit::SetScrollBarRanges() { - // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events. - - if ( !pHScroll || !pVScroll ) - return; + // Extra-Method, not InitScrollBars, but for EditEngine-Events. - pHScroll->SetRange( Range( 0, nCurTextWidth ) ); + if ( !pHScroll || !pVScroll ) + return; - pVScroll->SetRange( Range( 0, ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetTextHeight() ) ); + pHScroll->SetRange( Range( 0, nCurTextWidth ) ); + pVScroll->SetRange( Range( 0, ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetTextHeight() ) ); } -USHORT AppEdit::GetLineNr(){ return pDataEdit->GetLineNr(); } +USHORT AppEdit::GetLineNr() +{ + return pDataEdit->GetLineNr(); +} FileType AppEdit::GetFileType() { - return FT_BASIC_SOURCE; + return FT_BASIC_SOURCE; } // Set up the menu @@ -222,8 +224,6 @@ long AppEdit::DeInitMenu( Menu* pMenu ) return TRUE; } -// Sourcecode-Datei laden - void AppEdit::Resize() { if( !pDataEdit ) @@ -268,7 +268,6 @@ void AppEdit::Resize() TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; -// Kopiert und adaptiert long nVisY = pTextView->GetStartDocPos().Y(); pTextView->ShowCursor(); Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); @@ -293,8 +292,6 @@ void AppEdit::PostLoad() { } -// mit neuem Namen speichern - void AppEdit::PostSaveAs() { } diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx index 50a4642868..3eb128da77 100644 --- a/basic/source/app/appedit.hxx +++ b/basic/source/app/appedit.hxx @@ -40,7 +40,7 @@ class BasicFrame; -class AppEdit : public AppWin { // Editor-Window: +class AppEdit : public AppWin { // Editor window using Window::Scroll; public: @@ -56,15 +56,15 @@ public: TYPEINFO(); AppEdit( BasicFrame* ); ~AppEdit(); - USHORT GetLineNr(); // Aktuelle Zeilennummer - FileType GetFileType(); // Liefert den Filetype - virtual long InitMenu( Menu* ); // Initialisierung des Menues - virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind - virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler + USHORT GetLineNr(); // Current line number + FileType GetFileType(); // Returns the file type + virtual long InitMenu( Menu* ); // Inits the menu + virtual long DeInitMenu( Menu* ); // Reset to enable all Shortcuts + virtual void Command( const CommandEvent& rCEvt ); // Command Handler void Resize(); - void PostLoad(); // Nachbearbeiten des geladenen (Source am Modul setzen) - void PostSaveAs(); // Nachbearbeiten des Modils ... - void Mark( short, short, short );// Text markieren + void PostLoad(); + void PostSaveAs(); + void Mark( short, short, short ); // Select text void Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 ); virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } virtual void LoadIniFile(); // (re)load ini file after change diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx index 69c73ced8b..d6bb483588 100644 --- a/basic/source/app/apperror.cxx +++ b/basic/source/app/apperror.cxx @@ -42,13 +42,13 @@ TYPEINIT1(AppError,AppWin); AppError::AppError( BasicFrame* pParent, String aFileName ) : AppWin( pParent ) { - SetText( aFileName ); // Muß vor new MsgEdit stehen!! + SetText( aFileName ); // Call before MsgEdit!! pDataEdit = new MsgEdit( this, pParent, WB_HSCROLL | WB_VSCROLL | WB_LEFT ); LoadIniFile(); bHasFile = pDataEdit->Load( aFileName ); DirEntry aEntry( aFileName ); UpdateFileInfo( HAS_BEEN_LOADED ); - // Icon definieren: + // Define icon // pIcon = new Icon( ResId( RID_WORKICON ) ); // if( pIcon ) SetIcon( *pIcon ); diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx index ae3960946e..c560b1fd7d 100644 --- a/basic/source/app/apperror.hxx +++ b/basic/source/app/apperror.hxx @@ -40,10 +40,10 @@ public: AppError( BasicFrame*, String ); ~AppError(); // long Command( short nID ); - virtual long InitMenu( Menu* ); // Initialisierung des Menues - virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind - USHORT GetLineNr(); // Aktuelle Zeilennummer - FileType GetFileType(); // Liefert den Filetype + virtual long InitMenu( Menu* ); + virtual long DeInitMenu( Menu* ); + USHORT GetLineNr(); + FileType GetFileType(); MsgEdit* GetMsgTree() { return ((MsgEdit*)pDataEdit); } virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } virtual void LoadIniFile(); // (re)load ini file after change diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx index b187e95e44..ad65d45395 100644 --- a/basic/source/app/appwin.cxx +++ b/basic/source/app/appwin.cxx @@ -47,9 +47,9 @@ #include "dialogs.hxx" #include "basrid.hxx" -String *AppWin::pNoName = NULL; // enthaelt den "Untitled"-String -short AppWin::nNumber = 0; // fortlaufende Nummer -short AppWin::nCount = 0; // Anzahl Editfenster +String *AppWin::pNoName = NULL; // contains the "Untitled"-String +short AppWin::nNumber = 0; // consecutive number +short AppWin::nCount = 0; // number of edit windows TYPEINIT0(AppWin); AppWin::AppWin( BasicFrame* pParent ) @@ -61,12 +61,12 @@ AppWin::AppWin( BasicFrame* pParent ) , bFind( TRUE ) , pDataEdit(NULL) { - // evtl. den Untitled-String laden: + // Load the Untitled string if not yet loaded if( !pNoName ) pNoName = new String( SttResId( IDS_NONAME ) ); nCount++; - // Maximized Status von aktuellem Fenster holen + // Get maximized state from current window USHORT nInitialWinState; if ( pFrame->pWork ) { @@ -92,7 +92,7 @@ AppWin::~AppWin() { nCount--; pFrame->RemoveWindow( this ); - pFrame = NULL; // So daß nach BasicRun nicht mehr versucht wird Fenstertext zu setzen + pFrame = NULL; // Set to stop setting window text after BasicRun } void AppWin::SetText( const XubString& rStr ) @@ -175,8 +175,8 @@ void AppWin::Cascade( USHORT nNr ) } Size aWinSize = pFrame->GetOutputSizePixel(); - aWinSize.Width() -= aWinSize.Width() / 5; // auf 80 % reduzieren - aWinSize.Height() -= nTitleHeight * nNr; // Unten entsprechen kürzen + aWinSize.Width() -= aWinSize.Width() / 5; // reduce to 80 % + aWinSize.Height() -= nTitleHeight * nNr; // snip height to appropriate value aWinSize.Height() -= 2; Point nPos( nTitleHeight * nNr, nTitleHeight * nNr ); @@ -191,14 +191,18 @@ void AppWin::RequestHelp( const HelpEvent& ) void AppWin::Help() { - String s = pDataEdit->GetSelected(); - if( s.Len() ) { - // Leerstellen davor weg: - while( s.GetChar(0) == ' ' ) s.Erase( 0, 1 ); + String s = pDataEdit->GetSelected(); + if( s.Len() > 0 ) + { + // Trim leading whitespaces + while( s.GetChar(0) == ' ' ) + s.Erase( 0, 1 ); // aBasicApp.pHelp->Start( s ); - } else { + } + else + { // aBasicApp.pHelp->Start( OOO_HELP_INDEX ); - } + } } void AppWin::Resize() @@ -213,10 +217,10 @@ void AppWin::Resize() void AppWin::GetFocus() { pFrame->FocusWindow( this ); - if( pDataEdit ) // Im Destruktor wird GetFocus gerufen, daher diese Abfrage + if( pDataEdit ) // GetFocus is called by the destructor, so this check { pDataEdit->GrabFocus(); -// InitMenu(GetpApp()->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist +// InitMenu(GetpApp()->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); } } @@ -460,8 +464,7 @@ void AppWin::Reload() SkipReload( FALSE ); } -// Datei laden - +// Load file BOOL AppWin::Load( const String& aName ) { SkipReload(); @@ -500,8 +503,7 @@ BOOL AppWin::Load( const String& aName ) return !bErr; } -// Datei speichern - +// Save file USHORT AppWin::ImplSave() { SkipReload(); @@ -528,8 +530,7 @@ USHORT AppWin::ImplSave() return nResult; } -// mit neuem Namen speichern - +// Save to new file name USHORT AppWin::SaveAs() { SkipReload(); @@ -551,8 +552,7 @@ USHORT AppWin::SaveAs() } } -// Soll gespeichert werden? - +// Should we save the file? USHORT AppWin::QuerySave( QueryBits nBits ) { BOOL bQueryDirty = ( nBits & QUERY_DIRTY ) != 0; @@ -594,7 +594,7 @@ USHORT AppWin::QuerySave( QueryBits nBits ) nReturn = SAVE_RES_CANCEL; break; default: - DBG_ERROR("switch default where no default should be: Interneal error"); + DBG_ERROR("switch default where no default should be: Internal error"); nReturn = SAVE_RES_CANCEL; } SkipReload( FALSE ); @@ -614,7 +614,7 @@ BOOL AppWin::Close() } // uncomment to avoid compiler warning // break; - case SAVE_RES_ERROR: // Fehlermeldung schon ausgegeben + case SAVE_RES_ERROR: return FALSE; // uncomment to avoid compiler warning // break; @@ -628,8 +628,7 @@ BOOL AppWin::Close() } } -// Text suchen - +// Search and find text void AppWin::Find() { SttResId aResId( IDD_FIND_DIALOG ); @@ -640,8 +639,7 @@ void AppWin::Find() } } -// Text ersetzen - +// Replace text void AppWin::Replace() { SttResId aResId( IDD_REPLACE_DIALOG ); @@ -653,8 +651,7 @@ void AppWin::Replace() } } -// Suchen/ersetzen wiederholen - +// Repeat search/replace operation void AppWin::Repeat() { if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,SttResId(IDS_PATTERNNOTFOUND)).Execute() && FALSE) ) && !bFind ) diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx index 6ea33e35a9..95439f2f06 100644 --- a/basic/source/app/appwin.hxx +++ b/basic/source/app/appwin.hxx @@ -64,30 +64,30 @@ typedef USHORT QueryBits; class BasicFrame; -class AppWin : public DockingWindow, public SfxListener // Dokumentfenster +class AppWin : public DockingWindow, public SfxListener // Document window { friend class MsgEdit; protected: - static short nNumber; // fortlaufende Nummer - static short nCount; // Anzahl Editfenster + static short nNumber; // serial number + static short nCount; // number of edit windows static String *pNoName; // "Untitled" - FileStat aLastAccess; // Wann wurde die geladene Dateiversion verändert - USHORT nSkipReload; // Manchmal darf kein Reload erfolgen - BOOL bHasFile; // Ansonsten hat reload auch keinen Sinn - BOOL bReloadAborted; // Wird gesetzt, wenn reload abgelehnt wurde, so daß beim Schließen nochmal gefragt werden kann + FileStat aLastAccess; // Last access time of loaded file + USHORT nSkipReload; // Sometimes there must not be a reload + BOOL bHasFile; // Otherwise reload does not make sense + BOOL bReloadAborted; // Is set if reload was cancelled so that we can ask again wehn closing - short nId; // ID-Nummer( "Unbenannt n" ) + short nId; // ID-Nummer( "Unnamed n" ) BasicFrame* pFrame; // Parent-Window -// Icon* pIcon; // Dokument-Icon - String aFind; // Suchstring - String aReplace; // Ersetze-String - BOOL bFind; // TRUE, wenn Suchen und nicht Ersetzen - void RequestHelp( const HelpEvent& );// Hilfe-Handler - void GetFocus(); // aktivieren - virtual USHORT ImplSave(); // Datei speichern - USHORT nWinState; // Maximized, Iconized oder Normal - Point nNormalPos; // Position wenn Normal - Size nNormalSize; // Größe wenn Normal +// Icon* pIcon; // Document icon + String aFind; // Search string + String aReplace; // Replace string + BOOL bFind; // TRUE if search not replace + void RequestHelp( const HelpEvent& ); // Help handler + void GetFocus(); // activate + virtual USHORT ImplSave(); // Save file + USHORT nWinState; // Maximized, Iconized or Normal + Point nNormalPos; // Position if normal + Size nNormalSize; // Size if Normal virtual long PreNotify( NotifyEvent& rNEvt ); USHORT nWinId; @@ -95,30 +95,30 @@ public: TYPEINFO(); AppWin( BasicFrame* ); ~AppWin(); - DataEdit* pDataEdit; // Daten-Flaeche - virtual USHORT GetLineNr()=0; // Aktuelle Zeilennummer - virtual long InitMenu( Menu* ); // Initialisierung des Menues - virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind - virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler - virtual void Resize(); // Aenderung Fenstergroesse - virtual void Help(); // Hilfe aktivieren - virtual BOOL Load( const String& ); // Datei laden - virtual void PostLoad(){} // Nachbearbeiten des geladenen (Source am Modul setzen) - virtual USHORT SaveAs(); // Datei unter neuem Namen speichern - virtual void PostSaveAs(){} // Nachbearbeiten des Moduls ... - virtual void Find(); // Text suchen - virtual void Replace(); // Text ersetzen - virtual void Repeat(); // Suche wiederholen - virtual BOOL Close(); // Fenster schliessen - virtual void Activate(); // Fenster wurde aktiviert - virtual FileType GetFileType()=0; // Liefert den Filetype - virtual BOOL ReloadAllowed(){ return TRUE; } // Ermöglicht dem Dok temporär NEIN zu sagen - virtual void Reload(); // Reload nach änderung auf Platte + DataEdit* pDataEdit; // Data area + virtual USHORT GetLineNr()=0; // Current line number + virtual long InitMenu( Menu* ); // Init of the menu + virtual long DeInitMenu( Menu* ); // reset to enable all shortcuts + virtual void Command( const CommandEvent& rCEvt ); // Command handler + virtual void Resize(); + virtual void Help(); + virtual BOOL Load( const String& ); // Load file + virtual void PostLoad(){} // Set source at module + virtual USHORT SaveAs(); // Save file as + virtual void PostSaveAs(){} + virtual void Find(); // find text + virtual void Replace(); // replace text + virtual void Repeat(); // repeat find/replace + virtual BOOL Close(); // close window + virtual void Activate(); // window was activated + virtual FileType GetFileType()=0; // returns the filetype + virtual BOOL ReloadAllowed(){ return TRUE; } + virtual void Reload(); // Reload after change on disk virtual void LoadIniFile(){;} // (re)load ini file after change - void CheckReload(); // Prüft und Fragt ob reloaded werden soll - BOOL DiskFileChanged( USHORT nWhat ); // Prüft ob die Datei sich verändert hat - void UpdateFileInfo( USHORT nWhat ); // Merkt sich den aktuellen Zustand der Datei - BOOL IsSkipReload(); // Soll reload getestet werden + void CheckReload(); // Checks and asks if reload should performed + BOOL DiskFileChanged( USHORT nWhat ); // Checks file for changes + void UpdateFileInfo( USHORT nWhat ); // Remembers last file state + BOOL IsSkipReload(); // Should we test reload? void SkipReload( BOOL bSkip = TRUE ); USHORT GetWinState(){ return nWinState; } void Maximize(); @@ -126,7 +126,7 @@ public: void Minimize( BOOL bMinimize ); void Cascade( USHORT nNr ); - USHORT QuerySave( QueryBits nBits = QUERY_ALL ); // Speichern + USHORT QuerySave( QueryBits nBits = QUERY_ALL ); BOOL IsModified() { return pDataEdit->IsModified(); } BasicFrame* GetBasicFrame() { return pFrame; } virtual void TitleButtonClick( USHORT nButton ); diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx index 8204adc167..a2aa1ff9c9 100644 --- a/basic/source/app/basicrt.cxx +++ b/basic/source/app/basicrt.cxx @@ -38,112 +38,110 @@ const String BasicRuntime::GetSourceRevision() { - return pRun->GetModule()->GetComment(); + return pRun->GetModule()->GetComment(); } const String BasicRuntime::GetModuleName( SbxNameType nType ) { - return pRun->GetModule()->GetName( nType ); + return pRun->GetModule()->GetName( nType ); } const String BasicRuntime::GetMethodName( SbxNameType nType ) { - return pRun->GetMethod()->GetName( nType ); + return pRun->GetMethod()->GetName( nType ); } xub_StrLen BasicRuntime::GetLine() { - return pRun->nLine; + return pRun->nLine; } xub_StrLen BasicRuntime::GetCol1() { - return pRun->nCol1; + return pRun->nCol1; } xub_StrLen BasicRuntime::GetCol2() { - return pRun->nCol2; + return pRun->nCol2; } BOOL BasicRuntime::IsRun() { - return pRun->IsRun(); + return pRun->IsRun(); } BasicRuntime BasicRuntime::GetNextRuntime() { - return BasicRuntime ( pRun->pNext ); + return BasicRuntime ( pRun->pNext ); } - const String BasicErrorStackEntry::GetSourceRevision() { - return pEntry->aMethod->GetModule()->GetComment(); + return pEntry->aMethod->GetModule()->GetComment(); } const String BasicErrorStackEntry::GetModuleName( SbxNameType nType ) { - return pEntry->aMethod->GetModule()->GetName( nType ); + return pEntry->aMethod->GetModule()->GetName( nType ); } const String BasicErrorStackEntry::GetMethodName( SbxNameType nType ) { - return pEntry->aMethod->GetName( nType ); + return pEntry->aMethod->GetName( nType ); } xub_StrLen BasicErrorStackEntry::GetLine() { - return pEntry->nLine; + return pEntry->nLine; } xub_StrLen BasicErrorStackEntry::GetCol1() { - return pEntry->nCol1; + return pEntry->nCol1; } xub_StrLen BasicErrorStackEntry::GetCol2() { - return pEntry->nCol2; + return pEntry->nCol2; } - BasicRuntime BasicRuntimeAccess::GetRuntime() { - return BasicRuntime( pINST->pRun ); + return BasicRuntime( pINST->pRun ); } bool BasicRuntimeAccess::HasRuntime() { - return pINST && pINST->pRun != NULL; + return pINST && pINST->pRun != NULL; } USHORT BasicRuntimeAccess::GetStackEntryCount() { - return GetSbData()->pErrStack->Count(); + return GetSbData()->pErrStack->Count(); } BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( USHORT nIndex ) { - return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) ); + return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) ); } BOOL BasicRuntimeAccess::HasStack() { - return GetSbData()->pErrStack != NULL; + return GetSbData()->pErrStack != NULL; } void BasicRuntimeAccess::DeleteStack() { - delete GetSbData()->pErrStack; - GetSbData()->pErrStack = NULL; + delete GetSbData()->pErrStack; + GetSbData()->pErrStack = NULL; } BOOL BasicRuntimeAccess::IsRunInit() { - return GetSbData()->bRunInit; + return GetSbData()->bRunInit; } diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index 3982b66f44..ca75c2dd03 100644 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -142,11 +142,10 @@ void BreakpointWindow::InsertBreakpoint( USHORT nLine ) else pBrk = Next(); } - // Keine Einfuegeposition gefunden => LIST_APPEND + // No insert position found => LIST_APPEND if ( pNewBrk ) Insert( pNewBrk, LIST_APPEND ); - // vielleicht mal etwas genauer... Invalidate(); if ( pModule->SetBP( nLine ) ) @@ -314,16 +313,16 @@ Breakpoint* BreakpointWindow::FindBreakpoint( const Point& rMousePos ) void BreakpointWindow::ToggleBreakpoint( USHORT nLine ) { Breakpoint* pBrk = FindBreakpoint( nLine ); - if ( pBrk ) // entfernen + if ( pBrk ) // remove { pModule->ClearBP( nLine ); delete Remove( pBrk ); } - else // einen erzeugen + else // create one { InsertBreakpoint( nLine ); } - // vielleicht mal etwas genauer... + Invalidate(); } @@ -366,7 +365,6 @@ void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt ) long nYPos = aMousePos.Y() + nCurYOffset; long nLine = nYPos / nLineHeight + 1; ToggleBreakpoint( sal::static_int_cast< USHORT >(nLine) ); - // vielleicht mal etwas genauer... Invalidate(); } } @@ -374,10 +372,10 @@ void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt ) void BreakpointWindow::SetMarkerPos( USHORT nLine, BOOL bError ) { - ShowMarker( FALSE ); // Alten wegzeichen... + ShowMarker( FALSE ); // Remove old one nMarkerPos = nLine; bErrorMarker = bError; - ShowMarker( TRUE ); // Neuen zeichnen... + ShowMarker( TRUE ); // Draw new one Update(); } diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx index 12f28f6853..cdf6ba679a 100644 --- a/basic/source/app/dataedit.hxx +++ b/basic/source/app/dataedit.hxx @@ -39,8 +39,8 @@ class String; class Font; -// Find, Load und Save müssen implementiert werden, -// die anderen müssen in MemberType existieren +// Find, Load and Save must be implemented, +// the others must exist in MemberType #define DATA_FUNC_DEF( MemberName, MemberType ) \ public: \ MemberType MemberName; \ @@ -88,9 +88,9 @@ public: virtual void Undo()=0; virtual void Redo()=0; - virtual BOOL Find( const String& )=0; // Text suchen & markieren - virtual BOOL Load( const String& )=0; // Text aus Datei laden - virtual BOOL Save( const String& )=0; // Text in Datei speichern + virtual BOOL Find( const String& )=0; // Find and select text + virtual BOOL Load( const String& )=0; // Load text from file + virtual BOOL Save( const String& )=0; // Save text to file virtual String GetSelected()=0; virtual void GrabFocus()=0; virtual TextSelection GetSelection() const=0; @@ -98,7 +98,7 @@ public: virtual USHORT GetLineNr() const=0; virtual String GetText() const=0; virtual void SetText( const String& rStr )=0; - virtual BOOL HasText() const=0; // damit vermeiden wir GetText.Len() + virtual BOOL HasText() const=0; // to avoid GetText.Len() virtual void ReplaceSelected( const String& rStr )=0; virtual BOOL IsModified()=0; virtual void SetModifyHdl( Link )=0; @@ -113,7 +113,7 @@ public: virtual void BuildKontextMenu( PopupMenu *&pMenu ) { (void) pMenu; /* avoid warning about unused parameter */ - } // Wer will kann hier eigene Einträge hinzufügen + } }; #endif diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index e38c399604..fa770f985f 100644 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -283,20 +283,20 @@ OptionsDialog::~OptionsDialog() BOOL OptionsDialog::Close() { - if ( TabDialog::Close() ) - { - delete this; - return TRUE; - } - else - return FALSE; + if ( TabDialog::Close() ) + { + delete this; + return TRUE; + } + else + return FALSE; } IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl ) { USHORT nId = pTabCtrl->GetCurPageId(); - // Wenn TabPage noch nicht erzeugt wurde, dann erzeugen + // If TabPage was not yet created, do it if ( !pTabCtrl->GetTabPage( nId ) ) { TabPage *pNewTabPage = NULL; @@ -629,7 +629,7 @@ MiscOptions::MiscOptions( Window* pParent, Config &aConfig ) aNFUNOPort.SetValue( aTemp.ToInt32() ); aConfig.SetGroup("Misc"); - aTemp = aConfig.ReadKey( "ServerTimeout", "10000" ); // Vorgabe 1 Minute + aTemp = aConfig.ReadKey( "ServerTimeout", "10000" ); // Default 1 Minute aServerTimeout.SetTime( Time(aTemp.ToInt32()) ); aConfig.SetGroup("LRU"); @@ -831,7 +831,7 @@ void GenericOptions::LoadData() aCbArea.SetText( aCbArea.GetEntry( 0 ) ); CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); - // Und auch die Daten laden + // Add load the data LINK( this, GenericOptions, LoadGroup ).Call( NULL ); } @@ -897,10 +897,10 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) String aType; if ( aLastGroupName.Len() ) - { // Werte zwischenspeichern? + { // Cache values? aCurrentValue = aCbValue.GetText(); if ( aCbValue.GetEntryPos( aCurrentValue ) == COMBOBOX_ENTRY_NOTFOUND ) - { // Dann legen wir mal einen neuen Wert an + { // Create a new value LINK( this, GenericOptions, NewValue ).Call( NULL ); } @@ -909,7 +909,7 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) USHORT i; for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) { - if ( i ) // ab Entry 1 + if ( i > 0 ) aAllValues += ';'; aAllValues += aCbValue.GetEntry( i ); } @@ -1012,7 +1012,7 @@ void GenericOptions::Save( Config &aConfig ) (void) aConfig; /* avoid warning about unused parameter */ DBG_ASSERT( &aConfig == &aConf, "Saving to different Configuration" ); - // eventuelle �nderungen Speichern + // Save changes LINK( this, GenericOptions, LoadGroup ).Call( NULL ); } @@ -1023,7 +1023,7 @@ class TextAndWin : public DockingWindow Window *pWin; Window* pFtOriginalParent; Window* pWinOriginalParent; - long nSpace; // Standardabstand + long nSpace; // default space BOOL bAlignTop; public: @@ -1068,16 +1068,16 @@ void TextAndWin::Resize() pFt->Show(); nFixedTextOffset = pFt->GetSizePixel().Height() + nSpace; - // FixedText Positionieren + // FixedText positioning pFt->SetPosPixel( Point( 0, nTopSpace ) ); } - // Window Positionieren + // Window positioning long nWinPosY = nFixedTextOffset; nWinPosY += nTopSpace; pWin->SetPosPixel( Point( 0, nWinPosY ) ); - // Gr��e des Window anpassen + // Set size of window long nWinHeight = GetOutputSizePixel().Height(); nWinHeight -= nWinPosY; nWinHeight -= nBottomSpace; @@ -1095,7 +1095,7 @@ DisplayHidDlg::DisplayHidDlg( Window * pParent ) , aPbBenennen( this, SttResId( RID_PB_BENENNEN ) ) , aPbSelectAll( this, SttResId( RID_PB_SELECTALL ) ) , aOKClose( this, SttResId( RID_OK_CLOSE ) ) -, nDisplayMode( DH_MODE_KURZNAME | DH_MODE_LANGNAME ) // Falls wir ein altes Office haben diesen Default verwenden +, nDisplayMode( DH_MODE_KURZNAME | DH_MODE_LANGNAME ) // If we have an old office use this default { FreeResource(); @@ -1200,8 +1200,8 @@ void DisplayHidDlg::AddData( WinInfoRec* pWinInfo ) aMlbControls.Clear(); aMlbSlots.Clear(); - if ( pWinInfo->nRType & DH_MODE_DATA_VALID ) // kein altes Office - nDisplayMode = pWinInfo->nRType; // Wird im Reset zur �bermittlung des Modus verwendet + if ( pWinInfo->nRType & DH_MODE_DATA_VALID ) // no old office + nDisplayMode = pWinInfo->nRType; // Is used for mode transmission while reset // if ( pWinInfo->aUId.GetULONG() & DH_MODE_DATA_VALID ) // kein altes Office // nDisplayMode = pWinInfo->aUId.GetULONG(); // Wird im Reset zur �bermittlung des Modus verwendet @@ -1227,7 +1227,7 @@ void DisplayHidDlg::AddData( WinInfoRec* pWinInfo ) aMsg += pWinInfo->aUId; aMsg.Expand(13); } - aMsg.AppendAscii( " " ); // Mindestens 3 Blanks sollten schon sein. + aMsg.AppendAscii( " " ); // At least three blanks if ( nDisplayMode & DH_MODE_LANGNAME ) { @@ -1240,12 +1240,12 @@ void DisplayHidDlg::AddData( WinInfoRec* pWinInfo ) aMlbControls.InsertEntry( aMsg ); - // Haben wir noch einen Slotname? + // Do we have a Slotname? if ( ( nDisplayMode & DH_MODE_KURZNAME ) && pWinInfo->aSlotname.Len() > 0 ) { aMsg = pWinInfo->aSlotname; aMsg.Expand(20); - aMsg.AppendAscii( " " ); // Mindestens 3 Blanks sollten schon sein. + aMsg.AppendAscii( " " ); if ( nDisplayMode & DH_MODE_LANGNAME ) { @@ -1264,62 +1264,62 @@ void DisplayHidDlg::Resize() if ( IsRollUp() ) { - // Wir wollen nur die Toolbox sehen + // We want only the toolbox to be seend SetOutputSizePixel( aTbConf.GetSizePixel() ); } else { // SetUpdateMode( FALSE ); - // Minimalgr��e + // Minimum size Size aSize( GetOutputSizePixel() ); aSize.Width() = std::max( aSize.Width(), (long)(aOKClose.GetSizePixel().Width() * 3 )); aSize.Height() = std::max( aSize.Height(), (long)(aOKClose.GetSizePixel().Height() * 8 )); SetOutputSizePixel( aSize ); - // Standardabstand + // Default space long nSpace = pSplit->GetPosPixel().X(); - // ToolBox Breite anpassen + // Adapt ToolBox width aTbConf.SetSizePixel( Size ( GetSizePixel().Width(), aTbConf.CalcWindowSizePixel().Height() ) ); - aTbConf.SetSizePixel( Size() ); // Vorerst verstecken! + aTbConf.SetSizePixel( Size() ); // Hide at first - // SplitWindow Positionieren + // SplitWindow positioning pSplit->SetPosPixel( Point( nSpace, nSpace + aTbConf.GetPosPixel().Y() + aTbConf.GetSizePixel().Height() ) ); - // Breite des SplitWindows bestimmen + // Calculate width of SplitWindows long nSplitWidth = GetSizePixel().Width(); nSplitWidth -= aPbBenennen.GetSizePixel().Width(); - nSplitWidth -= 3 * nSpace; // Die Zwischenr�ume - nSplitWidth -= nSpace / 2; // Etwas mehr Platz am rechten Rand + nSplitWidth -= 3 * nSpace; // Spaces + nSplitWidth -= nSpace / 2; // Little more space at right margin - // H�he des SplitWindows bestimmen + // Calculate hight of SplitWindows long nSplitHeight = GetOutputSizePixel().Height(); nSplitHeight -= pSplit->GetPosPixel().Y(); - nSplitHeight -= nSpace; // der Abstand unten + nSplitHeight -= nSpace; // bottom margin - // Gr��e des SplitWindows setzen + // Set size of SplitWindows pSplit->SetSizePixel( Size( nSplitWidth, nSplitHeight ) ); Point aPos; - // Button "Kopieren" Positionieren + // Button "Copy" positioning aPos = pSplit->GetPosPixel(); aPos.Move( nSplitWidth, 0 ); aPos.Move( nSpace, 0 ); aPbKopieren.SetPosPixel( aPos ); - // Button "Alles W�hlen" gleich darunter positionieren + // Button "Get all" aPos.Move( 0, aPbKopieren.GetSizePixel().Height() ); aPos.Move( 0, nSpace ); aPbSelectAll.SetPosPixel( aPos ); - // Button "Benennen" gleich darunter positionieren + // Button "Name" aPos.Move( 0, aPbSelectAll.GetSizePixel().Height() ); aPos.Move( 0, nSpace ); aPbBenennen.SetPosPixel( aPos ); - // Und zum Schlu� noch den "Close" Button positionieren + // "Close" Button aPos = pSplit->GetPosPixel(); aPos.Move( nSpace, -aOKClose.GetSizePixel().Height() ); aPos.Move( pSplit->GetSizePixel().Width(), pSplit->GetSizePixel().Height() ); @@ -1378,16 +1378,16 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar ) aNumericFieldRID_NF_NEW_LONG.Show(); aNumericFieldRID_NF_NEW_LONG.SetText( pVar->GetString() ); aNumericFieldRID_NF_NEW_LONG.Reformat(); - // M�ssen hart gesetzt werden, da der Rsc Compiler damit nicht klar kommt. + // Must be hardcoded otherwise the Rsc Compiler will fail aNumericFieldRID_NF_NEW_LONG.SetMin( -aNumericFieldRID_NF_NEW_LONG.GetMax()-1 ); aNumericFieldRID_NF_NEW_LONG.SetFirst( -aNumericFieldRID_NF_NEW_LONG.GetLast()-1 ); break; -// case SbxOBJECT: // kann nicht editiert werden +// case SbxOBJECT: // cannot be edited // break; case SbxSINGLE: case SbxDOUBLE: case SbxSTRING: - case SbxVARIANT: // Taucht wohl auch nicht auf. stattdessen SbxEMPTY + case SbxVARIANT: case SbxEMPTY: aEditRID_ED_NEW_STRING.Show(); aEditRID_ED_NEW_STRING.SetText( pVar->GetString() ); @@ -1405,7 +1405,7 @@ VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar ) IMPL_LINK( VarEditDialog, OKClick, Button *, pButton ) { (void) pButton; /* avoid warning about unused parameter */ - BOOL bWasError = SbxBase::IsError(); // Da eventuell ein Fehler geschmissen wird. + BOOL bWasError = SbxBase::IsError(); // Probably an error is thrown SbxDataType eType = pVar->GetType(); @@ -1433,15 +1433,15 @@ SvNumberformat:: const International& rIntl, int& nErrno, const xub_Unicode** ppEnd = NULL ); - // Konvertiert analog strtod einen dezimalen String in einen double, - // Dezimalseparator und Tausenderseparator werden aus International - // genommen, fuehrende Leerzeichen werden weggeparst. - // Ist ppEnd!=NULL wird *ppEnd hinter das Weggeparste gesetzt. - // Enthaelt pStr nur den zu parsenden String, ist also bei Erfolg - // **ppEnd=='\0' und *ppEnd-pStr==strlen(pStr). - // Bei Ueberlauf wird fVal=+/-HUGE_VAL gesetzt, bei Unterlauf 0, - // nErrno wird in diesen Faellen auf ERANGE gesetzt, sonst 0. - // "+/-1.#INF" werden als +/-HUGE_VAL erkannt. + // Converts just as strtod a decimal string to a double. + // Decimal and thousand separators come from International, + // leading spaces are omitted. + // If ppEnd!=NULL then *ppEnd is set after the parsed data. + // If pStr contains only the String to be parsed, then if success: + // **ppEnd=='\0' and *ppEnd-pStr==strlen(pStr). + // If overflow fVal=+/-HUGE_VAL, if underflow 0, + // nErrno is in this cases set to ERANGE otherwise 0. + // "+/-1.#INF" are recognized as +/-HUGE_VAL. */ @@ -1491,7 +1491,6 @@ SvNumberformat:: if ( bError ) { -// ErrorBox( this, WB_OK | WB_DEF_OK, "Der Wert ist ung�ltig und kann daher nicht gesetzt werden" ).Execute(); ErrorBox( this, SttResId( IDS_INVALID_VALUE ) ).Execute(); return 1; } diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk index 590bd7f151..13c3b4a8b5 100644 --- a/basic/source/app/makefile.mk +++ b/basic/source/app/makefile.mk @@ -40,7 +40,7 @@ LIBTARGET = NO .INCLUDE : settings.mk -# --- Allgemein ------------------------------------------------------------ +# --- Common ------------------------------------------------------------ OBJFILES = \ $(OBJ)$/ttbasic.obj \ diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 4de5f13591..1ef046170d 100644 --- a/basic/source/app/msgedit.cxx +++ b/basic/source/app/msgedit.cxx @@ -179,7 +179,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) } if ( !bFileLoading ) - { // Kommt vom Testtool und muß gleich geschrieben werden. + { // Comes from Testtool and must be written immediately BOOL bFileWasChanged = pAppError->DiskFileChanged( SINCE_LAST_LOAD ); DBG_ASSERT( aLogFileName == LogMsg->aLogFileName, "Logging to different logfile as before" ); @@ -253,8 +253,8 @@ void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) COPY_TTDEBUGDATA( LOG_RUN ); if ( !bFileLoading || ( bFileLoading && nVersion >= 2 ) ) pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, 0, pTTDebugData ); - else // Erstes Dateiformat - pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, LIST_APPEND, pTTDebugData ); // und damit an Ende! + else // First file format + pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, LIST_APPEND, pTTDebugData ); // and therefor at the end aEditTree.ShowEntry( pCurrentRun ); pCurrentTestCase = NULL; @@ -266,7 +266,7 @@ void MsgEdit::AddTestCase( String aMsg, TTDebugData aDebugData ) { if ( pCurrentRun ) { - if ( aMsg.Len() == 0 ) // Am Ende des Testcase + if ( aMsg.Len() == 0 ) // End of Testcase { pCurrentTestCase = NULL; } @@ -494,7 +494,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("Unbekannter Typ im ResultFenster"); + default:DBG_ERROR("Unknown type in ResultWindow!"); } aRet += aEditTree.GetEntryText( pEntry ); return aRet; @@ -527,7 +527,7 @@ String MsgEdit::Impl_MakeSaveText( SvLBoxEntry *pEntry ) const TTDebugData *aData = (TTDebugData*)pEntry->GetUserData(); if ( aEditTree.PrevSibling( pEntry ) && LOGTYPE( aEditTree.PrevSibling( pEntry ) ) == LOG_TEST_CASE ) - { // Um Cases richtig abzuschliessen, so daß Warnings und Msgs in Hirarchie richtig. + { // To properly finish cases and warnings/msgs are in correct hierarchie aRet += String::CreateFromInt32( (int)LOG_TEST_CASE ); aRet.AppendAscii(";;0;0;0;\"\"\n"); } @@ -620,14 +620,18 @@ void MsgEdit::SetText( const String& rStr ) DBG_ERROR("Not Implemented"); } -BOOL MsgEdit::HasText() const { return aEditTree.First() != NULL; } +BOOL MsgEdit::HasText() const +{ + return aEditTree.First() != NULL; +} -// Es wird entweder ab Beginn oder ab Markierungsbegin + 1 gesucht. +// Search from the beginning or mark start + 1 BOOL MsgEdit::Find( const String& s ) { TextSelection r = GetSelection(); USHORT bgn = (USHORT) r.GetStart().GetPara() + 1; - if ( r.GetStart().GetPara() == 0 ) bgn = 0; // Suchen ganz von Anfang + if ( r.GetStart().GetPara() == 0 ) + bgn = 0; // Search from the beginning SvLBoxEntry *pEntry = aEditTree.GetModel()->GetEntryAtAbsPos( bgn ); while ( pEntry ) @@ -641,11 +645,12 @@ BOOL MsgEdit::Find( const String& s ) } return FALSE; } + /****************************************************************** -Zum Fileformat der *.res Dateien: -Die Informationenn werden als Semikolon getrennte Strings -zusammengebastelt. Reihenfolge: + Fileformat of *.res file: + Information are stored as semicolon separated strings + Order: LogType;Filename;Line;Col1;Col2;Message @@ -661,11 +666,11 @@ BOOL MsgEdit::Load( const String& aName ) { aEditTree.Clear(); String aLine; - bFileLoading = TRUE; // So daß nicht gleich wieder auf Platte mitgelogt wird. + bFileLoading = TRUE; // To avoid logging to disk TTLogMsg *pLogMsg = new TTLogMsg; while( !aStrm.IsEof() && bOk ) { - if ( nVersion >= 3 ) // Wir habe utf8 + if ( nVersion >= 3 ) // utf8 aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_UTF8 ); else aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_IBM_850 ); @@ -685,7 +690,9 @@ BOOL MsgEdit::Load( const String& aName ) aDebugData.nCol1 = USHORT( TOKEN(3).ToInt32() ); aDebugData.nCol2 = USHORT( TOKEN(4).ToInt32() ); aDebugData.aMsg = aLine.GetQuotedToken( 5, CUniString("\"\"") ); - aDebugData.aMsg.Erase(0,1); // Anführungszeichen entfernen + + // Remove leading and trailing quotes + aDebugData.aMsg.Erase(0,1); aDebugData.aMsg.Erase(aDebugData.aMsg.Len()-1,1); pLogMsg->aLogFileName.Erase(); @@ -704,7 +711,7 @@ BOOL MsgEdit::Load( const String& aName ) delete pLogMsg; aStrm.Close(); if ( nVersion < 2 && !bLoadError ) - Save( aName ); // Muß sein, sonst passiert beim mitloggen Blödsinn. + Save( aName ); // Necessary to avoid mess } else @@ -918,7 +925,7 @@ TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry ) case LOG_QA_ERROR: return HasQAError; default: - DBG_ERROR("Unbekannter Typ im ResultFenster"); + DBG_ERROR("Unknown type in ResultWindow"); } return HasNothing; } @@ -986,7 +993,7 @@ void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry, const String& rStr ,const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind ) { - USHORT nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" + USHORT nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); TTLBoxString* pStr = new TTLBoxString( pEntry, 0, pCol->GetText() ); diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx index ec93d1fdce..764228341b 100644 --- a/basic/source/app/msgedit.hxx +++ b/basic/source/app/msgedit.hxx @@ -40,7 +40,7 @@ class AppError; #define SelectChildren SelectChilds // Sonst wird mir schlecht -typedef USHORT TTFeatures; // Bitfeld für Features der Entrys +typedef USHORT TTFeatures; // Bitfield for features of the entries #define HasNothing TTFeatures(0x00) #define HasError TTFeatures(0x01) #define HasWarning TTFeatures(0x02) @@ -84,13 +84,13 @@ class MsgEdit : public DataEdit SvLBoxEntry *pCurrentError; BOOL bModified; Link lModify; - BOOL bFileLoading; // TRUE während eine Datei geladen wird. + BOOL bFileLoading; // TRUE while loading a file String Impl_MakeText( SvLBoxEntry *pEntry ) const; String Impl_MakeSaveText( SvLBoxEntry *pEntry ) const; String Impl_MakeSaveText( TTDebugData aData ) const; - USHORT nVersion; // Speichert die Dateiversion + USHORT nVersion; // Stores file version AppError* pAppError; - String aLogFileName; // Name der Logdatei + String aLogFileName; static USHORT nMaxLogLen; static BOOL bLimitLogLen; diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx index 8dad4da153..335db6c21c 100644 --- a/basic/source/app/mybasic.cxx +++ b/basic/source/app/mybasic.cxx @@ -99,13 +99,13 @@ MyBasic::MyBasic() : StarBASIC() // AB-Uno-Test #ifdef unotest - // Uno-Service-Manager holenReflection Service bolen - createAndSetDefaultServiceManager(); // spaeter schon erledigt + // Get Uno-Service-Manager and Reflection Service + createAndSetDefaultServiceManager(); // done later - // Uno-Test-Objekt holen + // Get Uno-Test-Object UsrAny aObjAny = getIntrospectionTestObject(); - // Objekt verpacken in ein SbUnoObject packen + // Box object into SbUnoObject String aName( "UnoObject" ); SbxObjectRef xSbUnoObj = GetSbUnoObject( aName, aObjAny ); //SbxObjectRef xSbUnoObj = new SbUnoObject( aName, aObjAny ); @@ -161,9 +161,9 @@ void MyBasic::LoadIniFile() SbTextType MyBasic::GetSymbolType( const String &rSymbol, BOOL bWasTTControl ) { - (void) rSymbol; /* avoid warning about unused parameter */ + (void) rSymbol; /* avoid warning about unused parameter */ (void) bWasTTControl; /* avoid warning about unused parameter */ - return SB_SYMBOL; // Alles was hier landet ist vom Typ SB_SYMBOL und bleibt es auch + return SB_SYMBOL; // Everything here is of type SB_SYMBOL and continues to be so } @@ -194,7 +194,7 @@ BOOL MyBasic::ErrorHdl() { AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() ); if( !pWin ) - { // erstmal Fenster aufmachen + { // open a window pWin = aBasicApp.pFrame->CreateModuleWin( GetActiveModule() ); } else @@ -207,7 +207,7 @@ BOOL MyBasic::ErrorHdl() 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ), LIST_APPEND ); nError++; - return BOOL( nError < 20 ); // Abbruch nach 20 Fehlern + return BOOL( nError < 20 ); // Cancel after 20 errors } else { @@ -246,7 +246,7 @@ USHORT MyBasic::BreakHdl() { AppBasEd* pWin = aBasicApp.pFrame->FindModuleWin( pMod->GetName() ); if( !pWin ) - { // erstmal Fenster aufmachen + { // open a window pWin = aBasicApp.pFrame->CreateModuleWin( pMod ); } else @@ -254,7 +254,7 @@ USHORT MyBasic::BreakHdl() pWin->Highlight( GetLine(), GetCol1(), GetCol2() ); } - if( IsBreak() ) // Wenn Breakpoint (oder "Run to Cursor") + if( IsBreak() ) // If Breakpoint (or "Run to Cursor") { // if ( GetActiveModule()->IsBP(GetLine()) ) // GetActiveModule()->ClearBP(GetLine()); @@ -268,7 +268,7 @@ USHORT MyBasic::BreakHdl() /*************************************************************************** |* -|* class BasicError +|* class BasicError |* ***************************************************************************/ @@ -290,16 +290,18 @@ BasicError::BasicError aText = r; } -// Dies ist ein Beispiel, wie die Fehler-Information geschickt -// aufgebaut werden kann, um ein Statement zu highlighten. - +// This is a sample how to build the error information +// to highlight a statement void BasicError::Show() { - if( pWin && aBasicApp.pFrame->IsWinValid( pWin ) ) { + if( pWin && aBasicApp.pFrame->IsWinValid( pWin ) ) + { pWin->Highlight( nLine, nCol1, nCol2 ); aBasicApp.pFrame->pStatus->Message( aText ); - } else MessBox( aBasicApp.pFrame, WB_OK, aBasicApp.pFrame->GetText(), - aText ).Execute(); + } + else + MessBox( aBasicApp.pFrame, WB_OK, aBasicApp.pFrame->GetText(), + aText ).Execute(); } diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx index 8db7660b3a..424089c27e 100644 --- a/basic/source/app/printer.cxx +++ b/basic/source/app/printer.cxx @@ -69,11 +69,11 @@ BasicPrinter::BasicPrinter() : Printer() nPage = 0; nLine = 9999; SetMapMode( MapMode( MAP_POINT ) ); Size s( GetOutputSize() ); - // 10-Punkt-Schrift verwenden + // Use 10 point font Font aFont( FAMILY_MODERN, Size( 0, 10 ) ); aFont.SetPitch( PITCH_FIXED ); SetFont( aFont ); - // Ausgabe: 6 Zeilen/Zoll = 12 Punkt + // Output: 6 Lines/Inch = 12 Point nLines = (short) s.Height() / 12; nYoff = 12; SetStartPrintHdl( LINK( this, BasicPrinter, StartPrintHdl ) ); @@ -100,16 +100,16 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame * { nPage = 0; nLine = 9999; aFile = rFile; - // Dialog einrichten + // Setup dialog SttResId aResId( IDD_PRINT_DIALOG ); pDlg = new PrintingDialog ( aBasicApp.pFrame, this, aResId, aFile ); - // Position des Dialogs setzen + // Set position of dialog Size s1 = aBasicApp.pFrame->GetSizePixel(); Size s2 = pDlg->GetSizePixel(); pDlg->SetPosPixel( Point( (s1.Width() - s2.Width() ) / 2, (s1.Height()- s2.Height() ) / 2 ) ); - // PRINT-Menu disablen + // Disable PRINT-Menu MenuBar* pBar = pFrame->GetMenuBar(); Menu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE ); pFileMenu->EnableItem( RID_FILEPRINT, FALSE ); @@ -141,7 +141,8 @@ void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame * IMPL_LINK_INLINE_START( BasicPrinter, StartPrintHdl, Printer *, pPrinter ) { (void) pPrinter; /* avoid warning about unused parameter */ - if( pDlg ) pDlg->Show(); + if( pDlg != NULL ) + pDlg->Show(); return 0; } IMPL_LINK_INLINE_END( BasicPrinter, StartPrintHdl, Printer *, pPrinter ) @@ -149,7 +150,8 @@ IMPL_LINK_INLINE_END( BasicPrinter, StartPrintHdl, Printer *, pPrinter ) IMPL_LINK_INLINE_START( BasicPrinter, EndPrintHdl, Printer *, pPrinter ) { (void) pPrinter; /* avoid warning about unused parameter */ - if( pDlg ) pDlg->Hide(); + if( pDlg != NULL) + pDlg->Hide(); return 0; } IMPL_LINK_INLINE_END( BasicPrinter, EndPrintHdl, Printer *, pPrinter ) @@ -157,7 +159,8 @@ IMPL_LINK_INLINE_END( BasicPrinter, EndPrintHdl, Printer *, pPrinter ) IMPL_LINK_INLINE_START( BasicPrinter, PrintPageHdl, Printer *, pPrinter ) { (void) pPrinter; /* avoid warning about unused parameter */ - if( pDlg ) pDlg->ChangeMessage( nPage ); + if( pDlg != NULL) + pDlg->ChangeMessage( nPage ); return 0; } IMPL_LINK_INLINE_END( BasicPrinter, PrintPageHdl, Printer *, pPrinter ) diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx index 1dffedf331..01491f9e9d 100644 --- a/basic/source/app/process.cxx +++ b/basic/source/app/process.cxx @@ -54,7 +54,6 @@ #include <basic/process.hxx> -// Konstruktor für den Process Process::Process() : pArgumentList( NULL ) , pEnvList( NULL ) @@ -64,7 +63,6 @@ Process::Process() { } -// Destruktor Process::~Process() { // delete pArgumentList; @@ -106,9 +104,8 @@ long Process::ImplGetExitCode() //////////////////////////////////////////////////////////////////////////// -// Die Methoden: void Process::SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv ) -{ // Imagedatei des Executables +{ // Set image file of executable if ( pProcess && ImplIsRunning() ) SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); else @@ -163,7 +160,7 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const } BOOL Process::Start() -{ // Programm wird gestartet +{ // Start program BOOL bSuccess=FALSE; if ( pProcess && !ImplIsRunning() ) { @@ -196,6 +193,7 @@ BOOL Process::Start() catch( ... ) { bWasGPF = TRUE; + // TODO: Output debug message !! } nErrorMode = SetErrorMode(nErrorMode); #endif @@ -207,17 +205,17 @@ BOOL Process::Start() } ULONG Process::GetExitCode() -{ // ExitCode des Programms(nachdem es beendet ist) +{ // ExitCode of program after execution return ImplGetExitCode(); } BOOL Process::IsRunning() -{ // Programm läuft noch +{ return ImplIsRunning(); } BOOL Process::WasGPF() -{ // Programm mit GPF o.ä. abgebrochen +{ // Did the process fail? #ifdef WNT return ImplGetExitCode() == 3221225477; #else diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx index ae315eabb0..9caf34148c 100644 --- a/basic/source/app/processw.cxx +++ b/basic/source/app/processw.cxx @@ -46,10 +46,10 @@ #include "processw.hxx" -// Der Process hat folgende Elemente: +// Process has the following elements: // 1) Properties: -// Keine -// 2) Methoden: +// none +// 2) Methods: // SetImage( Filename ) // BOOL Start // USHORT GetExitCode @@ -57,56 +57,53 @@ // BOOL WasGPF -// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte -// Version, die sehr viele Elemente enthalten kann. Die Elemente werden -// je nach Bedarf aus der Tabelle in das Objekt uebernommen. +// This implementation is a sample for a table driven version that +// can contain lots of elements. The elements are taken into the object +// when they are needed. -// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: +// The nArgs field of a table entry is scrambled as follows: +#define _ARGSMASK 0x00FF // Up to 255 arguments +#define _RWMASK 0x0F00 // Mask for R/W-Bits +#define _TYPEMASK 0xF000 // Mask for entry type -#define _ARGSMASK 0x00FF // Bis zu 255 Argumente -#define _RWMASK 0x0F00 // Maske fuer R/W-Bits -#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags +#define _READ 0x0100 // can be read +#define _BWRITE 0x0200 // can be used as Lvaluen +#define _LVALUE _BWRITE +#define _READWRITE 0x0300 // can read and written +#define _OPT 0x0400 // TRUE: optional parameter +#define _METHOD 0x1000 // Mask-Bit for a method +#define _PROPERTY 0x2000 // Mask-Bit for a property +#define _COLL 0x4000 // Mask-Bit for a collection -#define _READ 0x0100 // kann gelesen werden -#define _BWRITE 0x0200 // kann as Lvalue verwendet werden -#define _LVALUE _BWRITE // kann as Lvalue verwendet werden -#define _READWRITE 0x0300 // beides -#define _OPT 0x0400 // TRUE: optionaler Parameter -#define _METHOD 0x1000 // Masken-Bit fuer eine Methode -#define _PROPERTY 0x2000 // Masken-Bit fuer eine Property -#define _COLL 0x4000 // Masken-Bit fuer eine Collection - // Kombination von oberen Bits: -#define _FUNCTION 0x1100 // Maske fuer Function -#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht -#define _ROPROP 0x2100 // Maske Read Only-Property -#define _WOPROP 0x2200 // Maske Write Only-Property -#define _RWPROP 0x2300 // Maske Read/Write-Property -#define _COLLPROP 0x4100 // Maske Read-Collection-Element - -#define COLLNAME "Elements" // Name der Collection, hier mal hart verdrahtet +// Combination of the bits above: +#define _FUNCTION 0x1100 // Mask for a Function +#define _LFUNCTION 0x1300 // Mask for a Function, that can be uses as Lvalue +#define _ROPROP 0x2100 // Mask Read Only-Property +#define _WOPROP 0x2200 // Mask Write Only-Property +#define _RWPROP 0x2300 // Mask Read/Write-Property +#define _COLLPROP 0x4100 // Mask Read-Collection-Element +#define COLLNAME "Elements" // Name of the collection, hard coded ProcessWrapper::Methods ProcessWrapper::aProcessMethods[] = { -// Imagedatei des Executables +// Imagefile of the Executable { "SetImage", SbxEMPTY, &ProcessWrapper::PSetImage, 1 | _FUNCTION }, - // Zwei Named Parameter + // Two Named Parameter { "Filename", SbxSTRING, NULL, 0 }, { "Params", SbxSTRING, NULL, _OPT }, -// Programm wird gestartet +// Program is started { "Start", SbxBOOL, &ProcessWrapper::PStart, 0 | _FUNCTION }, -// ExitCode des Programms(nachdem es beendet ist) +// ExitCode of the program { "GetExitCode", SbxULONG, &ProcessWrapper::PGetExitCode, 0 | _FUNCTION }, -// Programm läuft noch +// Program is running { "IsRunning", SbxBOOL, &ProcessWrapper::PIsRunning, 0 | _FUNCTION }, -// Programm mit GPF o.ä. abgebrochen +// Program has faulted with GPF etc. { "WasGPF", SbxBOOL, &ProcessWrapper::PWasGPF, 0 | _FUNCTION }, -{ NULL, SbxNULL, NULL, -1 }}; // Tabellenende - +{ NULL, SbxNULL, NULL, -1 }}; // End of table -// Konstruktor für den Process ProcessWrapper::ProcessWrapper() : SbxObject( CUniString("Process") ) { pProcess = new Process(); @@ -114,26 +111,24 @@ ProcessWrapper::ProcessWrapper() : SbxObject( CUniString("Process") ) pMethods = &aProcessMethods[0]; } -// Destruktor ProcessWrapper::~ProcessWrapper() { delete pProcess; } -// Suche nach einem Element: -// Hier wird linear durch die Methodentabelle gegangen, bis eine -// passende Methode gefunden wurde. -// Wenn die Methode/Property nicht gefunden wurde, nur NULL ohne -// Fehlercode zurueckliefern, da so auch eine ganze Chain von -// Objekten nach der Methode/Property befragt werden kann. - +// Search for an element: +// Linear search through the method table until an appropriate one +// can be found. +// If the the method/property cannot be found, NULL is return +// without an error code, so that we can ask the whole +// chain of objects for the method/property. SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) { - // Ist das Element bereits vorhanden? + // Is the element already available? SbxVariable* pRes = SbxObject::Find( rName, t ); if( !pRes && t != SbxCLASS_OBJECT ) { - // sonst suchen + // otherwise search Methods* p = pMethods; short nIndex = 0; BOOL bFound = FALSE; @@ -148,7 +143,7 @@ SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) } if( bFound ) { - // Args-Felder isolieren: + // isolate Args fields: short nAccess = ( p->nArgs & _RWMASK ) >> 8; short nType = ( p->nArgs & _TYPEMASK ); String aMethodName( p->pName, RTL_TEXTENCODING_ASCII_US ); @@ -158,9 +153,8 @@ SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) else if( nType & _METHOD ) eCT = SbxCLASS_METHOD; pRes = Make( aMethodName, eCT, p->eType ); - // Wir setzen den Array-Index + 1, da ja noch andere - // Standard-Properties existieren, die auch aktiviert - // werden muessen. + // We set array index + 1 because there are other + // default properties that must be activated pRes->SetUserData( nIndex + 1 ); pRes->SetFlags( nAccess ); } @@ -168,8 +162,7 @@ SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) return pRes; } -// Aktivierung eines Elements oder Anfordern eines Infoblocks - +// Activation of an element or request for an info block void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, const SfxHint& rHint, const TypeId& rHT ) { @@ -179,7 +172,7 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, SbxVariable* pVar = pHint->GetVar(); SbxArray* pNotifyPar = pVar->GetParameters(); USHORT nIndex = (USHORT) pVar->GetUserData(); - // kein Index: weiterreichen! + // No index: put through if( nIndex ) { ULONG t = pHint->GetId(); @@ -192,13 +185,13 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, bWrite = TRUE; if( t == SBX_HINT_DATAWANTED || bWrite ) { - // Parameter-Test fuer Methoden: + // Parameter-Test for methods: USHORT nPar = pMethods[ --nIndex ].nArgs & 0x00FF; - // Element 0 ist der Returnwert + // Element 0 is the return value if( ( !pNotifyPar && nPar ) || ( pNotifyPar && pNotifyPar->Count() < nPar+1 ) ) SetError( SbxERR_WRONG_ARGS ); - // Alles klar, man kann den Call ausfuehren + // ready for call else { (this->*(pMethods[ nIndex ].pFunc))( pVar, pNotifyPar, bWrite ); @@ -210,8 +203,7 @@ void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, } } -// Zusammenbau der Infostruktur fuer einzelne Elemente - +// Building the info struct for single elements SbxInfo* ProcessWrapper::GetInfo( short nIdx ) { Methods* p = &pMethods[ nIdx ]; @@ -237,13 +229,11 @@ SbxInfo* ProcessWrapper::GetInfo( short nIdx ) //////////////////////////////////////////////////////////////////////////// -// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert -// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus -// Element 0 gespeichert. +// Properties and methods save the return value in argv[0] (Get, bPut = FALSE) +// and store the value from argv[0] (Put, bPut = TRUE) -// Die Methoden: void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) -{ // Imagedatei des Executables +{ // Imagefile of the executable (void) pVar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ if ( pMethodePar->Count() >= 2 ) @@ -253,28 +243,28 @@ void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pMethodePar, BOOL b } void ProcessWrapper::PStart( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) -{ // Programm wird gestartet +{ // Program is started (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutBool( pProcess->Start() ); } void ProcessWrapper::PGetExitCode( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) -{ // ExitCode des Programms(nachdem es beendet ist) +{ // ExitCode of the program after it was finished (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutULong( pProcess->GetExitCode() ); } void ProcessWrapper::PIsRunning( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) -{ // Programm läuft noch +{ // Program is still running (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutBool( pProcess->IsRunning() ); } void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWriteIt ) -{ // Programm mit GPF o.ä. abgebrochen +{ // Program faulted with GPF etc. (void) pMethodePar; /* avoid warning about unused parameter */ (void) bWriteIt; /* avoid warning about unused parameter */ pVar->PutBool( pProcess->WasGPF() ); @@ -285,8 +275,7 @@ void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pMethodePar, BOOL bWr -// Die Factory legt unser Objekte an. - +// The factory creates our object SbxObject* ProcessFactory::CreateObject( const String& rClass ) { if( rClass.CompareIgnoreCaseToAscii( "Process" ) == COMPARE_EQUAL ) diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx index 3c6f2b2ad9..ce8d0dcde0 100644 --- a/basic/source/app/processw.hxx +++ b/basic/source/app/processw.hxx @@ -41,9 +41,8 @@ class ProcessWrapper : public SbxObject { using SbxVariable::GetInfo; - // Definition eines Tabelleneintrags. Dies wird hier gemacht, - // da dadurch die Methoden und Properties als private deklariert - // werden koennen. +// 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 ) public: #endif @@ -54,25 +53,24 @@ private: #endif struct Methods { - const char* pName; // Name des Eintrags - SbxDataType eType; // Datentyp + const char* pName; // Name of the entry + SbxDataType eType; // Data type pMeth pFunc; // Function Pointer - short nArgs; // Argumente und Flags + short nArgs; // Arguments and flags }; - static Methods aProcessMethods[]; // Methodentabelle - Methods *pMethods; // Aktuelle Methodentabelle + static Methods aProcessMethods[]; // Method table + Methods *pMethods; // Current method table - // Methoden void PSetImage( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); void PStart( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); void PIsRunning( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); void PWasGPF( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); - // Interne Member und Methoden + // Internal members and methods Process *pProcess; - // Infoblock auffuellen + // Fill info block SbxInfo* GetInfo( short nIdx ); // Broadcaster Notification @@ -81,13 +79,11 @@ private: public: ProcessWrapper(); ~ProcessWrapper(); - // Suchen eines Elements + // Search for an element virtual SbxVariable* Find( const String&, SbxClassType ); }; - -// Die dazugehoerige Factory: - +// Factory class ProcessFactory : public SbxFactory { public: diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx index c18479435f..6a90321b0d 100644 --- a/basic/source/app/status.cxx +++ b/basic/source/app/status.cxx @@ -48,7 +48,7 @@ StatusLine::StatusLine( BasicFrame* p ) // initialize TaskStatusBar TaskStatusBar* pTempStatusBar = GetStatusBar(); - long nCharWidth = GetTextWidth( '0' ); // Angenommen, alle Zahlen sind gleich breit + long nCharWidth = GetTextWidth( '0' ); // We state: All numbers has the same width pTempStatusBar->InsertItem( ST_MESSAGE, GetTextWidth( 'X' ) * 20, SIB_LEFT | SIB_IN | SIB_AUTOSIZE ); pTempStatusBar->InsertItem( ST_LINE, 5*nCharWidth ); pTempStatusBar->InsertItem( ST_PROF, GetTextWidth( 'X' ) * 10 ); @@ -111,7 +111,7 @@ void StatusLine::LoadTaskToolBox() pTaskToolBox->StartUpdateTask(); while ( nFirstWinPos < pWinMenu->GetItemCount() ) - { // Es gibt Fenster + { // There are windows Window* pWin = pFrame->FindWin( pWinMenu->GetItemId( nFirstWinPos ) ); if ( pWin ) diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx index c05b6c106f..9daa9229aa 100644 --- a/basic/source/app/status.hxx +++ b/basic/source/app/status.hxx @@ -48,9 +48,9 @@ protected: public: StatusLine( BasicFrame* ); - void Message( const String& ); // Text anzeigen - void Pos( const String& s ); // Textposition anzeigen - void SetProfileName( const String& s ); // Current Profile + void Message( const String& ); // Show text + void Pos( const String& s ); // Show text position + void SetProfileName( const String& s ); // Current Profile void LoadTaskToolBox(); }; diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx index 48865c209f..bf118d1f2c 100644 --- a/basic/source/app/textedit.cxx +++ b/basic/source/app/textedit.cxx @@ -43,7 +43,7 @@ #include "textedit.hxx" #include "appedit.hxx" #include "brkpnts.hxx" -#include <basic/testtool.hxx> // defines für das Syntaxhighlighting +#include <basic/testtool.hxx> // defines for syntax highlighting TextEditImp::TextEditImp( AppEdit* pParent, const WinBits& aBits ) : Window( pParent, aBits ) @@ -70,8 +70,8 @@ TextEditImp::TextEditImp( AppEdit* pParent, const WinBits& aBits ) StartListening( *pTextEngine ); - HideTipTimer.SetTimeout( 5000 ); // 5 Sekunden - ShowTipTimer.SetTimeout( 500 ); // 1/2 Sekunde + HideTipTimer.SetTimeout( 5000 ); // 5 seconds + ShowTipTimer.SetTimeout( 500 ); // 1/2 seconds HideTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, HideVarContents ) ); ShowTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, ShowVarContents ) ); } @@ -123,7 +123,7 @@ void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { pAppEdit->nCurTextWidth = nWidth; if ( pAppEdit->pHScroll ) - { // Initialisierung abgeschlossen? + { // Initialization finished? pAppEdit->pHScroll->SetRange( Range( 0, (long)nWidth) ); pAppEdit->pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); } @@ -139,7 +139,7 @@ void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, FALSE ); - // Lästiges anpassen für 2 Zeichen am Zeilenende statt einem(Hartverdrateter Default) + // Itchy adaption for two signs at line ends instead of one (hard coded default) pTextEngine->SetMaxTextLen( STRING_MAXLEN - pTextEngine->GetParagraphCount() ); } else if( rTextHint.GetId() == TEXT_HINT_FORMATPARA ) @@ -159,9 +159,9 @@ private: FontWeight maFontWeight; public: - TextAttribSpechial( const FontWeight& rFontWeight ); - TextAttribSpechial( const TextAttribSpechial& rAttr ); - ~TextAttribSpechial() {;} + TextAttribSpechial( const FontWeight& rFontWeight ); + TextAttribSpechial( const TextAttribSpechial& rAttr ); + ~TextAttribSpechial() {;} virtual void SetFont( Font& rFont ) const; virtual TextAttrib* Clone() const; @@ -213,7 +213,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) return; } - /// hier werden die Type für das Testtool nachbearbeitet + // here is the postprocessing for types for the TestTool USHORT i; BOOL bWasTTControl = FALSE; for ( i = 0; i < aPortionList.Count(); i++ ) @@ -250,15 +250,9 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) } } - // Evtl. Optimieren: - // Wenn haufig gleiche Farbe, dazwischen Blank ohne Farbe, - // ggf. zusammenfassen, oder zumindest das Blank, - // damit weniger Attribute - if ( TRUE /*bOptimizeHighlight*/ ) - { // Es muessen nur die Blanks und Tabs mit attributiert werden. - // Wenn zwei gleiche Attribute hintereinander eingestellt werden, - // optimiert das die EditEngine. + // If there are two equal attributes one after another, + // they are optimized by the EditEngine. xub_StrLen nLastEnd = 0; #ifdef DBG_UTIL xub_StrLen nLine = aPortionList[0].nLine; @@ -281,7 +275,6 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) ) r.nEnd = rSource.Len()-1; } - } BOOL bWasModified = pTextEngine->IsModified(); for ( i = 0; i < aPortionList.Count(); i++ ) @@ -293,7 +286,7 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) SbTextType eCol = r.eType; Color aColor; - ULONG nLine = nLineOff+r.nLine-1; // -1, weil Basic bei 1 beginnt + ULONG nLine = nLineOff+r.nLine-1; // -1, because BASIC starts with 1 switch ( +eCol ) { case SB_KEYWORD: @@ -337,19 +330,19 @@ void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) default: { aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) ); - DBG_ERROR( "Unbekannte Syntax-Farbe?" ); + DBG_ERROR( "Unknown syntax color" ); } } pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 ); } - // Das Highlighten soll kein Modify setzen + // Highlighting should not modify the text pTextEngine->SetModified( bWasModified ); } void TextEditImp::DoSyntaxHighlight( ULONG nPara ) { - // Durch das DelayedSyntaxHighlight kann es passieren, - // dass die Zeile nicht mehr existiert! + // Due to delayed syntax highlight it can happend that the + // paragraph does no longer exist if ( nPara < pTextEngine->GetParagraphCount() ) { // leider weis ich nicht, ob genau diese Zeile Modified() ... @@ -363,8 +356,8 @@ void TextEditImp::DoSyntaxHighlight( ULONG nPara ) void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) { - // Zeile wird nur in 'Liste' aufgenommen, im TimerHdl abgearbeitet. - // => Nicht Absaetze manipulieren, waehrend EditEngine formatiert. + // Paragraph is added to 'List', processed in TimerHdl. + // => Do not manipulate paragraphs while EditEngine is formatting // if ( pProgress ) // pProgress->StepProgress(); @@ -382,7 +375,7 @@ void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG ) { - DBG_ASSERT( pTextView, "Noch keine View, aber Syntax-Highlight ?!" ); + DBG_ASSERT( pTextView, "Not yet a View but Syntax-Highlight ?!" ); pTextEngine->SetUpdateMode( FALSE ); bHighlightning = TRUE; @@ -405,13 +398,13 @@ IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG ) } BOOL bWasModified = pTextEngine->IsModified(); - if ( aSyntaxLineTable.Count() > 3 ) // Ohne VDev + if ( aSyntaxLineTable.Count() > 3 ) // Without VDev { pTextEngine->SetUpdateMode( TRUE ); pTextView->ShowCursor( TRUE, TRUE ); } else - pTextEngine->SetUpdateMode( TRUE ); // ! Mit VDev + pTextEngine->SetUpdateMode( TRUE ); // ! With VDev // pTextView->ForceUpdate(); // SetUpdateMode( TRUE ) soll kein Modify setzen @@ -489,7 +482,7 @@ void TextEditImp::KeyInput( const KeyEvent& rKeyEvent ) if ( pTextView->GetTextEngine()->IsModified() ) ModifyHdl.Call( NULL ); else - pTextView->GetTextEngine()->SetModified( bWasModified ); // Eventuell wieder setzen + pTextView->GetTextEngine()->SetModified( bWasModified ); } void TextEditImp::Paint( const Rectangle& rRect ){ pTextView->Paint( rRect );} @@ -559,8 +552,8 @@ SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord ) String aSuffixes = CUniString( cSuffixes ); if ( aSuffixes.Search( aWord.GetChar(nLastChar) ) != STRING_NOTFOUND ) aWord.Erase( nLastChar, 1 ); - - BOOL bWasError = SbxBase::IsError(); // Da eventuell im Testtool ein Fehler geschmissen wird. + // because perhaps TestTools throws an error + BOOL bWasError = SbxBase::IsError(); pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( TRUE ); SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); pAppEdit->GetBasicFrame()->Basic().DebugFindNoErrors( FALSE ); @@ -587,8 +580,7 @@ IMPL_LINK( TextEditImp, ShowVarContents, void*, EMPTYARG ) SbxDataType eType = pVar->GetType(); if ( eType == SbxOBJECT ) { - // Kann zu Absturz, z.B. bei Selections-Objekt fuehren - // Type == Object heisst nicht, dass pVar == Object! + // Can cause a crash: Type == Object does not mean pVar == Object if ( pVar->GetObject() && pVar->GetObject()->ISA( SbxObject ) ) aHelpText = ((SbxObject*)(pVar->GetObject()))->GetClassName(); else @@ -599,7 +591,7 @@ IMPL_LINK( TextEditImp, ShowVarContents, void*, EMPTYARG ) else if ( eType != SbxEMPTY ) { aHelpText = pVar->GetName(); - if ( !aHelpText.Len() ) // Bei Uebergabeparametern wird der Name nicht kopiert + if ( !aHelpText.Len() ) // Name is not copied in arguments aHelpText = aWord; aHelpText += '='; aHelpText += pVar->GetString(); @@ -660,11 +652,11 @@ Variant(Empty) case SbxDOUBLE: case SbxINTEGER: case SbxLONG: -// case SbxOBJECT: // kann nicht editiert werden +// case SbxOBJECT: // cannot be edited case SbxSINGLE: case SbxSTRING: - case SbxVARIANT: // Taucht wohl auch nicht auf. stattdessen SbxEMPTY + case SbxVARIANT: // does not occure, instead SbxEMPTY case SbxEMPTY: { pAppEdit->GetBasicFrame()->SetEditVar( pVar ); @@ -702,28 +694,30 @@ TextEdit::~TextEdit() void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) { - if ( nLine ) // Kann eigentlich nicht vorkommen, außer bei Fehler 'Sub erwartet' in erster Zeile + if ( nLine ) // Should not occure but at 'Sub expected' in first line nLine--; String s = aEdit.pTextEngine->GetText( nLine ); if( nCol1 == STRING_NOTFOUND ) - // Keine Spalte angegeben - nCol1 = 0, nCol2 = STRING_NOTFOUND; + { + // No column given + nCol1 = 0; + nCol2 = STRING_NOTFOUND; + } if( nCol2 == STRING_NOTFOUND ) { nCol2 = s.Len(); } - // Anpassung an den Precompiler | EditText != Compilierter Text + // Adaption to the Precompiler | EditText != Compilied Text if ( nCol2 > s.Len() ) nCol2 = s.Len(); if ( nCol1 >= nCol2 ) nCol1 = 0; - // Da nCol2 u.U. hinter das aktuelle Statement zeigt - // (weil dort schon das naechste beginnt), muessen - // wird am Ende evtl. Whitespace, einen Doppelpunkt - // und mehr Whitespace entfernen + // Because nCol2 *may* point after the current statement + // (because the next one starts there) there are space + // that must be removed BOOL bColon = FALSE; while ( s.GetChar( nCol2 ) == ' ' && nCol2 > nCol1 && !bColon ) @@ -775,8 +769,7 @@ void TextEdit::SetText( const String& rStr ){ aEdit.pTextEngine->SetText(rStr); void TextEdit::SetModifyHdl( Link l ){ aEdit.SetModifyHdl(l); } BOOL TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; } -// Es wird entweder ab Beginn oder ab Markierungsbegin + 1 gesucht. - +// Search from the beginning or at mark + 1 BOOL TextEdit::Find( const String& s ) { DBG_CHKTHIS(TextEdit,0); diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 2bb1bc75a4..3c4980e266 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -283,17 +283,17 @@ namespace basic ::osl::MutexGuard aGuard( m_aMutex ); OSL_PRECOND( getApplicationBasicManager( false ) == NULL, "ImplRepository::impl_createApplicationBasicManager: there already is one!" ); - // Directory bestimmen + // Determine Directory SvtPathOptions aPathCFG; String aAppBasicDir( aPathCFG.GetBasicPath() ); if ( !aAppBasicDir.Len() ) aPathCFG.SetBasicPath( String::CreateFromAscii("$(prog)") ); - // #58293# soffice.new nur im User-Dir suchen => erstes Verzeichnis + // #58293# soffice.new search only in user dir => first dir String aAppFirstBasicDir = aAppBasicDir.GetToken(1); - // Basic erzeugen und laden - // MT: #47347# AppBasicDir ist jetzt ein PATH! + // Create basic and load it + // MT: #47347# AppBasicDir is now a PATH INetURLObject aAppBasic( SvtPathOptions().SubstituteVariable( String::CreateFromAscii("$(progurl)") ) ); aAppBasic.insertName( Application::GetAppName() ); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 3853120938..9c690f1c8d 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -430,14 +430,14 @@ class BasicLibInfo private: StarBASICRef xLib; String aLibName; - String aStorageName; // String reicht, da zur Laufzeit eindeutig. + String aStorageName; // String is sufficient, unique at runtime String aRelStorageName; String aPassword; BOOL bDoLoad; BOOL bReference; BOOL bPasswordVerified; - BOOL bFoundInPath; // Darf dann nicht neu relativiert werden! + BOOL bFoundInPath; // Must not relativated again! // Lib represents library in new UNO library container Reference< XLibraryContainer > mxScriptCont; @@ -471,7 +471,7 @@ public: const String& GetLibName() const { return aLibName; } void SetLibName( const String& rName ) { aLibName = rName; } - // Nur temporaer fuer Laden/Speichern.... + // Only temporary for Load/Save BOOL DoLoad() { return bDoLoad; } BOOL HasPassword() const { return aPassword.Len() != 0; } @@ -498,7 +498,7 @@ DECLARE_LIST( BasicLibsBase, BasicLibInfo* ) class BasicLibs : public BasicLibsBase { public: - String aBasicLibPath; // soll eigentlich Member vom Manager werden, aber jetzt nicht inkompatibel! + String aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible }; BasicLibInfo::BasicLibInfo() @@ -536,20 +536,20 @@ void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStora String aCurStorageName = INetURLObject(rBasMgrStorageName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE ); DBG_ASSERT(aCurStorageName.Len() != 0, "Bad storage name"); - // Falls nicht gesetzt, StorageName initialisieren + // If not set initialize StorageName if ( aStorageName.Len() == 0 ) aStorageName = aCurStorageName; - // Wieder laden? + // Load again? BOOL bDoLoad_ = xLib.Is(); if ( bUseOldReloadInfo ) bDoLoad_ = DoLoad(); rSStream << bDoLoad_; - // Den Namen der Lib... + // The name of the lib... rSStream.WriteByteString(GetLibName()); - // Absoluter Pfad.... + // Absolute path... if ( ! GetStorageName().EqualsAscii(szImbedded) ) { String aSName = INetURLObject( GetStorageName(), INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE ); @@ -559,14 +559,14 @@ void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStora else rSStream.WriteByteString( szImbedded ); - // Relativer Pfad... + // Relative path... if ( ( aStorageName == aCurStorageName ) || ( aStorageName.EqualsAscii(szImbedded) ) ) rSStream.WriteByteString( szImbedded ); else { - // Nicht den relativen Pfad ermitteln, wenn die Datei nur im Pfad - // gefunden wurde: Dann andert sich der relative Pfad und nach einem - // verschieben der Libs in einen anderen Pfad werden sie nicht gefunden. + // Do not determine the relative path if the file was only found in path: + // because the relative path would change and after moving the lib the + // the file cannot be found. if ( !IsFoundInPath() ) CalcRelStorageName( aCurStorageName ); rSStream.WriteByteString(aRelStorageName); @@ -576,11 +576,11 @@ void BasicLibInfo::Store( SotStorageStream& rSStream, const String& rBasMgrStora // Version 2 // ------------------------------ - // Referenz... + // reference... rSStream << bReference; // ------------------------------ - // Schluss + // End // ------------------------------ nEndPos = rSStream.Tell(); @@ -604,22 +604,22 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream ) DBG_ASSERT( nId == LIBINFO_ID, "Keine BasicLibInfo !?" ); if( nId == LIBINFO_ID ) { - // Wieder laden? + // Reload? BOOL bDoLoad; rSStream >> bDoLoad; pInfo->bDoLoad = bDoLoad; - // Den Namen der Lib... + // The name of the lib... String aName; rSStream.ReadByteString(aName); pInfo->SetLibName( aName ); - // Absoluter Pfad.... + // Absolute path... String aStorageName; rSStream.ReadByteString(aStorageName); pInfo->SetStorageName( aStorageName ); - // Relativer Pfad... + // Relative path... String aRelStorageName; rSStream.ReadByteString(aRelStorageName); pInfo->SetRelStorageName( aRelStorageName ); @@ -667,17 +667,16 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA // DBG_ASSERT( aStorName.Len(), "No Storage Name!" ); // DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name"); - // Wenn es den Manager-Stream nicht gibt, sind keine weiteren - // Aktionen noetig. + // If there is no Manager Stream, no further actions are necessary if ( rStorage.IsStream( ManagerStreamName ) ) { LoadBasicManager( rStorage, rBaseURL ); - // StdLib erhaelt gewuenschten Parent: + // StdLib contains Parent: StarBASIC* pStdLib = GetStdLib(); - DBG_ASSERT( pStdLib, "Standard-Lib nicht geladen?" ); + DBG_ASSERT( pStdLib, "Standard-Lib not loaded?" ); if ( !pStdLib ) { - // Sollte eigentlich nie passieren, aber dann wenigstens nicht abstuerzen... + // Should never happen, but if it happens we wont crash... pStdLib = new StarBASIC( NULL, mbDocMgr ); BasicLibInfo* pStdLibInfo = pLibs->GetObject( 0 ); if ( !pStdLibInfo ) @@ -692,7 +691,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA else { pStdLib->SetParent( pParentFromStdLib ); - // Die anderen erhalten die StdLib als Parent: + // The other get StdLib as parent: for ( USHORT nBasic = 1; nBasic < GetLibCount(); nBasic++ ) { StarBASIC* pBasic = GetLib( nBasic ); @@ -703,7 +702,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA pBasic->SetFlag( SBX_EXTSEARCH ); } } - // Durch das Insert modified: + // Modified through insert pStdLib->SetModified( FALSE ); } @@ -863,7 +862,7 @@ BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, BOOL bDocMgr ) : { DBG_CTOR( BasicManager, 0 ); Init(); - DBG_ASSERT( pSLib, "BasicManager kann nicht mit einem NULL-Pointer erzeugt werden!" ); + DBG_ASSERT( pSLib, "BasicManager cannot be created with a NULL-Pointer!" ); if( pLibPath ) pLibs->aBasicLibPath = *pLibPath; @@ -875,7 +874,7 @@ BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, BOOL bDocMgr ) : pStdLibInfo->SetLibName( String::CreateFromAscii(szStdLibName) ); pSLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH ); - // Speichern lohnt sich nur, wenn sich das Basic aendert. + // Save is only necessary if basic has changed xStdLib->SetModified( FALSE ); bBasMgrModified = FALSE; } @@ -883,22 +882,19 @@ BasicManager::BasicManager( StarBASIC* pSLib, String* pLibPath, BOOL bDocMgr ) : BasicManager::BasicManager() { DBG_CTOR( BasicManager, 0 ); - // Diese CTOR darf nur verwendet werden um bei 'Speichern unter' - // die relativen Pfade anzupassen, das gibt kein AppBasic und somit - // duerfen auch keine Libs geladen werden... + // This ctor may only be used to adapt relative paths for 'Save As'. + // There is no AppBasic so libs must not be loaded... Init(); } void BasicManager::ImpMgrNotLoaded( const String& rStorageName ) { - // pErrInf wird nur zerstoert, wenn der Fehler von einem ErrorHandler - // gehandelt wird! -// String aErrorText( BasicResId( IDS_SBERR_MGROPEN ) ); -// aErrorText.SearchAndReplace( "XX", rStorageName ); - StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, ERRCODE_BUTTON_OK ); + // pErrInf is only destroyed if the error os processed by an + // ErrorHandler + StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, ERRCODE_BUTTON_OK ); pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENMGRSTREAM, rStorageName ) ); - // Eine STD-Lib erzeugen, sonst macht es Peng! + // Create a stdlib otherwise we crash! BasicLibInfo* pStdLibInfo = CreateLibInfo(); pStdLibInfo->SetLib( new StarBASIC( NULL, mbDocMgr ) ); StarBASICRef xStdLib = pStdLibInfo->GetLib(); @@ -941,9 +937,9 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE ); // #i13114 removed, DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name"); - String aRealStorageName = maStorageName; // fuer relative Pfade, kann durch BaseURL umgebogen werden. + String aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL - // Wenn aus Vorlagen geladen wird, gilt nur die BaseURL: + // If loaded from template, only BaseURL is used: //String aBaseURL = INetURLObject::GetBaseURL(); if ( rBaseURL.Len() ) { @@ -963,15 +959,15 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR // Plausi! if( nLibs & 0xF000 ) { - DBG_ASSERT( !this, "BasicManager-Stream defekt!" ); + DBG_ASSERT( !this, "BasicManager-Stream defect!" ); return; } for ( USHORT nL = 0; nL < nLibs; nL++ ) { BasicLibInfo* pInfo = BasicLibInfo::Create( *xManagerStream ); - // ggf. absoluten Pfad-Namen korrigieren, wenn rel. existiert - // Immer erst den relativen versuchen, falls zwei Staende auf der Platte + // Correct absolute pathname if relative is existing. + // Always try relative first if there are two stands on disk if ( pInfo->GetRelStorageName().Len() && ( ! pInfo->GetRelStorageName().EqualsAscii(szImbedded) ) ) { INetURLObject aObj( aRealStorageName, INET_PROT_FILE ); @@ -986,7 +982,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR //*** TODO-End if ( pLibs->aBasicLibPath.Len() ) { - // Lib im Pfad suchen... + // Search lib in path String aSearchFile = pInfo->GetRelStorageName(); SvtPathOptions aPathCFG; if( aPathCFG.SearchFile( aSearchFile, SvtPathOptions::PATH_BASIC ) ) @@ -998,9 +994,8 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR } pLibs->Insert( pInfo, LIST_APPEND ); - // Libs aus externen Dateien sollen erst bei Bedarf geladen werden. - // Aber Referenzen werden gleich geladen, sonst bekommen die Grosskunden - // vielleicht Probleme... + // Libs from external files should be loaded only when necessary. + // But references are loaded at once, otherwise some big customers get into trouble if ( bLoadLibs && pInfo->DoLoad() && ( ( !pInfo->IsExtern() ) || ( pInfo->IsReference() ) ) ) { @@ -1048,11 +1043,11 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) pErrorMgr->InsertError( BasicError( *pErrInf, BASERR_REASON_OPENMGRSTREAM, aStorName ) ); // und es geht weiter... } - xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 als Trenner + xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator String aLibs; xManagerStream->ReadByteString(aLibs); xManagerStream->SetBufferSize( 0 ); - xManagerStream.Clear(); // Sream schliessen + xManagerStream.Clear(); // Close stream if ( aLibs.Len() ) { @@ -1062,7 +1057,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) for ( USHORT nLib = 0; nLib < nLibs; nLib++ ) { String aLibInfo( aLibs.GetToken( nLib, LIB_SEP ) ); - // == 2 soll irgendwann weg! + // TODO: Remove == 2 DBG_ASSERT( ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 2 ) || ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 3 ), "Ungueltige Lib-Info!" ); String aLibName( aLibInfo.GetToken( 0, LIBINFO_SEP ) ); String aLibAbsStorageName( aLibInfo.GetToken( 1, LIBINFO_SEP ) ); @@ -1103,12 +1098,11 @@ BasicManager::~BasicManager() { DBG_DTOR( BasicManager, 0 ); - // Listener benachrichtigen, falls noch etwas zu Speichern... + // Notify listener if something needs to be saved Broadcast( SfxSimpleHint( SFX_HINT_DYING) ); - // Basic-Infos zerstoeren... - // In umgekehrter Reihenfolge, weil die StdLib Referenzen haelt, die - // anderen nur die StdLib als Parent haben. + // Destroy Basic-Infos... + // In reverse order BasicLibInfo* pInf = pLibs->Last(); while ( pInf ) { @@ -1157,7 +1151,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag aStorageName = GetStorageName(); SotStorageRef xStorage; - // Der aktuelle darf nicht nochmal geoffnet werden... + // The current must not be opened again... if ( pCurStorage ) { String aStorName( pCurStorage->GetName() ); @@ -1186,7 +1180,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag } else { - // In dem Basic-Storage liegt jede Lib in einem Stream... + // In the Basic-Storage every lib is in a Stream... SotStorageStreamRef xBasicStream = xBasicStorage->OpenSotStream( pLibInfo->GetLibName(), eStreamReadMode ); if ( !xBasicStream.Is() || xBasicStream->GetError() ) { @@ -1213,7 +1207,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag } else { - // Das Basic skippen... + // Skip Basic... xBasicStream->Seek( STREAM_SEEK_TO_BEGIN ); ImplEncryptStream( *xBasicStream ); SbxBase::Skip( *xBasicStream ); @@ -1227,7 +1221,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag } else { - // Ggf. stehen weitere Informationen im Stream... + // Perhaps there are additional information in the stream... xBasicStream->SetKey( szCryptingKey ); xBasicStream->RefreshBuffer(); sal_uInt32 nPasswordMarker = 0; @@ -1241,7 +1235,6 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag xBasicStream->SetKey( ByteString() ); CheckModules( pLibInfo->GetLib(), pLibInfo->IsReference() ); } -// bBasMgrModified = TRUE; // Warum? return bLoaded; } } @@ -1257,7 +1250,7 @@ BOOL BasicManager::ImplEncryptStream( SvStream& rStrm ) const BOOL bProtected = FALSE; if ( nCreator != SBXCR_SBX ) { - // sollte nur bei verschluesselten Streams nicht stimmen. + // Should only be the case for encrypted Streams bProtected = TRUE; rStrm.SetKey( szCryptingKey ); rStrm.RefreshBuffer(); @@ -1265,7 +1258,8 @@ BOOL BasicManager::ImplEncryptStream( SvStream& rStrm ) const return bProtected; } -// Dieser Code ist notwendig, um das BASIC der Beta 1 laden zu koennen +// This code is necessary to load the BASIC of Beta 1 +// TODO: Which Beta 1? BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const { BOOL bProtected = ImplEncryptStream( rStrm ); @@ -1276,7 +1270,7 @@ BOOL BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con if( xNew->IsA( TYPE(StarBASIC) ) ) { StarBASIC* pNew = (StarBASIC*)(SbxBase*) xNew; - // Den Parent des alten BASICs uebernehmen + // Use the Parent of the old BASICs if( rOldBasic.Is() ) { pNew->SetParent( rOldBasic->GetParent() ); @@ -1320,8 +1314,8 @@ void BasicManager::CheckModules( StarBASIC* pLib, BOOL bReference ) const pLib->Compile( pModule ); } - // #67477, AB 8.12.99 On demand Compilieren bei referenzierten - // Libraries sollte nicht zu modified fuehren + // #67477, AB 8.12.99 On demand compile in referenced libs should not + // cause modified if( !bModified && bReference ) { DBG_ERROR( "Per Reference eingebundene Basic-Library ist nicht compiliert!" ); @@ -1344,13 +1338,13 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B aNewLibName += '_'; BasicLibInfo* pLibInfo = CreateLibInfo(); - // Erstmal mit dem Original-Namen, da sonst ImpLoadLibary nicht geht... + // Use original name otherwise ImpLoadLibary failes... pLibInfo->SetLibName( rLibName ); // Funktioniert so aber nicht, wenn Name doppelt // USHORT nLibId = GetLibId( rLibName ); USHORT nLibId = (USHORT) pLibs->GetPos( pLibInfo ); - // Vorm Laden StorageNamen setzen, da er mit pCurStorage verglichen wird. + // Set StorageName before load because it is compared with pCurStorage pLibInfo->SetStorageName( aStorageName ); BOOL bLoaded = ImpLoadLibary( pLibInfo, &rStorage ); @@ -1361,15 +1355,15 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, B if ( bReference ) { - pLibInfo->GetLib()->SetModified( FALSE ); // Dann nicht speichern + pLibInfo->GetLib()->SetModified( FALSE ); // Don't save in this case pLibInfo->SetRelStorageName( String() ); // pLibInfo->CalcRelStorageName( GetStorageName() ); pLibInfo->IsReference() = TRUE; } else { - pLibInfo->GetLib()->SetModified( TRUE ); // Muss nach Add gespeichert werden! - pLibInfo->SetStorageName( String::CreateFromAscii(szImbedded) ); // Im BasicManager-Storage speichern + pLibInfo->GetLib()->SetModified( TRUE ); // Must be saved after Add! + pLibInfo->SetStorageName( String::CreateFromAscii(szImbedded) ); // Save in BasicManager-Storage } bBasMgrModified = TRUE; } @@ -1399,17 +1393,17 @@ BOOL BasicManager::IsReference( USHORT nLib ) BOOL BasicManager::RemoveLib( USHORT nLib ) { - // Nur physikalisch loeschen, wenn keine Referenz. + // Only pyhsical deletion if no reference return RemoveLib( nLib, !IsReference( nLib ) ); } BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) { DBG_CHKTHIS( BasicManager, 0 ); - DBG_ASSERT( nLib, "Standard-Lib kann nicht entfernt werden!" ); + DBG_ASSERT( nLib, "Standard-Lib cannot be removed!" ); BasicLibInfo* pLibInfo = pLibs->GetObject( nLib ); - DBG_ASSERT( pLibInfo, "Lib nicht gefunden!" ); + DBG_ASSERT( pLibInfo, "Lib not found!" ); if ( !pLibInfo || !nLib ) { @@ -1419,9 +1413,8 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) return FALSE; } - // Wenn einer der Streams nicht geoeffnet werden kann, ist es kein - // Fehler, es gibt halt noch nichts zum loeschen, weil das Basic noch - // nie geschrieben wurde... + // If one of the streams cannot be opened, this is not an error, + // because BASIC was never written before... if ( bDelBasicFromStorage && !pLibInfo->IsReference() && ( !pLibInfo->IsExtern() || SotStorage::IsStorageFile( pLibInfo->GetStorageName() ) ) ) { @@ -1447,8 +1440,8 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) xBasicStorage->Remove( pLibInfo->GetLibName() ); xBasicStorage->Commit(); - // Wenn kein weiterer Stream vorhanden, - // dann auch den SubStorage loeschen. + // If no further stream available, + // delete the SubStorage. SvStorageInfoList aInfoList( 0, 4 ); xBasicStorage->FillInfoList( &aInfoList ); if ( !aInfoList.Count() ) @@ -1456,8 +1449,8 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) xBasicStorage.Clear(); xStorage->Remove( BasicStreamName ); xStorage->Commit(); - // Wenn kein weiterer Streams oder SubStorages vorhanden, - // dann auch den Storage loeschen. + // If no further Streams or SubStorages available, + // delete the Storage, too. aInfoList.Clear(); xStorage->FillInfoList( &aInfoList ); if ( !aInfoList.Count() ) @@ -1476,7 +1469,7 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) if ( pLibInfo->GetLib().Is() ) GetStdLib()->Remove( pLibInfo->GetLib() ); delete pLibs->Remove( pLibInfo ); - return TRUE; // Remove hat geklappt, Del unwichtig. + return TRUE; // Remove was successful, del unimportant } USHORT BasicManager::GetLibCount() const @@ -1509,7 +1502,7 @@ StarBASIC* BasicManager::GetLib( const String& rName ) const BasicLibInfo* pInf = pLibs->First(); while ( pInf ) { - if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL ) // prueffen, ob vorhanden... + if ( pInf->GetLibName().CompareIgnoreCaseToAscii( rName ) == COMPARE_EQUAL )// Check if available... return pInf->GetLib(); pInf = pLibs->Next(); @@ -2306,7 +2299,7 @@ Any LibraryContainer_Impl::getByName( const ::rtl::OUString& aName ) ::rtl::OUString aPassword = pLibInfo->GetPassword(); - // TODO Nur extern-Info liefern! + // TODO Only provide extern info! ::rtl::OUString aExternaleSourceURL; ::rtl::OUString aLinkTargetURL; if( pLibInfo->IsReference() ) diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx index 2fc29cac06..0e5a376bac 100644 --- a/basic/source/classes/disas.cxx +++ b/basic/source/classes/disas.cxx @@ -43,51 +43,51 @@ static const char* pOp1[] = { "NOP", - // Operatoren - // die folgenden Operatoren sind genauso angeordnet - // wie der enum SbxVarOp + // Operators + // the following operators have the same order as in + // enum SbxVarOp "EXP", "MUL", "DIV", "MOD", "PLUS", "MINUS", "NEG", "EQ", "NE", "LT", "GT", "LE", "GE", "IDIV", "AND", "OR", "XOR", "EQV", "IMP", "NOT", "CAT", - // Ende enum SbxVarOp + // End enum SbxVarOp "LIKE", "IS", - // Laden/speichern - "ARGC", // neuen Argv einrichten - "ARGV", // TOS ==> aktueller Argv - "INPUT", // Input ==> TOS - "LINPUT", // Line Input ==> TOS - "GET", // TOS anfassen - "SET", // Speichern Objekt TOS ==> TOS-1 - "PUT", // TOS ==> TOS-1 - "CONST", // TOS ==> TOS-1, dann ReadOnly - "DIM", // DIM - "REDIM", // REDIM - "REDIMP", // REDIM PRESERVE - "ERASE", // TOS loeschen - // Verzweigen - "STOP", // Programmende - "INITFOR", // FOR-Variable initialisieren - "NEXT", // FOR-Variable inkrementieren - "CASE", // Anfang CASE - "ENDCASE", // Ende CASE - "STDERR", // Standard-Fehlerbehandlung - "NOERROR", // keine Fehlerbehandlung - "LEAVE", // UP verlassen - // E/A - "CHANNEL", // TOS = Kanalnummer - "PRINT", // print TOS - "PRINTF", // print TOS in field - "WRITE", // write TOS - "RENAME", // Rename Tos+1 to Tos - "PROMPT", // TOS = Prompt for Input - "RESTART", // Restartpunkt definieren - "STDIO", // E/A-Kanal 0 einstellen - // Sonstiges - "EMPTY", // Leeren Ausdruck auf Stack - "ERROR", // TOS = Fehlercode - "LSET", // Speichern Objekt TOS ==> TOS-1 - "RSET", // Speichern Objekt TOS ==> TOS-1 + // Load/Store + "ARGC", // Create new Argv + "ARGV", // TOS ==> current Argv + "INPUT", // Input ==> TOS + "LINPUT", // Line Input ==> TOS + "GET", // get TOS + "SET", // Save Object TOS ==> TOS-1 + "PUT", // TOS ==> TOS-1 + "CONST", // TOS ==> TOS-1, then ReadOnly + "DIM", // DIM + "REDIM", // REDIM + "REDIMP", // REDIM PRESERVE + "ERASE", // delete TOS + // Branch + "STOP", // End of program + "INITFOR", // FOR-Variable init + "NEXT", // FOR-Variable increment + "CASE", // Begin CASE + "ENDCASE", // End CASE + "STDERR", // Default error handling + "NOERROR", // No error handling + "LEAVE", // leave UP + // I/O + "CHANNEL", // TOS = Channelnumber + "PRINT", // print TOS + "PRINTF", // print TOS in field + "WRITE", // write TOS + "RENAME", // Rename Tos+1 to Tos + "PROMPT", // TOS = Prompt for Input + "RESTART", // Define restart point + "STDIO", // Switch to I/O channel 0 + // Misc + "EMPTY", // Empty statement to stack + "ERROR", // TOS = error code + "LSET", // Save object TOS ==> TOS-1 + "RSET", // Save object TOS ==> TOS-1 (TODO: Same as above?) "REDIMP_ERASE", "INITFOREACH", "VBASET", @@ -96,127 +96,135 @@ static const char* pOp1[] = { }; static const char* pOp2[] = { - "NUMBER", // Laden einer numerischen Konstanten (+ID) - "STRING", // Laden einer Stringkonstanten (+ID) - "CONSTANT", // Immediate Load (+Wert) - "ARGN", // Speichern eines named Args in Argv (+StringID) - "PAD", // String auf feste Laenge bringen (+Laenge) - // Verzweigungen - "JUMP", // Sprung (+Target) - "JUMP.T", // TOS auswerten, bedingter Sprung (+Target) - "JUMP.F", // TOS auswerten, bedingter Sprung (+Target) - "ONJUMP", // TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal) - "GOSUB", // UP-Aufruf (+Target) - "RETURN", // UP-Return (+0 oder Target) - "TESTFOR", // FOR-Variable testen, inkrementieren (+Endlabel) - "CASETO", // Tos+1 <= Case <= Tos, 2xremove (+Target) - "ERRHDL", // Fehler-Handler (+Offset) - "RESUME", // Resume nach Fehlern (+0 or 1 or Label) - // E/A - "CLOSE", // (+Kanal/0) - "PRCHAR", // (+char) - // Objekte - "SETCLASS", // Set + Klassennamen testen (+StringId) - "TESTCLASS", // Check TOS class (+StringId) - "LIB", // Libnamen fuer Declare-Procs setzen (+StringId) - // Neues ab Beta 3 - "BASED", // TOS wird um BASE erhoeht, BASE davor gepusht - "ARGTYP", // Letzten Parameter in Argv konvertieren (+Typ) + "NUMBER", // Load a numeric constant (+ID) + "STRING", // Load a string constant (+ID) + "CONSTANT", // Immediate Load (+value) + "ARGN", // Save named args in argv (+StringID) + "PAD", // Pad String to defined length (+length) + // Branches + "JUMP", // Jump to target (+Target) + "JUMP.T", // evaluate TOS, conditional jump (+Target) + "JUMP.F", // evaluate TOS, conditional jump (+Target) + "ONJUMP", // evaluate TOS, jump into JUMP-table (+MaxVal) + "GOSUB", // UP-Call (+Target) + "RETURN", // UP-Return (+0 or Target) + "TESTFOR", // Test FOR-Variable, increment (+Endlabel) + "CASETO", // Tos+1 <= Case <= Tos, 2xremove (+Target) + "ERRHDL", // Error-Handler (+Offset) + "RESUME", // Resume after errors (+0 or 1 or Label) + // I/O + "CLOSE", // (+channel/0) + "PRCHAR", // (+char) + // Objects + "SETCLASS", // Test Set + Classname (+StringId) + "TESTCLASS", // Check TOS class (+StringId) + "LIB", // Set Libname for Declare-Procs (+StringId) + // New since Beta 3 (TODO: Which Beta3?) + "BASED", // TOS is incremted about BASE, push BASE before + "ARGTYP", // Convert last parameter in argv (+Type) "VBASETCLASS", }; static const char* pOp3[] = { - // Alle Opcodes mit zwei Operanden - "RTL", // Laden aus RTL (+StringID+Typ) - "FIND", // Laden (+StringID+Typ) - "ELEM", // Laden Element (+StringID+Typ) - "PARAM", // Parameter (+Offset+Typ) - // Verzweigen - "CALL", // DECLARE-Methode rufen (+StringID+Typ) - "CALL.C", // Cdecl-DECLARE-Methode rufen (+StringID+Typ) - "CASEIS", // Case-Test (+Test-Opcode+False-Target) - "STMNT", // Beginn eines Statements (+Line+Col) - // E/A - "OPEN", // (+SvStreamFlags+Flags) - // Objekte und Variable - "LOCAL", // Lokale Variable (+StringID+Typ) - "PUBLIC", // Modulglobale Variable (+StringID+Typ) - "GLOBAL", // Globale Variable (+StringID+Typ) - "CREATE", // Objekt kreieren (+StringId+StringId) - "STATIC", // Objekt kreieren (+StringId+StringId) - "TCREATE", // User defined Objekt kreieren (+StringId+StringId) - "DCREATE", // User defined Objekt-Array kreieren (+StringId+StringId) - "GLOBAL_P", // Globale Variable definieren, die beim Neustart von Basic - // nicht ueberschrieben wird, P=PERSIST (+StringID+Typ) - "FIND_G", // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P - "DCREATE_REDIMP", // User defined Objekt-Array redimensionieren (+StringId+StringId) - "FIND_CM", // Search inside a class module (CM) to enable global search in time + // All opcodes with two operands + "RTL", // Load from RTL (+StringID+Typ) + "FIND", // Load (+StringID+Typ) + "ELEM", // Load element (+StringID+Typ) + "PARAM", // Parameter (+Offset+Typ) + + // Branching + "CALL", // Call DECLARE method (+StringID+Typ) + "CALL.C", // Call Cdecl-DECLARE method (+StringID+Typ) + "CASEIS", // Case-Test (+Test-Opcode+False-Target) + "STMNT", // Start of a statement (+Line+Col) + + // I/O + "OPEN", // (+SvStreamFlags+Flags) + + // Objects and variables + "LOCAL", // Local variables (+StringID+Typ) + "PUBLIC", // Modul global var (+StringID+Typ) + "GLOBAL", // Global var (+StringID+Typ) + "CREATE", // Create object (+StringId+StringId) + "STATIC", // Create static object (+StringId+StringId) + "TCREATE", // Create User defined Object (+StringId+StringId) + "DCREATE", // Create User defined Object-Array kreieren (+StringId+StringId) + "GLOBAL_P", // Define persistent global var (existing after basic restart) + // P=PERSIST (+StringID+Typ) + "FIND_G", // Searches for global var with special handling due to _GLOBAL_P + "DCREATE_REDIMP", // Change dimensions of a user defined Object-Array (+StringId+StringId) + "FIND_CM", // Search inside a class module (CM) to enable global search in time "PUBLIC_P", // Module global Variable (persisted between calls)(+StringID+Typ) }; static const char** pOps[3] = { pOp1, pOp2, pOp3 }; -typedef void( SbiDisas::*Func )( String& ); // Verarbeitungsroutine +typedef void( SbiDisas::*Func )( String& ); // Processing routines static const Func pOperand2[] = { - &SbiDisas::StrOp, // Laden einer numerischen Konstanten (+ID) - &SbiDisas::StrOp, // Laden einer Stringkonstanten (+ID) + &SbiDisas::StrOp, // Load a numeric constant (+ID) + &SbiDisas::StrOp, // Load a string constant (+ID) &SbiDisas::ImmOp, // Immediate Load (+Wert) - &SbiDisas::StrOp, // Speichern eines benannten Arguments(+ID) - &SbiDisas::ImmOp, // String auf feste Laenge bringen (+Laenge) - // Verzweigungen - &SbiDisas::LblOp, // Sprung (+Target) - &SbiDisas::LblOp, // TOS auswerten), bedingter Sprung (+Target) - &SbiDisas::LblOp, // TOS auswerten), bedingter Sprung (+Target) - &SbiDisas::OnOp, // TOS auswerten), Sprung in JUMP-Tabelle (+MaxVal) - &SbiDisas::LblOp, // UP-Aufruf (+Target) - &SbiDisas::ReturnOp, // UP-Return (+0 oder Target) - &SbiDisas::LblOp, // FOR-Variable testen), inkrementieren (+Endlabel) + &SbiDisas::StrOp, // Save a named argument (+ID) + &SbiDisas::ImmOp, // Strip String to fixed size (+length) + + // Branches + &SbiDisas::LblOp, // Jump (+Target) + &SbiDisas::LblOp, // eval TOS, conditional jump (+Target) + &SbiDisas::LblOp, // eval TOS, conditional jump (+Target) + &SbiDisas::OnOp, // eval TOS, jump in JUMP table (+MaxVal) + &SbiDisas::LblOp, // UP call (+Target) + &SbiDisas::ReturnOp, // UP Return (+0 or Target) + &SbiDisas::LblOp, // test FOR-Variable, increment (+Endlabel) &SbiDisas::LblOp, // Tos+1 <= Case <= Tos), 2xremove (+Target) - &SbiDisas::LblOp, // Fehler-Handler (+Offset) - &SbiDisas::ResumeOp, // Resume nach Fehlern (+0 or 1 or Label) - // E/A - &SbiDisas::CloseOp, // (+Kanal/0) + &SbiDisas::LblOp, // Error handler (+Offset) + &SbiDisas::ResumeOp, // Resume after errors (+0 or 1 or Label) + + // I/O + &SbiDisas::CloseOp, // (+channel/0) &SbiDisas::CharOp, // (+char) - // Objekte - &SbiDisas::StrOp, // Klassennamen testen (+StringId) - &SbiDisas::StrOp, // TESTCLASS, Check TOS class (+StringId) - &SbiDisas::StrOp, // Libnamen fuer Declare-Procs setzen (+StringId) - &SbiDisas::ImmOp, // TOS wird um BASE erhoeht, BASE davor gepusht - &SbiDisas::TypeOp, // Letzten Parameter in Argv konvertieren (+Typ) - &SbiDisas::StrOp, // VBASETCLASS (+StringId) + + // Objects + &SbiDisas::StrOp, // Test classname (+StringId) + &SbiDisas::StrOp, // TESTCLASS, Check TOS class (+StringId) + &SbiDisas::StrOp, // Set libname for declare procs (+StringId) + &SbiDisas::ImmOp, // TOS is incremented about BASE erhoeht, BASE pushed before + &SbiDisas::TypeOp, // Convert last parameter to/in(?) argv (+Typ) + &SbiDisas::StrOp, // VBASETCLASS (+StringId) }; static const Func pOperand3[] = { - // Alle Opcodes mit zwei Operanden - &SbiDisas::VarOp, // Laden aus RTL (+StringID+Typ) - &SbiDisas::VarOp, // Laden (+StringID+Typ) - &SbiDisas::VarOp, // Laden Element (+StringID+Typ) + // All opcodes with two operands + &SbiDisas::VarOp, // Load from RTL (+StringID+Typ) + &SbiDisas::VarOp, // Load (+StringID+Typ) + &SbiDisas::VarOp, // Load Element (+StringID+Typ) &SbiDisas::OffOp, // Parameter (+Offset+Typ) - // Verzweigen - &SbiDisas::VarOp, // DECLARE-Methode rufen (+StringID+Typ) - &SbiDisas::VarOp, // CDecl-DECLARE-Methode rufen (+StringID+Typ) + + // Branch + &SbiDisas::VarOp, // Call DECLARE-Method (+StringID+Typ) + &SbiDisas::VarOp, // Call CDecl-DECLARE-Methode (+StringID+Typ) &SbiDisas::CaseOp, // Case-Test (+Test-Opcode+False-Target) - &SbiDisas::StmntOp, // Statement (+Zeilen+Spalte) - // E/A + &SbiDisas::StmntOp, // Statement (+Row+Column) + + // I/O &SbiDisas::StrmOp, // (+SvStreamFlags+Flags) - // Objekte - &SbiDisas::VarDefOp, // Lokale Variable definieren (+StringID+Typ) - &SbiDisas::VarDefOp, // Modulglobale Variable definieren (+StringID+Typ) - &SbiDisas::VarDefOp, // Globale Variable definieren (+StringID+Typ) - &SbiDisas::Str2Op, // Objekt kreieren (+StringId+StringId) - &SbiDisas::VarDefOp, // Statische Variable definieren (+StringID+Typ) - &SbiDisas::Str2Op, // User defined Objekt kreieren (+StringId+StringId) - &SbiDisas::Str2Op, // User defined Objekt-Array kreieren (+StringId+StringId) - &SbiDisas::VarDefOp, // Globale Variable definieren, die beim Neustart von Basic - // nicht ueberschrieben wird, P=PERSIST (+StringID+Typ) - &SbiDisas::VarOp, // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P - &SbiDisas::Str2Op, // User defined Objekt-Array redimensionieren (+StringId+StringId) + + // Objects + &SbiDisas::VarDefOp, // Define local var (+StringID+Typ) + &SbiDisas::VarDefOp, // Define Module global var (+StringID+Typ) + &SbiDisas::VarDefOp, // Define global var (+StringID+Typ) + &SbiDisas::Str2Op, // Create object (+StringId+StringId) + &SbiDisas::VarDefOp, // Define static object (+StringID+Typ) + &SbiDisas::Str2Op, // Create User defined Object (+StringId+StringId) + &SbiDisas::Str2Op, // Create User defined Object-Array (+StringId+StringId) + &SbiDisas::VarDefOp, // Define persistent global var P=PERSIST (+StringID+Typ) + &SbiDisas::VarOp, // Searches for global var with special handling due to _GLOBAL_P + &SbiDisas::Str2Op, // Redimensionate User defined Object-Array (+StringId+StringId) &SbiDisas::VarOp, // FIND_CM &SbiDisas::VarDefOp, // PUBLIC_P }; - +// TODO: Why as method? Isn't a simple define sufficient? static const char* _crlf() { #if defined (UNX) || defined( PM2 ) @@ -226,9 +234,7 @@ static const char* _crlf() #endif } -// Diese Methode ist hier, damit die Datei als eigenes Segment geladen werden -// kann. - +// This method exists because we want to load the file as own segment BOOL SbModule::Disassemble( String& rText ) { rText.Erase(); @@ -248,7 +254,7 @@ SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) nPC = 0; nOp1 = nOp2 = nParts = 0; eOp = _NOP; - // Label-Bits setzen + // Set Label-Bits nOff = 0; while( Fetch() ) { @@ -270,7 +276,7 @@ SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) } } nOff = 0; - // Die Publics noch dazu + // Add the publics for( USHORT i = 0; i < pMod->GetMethods()->Count(); i++ ) { SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); @@ -282,8 +288,7 @@ SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) } } -// Aktuellen Opcode auslesen - +// Read current opcode BOOL SbiDisas::Fetch() { nPC = nOff; @@ -356,10 +361,10 @@ BOOL SbiDisas::DisasLine( String& rText ) rText.Erase(); if( !Fetch() ) return FALSE; - // Neue Zeile? + // New line? if( eOp == _STMNT && nOp1 != nLine ) { - // Zeile raussuchen + // Find line String aSource = rImg.aOUSource; nLine = nOp1; USHORT n = 0; @@ -369,7 +374,7 @@ BOOL SbiDisas::DisasLine( String& rText ) if( n == STRING_NOTFOUND ) break; else n++; } - // Stelle anzeigen + // Show position if( n != STRING_NOTFOUND ) { USHORT n2 = aSource.SearchAscii( "\n", n ); @@ -444,9 +449,7 @@ BOOL SbiDisas::DisasLine( String& rText ) return TRUE; } - -// Auslesen aus StringPool - +// Read from StringPool void SbiDisas::StrOp( String& rText ) { String aStr = rImg.GetString( (USHORT)nOp1 ); @@ -476,14 +479,12 @@ void SbiDisas::Str2Op( String& rText ) } // Immediate Operand - void SbiDisas::ImmOp( String& rText ) { rText += String::CreateFromInt32(nOp1); } // OnGoto Operand - void SbiDisas::OnOp( String& rText ) { rText += String::CreateFromInt32(nOp1 & 0x7FFF); @@ -492,7 +493,6 @@ void SbiDisas::OnOp( String& rText ) } // Label - void SbiDisas::LblOp( String& rText ) { char cBuf[ 10 ]; @@ -500,16 +500,14 @@ void SbiDisas::LblOp( String& rText ) rText.AppendAscii( cBuf ); } -// 0 oder Label - +// 0 or Label void SbiDisas::ReturnOp( String& rText ) { if( nOp1 ) LblOp( rText ); } -// 0, 1 oder Label - +// 0, 1 or Label void SbiDisas::ResumeOp( String& rText ) { switch( nOp1 ) @@ -519,24 +517,21 @@ void SbiDisas::ResumeOp( String& rText ) } } -// Prompt ausgeben +// print Prompt // FALSE/TRUE - void SbiDisas::PromptOp( String& rText ) { if( nOp1 ) rText.AppendAscii( "\"? \"" ); } -// 0 oder 1 - +// 0 or 1 void SbiDisas::CloseOp( String& rText ) { rText.AppendAscii( nOp1 ? "Channel" : "All" ); } -// Zeichen ausgeben - +// Print character void SbiDisas::CharOp( String& rText ) { const char* p = NULL; @@ -558,13 +553,12 @@ void SbiDisas::CharOp( String& rText ) rText += (USHORT)nOp1; } -// Variable ausgeben: String-ID und Typ - +// Print var: String-ID and type void SbiDisas::VarOp( String& rText ) { rText += rImg.GetString( (USHORT)(nOp1 & 0x7FFF) ); rText.AppendAscii( "\t; " ); - // Der Typ + // The type UINT32 n = nOp1; nOp1 = nOp2; TypeOp( rText ); @@ -572,24 +566,22 @@ void SbiDisas::VarOp( String& rText ) rText.AppendAscii( ", Args" ); } -// Variable definieren: String-ID und Typ - +// Define variable: String-ID and type void SbiDisas::VarDefOp( String& rText ) { rText += rImg.GetString( (USHORT)(nOp1 & 0x7FFF) ); rText.AppendAscii( "\t; " ); - // Der Typ + // The Typ nOp1 = nOp2; TypeOp( rText ); } -// Variable ausgeben: Offset und Typ - +// Print variable: Offset and Typ void SbiDisas::OffOp( String& rText ) { rText += String::CreateFromInt32( nOp1 & 0x7FFF ); rText.AppendAscii( "\t; " ); - // Der Typ + // The type UINT32 n = nOp1; nOp1 = nOp2; TypeOp( rText ); @@ -597,8 +589,8 @@ void SbiDisas::OffOp( String& rText ) rText.AppendAscii( ", Args" ); } -// Datentyp -#ifdef HP9000 +// 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", @@ -633,8 +625,7 @@ void SbiDisas::TypeOp( String& rText ) #undef pTypes #endif -// TRUE-Label, Bedingungs-Opcode - +// TRUE-Label, condition Opcode void SbiDisas::CaseOp( String& rText ) { LblOp( rText ); @@ -642,8 +633,7 @@ void SbiDisas::CaseOp( String& rText ) rText.AppendAscii( pOp1[ nOp2 - SbxEQ + _EQ ] ); } -// Zeile, Spalte - +// Row, column void SbiDisas::StmntOp( String& rText ) { rText += String::CreateFromInt32( nOp1 ); @@ -657,7 +647,6 @@ void SbiDisas::StmntOp( String& rText ) } // open mode, flags - void SbiDisas::StrmOp( String& rText ) { char cBuf[ 10 ]; diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index d9269cf084..7776b57829 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -235,13 +235,13 @@ public: BasicScriptListener_Impl( StarBASIC* pBasic, const Reference< frame::XModel >& xModel ) : maBasicRef( pBasic ), m_xModel( xModel ) {} - // Methoden von XAllListener + // Methods of XAllListener virtual void SAL_CALL firing(const ScriptEvent& aScriptEvent) throw( RuntimeException ); virtual Any SAL_CALL approveFiring(const ScriptEvent& aScriptEvent) throw( InvocationTargetException, RuntimeException ); - // Methoden von XEventListener + // Methods of XEventListener virtual void SAL_CALL disposing(const EventObject& Source) throw( RuntimeException ); }; diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 7467846c00..d799050724 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -81,7 +81,7 @@ void SbiImage::Clear() /************************************************************************** * -* Service-Routinen fuer das Laden und Speichern +* Service-Routines for Load/Store * **************************************************************************/ @@ -90,8 +90,7 @@ BOOL SbiGood( SvStream& r ) return BOOL( !r.IsEof() && r.GetError() == SVSTREAM_OK ); } -// Oeffnen eines Records - +// Open Record ULONG SbiOpenRecord( SvStream& r, UINT16 nSignature, UINT16 nElem ) { ULONG nPos = r.Tell(); @@ -99,8 +98,7 @@ ULONG SbiOpenRecord( SvStream& r, UINT16 nSignature, UINT16 nElem ) return nPos; } -// Schliessen eines Records - +// Close Record void SbiCloseRecord( SvStream& r, ULONG nOff ) { ULONG nPos = r.Tell(); @@ -111,16 +109,15 @@ void SbiCloseRecord( SvStream& r, ULONG nOff ) /************************************************************************** * -* Laden und Speichern +* Load/Store * **************************************************************************/ -// Falls die Versionsnummer nicht passt, werden die binaeren Teile -// nicht geladen, wohl aber Source, Kommentar und Name. - +// If the version number does not find, binary parts are omitted, but not +// source, comments and name BOOL SbiImage::Load( SvStream& r ) { - UINT32 nVersion = 0; // Versionsnummer + UINT32 nVersion = 0; // Versionsnumber return Load( r, nVersion ); } BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) @@ -130,10 +127,10 @@ BOOL SbiImage::Load( SvStream& r, UINT32& nVersion ) UINT32 nLen, nOff; Clear(); - // Master-Record einlesen + // Read Master-Record r >> nSign >> nLen >> nCount; ULONG nLast = r.Tell() + nLen; - UINT32 nCharSet; // System-Zeichensatz + UINT32 nCharSet; // System charset UINT32 lDimBase; UINT16 nReserved1; UINT32 nReserved2; @@ -275,7 +272,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) aEmptyImg.Save( r, B_LEGACYVERSION ); return TRUE; } - // Erst mal der Header: + // First of all the header ULONG nStart = SbiOpenRecord( r, B_MODULE, 1 ); ULONG nPos; @@ -299,7 +296,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) //r << aName; SbiCloseRecord( r, nPos ); } - // Kommentar? + // Comment? if( aComment.Len() && SbiGood( r ) ) { nPos = SbiOpenRecord( r, B_COMMENT, 1 ); @@ -340,7 +337,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) } #endif } - // Binaere Daten? + // Binary data? if( pCode && SbiGood( r ) ) { nPos = SbiOpenRecord( r, B_PCODE, 1 ); @@ -361,14 +358,14 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) if( nStrings ) { nPos = SbiOpenRecord( r, B_STRINGPOOL, nStrings ); - // Fuer jeden String: - // UINT32 Offset des Strings im Stringblock + // For every String: + // UINT32 Offset of the Strings in the Stringblock short i; for( i = 0; i < nStrings && SbiGood( r ); i++ ) r << (UINT32) pStringOff[ i ]; - // Danach der String-Block + // Then the String-Block char* pByteStrings = new char[ nStringSize ]; for( i = 0; i < nStrings; i++ ) { @@ -382,7 +379,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) delete[] pByteStrings; SbiCloseRecord( r, nPos ); } - // Und die Gesamtlaenge setzen + // Set overall length SbiCloseRecord( r, nStart ); if( !SbiGood( r ) ) bError = TRUE; @@ -391,7 +388,7 @@ BOOL SbiImage::Save( SvStream& r, UINT32 nVer ) /************************************************************************** * -* Routinen, die auch vom Compiler gerufen werden +* Routines called by the compiler * **************************************************************************/ @@ -415,9 +412,8 @@ void SbiImage::MakeStrings( short nSize ) // Hinzufuegen eines Strings an den StringPool. Der String-Puffer // waechst dynamisch in 1K-Schritten - - - +// Add a string to StringPool. The String buffer is dynamically +// growing in 1K-Steps void SbiImage::AddString( const String& r ) { if( nStringIdx >= nStrings ) @@ -451,26 +447,25 @@ void SbiImage::AddString( const String& r ) //ByteString aByteStr( r, eCharSet ); memcpy( pStrings + nStringOff, r.GetBuffer(), len * sizeof( sal_Unicode ) ); nStringOff = nStringOff + len; - // war das der letzte String? Dann die Groesse - // des Puffers aktualisieren + // Last String? The update the size of the buffer if( nStringIdx >= nStrings ) nStringSize = nStringOff; } } } -// Codeblock hinzufuegen -// Der Block wurde vom Compiler aus der Klasse SbBuffer herausgeholt -// und ist bereits per new angelegt. Ausserdem enthaelt er alle Integers -// im Big Endian-Format, kann also direkt gelesen/geschrieben werden. - +// Add code block +// The block was fetched by the compiler from class SbBuffer and +// is already created with new. Additionally it contains all Integers +// in Big Endian format, so can be directly read/written. void SbiImage::AddCode( char* p, UINT32 s ) { pCode = p; nCodeSize = s; } -void SbiImage::AddType(SbxObject* pObject) // User-Type mit aufnehmen +// Add user type +void SbiImage::AddType(SbxObject* pObject) { if( !rTypes.Is() ) rTypes = new SbxArray; @@ -488,12 +483,11 @@ void SbiImage::AddEnum(SbxObject* pObject) // Register enum type /************************************************************************** * -* Zugriffe auf das Image +* Accessing the image * **************************************************************************/ -// IDs zaehlen ab 1!! - +// Note: IDs start with 1 String SbiImage::GetString( short nId ) const { if( nId && nId <= nStrings ) @@ -528,27 +522,24 @@ const SbxObject* SbiImage::FindType (String aTypeName) const return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL; } -UINT16 -SbiImage::CalcLegacyOffset( INT32 nOffset ) +UINT16 SbiImage::CalcLegacyOffset( INT32 nOffset ) { return SbiCodeGen::calcLegacyOffSet( (BYTE*)pCode, nOffset ) ; } -UINT32 -SbiImage::CalcNewOffset( INT16 nOffset ) + +UINT32 SbiImage::CalcNewOffset( INT16 nOffset ) { return SbiCodeGen::calcNewOffSet( (BYTE*)pLegacyPCode, nOffset ) ; } -void -SbiImage::ReleaseLegacyBuffer() +void SbiImage::ReleaseLegacyBuffer() { delete[] pLegacyPCode; pLegacyPCode = NULL; nLegacyCodeSize = 0; } -BOOL -SbiImage::ExceedsLegacyLimits() +BOOL SbiImage::ExceedsLegacyLimits() { if ( ( nStringSize > 0xFF00L ) || ( CalcLegacyOffset( nCodeSize ) > 0xFF00L ) ) return TRUE; diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index feceb9612f..aed5b2b3c5 100644 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -48,7 +48,7 @@ using namespace cppu; //======================================================================== -// Deklaration Konvertierung von Sbx nach Uno mit bekannter Zielklasse +// Declaration conversion from Sbx to UNO with known target type Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL ); //======================================================================== @@ -383,14 +383,15 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite (void)pBasic; (void)bWrite; - // Wir brauchen mindestens 1 Parameter + // We need at least one parameter + // TODO: In this case < 2 is not correct ;-) if ( rPar.Count() < 2 ) { StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } - // Klassen-Name der struct holen + // Get class names of struct String aServiceName( RTL_CONSTASCII_USTRINGPARAM("stardiv.uno.beans.PropertySet") ); #if 0 @@ -406,7 +407,7 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite SbxVariableRef refVar = rPar.Get(0); if( xInterface.is() ) { - // PropertyValues setzen + // Set PropertyValues Any aArgAsAny = sbxToUnoValue( rPar.Get(1), getCppuType( (Sequence<PropertyValue>*)0 ) ); Sequence<PropertyValue> *pArg = @@ -414,19 +415,19 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite Reference< XPropertyAccess > xPropAcc = Reference< XPropertyAccess >::query( xInterface ); xPropAcc->setPropertyValues( *pArg ); - // SbUnoObject daraus basteln und zurueckliefern + // Build a SbUnoObject and return it Any aAny; aAny <<= xInterface; SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) { - // Objekt zurueckliefern + // Return object refVar->PutObject( (SbUnoObject*)xUnoObj ); return; } } - // Objekt konnte nicht erzeugt werden + // Object could not be created refVar->PutObject( NULL ); } diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 1c0f70dbb4..6dedae6bdc 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -66,10 +66,7 @@ TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" - -//======================================================================== -// Array zur Umrechnung SFX <-> VB-Fehlercodes anlegen - +// Create array for conversion SFX <-> VB error code struct SFX_VB_ErrorItem { USHORT nErrorVB; @@ -199,17 +196,13 @@ const SFX_VB_ErrorItem __FAR_DATA SFX_VB_ErrorTab[] = { 1004, SbERR_METHOD_FAILED }, { 1005, SbERR_SETPROP_FAILED }, { 1006, SbERR_GETPROP_FAILED }, - { 0xFFFF, 0xFFFFFFFFL } // End-Marke + { 0xFFFF, 0xFFFFFFFFL } // End mark }; - -//////////////////////////////////////////////////////////////////////////// - -// Die StarBASIC-Factory hat einen Hack. Wenn ein SbModule eingerichtet wird, -// wird der Pointer gespeichert und an nachfolgende SbProperties/SbMethods -// uebergeben. Dadurch wird die Modul-Relationship wiederhergestellt. Das -// klappt aber nur, wenn ein Modul geladen wird. Fuer getrennt geladene -// Properties kann es Probleme geben! +// The StarBASIC factory is a hack. When a SbModule is created, its pointer +// is saved and given to the following SbProperties/SbMethods. This restores +// the Modul-relationshop. But it works only when a modul is loaded. +// Can cause troubles with separately loaded properties! SbxBase* SbiFactory::Create( UINT16 nSbxId, UINT32 nCreator ) { @@ -637,9 +630,6 @@ SbModule* SbClassFactory::FindClass( const String& rClassName ) return pMod; } - -//////////////////////////////////////////////////////////////////////////// - StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic ) { @@ -662,19 +652,17 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) AddFactory( pOLEFAC ); } pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); - // Suche ueber StarBASIC ist immer global + // Search via StarBasic is always global SetFlag( SBX_GBLSEARCH ); } -// #51727 SetModified ueberladen, damit der Modified- -// Zustand nicht an den Parent weitergegeben wird. +// #51727 Override SetModified so that the modified state +// is not given to the parent void StarBASIC::SetModified( BOOL b ) { SbxBase::SetModified( b ); } -//*** - StarBASIC::~StarBASIC() { if( !--GetSbData()->nInst ) @@ -691,9 +679,9 @@ StarBASIC::~StarBASIC() pOLEFAC = NULL; #ifdef DBG_UTIL - // SbiData braucht am Programm-Ende nicht abgeraeumt werden, - // aber wir wollen keine MLK's beim Purify - // Wo sollte es sonst geschehen??? + // There is no need to clean SbiData at program end, + // but we dislike MLK's at Purify + // TODO: Where else??? SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC ); SbiGlobals* p = *pp; if( p ) @@ -717,9 +705,7 @@ StarBASIC::~StarBASIC() } } -// operator new() wird hier versenkt, damit jeder eine Instanz -// anlegen kann, ohne neu zu bilden. - +// Override new() operator, so that everyone can create a new instance void* StarBASIC::operator new( size_t n ) { if( n < sizeof( StarBASIC ) ) @@ -737,7 +723,7 @@ void StarBASIC::operator delete( void* p ) /************************************************************************** * -* Erzeugen/Verwalten von Modulen +* Creation/Managment of modules * **************************************************************************/ @@ -817,10 +803,10 @@ SbModule* StarBASIC::FindModule( const String& rName ) return NULL; } -// Init-Code aller Module ausfuehren (auch in inserteten Bibliotheken) +// Run Init-Code of all modules (including inserted libraries) void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) { - // Eigene Module initialisieren + // Init own modules for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); @@ -836,8 +822,8 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) pModule->RunInit(); } - // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt - // Wenn ja, auch dort initialisieren + // Check all objects if they are BASIC, + // if yes initialize for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) { SbxVariable* pVar = pObjs->Get( nObj ); @@ -851,15 +837,14 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) // force reinitialisation at next start void StarBASIC::DeInitAllModules( void ) { - // Eigene Module initialisieren + // Deinit own modules for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); if( pModule->pImage ) pModule->pImage->bInit = false; } - // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt - // Wenn ja, auch dort initialisieren + for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) { SbxVariable* pVar = pObjs->Get( nObj ); @@ -869,7 +854,7 @@ void StarBASIC::DeInitAllModules( void ) } } -// #43011 Fuer das TestTool, um globale Variablen loeschen zu koennen +// #43011 For TestTool, to delete global vars void StarBASIC::ClearGlobalVars( void ) { SbxArrayRef xProps( GetProperties() ); @@ -882,14 +867,12 @@ void StarBASIC::ClearGlobalVars( void ) SetModified( TRUE ); } - -// Diese Implementation sucht erst innerhalb der Runtime-Library, dann -// nach einem Element innerhalb eines Moduls. Dieses Element kann eine -// Public-Variable oder ein Entrypoint sein. Wenn nicht gefunden, wird, -// falls nach einer Methode gesucht wird und ein Modul mit dem angege- -// benen Namen gefunden wurde, der Entrypoint "Main" gesucht. Wenn das -// auch nicht klappt, laeuft die traditionelle Suche ueber Objekte an. - +// This implementation at first searches within the runtime library, +// then it looks for an element within one module. This moudle can be +// a public var or an entrypoint. If it is not found and we look for a +// method and a module with the given name is found the search continues +// for entrypoint "Main". +// If this fails again a conventional search over objects is performend. SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) { static String aMainStr( RTL_CONSTASCII_USTRINGPARAM("Main") ); @@ -897,7 +880,7 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) SbxVariable* pRes = NULL; SbModule* pNamed = NULL; // "Extended" search in Runtime Lib - // aber nur, wenn SbiRuntime nicht das Flag gesetzt hat + // but only if SbiRuntime has not set the flag if( !bNoRtl ) { if( t == SbxCLASS_DONTCARE || t == SbxCLASS_OBJECT ) @@ -910,15 +893,15 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) if( pRes ) pRes->SetFlag( SBX_EXTFOUND ); } - // Module durchsuchen + // Search module if( !pRes ) for( USHORT i = 0; i < pModules->Count(); i++ ) { SbModule* p = (SbModule*) pModules->Get( i ); if( p->IsVisible() ) { - // Modul merken fuer Main()-Aufruf - // oder stimmt etwa der Name ueberein?!? + // Remember modul fpr Main() call + // or is the name equal?!? if( p->GetName().EqualsIgnoreCaseAscii( rName ) ) { if( t == SbxCLASS_OBJECT || t == SbxCLASS_DONTCARE ) @@ -927,8 +910,8 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) } pNamed = p; } - // Sonst testen, ob das Element vorhanden ist - // GBLSEARCH-Flag rausnehmen (wg. Rekursion) + // otherwise check if the element is available + // unset GBLSEARCH-Flag (due to Rekursion) USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH; p->ResetFlag( SBX_GBLSEARCH ); pRes = p->Find( rName, t ); @@ -958,7 +941,7 @@ BOOL StarBASIC::Call( const String& rName, SbxArray* pParam ) return bRes; } -// Find-Funktion ueber Name (z.B. Abfrage aus BASIC-IDE) +// Find method via name (e.g. query via BASIC IDE) SbxBase* StarBASIC::FindSBXInCurrentScope( const String& rName ) { if( !pINST ) @@ -968,11 +951,11 @@ SbxBase* StarBASIC::FindSBXInCurrentScope( const String& rName ) return pINST->pRun->FindElementExtern( rName ); } -// Alte Schnittstelle vorerst erhalten +// Preserve old interface SbxVariable* StarBASIC::FindVarInCurrentScopy ( const String& rName, USHORT& rStatus ) { - rStatus = 1; // Annahme: Nichts gefunden + rStatus = 1; // Presumption: nothing found SbxVariable* pVar = NULL; SbxBase* pSbx = FindSBXInCurrentScope( rName ); if( pSbx ) @@ -981,7 +964,7 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy pVar = PTR_CAST(SbxVariable,pSbx); } if( pVar ) - rStatus = 0; // doch gefunden + rStatus = 0; // We found something return pVar; } @@ -1002,14 +985,12 @@ BOOL StarBASIC::IsRunning() /************************************************************************** * -* Objekt-Factories etc. +* Object factories and others * **************************************************************************/ -// Aktivierung eines Objekts. Aktive Objekte muessen nicht mehr -// von BASIC aus ueber den Namen angesprochen werden. Ist -// NULL angegeben, wird alles aktiviert. - +// Activation of an object. There is no need to access active objects +// with name via BASIC. If NULL is given, everything is activated. void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) { if( pName ) @@ -1038,7 +1019,7 @@ void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) /************************************************************************** * -* Debugging und Fehlerbehandlung +* Debugging and error handling * **************************************************************************/ @@ -1084,12 +1065,12 @@ USHORT __EXPORT StarBASIC::BreakHdl() ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE ); } -// Abfragen fuer den Error-Handler und den Break-Handler: +// Calls for error handler and break handler USHORT StarBASIC::GetLine() { return GetSbData()->nLine; } USHORT StarBASIC::GetCol1() { return GetSbData()->nCol1; } USHORT StarBASIC::GetCol2() { return GetSbData()->nCol2; } -// Spezifisch fuer den Error-Handler: +// Specific to error handler SbError StarBASIC::GetErrorCode() { return GetSbData()->nCode; } const String& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; } BOOL StarBASIC::IsCompilerError() { return GetSbData()->bCompiler; } @@ -1101,10 +1082,10 @@ SbLanguageMode StarBASIC::GetGlobalLanguageMode() { return GetSbData()->eLanguageMode; } -// Lokale Einstellung +// Local settings SbLanguageMode StarBASIC::GetLanguageMode() { - // Globale Einstellung nehmen? + // Use global settings? if( eLanguageMode == SB_LANG_GLOBAL ) return GetSbData()->eLanguageMode; else diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 6880f704e6..c6e9b42c45 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -817,64 +817,3 @@ void SbiParser::ErrorStmnt() aGen.Gen( _ERROR ); } - -// AB 22.5.1996 -// JavaScript-Parsing zunaechst provisorisch hier implementiert -void SbiParser::OpenJavaBlock( SbiToken, SbiExprNode* ) -{ -} - -void SbiParser::CloseJavaBlock() -{ -} - -void SbiParser::JavaStmntBlock( SbiToken ) -{ -} - -void SbiParser::JavaBreak() -{ -} - -void SbiParser::JavaContinue() -{ -} - -void SbiParser::JavaFor() -{ -} - -void SbiParser::JavaFunction() -{ -} - -void SbiParser::JavaIf() -{ -} - -void SbiParser::JavaNew() -{ -} - -void SbiParser::JavaReturn() -{ -} - -void SbiParser::JavaThis() -{ -} - -void SbiParser::JavaVar() -{ -} - -void SbiParser::JavaWhile() -{ -} - -void SbiParser::JavaWith() -{ -} - - - diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index 45b48631a4..a12a8690dd 100644 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -143,22 +143,6 @@ public: void While(); // WHILE/WEND void With(); // WITH void Write(); // WRITE - - // JavaScript-Parsing - void OpenJavaBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen - void CloseJavaBlock(); // Block aufloesen - void JavaStmntBlock( SbiToken ); // Statement-Block abarbeiten - void JavaBreak(); - void JavaContinue(); - void JavaFor(); - void JavaFunction(); - void JavaIf(); - void JavaNew(); - void JavaReturn(); - void JavaThis(); - void JavaVar(); - void JavaWhile(); - void JavaWith(); }; |