summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllmann-Rahn <allmann-rahn@ubuntu.ubuntu-domain>2011-08-27 21:37:14 +0200
committerTor Lillqvist <tlillqvist@novell.com>2011-08-31 16:29:43 +0300
commit8b11173f34bcbd5c27c1842e65ef3ab91bb24019 (patch)
tree2caad5d1b7c1f2a6a7eca933b420c0e352be088a
parent930e38e16329e4a81dc2dcf185d44a752fbfbf7f (diff)
Translated German comments, removed redundant ones till cairo (incl.)
-rw-r--r--basegfx/inc/basegfx/matrix/b2dhommatrix.hxx21
-rw-r--r--basic/inc/basic/process.hxx2
-rw-r--r--basic/inc/basic/sbxbase.hxx2
-rw-r--r--basic/source/app/app.hxx6
-rw-r--r--basic/source/app/appwin.cxx2
-rw-r--r--basic/source/basmgr/basmgr.cxx2
-rw-r--r--basic/source/classes/sb.cxx2
-rw-r--r--basic/source/classes/sbintern.cxx8
-rw-r--r--basic/source/classes/sbunoobj.cxx6
-rw-r--r--basic/source/comp/exprtree.cxx186
-rw-r--r--basic/source/comp/io.cxx30
-rw-r--r--basic/source/comp/loops.cxx57
-rw-r--r--basic/source/comp/parser.cxx103
-rw-r--r--basic/source/comp/sbcomp.cxx12
-rw-r--r--basic/source/comp/scanner.cxx71
-rw-r--r--basic/source/comp/symtbl.cxx92
-rw-r--r--basic/source/comp/token.cxx69
-rw-r--r--basic/source/inc/buffer.hxx42
-rw-r--r--basic/source/inc/codegen.hxx18
-rw-r--r--basic/source/inc/collelem.hxx8
-rw-r--r--basic/source/inc/disas.hxx18
-rw-r--r--basic/source/inc/expr.hxx134
-rw-r--r--basic/source/inc/filefmt.hxx192
-rw-r--r--basic/source/inc/image.hxx62
-rw-r--r--basic/source/inc/iosys.hxx41
-rw-r--r--basic/source/inc/object.hxx50
-rw-r--r--basic/source/inc/opcodes.hxx150
-rw-r--r--basic/source/inc/parser.hxx82
-rw-r--r--basic/source/inc/runtime.hxx179
-rw-r--r--basic/source/inc/sbcomp.hxx10
-rw-r--r--basic/source/inc/sbintern.hxx36
-rw-r--r--basic/source/inc/sbjsmeth.hxx6
-rw-r--r--basic/source/inc/sbjsmod.hxx8
-rw-r--r--basic/source/inc/sbunoobj.hxx31
-rw-r--r--basic/source/inc/scanner.hxx63
-rw-r--r--basic/source/inc/symtbl.hxx123
-rw-r--r--basic/source/inc/token.hxx56
-rw-r--r--basic/source/runtime/basrdll.cxx4
-rw-r--r--basic/source/runtime/inputbox.cxx2
-rw-r--r--basic/source/runtime/iosys.cxx19
-rw-r--r--basic/source/runtime/methods.cxx121
-rw-r--r--basic/source/runtime/methods1.cxx105
-rw-r--r--basic/source/runtime/props.cxx8
-rw-r--r--basic/source/runtime/runtime.cxx267
-rw-r--r--basic/source/runtime/stdobj.cxx87
-rw-r--r--basic/source/runtime/stdobj1.cxx9
-rw-r--r--basic/source/runtime/step0.cxx128
-rw-r--r--basic/source/runtime/step1.cxx85
-rw-r--r--basic/source/runtime/step2.cxx242
-rw-r--r--basic/source/sample/collelem.cxx12
-rw-r--r--basic/source/sample/object.cxx139
-rw-r--r--basic/source/sbx/sbxbool.cxx2
-rw-r--r--basic/source/sbx/sbxform.cxx480
-rw-r--r--basic/source/sbx/sbxscan.cxx189
-rw-r--r--basic/workben/mgrtest.cxx6
55 files changed, 1804 insertions, 2081 deletions
diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
index 08555821af40..71596353c829 100644
--- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
+++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
@@ -71,53 +71,43 @@ namespace basegfx
// involved in calculations
bool isLastLineDefault() const;
- // Auf Einheitsmatrix zuruecksetzen
+ // reset to a standard matrix
bool isIdentity() const;
void identity();
- // Invertierung
bool isInvertible() const;
bool invert();
- // Normalisierung
bool isNormalized() const;
void normalize();
- // Determinante
double determinant() const;
- // Trace
double trace() const;
- // Transpose
void transpose();
- // Rotation
void rotate(double fRadiant);
- // Translation
void translate(double fX, double fY);
- // Skalierung
void scale(double fX, double fY);
// Shearing-Matrices
void shearX(double fSx);
void shearY(double fSy);
- // Addition, Subtraktion
+
B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
- // Vergleichsoperatoren
bool operator==(const B2DHomMatrix& rMat) const;
bool operator!=(const B2DHomMatrix& rMat) const;
- // Multiplikation, Division mit Konstante
B2DHomMatrix& operator*=(double fValue);
B2DHomMatrix& operator/=(double fValue);
- // Matritzenmultiplikation von links auf die lokale
+ // matrix multiplication from the left to the local
B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
// assignment operator
@@ -125,11 +115,10 @@ namespace basegfx
// Help routine to decompose given homogen 3x3 matrix to components. A correction of
// the components is done to avoid inaccuracies.
- // Zerlegung
bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
};
- // Addition, Subtraktion
+ // addition, subtraction
inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
{
B2DHomMatrix aSum(rMatA);
@@ -144,7 +133,7 @@ namespace basegfx
return aDiv;
}
- // Multiplikation, Division mit Konstante
+ // multiplication, division by a constant
inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
{
B2DHomMatrix aNew(rMat);
diff --git a/basic/inc/basic/process.hxx b/basic/inc/basic/process.hxx
index 8c63f532356b..e7954072bf22 100644
--- a/basic/inc/basic/process.hxx
+++ b/basic/inc/basic/process.hxx
@@ -55,7 +55,7 @@ class Process
public:
Process();
~Process();
- // Methoden
+ // methods
void SetImage( const String &aAppPath, const String &aAppParams, const Environment *pEnv = NULL );
sal_Bool Start();
sal_uIntPtr GetExitCode();
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index e38c2ec5d5fc..b136f1f28557 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -40,7 +40,7 @@ class SbxBasicFormater;
SV_DECL_PTRARR_DEL(SbxFacs,SbxFactory*,5,5)
-// AppData-Struktur for SBX:
+// AppData structure for SBX:
struct SbxAppData
{
SbxError eSbxError; // Error code
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index 3ef46edc2cb1..cdc776554546 100644
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -53,10 +53,10 @@ struct TTLogMsg;
typedef ::std::vector< AppWin* > EditList;
class BasicApp : public Application {
- short nWait; // Wait-Zaehler
+ short nWait; // wait counter
public:
- BasicFrame* pFrame; // Frame Window
- Accelerator* pMainAccel; // Acceleratoren
+ BasicFrame* pFrame; // frame window
+ Accelerator* pMainAccel; // accelerators
int Main( );
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
index fc6d5ecfa548..8d7375a77f26 100644
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -219,7 +219,7 @@ long AppWin::PreNotify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == EVENT_GETFOCUS )
if ( pFrame->pList->back() != this )
Activate();
- return sal_False; // Der event soll weiter verarbeitet werden
+ return sal_False; // the event shall continue to be handled
}
void AppWin::Activate()
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index c3187f58f4fa..174aa1dab08e 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1341,7 +1341,7 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const String& rLibName, s
BasicLibInfo* pLibInfo = CreateLibInfo();
// Use original name otherwise ImpLoadLibary failes...
pLibInfo->SetLibName( rLibName );
- // Funktioniert so aber nicht, wenn Name doppelt
+ // but doesn't work this way if name exists twice
sal_uInt16 nLibId = (sal_uInt16) pLibs->GetPos( pLibInfo );
// Set StorageName before load because it is compared with pCurStorage
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index d2a534164892..98f71aecae7c 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1794,7 +1794,7 @@ SbxArrayRef StarBASIC::getUnoListeners( void )
/**************************************************************************
*
-* Laden und Speichern
+* load and save
*
**************************************************************************/
diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx
index 2f0a9fe93fee..201f53830851 100644
--- a/basic/source/classes/sbintern.cxx
+++ b/basic/source/classes/sbintern.cxx
@@ -32,10 +32,10 @@
#include "sbintern.hxx"
#include "sbunoobj.hxx"
-#include "token.hxx" // Tokenizer
-#include "symtbl.hxx" // Symbolverwaltung
-#include "parser.hxx" // Parser
-#include "codegen.hxx" // Code-Generator
+#include "token.hxx"
+#include "symtbl.hxx"
+#include "parser.hxx"
+#include "codegen.hxx"
#include <basic/basmgr.hxx>
SV_IMPL_PTRARR(SbErrorStack, SbErrorStackEntry*)
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c8ccefa3cfff..360e78a3f5f9 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1244,8 +1244,8 @@ Any sbxToUnoValue( SbxVariable* pVar )
return sbxToUnoValueImpl( pVar );
}
-// Funktion, um einen globalen Bezeichner im
-// UnoScope zu suchen und fuer Sbx zu wrappen
+// function to find a global identifier in
+// the UnoScope and to wrap it for Sbx
static bool implGetTypeByName( const String& rName, Type& rRetType )
{
bool bSuccess = false;
@@ -4183,7 +4183,7 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const ::rtl::OUStri
}
//========================================================================
-// Uno-Service erzeugen
+// create Uno-Service
// 1. Parameter == Prefix-Name of the macro
// 2. Parameter == fully qualified name of the listener
void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 31d285f89148..1c7ec1be4767 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -30,7 +30,7 @@
#include "precompiled_basic.hxx"
#include "sbcomp.hxx"
-#include <basic/sbx.hxx> // w.g. ...IMPL_REF(...sbxvariable)
+#include <basic/sbx.hxx> // because of ...IMPL_REF(...sbxvariable)
#include "expr.hxx"
/***************************************************************************
@@ -99,20 +99,20 @@ SbiExpression::~SbiExpression()
delete pExpr;
}
-// Einlesen eines kompletten Bezeichners
-// Ein Bezeichner hat folgende Form:
+// reading in a complete identifier
+// an identifier has the following form:
// name[(Parameter)][.Name[(parameter)]]...
-// Strukturelemente werden ueber das Element pNext verkoppelt,
-// damit sie nicht im Baum stehen.
+// structure elements are coupled via the element pNext,
+// so that they're not in the tree.
-// Folgen Parameter ohne Klammer? Dies kann eine Zahl, ein String,
-// ein Symbol oder auch ein Komma sein (wenn der 1. Parameter fehlt)
+// Are there parameters without brackets following? This may be a number,
+// a string, a symbol or also a comma (if the 1st parameter is missing)
static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok )
{
if( eTok == LPAREN )
return sal_True;
- // Aber nur, wenn CALL-aehnlich!
+ // but only if similar to CALL!
if( !p->WhiteSpace() || eCurExpr != SbSYMBOL )
return sal_False;
if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING
@@ -131,26 +131,26 @@ static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken
return sal_False;
}
-// Definition eines neuen Symbols
+// definition of a new symbol
static SbiSymDef* AddSym
( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
const String& rName, SbxDataType eType, SbiParameters* pPar )
{
SbiSymDef* pDef;
- // A= ist keine Prozedur
+ // A= is not a procedure
sal_Bool bHasType = sal_Bool( eTok == EQ || eTok == DOT );
if( ( !bHasType && eCurExpr == SbSYMBOL ) || pPar )
{
- // Dies ist also eine Prozedur
- // da suche man doch den richtigen Pool raus, da Procs
- // immer in einem Public-Pool landen muessen
+ // so this is a procedure
+ // the correct pool should be found out, as
+ // procs must always get into a public pool
SbiSymPool* pPool = &rPool;
if( pPool->GetScope() != SbPUBLIC )
pPool = &rPool.GetParser()->aPublics;
SbiProcDef* pProc = pPool->AddProc( rName );
- // Sonderbehandlung fuer Colls wie Documents(1)
+ // special treatment for Colls like Documents(1)
if( eCurExpr == SbSTDEXPR )
bHasType = sal_True;
@@ -158,7 +158,7 @@ static SbiSymDef* AddSym
pDef->SetType( bHasType ? eType : SbxEMPTY );
if( pPar )
{
- // Dummy-Parameter generieren
+ // generate dummy parameters
sal_uInt16 n = 1;
for( short i = 0; i < pPar->GetSize(); i++ )
{
@@ -170,22 +170,21 @@ static SbiSymDef* AddSym
}
else
{
- // oder ein normales Symbol
+ // or a normal symbol
pDef = rPool.AddSym( rName );
pDef->SetType( eType );
}
return pDef;
}
-// Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties)
+// currently even keywords are allowed (because of Dflt properties of the same name)
SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
if( pParser->Peek() == DOT )
{
- // eine WITH-Variable
SbiExprNode* pWithVar = pParser->GetWithVar();
- // #26608: Ans Ende der Node-Kette gehen, um richtiges Objekt zu uebergeben
+ // #26608: get to the node-chain's end to pass the correct object
SbiSymDef* pDef = pWithVar ? pWithVar->GetRealVar() : NULL;
SbiExprNode* pNd = NULL;
if( !pDef )
@@ -207,23 +206,23 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
- // Anfang des Parsings merken
+ // memorize the parsing's begin
pParser->LockColumn();
String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType;
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
- // Folgen Parameter?
+ // are there parameters following?
SbiToken eNextTok = pParser->Peek();
- // Ist es ein benannter Parameter?
- // Dann einfach eine Stringkonstante erzeugen. Diese wird
- // im SbiParameters-ctor erkannt und weiterverarbeitet
+ // is it a known parameter?
+ // create a string constant then, which will be recognized
+ // in the SbiParameters-ctor and is continued to be handled
if( eNextTok == ASSIGN )
{
pParser->UnlockColumn();
return new SbiExprNode( pParser, aSym );
}
- // ab hier sind keine Keywords zugelassen!
+ // no keywords allowed from here on!
if( pParser->IsKwd( eTok ) )
{
if( pParser->IsCompatible() && eTok == INPUT )
@@ -257,9 +256,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
eTok = pParser->Peek();
}
}
- // Es koennte ein Objektteil sein, wenn . oder ! folgt
- // Bei . muss aber die Variable bereits definiert sein; wenn pDef
- // nach der Suche NULL ist, isses ein Objekt!
+ // It might be an object part, if . or ! is following.
+ // In case of . the variable must already be defined;
+ // it's an object, if pDef is NULL after the search.
sal_Bool bObj = sal_Bool( ( eTok == DOT || eTok == EXCLAM )
&& !pParser->WhiteSpace() );
if( bObj )
@@ -269,18 +268,18 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
eType = SbxOBJECT;
else
{
- // Name%. geht wirklich nicht!
+ // Name%. really does not work!
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
}
- // Suche:
+ // Search:
SbiSymDef* pDef = pParser->pPool->Find( aSym );
if( !pDef )
{
- // Teil der Runtime-Library?
- // AB 31.3.1996: In Parser-Methode ausgelagert
- // (wird auch in SbiParser::DefVar() in DIM.CXX benoetigt)
+ // Part of the Runtime-Library?
+ // from 31.3.1996: swapped out to parser-method
+ // (is also needed in SbiParser::DefVar() in DIM.CXX)
pDef = pParser->CheckRTLForSym( aSym, eType );
// #i109184: Check if symbol is or later will be defined inside module
@@ -291,8 +290,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
if( !pDef )
{
- // Falls ein Punkt angegeben war, isses Teil eines Objekts,
- // also muss der Returnwert ein Objekt sein
if( bObj )
eType = SbxOBJECT;
pDef = AddSym( eTok, *pParser->pPool, eCurExpr, aSym, eType, pPar );
@@ -305,8 +302,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
else
{
- // Symbol ist bereits definiert.
- // Ist es eine Konstante?
SbiConstDef* pConst = pDef->GetConstDef();
if( pConst )
{
@@ -315,9 +310,8 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
else
return new SbiExprNode( pParser, pConst->GetValue(), pConst->GetType() );
}
- // Hat es Dimensionen,
- // und sind auch Parameter angegeben?
- // (Wobei 0 Parameter () entsprechen)
+
+ // 0 parameters come up to ()
if( pDef->GetDims() )
{
if( pPar && pPar->GetSize() && pPar->GetSize() != pDef->GetDims() )
@@ -329,26 +323,26 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// #119187 Only error if types conflict
if( eType >= SbxINTEGER && eType <= SbxSTRING && eType != eDefType )
{
- // Wie? Erst mit AS definieren und dann einen Suffix nehmen?
+ // How? Define with AS first and take a Suffix then?
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
else if ( eType == SbxVARIANT )
- // Falls nix angegeben, den Typ des Eintrags nehmen
- // aber nur, wenn die Var nicht mit AS XXX definiert ist
- // damit erwischen wir n% = 5 : print n
+ // if there's nothing named, take the type of the entry,
+ // but only if the var hasn't been defined with AS XXX
+ // so that we catch n% = 5 : print n
eType = eDefType;
}
- // Typcheck bei Variablen:
- // ist explizit im Scanner etwas anderes angegeben?
- // Bei Methoden ist dies OK!
- if( eType != SbxVARIANT && // Variant nimmt alles
+ // checking type of variables:
+ // is there named anything different in the scanner?
+ // That's OK for methods!
+ if( eType != SbxVARIANT && // Variant takes everything
eType != pDef->GetType() &&
!pDef->GetProcDef() )
{
- // Es kann sein, dass pDef ein Objekt beschreibt, das bisher
- // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern
- // AB, 16.12.95 (Vielleicht noch aehnliche Faelle moeglich ?!?)
+ // maybe pDef describes an object that so far has only been
+ // recognized as SbxVARIANT - then change type of pDef
+ // from 16.12.95 (similar cases possible perhaps?!?)
if( eType == SbxOBJECT && pDef->GetType() == SbxVARIANT )
{
pDef->SetType( SbxOBJECT );
@@ -367,11 +361,11 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
{
- // AB, 8.1.95: Objekt kann auch vom Typ SbxVARIANT sein
+ // from 8.1.95: Object may also be of the type SbxVARIANT
if( pDef->GetType() == SbxVARIANT )
pDef->SetType( SbxOBJECT );
- // Falls wir etwas mit Punkt einscannen, muss der
- // Typ SbxOBJECT sein
+ // if we scan something with point,
+ // the type must be SbxOBJECT
if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
{
// defer error until runtime if in vba mode
@@ -384,13 +378,13 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
if( !bError )
pNd->aVar.pNext = ObjTerm( *pDef );
}
- // Merken der Spalte 1 wieder freigeben
+
pParser->UnlockColumn();
return pNd;
}
-// Aufbau eines Objekt-Terms. Ein derartiger Term ist Teil
-// eines Ausdrucks, der mit einer Objektvariablen beginnt.
+// construction of an object term. A term of this kind is part
+// of an expression that begins with an object variable.
SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
{
@@ -398,8 +392,8 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
SbiToken eTok = pParser->Next();
if( eTok != SYMBOL && !pParser->IsKwd( eTok ) && !pParser->IsExtra( eTok ) )
{
- // #66745 Einige Operatoren koennen in diesem Kontext auch
- // als Identifier zugelassen werden, wichtig fuer StarOne
+ // #66745 Some operators can also be allowed
+ // as identifiers, important for StarOne
if( eTok != MOD && eTok != NOT && eTok != AND && eTok != OR &&
eTok != XOR && eTok != EQV && eTok != IMP && eTok != IS )
{
@@ -416,7 +410,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
eTok = pParser->Peek();
- // Parameter?
+
if( DoParametersFollow( pParser, eCurExpr, eTok ) )
{
bool bStandaloneExpression = false;
@@ -443,13 +437,13 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
eType = SbxOBJECT;
else
{
- // Name%. geht wirklich nicht!
+ // Name%. does really not work!
pParser->Error( SbERR_BAD_DECLARATION, aSym );
bError = sal_True;
}
}
- // Der Symbol-Pool eines Objekts ist immer PUBLIC
+ // an object's symbol pool is always PUBLIC
SbiSymPool& rPool = rObj.GetPool();
rPool.SetScope( SbPUBLIC );
SbiSymDef* pDef = rPool.Find( aSym );
@@ -464,11 +458,6 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
{
- // Falls wir etwas mit Punkt einscannen, muss der
- // Typ SbxOBJECT sein
-
- // Es kann sein, dass pDef ein Objekt beschreibt, das bisher
- // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern
if( pDef->GetType() == SbxVARIANT )
pDef->SetType( SbxOBJECT );
@@ -486,20 +475,20 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
return pNd;
}
-// Als Operanden kommen in Betracht:
-// Konstante
-// skalare Variable
-// Strukturelemente
-// Array-Elemente
-// Funktionen
-// geklammerte Ausdruecke
+// an operand can be:
+// constant
+// scalar variable
+// structure elements
+// array elements
+// functions
+// bracketed expressions
SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
{
SbiExprNode *pRes;
SbiToken eTok;
- // Operand testen:
+ // test operand:
switch( eTok = pParser->Peek() )
{
case SYMBOL:
@@ -555,13 +544,13 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf )
pRes->bComposite = sal_True;
break;
default:
- // Zur Zeit sind Keywords hier OK!
+ // keywords here are OK at the moment!
if( pParser->IsKwd( eTok ) )
pRes = Term();
else
{
pParser->Next();
- pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); // bei Fehlern
+ pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE );
pParser->Error( SbERR_UNEXPECTED, eTok );
}
}
@@ -848,7 +837,7 @@ SbiExprNode* SbiExpression::Like()
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
- // Mehrere Operatoren hintereinander gehen nicht
+ // multiple operands in a row does not work
if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
@@ -882,9 +871,6 @@ SbiExprNode* SbiExpression::Boolean()
|*
***************************************************************************/
-// Parsing einer Expression, die sich zu einer numerischen
-// Konstanten verarbeiten laesst.
-
SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
{
if( pExpr->IsConstant() )
@@ -902,13 +888,12 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
}
else
{
- // #40204 Spezialbehandlung fuer sal_Bool-Konstanten
+ // #40204 special treatment for sal_Bool-constants
sal_Bool bIsBool = sal_False;
if( pExpr->eNodeType == SbxVARVAL )
{
SbiSymDef* pVarDef = pExpr->GetVar();
- // Ist es eine sal_Bool-Konstante?
sal_Bool bBoolVal = sal_False;
if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) )
{
@@ -922,7 +907,6 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
bBoolVal = sal_False;
}
- // Wenn es ein sal_Bool ist, Node austauschen
if( bIsBool )
{
delete pExpr;
@@ -988,7 +972,6 @@ SbiExprList::~SbiExprList()
}
}
-// Parameter anfordern (ab 0)
SbiExpression* SbiExprList::Get( short n )
{
@@ -1014,11 +997,11 @@ void SbiExprList::addExpression( SbiExpression* pExpr )
|*
***************************************************************************/
-// Parsender Konstruktor:
-// Die Parameterliste wird komplett geparst.
-// "Prozedurname()" ist OK.
-// Dann handelt es sich um eine Funktion ohne Parameter
-// respektive um die Angabe eines Arrays als Prozedurparameter.
+// parsing constructor:
+// the parameter list is completely parsed
+// "procedurename()" is OK
+// it's a function without parameters then
+// i. e. you give an array as procedure parameter
// #i79918/#i80532: bConst has never been set to true
// -> reused as bStandaloneExpression
@@ -1032,7 +1015,6 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
SbiExpression *pExpr;
SbiToken eTok = pParser->Peek();
- // evtl. Klammer auf weg:
bool bAssumeExprLParenMode = false;
bool bAssumeArrayMode = false;
if( eTok == LPAREN )
@@ -1049,25 +1031,25 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
}
}
- // Ende-Test
+
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
{
if( eTok == RPAREN )
pParser->Next();
return;
}
- // Parametertabelle einlesen und in richtiger Folge ablegen!
+ // read in parameter table and lay down in correct order!
SbiExpression* pLast = NULL;
String aName;
while( !bError )
{
aName.Erase();
- // Fehlendes Argument
+ // missing argument
if( eTok == COMMA )
{
pExpr = new SbiExpression( pParser, 0, SbxEMPTY );
}
- // Benannte Argumente: entweder .name= oder name:=
+ // named arguments: either .name= or name:=
else
{
bool bByVal = false;
@@ -1117,7 +1099,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
if( pParser->Peek() == ASSIGN )
{
// VBA mode: name:=
- // SbiExpression::Term() hat einen String daraus gemacht
+ // SbiExpression::Term() has made as string out of it
aName = pExpr->GetString();
delete pExpr;
pParser->Next();
@@ -1137,7 +1119,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
if( bAssumeArrayMode )
break;
- // Naechstes Element?
+ // next element?
eTok = pParser->Peek();
if( eTok != COMMA )
{
@@ -1156,7 +1138,7 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
break;
}
}
- // Schliessende Klammer
+ // closing bracket
if( eTok == RPAREN )
{
pParser->Next();
@@ -1176,10 +1158,9 @@ SbiParameters::SbiParameters( SbiParser* p, sal_Bool bStandaloneExpression, sal_
|*
***************************************************************************/
-// Parsender Konstruktor:
-// Eine Liste von Array-Dimensionen wird geparst. Die Ausdruecke werden
-// auf numerisch getestet. Das bCONST-Bit wird gesetzt, wenn alle Ausdruecke
-// Integer-Konstanten sind.
+// parsing constructor:
+// A list of array dimensions is parsed. The expressions are tested for being
+// numeric. The bCONST-Bit is reset when all expressions are Integer constants.
SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
{
@@ -1216,7 +1197,6 @@ SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p )
}
else
{
- // Nur eine Dim-Angabe
pExpr1->SetBased();
pExpr1->pNext = NULL;
bConst &= pExpr1->IsIntConstant();
diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx
index bc458e54305f..cff657adfb07 100644
--- a/basic/source/comp/io.cxx
+++ b/basic/source/comp/io.cxx
@@ -34,7 +34,7 @@
#include "sbcomp.hxx"
#include "iosys.hxx"
-// Test, ob ein I/O-Channel angegeben wurde
+// test if there's an I/O channel
sal_Bool SbiParser::Channel( sal_Bool bAlways )
{
@@ -54,15 +54,13 @@ sal_Bool SbiParser::Channel( sal_Bool bAlways )
return bRes;
}
-// Fuer PRINT und WRITE wird bei Objektvariablen versucht,
-// die Default-Property anzusprechen.
-
-// PRINT
+// it's tried that at object variables the Default-
+// Property is addressed for PRINT and WRITE
void SbiParser::Print()
{
sal_Bool bChan = Channel();
- // Die Ausdruecke zum Drucken:
+
while( !bAbort )
{
if( !IsEoln( Peek() ) )
@@ -93,7 +91,7 @@ void SbiParser::Print()
void SbiParser::Write()
{
sal_Bool bChan = Channel();
- // Die Ausdruecke zum Drucken:
+
while( !bAbort )
{
SbiExpression* pExpr = new SbiExpression( this );
@@ -153,7 +151,7 @@ void SbiParser::LineInput()
pExpr->Gen();
aGen.Gen( _LINPUT );
delete pExpr;
- aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepLINPUT()
+ aGen.Gen( _CHAN0 ); // ResetChannel() not in StepLINPUT() anymore
}
// INPUT
@@ -178,7 +176,7 @@ void SbiParser::Input()
else break;
}
delete pExpr;
- aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepINPUT()
+ aGen.Gen( _CHAN0 );
}
// OPEN stringexpr FOR mode ACCCESS access mode AS Channel [Len=n]
@@ -209,8 +207,8 @@ void SbiParser::Open()
{
Next();
eTok = Next();
- // Nur STREAM_READ,STREAM_WRITE-Flags in nMode beeinflussen
- nMode &= ~(STREAM_READ | STREAM_WRITE); // loeschen
+ // influence only STREAM_READ,STREAM_WRITE-Flags in nMode
+ nMode &= ~(STREAM_READ | STREAM_WRITE); // delete
if( eTok == READ )
{
if( Peek() == WRITE )
@@ -254,7 +252,7 @@ void SbiParser::Open()
default: break;
}
TestToken( AS );
- // Die Kanalnummer
+ // channel number
SbiExpression* pChan = new SbiExpression( this );
if( !pChan )
Error( SbERR_SYNTAX );
@@ -270,10 +268,10 @@ void SbiParser::Open()
}
}
if( !pLen ) pLen = new SbiExpression( this, 128, SbxINTEGER );
- // Der Stack fuer den OPEN-Befehl sieht wie folgt aus:
- // Blocklaenge
- // Kanalnummer
- // Dateiname
+ // the stack for the OPEN command looks as follows:
+ // block length
+ // channel number
+ // file name
pLen->Gen();
if( pChan )
pChan->Gen();
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index c3e9159dac3b..392e3e9ccb5c 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -37,18 +37,18 @@ void SbiParser::If()
{
sal_uInt32 nEndLbl;
SbiToken eTok = NIL;
- // Ende-Tokens ignorieren:
+ // ignore end-tokens
SbiExpression aCond( this );
aCond.Gen();
TestToken( THEN );
if( IsEoln( Next() ) )
{
- // Am Ende jeden Blocks muss ein Jump zu ENDIF
- // eingefuegt werden, damit bei ELSEIF nicht erneut die Bedingung
- // ausgewertet wird. Die Tabelle nimmt alle Absprungstellen auf.
+ // At the end of each block a jump to ENDIF must be inserted,
+ // so that the condition is not evaluated again at ELSEIF.
+ // The table collects all jump points.
#define JMP_TABLE_SIZE 100
- sal_uInt32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs zulaessig
- sal_uInt16 iJmp = 0; // aktueller Tabellen-Index
+ sal_uInt32 pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs allowed
+ sal_uInt16 iJmp = 0; // current table index
// multiline IF
nEndLbl = aGen.Gen( _JUMPF, 0 );
@@ -64,7 +64,7 @@ void SbiParser::If()
}
while( eTok == ELSEIF )
{
- // Bei erfolgreichem IF/ELSEIF auf ENDIF springen
+ // jump to ENDIF in case of a successful IF/ELSEIF
if( iJmp >= JMP_TABLE_SIZE )
{
Error( SbERR_PROG_TOO_LARGE ); bAbort = sal_True; return;
@@ -104,7 +104,7 @@ void SbiParser::If()
else if( eTok == ENDIF )
Next();
- // Jmp-Tabelle abarbeiten
+
while( iJmp > 0 )
{
iJmp--;
@@ -143,7 +143,7 @@ void SbiParser::If()
aGen.BackChain( nEndLbl );
}
-// ELSE/ELSEIF/ENDIF ohne IF
+// ELSE/ELSEIF/ENDIF without IF
void SbiParser::NoIf()
{
@@ -213,7 +213,7 @@ void SbiParser::For()
if( bForEach )
Next();
SbiExpression aLvalue( this, SbOPERAND );
- aLvalue.Gen(); // Variable auf dem Stack
+ aLvalue.Gen(); // variable on the Stack
if( bForEach )
{
@@ -227,10 +227,10 @@ void SbiParser::For()
{
TestToken( EQ );
SbiExpression aStartExpr( this );
- aStartExpr.Gen(); // Startausdruck auf dem Stack
+ aStartExpr.Gen();
TestToken( TO );
SbiExpression aStopExpr( this );
- aStopExpr.Gen(); // Endausdruck auf dem Stack
+ aStopExpr.Gen();
if( Peek() == STEP )
{
Next();
@@ -243,19 +243,19 @@ void SbiParser::For()
aOne.Gen();
}
TestEoln();
- // Der Stack hat jetzt 4 Elemente: Variable, Start, Ende, Inkrement
- // Startwert binden
+ // The stack has all 4 elements now: variable, start, end, increment
+ // bind start value
aGen.Gen( _INITFOR );
}
sal_uInt32 nLoop = aGen.GetPC();
- // Test durchfuehren, evtl. Stack freigeben
+ // do tests, maybe free the stack
sal_uInt32 nEndTarget = aGen.Gen( _TESTFOR, 0 );
OpenBlock( FOR );
StmntBlock( NEXT );
aGen.Gen( _NEXT );
aGen.Gen( _JUMP, nLoop );
- // Kommen Variable nach NEXT?
+ // are there variables after NEXT?
if( Peek() == SYMBOL )
{
SbiExpression aVar( this, SbOPERAND );
@@ -272,16 +272,15 @@ void SbiParser::With()
{
SbiExpression aVar( this, SbOPERAND );
- // Letzten Knoten in der Objekt-Kette ueberpruefen
SbiExprNode *pNode = aVar.GetExprNode()->GetRealNode();
SbiSymDef* pDef = pNode->GetVar();
- // Variant, AB 27.6.1997, #41090: bzw. empty -> mu Object sein
+ // Variant, from 27.6.1997, #41090: empty -> must be Object
if( pDef->GetType() == SbxVARIANT || pDef->GetType() == SbxEMPTY )
pDef->SetType( SbxOBJECT );
else if( pDef->GetType() != SbxOBJECT )
Error( SbERR_NEEDS_OBJECT );
- // Knoten auch auf SbxOBJECT setzen, damit spaeter Gen() klappt
+
pNode->SetType( SbxOBJECT );
OpenBlock( NIL, aVar.GetExprNode() );
@@ -289,7 +288,7 @@ void SbiParser::With()
CloseBlock();
}
-// LOOP/NEXT/WEND ohne Konstrukt
+// LOOP/NEXT/WEND without construct
void SbiParser::BadBlock()
{
@@ -312,11 +311,11 @@ void SbiParser::OnGoto()
Error( SbERR_EXPECTED, "GoTo/GoSub" );
eTok = GOTO;
}
- // Label-Tabelle einlesen:
+
sal_uInt32 nLbl = 0;
do
{
- Next(); // Label holen
+ Next(); // get label
if( MayBeLabel() )
{
sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
@@ -371,7 +370,7 @@ void SbiParser::Select()
sal_uInt32 nNextTarget = 0;
sal_uInt32 nDoneTarget = 0;
sal_Bool bElse = sal_False;
- // Die Cases einlesen:
+
while( !bAbort )
{
eTok = Next();
@@ -380,7 +379,7 @@ void SbiParser::Select()
if( nNextTarget )
aGen.BackChain( nNextTarget ), nNextTarget = 0;
aGen.Statement();
- // Jeden Case einlesen
+
sal_Bool bDone = sal_False;
sal_uInt32 nTrueTarget = 0;
if( Peek() == ELSE )
@@ -429,13 +428,13 @@ void SbiParser::Select()
if( Peek() == COMMA ) Next();
else TestEoln(), bDone = sal_True;
}
- // Alle Cases abgearbeitet
+
if( !bElse )
{
nNextTarget = aGen.Gen( _JUMP, nNextTarget );
aGen.BackChain( nTrueTarget );
}
- // den Statement-Rumpf bauen
+ // build the statement body
while( !bAbort )
{
eTok = Peek();
@@ -472,14 +471,14 @@ void SbiParser::On()
SbiToken eTok = Peek();
String aString = SbiTokenizer::Symbol(eTok);
if (aString.EqualsIgnoreCaseAscii("ERROR"))
- eTok = _ERROR_; // Error kommt als SYMBOL
+ eTok = _ERROR_; // Error comes as SYMBOL
if( eTok != _ERROR_ && eTok != LOCAL ) OnGoto();
else
{
if( eTok == LOCAL ) Next();
- Next (); // Kein TestToken mehr, da es sonst einen Fehler gibt
+ Next (); // no more TestToken, as there'd be an error otherwise
- Next(); // Token nach Error holen
+ Next(); // get token after error
if( eCurTok == GOTO )
{
// ON ERROR GOTO label|0
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 2ea78357882f..b8fb78f366d0 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -32,18 +32,18 @@
#include "sbcomp.hxx"
#include <com/sun/star/script/ModuleType.hpp>
-struct SbiParseStack { // "Stack" fuer Statement-Blocks
+struct SbiParseStack { // "Stack" for statement-blocks
SbiParseStack* pNext; // Chain
- SbiExprNode* pWithVar; // Variable fuer WITH
- SbiToken eExitTok; // Exit-Token
+ SbiExprNode* pWithVar;
+ SbiToken eExitTok;
sal_uInt32 nChain; // JUMP-Chain
};
struct SbiStatement {
SbiToken eTok;
- void( SbiParser::*Func )(); // Verarbeitungsroutine
- sal_Bool bMain; // sal_True: ausserhalb SUBs OK
- sal_Bool bSubr; // sal_True: in SUBs OK
+ void( SbiParser::*Func )();
+ sal_Bool bMain; // sal_True: OK outside the SUB
+ sal_Bool bSubr; // sal_True: OK inside the SUB
};
#define Y sal_True
@@ -148,16 +148,16 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
pPool = &aPublics;
for( short i = 0; i < 26; i++ )
- eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
+ eDefTypes[ i ] = SbxVARIANT; // no explicit default type
aPublics.SetParent( &aGlobals );
aGlobals.SetParent( &aRtlSyms );
- // Die globale Chainkette faengt bei Adresse 0 an:
+
nGblChain = aGen.Gen( _JUMP, 0 );
- rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
- rEnumArray = new SbxArray; // Array for Enum types
+ rTypeArray = new SbxArray; // array for user defined types
+ rEnumArray = new SbxArray; // array for Enum types
bVBASupportOn = pm->IsVBACompat();
if ( bVBASupportOn )
EnableCompatibility();
@@ -165,7 +165,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
}
-// Ist Teil der Runtime-Library?
+// part of the runtime-library?
SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
{
SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE );
@@ -187,7 +187,7 @@ SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
return pDef;
}
-// Globale Chainkette schliessen
+// close global chain
sal_Bool SbiParser::HasGlobalCode()
{
@@ -210,7 +210,7 @@ void SbiParser::OpenBlock( SbiToken eTok, SbiExprNode* pVar )
pStack = p;
pWithVar = pVar;
- // #29955 for-Schleifen-Ebene pflegen
+ // #29955 service the for-loop level
if( eTok == FOR )
aGen.IncForLevel();
}
@@ -221,7 +221,7 @@ void SbiParser::CloseBlock()
{
SbiParseStack* p = pStack;
- // #29955 for-Schleifen-Ebene pflegen
+ // #29955 service the for-loop level
if( p->eExitTok == FOR )
aGen.DecForLevel();
@@ -264,7 +264,7 @@ sal_Bool SbiParser::TestSymbol( sal_Bool bKwdOk )
return sal_False;
}
-// Testen auf ein bestimmtes Token
+
sal_Bool SbiParser::TestToken( SbiToken t )
{
@@ -279,7 +279,7 @@ sal_Bool SbiParser::TestToken( SbiToken t )
}
}
-// Testen auf Komma oder EOLN
+
sal_Bool SbiParser::TestComma()
{
@@ -298,7 +298,7 @@ sal_Bool SbiParser::TestComma()
return sal_True;
}
-// Testen, ob EOLN vorliegt
+
void SbiParser::TestEoln()
{
@@ -309,8 +309,7 @@ void SbiParser::TestEoln()
}
}
-// Parsing eines Statement-Blocks
-// Das Parsing laeuft bis zum Ende-Token.
+
void SbiParser::StmntBlock( SbiToken eEnd )
{
@@ -325,8 +324,7 @@ void SbiParser::StmntBlock( SbiToken eEnd )
}
}
-// Die Hauptroutine. Durch wiederholten Aufrufs dieser Routine wird
-// die Quelle geparst. Returnwert sal_False bei Ende/Fehlern.
+
sal_Bool SbiParser::Parse()
{
@@ -337,19 +335,19 @@ sal_Bool SbiParser::Parse()
bErrorIsSymbol = false;
Peek();
bErrorIsSymbol = true;
- // Dateiende?
+
if( IsEof() )
{
- // AB #33133: Falls keine Sub angelegt wurde, muss hier
- // der globale Chain abgeschlossen werden!
- // AB #40689: Durch die neue static-Behandlung kann noch
- // ein nGblChain vorhanden sein, daher vorher abfragen
+ // AB #33133: If no sub has been created before,
+ // the global chain must be closed here!
+ // AB #40689: Due to the new static-handling there
+ // can be another nGblChain, so ask for it before.
if( bNewGblDefs && nGblChain == 0 )
nGblChain = aGen.Gen( _JUMP, 0 );
return sal_False;
}
- // Leerstatement?
+
if( IsEoln( eCurTok ) )
{
Next(); return sal_True;
@@ -357,20 +355,20 @@ sal_Bool SbiParser::Parse()
if( !bSingleLineIf && MayBeLabel( sal_True ) )
{
- // Ist ein Label
+ // is a label
if( !pProc )
Error( SbERR_NOT_IN_MAIN, aSym );
else
pProc->GetLabels().Define( aSym );
Next(); Peek();
- // Leerstatement?
+
if( IsEoln( eCurTok ) )
{
Next(); return sal_True;
}
}
- // Ende des Parsings?
+ // end of parsing?
if( eCurTok == eEndTok ||
( bVBASupportOn && // #i109075
(eCurTok == ENDFUNC || eCurTok == ENDPROPERTY || eCurTok == ENDSUB) &&
@@ -382,7 +380,7 @@ sal_Bool SbiParser::Parse()
return sal_False;
}
- // Kommentar?
+ // comment?
if( eCurTok == REM )
{
Next(); return sal_True;
@@ -400,16 +398,16 @@ sal_Bool SbiParser::Parse()
ePush = eCurTok;
}
}
- // Kommt ein Symbol, ist es entweder eine Variable( LET )
- // oder eine SUB-Prozedur( CALL ohne Klammern )
- // DOT fuer Zuweisungen im WITH-Block: .A=5
+ // if there's a symbol, it's either a variable (LET)
+ // or a SUB-procedure (CALL without brackets)
+ // DOT for assignments in the WITH-block: .A=5
if( eCurTok == SYMBOL || eCurTok == DOT )
{
if( !pProc )
Error( SbERR_EXPECTED, SUB );
else
{
- // Damit Zeile & Spalte stimmen...
+ // for correct line and column...
Next();
Push( eCurTok );
aGen.Statement();
@@ -420,7 +418,7 @@ sal_Bool SbiParser::Parse()
{
Next();
- // Hier folgen nun die Statement-Parser.
+ // statement parsers
SbiStatement* p;
for( p = StmntTable; p->eTok != NIL; p++ )
@@ -434,16 +432,15 @@ sal_Bool SbiParser::Parse()
Error( SbERR_NOT_IN_SUBR, eCurTok );
else
{
- // globalen Chain pflegen
- // AB #41606/#40689: Durch die neue static-Behandlung kann noch
- // ein nGblChain vorhanden sein, daher vorher abfragen
+ // AB #41606/#40689: Due to the new static-handling there
+ // can be another nGblChain, so ask for it before.
if( bNewGblDefs && nGblChain == 0 &&
( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ) )
{
nGblChain = aGen.Gen( _JUMP, 0 );
bNewGblDefs = sal_False;
}
- // Statement-Opcode bitte auch am Anfang einer Sub
+ // statement-opcode at the beginning of a sub, too, please
if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) ||
eCurTok == SUB || eCurTok == FUNCTION )
aGen.Statement();
@@ -457,35 +454,34 @@ sal_Bool SbiParser::Parse()
Error( SbERR_UNEXPECTED, eCurTok );
}
- // Test auf Ende des Statements:
- // Kann auch ein ELSE sein, da vor dem ELSE kein : stehen muss!
+ // test for the statement's end -
+ // might also be an ELSE, as there must not neccessary be a : before the ELSE!
if( !IsEos() )
{
Peek();
if( !IsEos() && eCurTok != ELSE )
{
- // falls das Parsing abgebrochen wurde, bis zum ":" vorgehen:
+ // if the parsing has been aborted, jump over to the ":"
Error( SbERR_UNEXPECTED, eCurTok );
while( !IsEos() ) Next();
}
}
- // Der Parser bricht am Ende ab, das naechste Token ist noch nicht
- // geholt!
+ // The parser aborts at the end, the
+ // next token has not been fetched yet!
return sal_True;
}
-// Innerste With-Variable liefern
+
SbiExprNode* SbiParser::GetWithVar()
{
if( pWithVar )
return pWithVar;
- // Sonst im Stack suchen
SbiParseStack* p = pStack;
while( p )
{
- // LoopVar kann zur Zeit nur fuer with sein
+ // LoopVar can at the moment only be for with
if( p->pWithVar )
return p->pWithVar;
p = p->pNext;
@@ -494,7 +490,7 @@ SbiExprNode* SbiParser::GetWithVar()
}
-// Zuweisung oder Subroutine Call
+// assignment or subroutine call
void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
{
@@ -540,7 +536,7 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
else
{
- // Dann muss es eine Zuweisung sein. Was anderes gibts nicht!
+ // so it must be an assignment!
if( !aVar.IsLvalue() )
Error( SbERR_LVALUE_EXPECTED );
TestToken( EQ );
@@ -566,7 +562,6 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
}
-// Zuweisungen
void SbiParser::Assign()
{
@@ -587,7 +582,7 @@ void SbiParser::Assign()
aGen.Gen( _PUT );
}
-// Zuweisungen einer Objektvariablen
+// assignments of an object-variable
void SbiParser::Set()
{
@@ -671,7 +666,7 @@ void SbiParser::RSet()
aGen.Gen( _RSET );
}
-// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR und so weiter
+// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR and so on
void SbiParser::DefXXX()
{
@@ -705,7 +700,7 @@ void SbiParser::DefXXX()
void SbiParser::Stop()
{
aGen.Gen( _STOP );
- Peek(); // #35694: Nur Peek(), damit EOL in Single-Line-If erkannt wird
+ Peek(); // #35694: only Peek(), so that EOL is recognized in Single-Line-If
}
// IMPLEMENTS
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index 86557db46699..b2cba95a5344 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -903,8 +903,8 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
#endif
-// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment
-// geladen werden kann.
+// This routine is defined here, so that the
+// compiler can be loaded as a discrete segment.
sal_Bool SbModule::Compile()
{
@@ -914,7 +914,7 @@ sal_Bool SbModule::Compile()
if( !pBasic )
return sal_False;
SbxBase::ResetError();
- // Aktuelles Modul!
+
SbModule* pOld = pCMOD;
pCMOD = this;
@@ -923,14 +923,14 @@ sal_Bool SbModule::Compile()
if( !pParser->GetErrors() )
pParser->aGen.Save();
delete pParser;
- // fuer den Disassembler
+ // for the disassembler
if( pImage )
pImage->aOUSource = aOUSource;
pCMOD = pOld;
- // Beim Compilieren eines Moduls werden die Modul-globalen
- // Variablen aller Module ungueltig
+ // compiling a module, the module-global
+ // variables of all modules become invalid
sal_Bool bRet = IsCompiled();
if( bRet )
{
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 11c081d1b4b2..1dec4db83caa 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -97,12 +97,12 @@ void SbiScanner::GenError( SbError code )
if( !bError && bErrors )
{
sal_Bool bRes = sal_True;
- // Nur einen Fehler pro Statement reporten
+ // report only one error per statement
bError = sal_True;
if( pBasic )
{
- // Falls EXPECTED oder UNEXPECTED kommen sollte, bezieht es sich
- // immer auf das letzte Token, also die Col1 uebernehmen
+ // in case of EXPECTED or UNEXPECTED it always refers
+ // to the last token, so take the Col1 over
sal_uInt16 nc = nColLock ? nSavedCol1 : nCol1;
switch( code )
{
@@ -123,8 +123,8 @@ void SbiScanner::GenError( SbError code )
nErrors++;
}
-// Falls sofort ein Doppelpunkt folgt, wird sal_True zurueckgeliefert.
-// Wird von SbiTokenizer::MayBeLabel() verwendet, um einen Label zu erkennen
+
+// used by SbiTokenizer::MayBeLabel() to detect a label
sal_Bool SbiScanner::DoesColonFollow()
{
@@ -135,7 +135,7 @@ sal_Bool SbiScanner::DoesColonFollow()
else return sal_False;
}
-// Testen auf ein legales Suffix
+// test for legal suffix
static SbxDataType GetSuffixType( sal_Unicode c )
{
@@ -149,8 +149,8 @@ static SbxDataType GetSuffixType( sal_Unicode c )
return SbxVARIANT;
}
-// Einlesen des naechsten Symbols in die Variablen aSym, nVal und eType
-// Returnwert ist sal_False bei EOF oder Fehlern
+// reading the next symbol into the variables aSym, nVal and eType
+// return value is sal_False at EOF or errors
#define BUF_SIZE 80
namespace {
@@ -165,7 +165,7 @@ inline bool lclIsWhitespace( sal_Unicode cChar )
sal_Bool SbiScanner::NextSym()
{
- // Fuer den EOLN-Fall merken
+ // memorize for the EOLN-case
sal_uInt16 nOldLine = nLine;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
@@ -177,7 +177,7 @@ sal_Bool SbiScanner::NextSym()
bSymbol =
bNumber = bSpaces = sal_False;
- // Zeile einlesen?
+ // read in line?
if( !pLine )
{
sal_Int32 n = nBufPos;
@@ -207,13 +207,13 @@ sal_Bool SbiScanner::NextSym()
nColLock = 0;
}
- // Leerstellen weg:
+
while( lclIsWhitespace( *pLine ) )
pLine++, nCol++, bSpaces = sal_True;
nCol1 = nCol;
- // nur Leerzeile?
+ // only blank line?
if( !*pLine )
goto eoln;
@@ -227,10 +227,10 @@ sal_Bool SbiScanner::NextSym()
bHash = sal_True;
}
- // Symbol? Dann Zeichen kopieren.
+ // copy character if symbol
if( BasicSimpleCharClass::isAlpha( *pLine, bCompatible ) || *pLine == '_' )
{
- // Wenn nach '_' nichts kommt, ist es ein Zeilenabschluss!
+ // if there's nothing behind '_' , it's the end of a line!
if( *pLine == '_' && !*(pLine+1) )
{ pLine++;
goto eoln; }
@@ -263,16 +263,16 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt
- // (sonst falsche Zeilenfortsetzung)
+ // replace closing '_' by space when end of line is following
+ // (wrong line continuation otherwise)
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )
{
aSym.GetBufferAccess(); // #109693 force copy if necessary
- *((sal_Unicode*)(pLine-1)) = ' '; // cast wegen const
+ *((sal_Unicode*)(pLine-1)) = ' '; // cast because of const
}
- // Typkennung?
- // Das Ausrufezeichen bitte nicht testen, wenn
- // danach noch ein Symbol anschliesst
+ // type recognition?
+ // don't test the exclamation mark
+ // if there's a symbol behind it
else if( *pLine != '!' || !BasicSimpleCharClass::isAlpha( pLine[ 1 ], bCompatible ) )
{
SbxDataType t = GetSuffixType( *pLine );
@@ -285,7 +285,7 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Zahl? Dann einlesen und konvertieren.
+ // read in and convert if number
else if( BasicSimpleCharClass::isDigit( *pLine & 0xFF )
|| ( *pLine == '.' && BasicSimpleCharClass::isDigit( *(pLine+1) & 0xFF ) ) )
{
@@ -297,14 +297,14 @@ sal_Bool SbiScanner::NextSym()
sal_Bool bBufOverflow = sal_False;
while( strchr( "0123456789.DEde", *pLine ) && *pLine )
{
- // AB 4.1.1996: Buffer voll? -> leer weiter scannen
+ // from 4.1.1996: buffer full? -> go on scanning empty
if( (p-buf) == (BUF_SIZE-1) )
{
bBufOverflow = sal_True;
pLine++, nCol++;
continue;
}
- // Komma oder Exponent?
+ // point or exponent?
if( *pLine == '.' )
{
if( ++comma > 1 )
@@ -320,7 +320,7 @@ sal_Bool SbiScanner::NextSym()
pLine++; nCol++; continue;
}
*p++ = 'E'; pLine++; nCol++;
- // Vorzeichen hinter Exponent?
+
if( *pLine == '+' )
pLine++, nCol++;
else
@@ -336,12 +336,12 @@ sal_Bool SbiScanner::NextSym()
}
*p = 0;
aSym = p; bNumber = sal_True;
- // Komma, Exponent mehrfach vorhanden?
+
if( comma > 1 || exp > 1 )
{ aError = '.';
GenError( SbERR_BAD_CHAR_IN_NUMBER ); }
- // #57844 Lokalisierte Funktion benutzen
+ // #57844 use localized function
nVal = rtl_math_uStringToDouble( buf, buf+(p-buf), '.', ',', NULL, NULL );
ndig = ndig - comma;
@@ -356,7 +356,7 @@ sal_Bool SbiScanner::NextSym()
if( bBufOverflow )
GenError( SbERR_MATH_OVERFLOW );
- // Typkennung?
+ // type recognition?
SbxDataType t = GetSuffixType( *pLine );
if( t != SbxVARIANT )
{
@@ -366,7 +366,7 @@ sal_Bool SbiScanner::NextSym()
}
}
- // Hex/Oktalzahl? Einlesen und konvertieren:
+ // Hex/octal number? Read in and convert:
else if( *pLine == '&' )
{
pLine++; nCol++;
@@ -383,7 +383,7 @@ sal_Bool SbiScanner::NextSym()
case 'H':
break;
default :
- // Wird als Operator angesehen
+ // treated as an operator
pLine--; nCol--; nCol1 = nCol-1; aSym = '&'; return SYMBOL;
}
bNumber = sal_True;
@@ -395,7 +395,7 @@ sal_Bool SbiScanner::NextSym()
sal_Unicode ch = sal::static_int_cast< sal_Unicode >(
toupper( *pLine & 0xFF ) );
pLine++; nCol++;
- // AB 4.1.1996: Buffer voll, leer weiter scannen
+ // from 4.1.1996: buffer full, go on scanning empty
if( (p-buf) == (BUF_SIZE-1) )
bBufOverflow = sal_True;
else if( String( cmp ).Search( ch ) != STRING_NOTFOUND )
@@ -447,7 +447,7 @@ sal_Bool SbiScanner::NextSym()
aSym = aLine.copy( n - 1, nCol - n + 1);
else
aSym = aLine.copy( n, nCol - n - 1 );
- // Doppelte Stringbegrenzer raus
+ // get out duplicate string delimiters
String s( cSep );
s += cSep;
sal_uInt16 nIdx = 0;
@@ -463,12 +463,12 @@ sal_Bool SbiScanner::NextSym()
if( cSep != ']' )
eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
}
- // ungueltige Zeichen:
+ // invalid characters:
else if( ( *pLine & 0xFF ) >= 0x7F )
{
GenError( SbERR_SYNTAX ); pLine++; nCol++;
}
- // andere Gruppen:
+ // other groups:
else
{
short n = 1;
@@ -485,7 +485,7 @@ sal_Bool SbiScanner::NextSym()
nCol2 = nCol-1;
PrevLineCommentLbl:
- // Kommentar?
+
if( bPrevLineExtentsComment || (eScanType != SbxSTRING &&
( aSym.GetBuffer()[0] == '\'' || aSym.EqualsIgnoreCaseAscii( "REM" ) ) ) )
{
@@ -499,8 +499,7 @@ PrevLineCommentLbl:
}
return sal_True;
- // Sonst Zeilen-Ende: aber bitte auf '_' testen, ob die
- // Zeile nicht weitergeht!
+
eoln:
if( nCol && *--pLine == '_' )
{
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 128c4acf52fc..4e6e93283c2b 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -37,11 +37,11 @@
SV_IMPL_PTRARR(SbiStrings,String*)
SV_IMPL_PTRARR(SbiSymbols,SbiSymDef*)
-// Alle Symbolnamen werden im Stringpool des Symbol-Pools abgelegt, damit
-// alle Symbole im gleichen Case verarbeitet werden. Beim Speichern des
-// Code-Images wird der globale Stringpool mit den entsprechenden Sympools
-// gespeichert. Der lokale Stringpool nimmt alle Symbole auf, die nicht
-// ins Image wandern (Labels, Konstantennamen etc).
+// All symbol names are laid down int the symbol-pool's stringpool, so that
+// all symbols are handled in the same case. On saving the code-image, the
+// global stringpool with the respective symbols is also saved.
+// The local stringpool holds all the symbols that don't move to the image
+// (labels, constant names etc.).
/***************************************************************************
|*
@@ -57,7 +57,6 @@ SbiStringPool::SbiStringPool( SbiParser* p )
SbiStringPool::~SbiStringPool()
{}
-// Suchen
const String& SbiStringPool::Find( sal_uInt16 n ) const
{
@@ -67,8 +66,7 @@ const String& SbiStringPool::Find( sal_uInt16 n ) const
return *aData.GetObject( n-1 );
}
-// Hinzufuegen eines Strings. Der String wird Case-Insensitiv
-// verglichen.
+
short SbiStringPool::Add( const String& rVal, sal_Bool bNoCase )
{
@@ -117,7 +115,6 @@ SbiSymPool::SbiSymPool( SbiStringPool& r, SbiSymScope s ) : rStrings( r )
SbiSymPool::~SbiSymPool()
{}
-// Inhalt loeschen
void SbiSymPool::Clear()
{
@@ -138,7 +135,6 @@ SbiSymDef* SbiSymPool::Next()
return aData.GetObject( nCur );
}
-// Hinzufuegen eines Symbols
SbiSymDef* SbiSymPool::AddSym( const String& rName )
{
@@ -157,7 +153,7 @@ SbiProcDef* SbiSymPool::AddProc( const String& rName )
SbiProcDef* p = new SbiProcDef( pParser, rName );
p->nPos = aData.Count();
p->nId = rStrings.Add( rName );
- // Procs sind immer global
+ // procs are always local
p->nProcId = 0;
p->pIn = this;
const SbiSymDef* q = p;
@@ -165,7 +161,7 @@ SbiProcDef* SbiSymPool::AddProc( const String& rName )
return p;
}
-// Hinzufuegen einer extern aufgebauten Symboldefinition
+// adding an externally constructed symbol definition
void SbiSymPool::Add( SbiSymDef* pDef )
{
@@ -174,7 +170,7 @@ void SbiSymPool::Add( SbiSymDef* pDef )
if( pDef->pIn )
{
#ifdef DBG_UTIL
- // schon in einem anderen Pool drin!
+
pParser->Error( SbERR_INTERNAL_ERROR, "Dbl Pool" );
#endif
return;
@@ -183,8 +179,8 @@ void SbiSymPool::Add( SbiSymDef* pDef )
pDef->nPos = aData.Count();
if( !pDef->nId )
{
- // Bei statischen Variablen muss ein eindeutiger Name
- // im Stringpool erzeugt werden (Form ProcName:VarName)
+ // A unique name must be created in the string pool
+ // for static variables (Form ProcName:VarName)
String aName( pDef->aName );
if( pDef->IsStatic() )
{
@@ -194,7 +190,7 @@ void SbiSymPool::Add( SbiSymDef* pDef )
}
pDef->nId = rStrings.Add( aName );
}
- // Procs sind immer global
+
if( !pDef->GetProcDef() )
pDef->nProcId = nProcId;
pDef->pIn = this;
@@ -203,7 +199,6 @@ void SbiSymPool::Add( SbiSymDef* pDef )
}
}
-// Suchen eines Eintrags ueber den Namen. Es wird auch im Parent gesucht.
SbiSymDef* SbiSymPool::Find( const String& rName ) const
{
@@ -221,7 +216,6 @@ SbiSymDef* SbiSymPool::Find( const String& rName ) const
return NULL;
}
-// Suchen ueber ID-Nummer
SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
{
@@ -237,7 +231,7 @@ SbiSymDef* SbiSymPool::FindId( sal_uInt16 n ) const
return NULL;
}
-// Suchen ueber Position (ab 0)
+// find via position (from 0)
SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
{
@@ -264,12 +258,11 @@ sal_uInt32 SbiSymPool::Reference( const String& rName )
SbiSymDef* p = Find( rName );
if( !p )
p = AddSym( rName );
- //Sicherheitshalber
+ // to be sure
pParser->aGen.GenStmnt();
return p->Reference();
}
-// Alle offenen Referenzen anmaulen
void SbiSymPool::CheckRefs()
{
@@ -283,7 +276,7 @@ void SbiSymPool::CheckRefs()
/***************************************************************************
|*
-|* Symbol-Definitionen
+|* symbol definitions
|*
***************************************************************************/
@@ -328,8 +321,6 @@ SbiConstDef* SbiSymDef::GetConstDef()
return NULL;
}
-// Wenn der Name benoetigt wird, den aktuellen Namen
-// aus dem Stringpool nehmen
const String& SbiSymDef::GetName()
{
@@ -338,7 +329,6 @@ const String& SbiSymDef::GetName()
return aName;
}
-// Eintragen eines Datentyps
void SbiSymDef::SetType( SbxDataType t )
{
@@ -358,9 +348,8 @@ void SbiSymDef::SetType( SbxDataType t )
eType = t;
}
-// Aufbau einer Backchain, falls noch nicht definiert
-// Es wird der Wert zurueckgeliefert, der als Operand gespeichert
-// werden soll.
+// construct a backchain, if not yet defined
+// the value that shall be stored as an operand is returned
sal_uInt32 SbiSymDef::Reference()
{
@@ -373,8 +362,6 @@ sal_uInt32 SbiSymDef::Reference()
else return nChain;
}
-// Definition eines Symbols.
-// Hier wird der Backchain aufgeloest, falls vorhanden
sal_uInt32 SbiSymDef::Define()
{
@@ -386,13 +373,13 @@ sal_uInt32 SbiSymDef::Define()
return nChain;
}
-// Eine Symboldefinition kann einen eigenen Pool haben. Dies ist
-// der Fall bei Objekten und Prozeduren (lokale Variable)
+// A symbol definition may have its own pool. This is the caseDies ist
+// for objects and procedures (local variable)
SbiSymPool& SbiSymDef::GetPool()
{
if( !pPool )
- pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // wird gedumpt
+ pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // is dumped
return *pPool;
}
@@ -402,22 +389,22 @@ SbiSymScope SbiSymDef::GetScope() const
}
-// Die Prozedur-Definition hat drei Pools:
-// 1) aParams: wird durch die Definition gefuellt. Enthaelt die Namen
-// der Parameter, wie sie innerhalb des Rumpfes verwendet werden.
-// Das erste Element ist der Returnwert.
-// 2) pPool: saemtliche lokale Variable
-// 3) aLabels: Labels
+// The procedure definition has three pools:
+// 1) aParams: is filled by the definition. Contains the
+// parameters' names, like they're used inside the body.
+// The first element is the return value.
+// 2) pPool: all local variables
+// 3) aLabels: labels
SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
sal_Bool bProcDecl )
: SbiSymDef( rName )
- , aParams( pParser->aGblStrings, SbPARAM ) // wird gedumpt
- , aLabels( pParser->aLclStrings, SbLOCAL ) // wird nicht gedumpt
+ , aParams( pParser->aGblStrings, SbPARAM ) // is dumped
+ , aLabels( pParser->aLclStrings, SbLOCAL ) // is not dumped
, mbProcDecl( bProcDecl )
{
aParams.SetParent( &pParser->aPublics );
- pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); // Locals
+ pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL );
pPool->SetParent( &aParams );
nLine1 =
nLine2 = 0;
@@ -425,8 +412,8 @@ SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
bPublic = sal_True;
bCdecl = sal_False;
bStatic = sal_False;
- // Fuer Returnwerte ist das erste Element der Parameterliste
- // immer mit dem Namen und dem Typ der Proc definiert
+ // For return values the first element of the parameter
+ // list is always defined with name and type of the proc
aParams.AddSym( aName );
}
@@ -444,30 +431,29 @@ void SbiProcDef::SetType( SbxDataType t )
aParams.Get( 0 )->SetType( eType );
}
-// Match mit einer Forward-Deklaration
-// Falls der Match OK ist, wird pOld durch this im Pool ersetzt
-// pOld wird immer geloescht!
+// match with a forward-declaration
+// if the match is OK, pOld is replaced by this in the pool
+// pOld is deleted in any case!
void SbiProcDef::Match( SbiProcDef* pOld )
{
SbiSymDef* po, *pn=NULL;
- // Parameter 0 ist der Funktionsname
+ // parameter 0 is the function name
sal_uInt16 i;
for( i = 1; i < aParams.GetSize(); i++ )
{
po = pOld->aParams.Get( i );
pn = aParams.Get( i );
- // Kein Typabgleich; das wird beim Laufen erledigt
- // aber ist sie evtl. mit zu wenigen Parametern aufgerufen
- // worden?
+ // no type matching - that is done during running
+ // but is it maybe called with too little parameters?
if( !po && !pn->IsOptional() && !pn->IsParamArray() )
break;
po = pOld->aParams.Next();
}
- // Wurden zu viele Parameter angegeben?
+
if( pn && i < aParams.GetSize() && pOld->pIn )
{
- // Die ganze Zeile markieren
+ // mark the whole line
pOld->pIn->GetParser()->SetCol1( 0 );
pOld->pIn->GetParser()->Error( SbERR_BAD_DECLARATION, aName );
}
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index df387eabc102..1027d5b683a9 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -34,11 +34,11 @@
struct TokenTable { SbiToken t; const char *s; };
-static short nToken; // Anzahl der Tokens
+static short nToken; // number of tokens
static TokenTable* pTokTable;
-static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
+static TokenTable aTokTable_Basic [] = {
{ CAT, "&" },
{ MUL, "*" },
@@ -119,7 +119,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ IMP, "Imp" },
{ IMPLEMENTS, "Implements" },
{ _IN_, "In" },
- { INPUT, "Input" }, // auch INPUT #
+ { INPUT, "Input" }, // also INPUT #
{ TINTEGER, "Integer" },
{ IS, "Is" },
{ LET, "Let" },
@@ -188,7 +188,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ WHILE, "While" },
{ WITH, "With" },
{ WITHEVENTS, "WithEvents" },
- { WRITE, "Write" }, // auch WRITE #
+ { WRITE, "Write" }, // also WRITE #
{ XOR, "Xor" },
{ NIL, "" }
};
@@ -217,7 +217,7 @@ TokenLabelInfo::~TokenLabelInfo()
}
-// Der Konstruktor ermittelt die Laenge der Token-Tabelle.
+// the constructor detects the length of the token table
SbiTokenizer::SbiTokenizer( const ::rtl::OUString& rSrc, StarBASIC* pb )
: SbiScanner( rSrc, pb )
@@ -236,7 +236,6 @@ SbiTokenizer::~SbiTokenizer()
{
}
-// Wiederablage (Pushback) eines Tokens. (Bis zu 2 Tokens)
void SbiTokenizer::Push( SbiToken t )
{
@@ -263,7 +262,7 @@ void SbiTokenizer::Error( SbError code, SbiToken tok )
Error( code );
}
-// Einlesen des naechsten Tokens, ohne dass das Token geschluckt wird
+// reading in the next token without absorbing it
SbiToken SbiTokenizer::Peek()
{
@@ -280,12 +279,11 @@ SbiToken SbiTokenizer::Peek()
return eCurTok = ePush;
}
-// Dies ist fuer die Decompilation.
-// Zahlen und Symbole liefern einen Leerstring zurueck.
+// For decompilation. Numbers and symbols return an empty string.
const String& SbiTokenizer::Symbol( SbiToken t )
{
- // Zeichen-Token?
+ // character token?
if( t < FIRSTKWD )
{
aSym = (char) t;
@@ -312,15 +310,15 @@ const String& SbiTokenizer::Symbol( SbiToken t )
return aSym;
}
-// Einlesen des naechsten Tokens und Ablage desselben
-// Tokens, die nicht in der Token-Tabelle vorkommen, werden
-// direkt als Zeichen zurueckgeliefert.
-// Einige Worte werden gesondert behandelt.
+// Reading in the next token and put it down.
+// Tokens that don't appear in the token table
+// are directly returned as a character.
+// Some words are treated in a special way.
SbiToken SbiTokenizer::Next()
{
if (bEof) return EOLN;
- // Schon eines eingelesen?
+ // have read in one already?
if( ePush != NIL )
{
eCurTok = ePush;
@@ -333,40 +331,35 @@ SbiToken SbiTokenizer::Next()
}
TokenTable *tp;
- // Sonst einlesen:
if( !NextSym() )
{
bEof = bEos = sal_True;
return eCurTok = EOLN;
}
- // Zeilenende?
+
if( aSym.GetBuffer()[0] == '\n' )
{
bEos = sal_True; return eCurTok = EOLN;
}
bEos = sal_False;
- // Zahl?
if( bNumber )
return eCurTok = NUMBER;
- // String?
else if( ( eScanType == SbxDATE || eScanType == SbxSTRING ) && !bSymbol )
return eCurTok = FIXSTRING;
- // Sonderfaelle von Zeichen, die zwischen "Z" und "a" liegen. ICompare()
- // wertet die Position dieser Zeichen unterschiedlich aus.
+ // Special cases of characters that are between "Z" and "a". ICompare()
+ // evaluates the position of these characters in different ways.
else if( aSym.GetBuffer()[0] == '^' )
return eCurTok = EXPON;
else if( aSym.GetBuffer()[0] == '\\' )
return eCurTok = IDIV;
else
{
- // Mit Typkennung oder ein Symbol und keine Keyword-Erkennung?
- // Dann kein Token-Test
if( eScanType != SbxVARIANT
|| ( !bKeywords && bSymbol ) )
return eCurTok = SYMBOL;
- // Gueltiges Token?
+ // valid token?
short lb = 0;
short ub = nToken-1;
short delta;
@@ -375,23 +368,23 @@ SbiToken SbiTokenizer::Next()
delta = (ub - lb) >> 1;
tp = &pTokTable[ lb + delta ];
StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s );
- // Gefunden?
+
if( res == COMPARE_EQUAL )
goto special;
- // Groesser? Dann untere Haelfte
+
if( res == COMPARE_LESS )
{
if ((ub - lb) == 2) ub = lb;
else ub = ub - delta;
}
- // Kleiner? Dann obere Haelfte
+
else
{
if ((ub -lb) == 2) lb = ub;
else lb = lb + delta;
}
} while( delta );
- // Symbol? Wenn nicht >= Token
+ // Symbol? if not >= token
sal_Unicode ch = aSym.GetBuffer()[0];
if( !BasicSimpleCharClass::isAlpha( ch, bCompatible ) && !bSymbol )
return eCurTok = (SbiToken) (ch & 0x00FF);
@@ -410,14 +403,14 @@ special:
// END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH
if( tp->t == END )
{
- // AB, 15.3.96, Spezialbehandlung fuer END, beim Peek() geht die
- // aktuelle Zeile verloren, daher alles merken und danach restaurieren
+ // from 15.3.96, special treatment for END, at Peek() the current
+ // time is lost, so memorize everything and restore after
sal_uInt16 nOldLine = nLine;
sal_uInt16 nOldCol = nCol;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
String aOldSym = aSym;
- SaveLine(); // pLine im Scanner sichern
+ SaveLine(); // save pLine in the scanner
eCurTok = Peek();
switch( eCurTok )
@@ -435,21 +428,20 @@ special:
nCol1 = nOldCol1;
if( eCurTok == END )
{
- // Alles zuruecksetzen, damit Token nach END ganz neu gelesen wird
+ // reset everything so that token is read completely newly after END
ePush = NIL;
nLine = nOldLine;
nCol = nOldCol;
nCol2 = nOldCol2;
aSym = aOldSym;
- RestoreLine(); // pLine im Scanner restaurieren
+ RestoreLine();
}
return eCurTok;
}
- // Sind Datentypen Keywords?
- // Nur nach AS, sonst sind es Symbole!
- // Es gibt ja ERROR(), DATA(), STRING() etc.
+ // are data types keywords?
+ // there is ERROR(), DATA(), STRING() etc.
eCurTok = tp->t;
- // AS: Datentypen sind Keywords
+ // AS: data types are keywords
if( tp->t == AS )
bAs = sal_True;
else
@@ -493,7 +485,6 @@ special:
#pragma optimize("",off)
#endif
-// Kann das aktuell eingelesene Token ein Label sein?
sal_Bool SbiTokenizer::MayBeLabel( sal_Bool bNeedsColon )
{
@@ -541,7 +532,7 @@ void SbiTokenizer::Hilite( SbTextPortions& rList )
else
aRes.eType = SB_PUNCTUATION;
}
- // Die Folge xxx.Keyword sollte nicht als Kwd geflagt werden
+ // the sequence xxx.Keyword should not be flagged as Kwd
if( aRes.eType == SB_KEYWORD
&& ( eLastTok == DOT|| eLastTok == EXCLAM ) )
aRes.eType = SB_SYMBOL;
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx
index 24c4bc002f60..db4d5c813194 100644
--- a/basic/source/inc/buffer.hxx
+++ b/basic/source/inc/buffer.hxx
@@ -34,29 +34,29 @@
class SbiParser;
-class SbiBuffer { // Code/Konstanten-Puffer:
- SbiParser* pParser; // fuer Fehlermeldungen
- char* pBuf; // Puffer-Pointer
- char* pCur; // aktueller Puffer-Pointer
- sal_uInt32 nOff; // aktuelles Offset
- sal_uInt32 nSize; // aktuelle Groesse
- short nInc; // Inkrement
- sal_Bool Check( sal_uInt16 ); // Buffergroesse testen
+class SbiBuffer {
+ SbiParser* pParser; // for error messages
+ char* pBuf;
+ char* pCur;
+ sal_uInt32 nOff;
+ sal_uInt32 nSize;
+ short nInc;
+ sal_Bool Check( sal_uInt16 );
public:
- SbiBuffer( SbiParser*, short ); // Inkrement
+ SbiBuffer( SbiParser*, short ); // increment
~SbiBuffer();
- void Patch( sal_uInt32, sal_uInt32 ); // Patchen
- void Chain( sal_uInt32 ); // Back-Chain
- void Align( sal_Int32 ); // Alignment
- sal_Bool Add( const void*, sal_uInt16 );// Element anfuegen
- sal_Bool operator += (const String&);// Basic-String speichern
- sal_Bool operator += (sal_Int8); // Zeichen speichern
- sal_Bool operator += (sal_Int16); // Integer speichern
- sal_Bool operator += (sal_uInt8); // Zeichen speichern
- sal_Bool operator += (sal_uInt16); // Integer speichern
- sal_Bool operator += (sal_uInt32); // Integer speichern
- sal_Bool operator += (sal_Int32); // Integer speichern
- char* GetBuffer(); // Puffer rausgeben (selbst loeschen!)
+ void Patch( sal_uInt32, sal_uInt32 );
+ void Chain( sal_uInt32 );
+ void Align( sal_Int32 );
+ sal_Bool Add( const void*, sal_uInt16 );
+ sal_Bool operator += (const String&); // save basic-string
+ sal_Bool operator += (sal_Int8); // save character
+ sal_Bool operator += (sal_Int16); // save integer
+ sal_Bool operator += (sal_uInt8); // save character
+ sal_Bool operator += (sal_uInt16); // save integer
+ sal_Bool operator += (sal_uInt32); // save integer
+ sal_Bool operator += (sal_Int32); // save integer
+ char* GetBuffer(); // give out buffer (delete yourself!)
char* GetBufferPtr(){ return pBuf; }
sal_uInt32 GetSize() { return nOff; }
};
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx
index 0f5699803945..ced319c4ce22 100644
--- a/basic/source/inc/codegen.hxx
+++ b/basic/source/inc/codegen.hxx
@@ -35,13 +35,13 @@ class SbModule;
#include "opcodes.hxx"
#include "buffer.hxx"
-class SbiCodeGen { // Code-Erzeugung:
- SbiParser* pParser; // fuer Fehlermeldungen, Line, Column etc.
- SbModule& rMod; // aktuelles Modul
- SbiBuffer aCode; // Code-Puffer
- short nLine, nCol; // Zeile, Spalte fuer Stmnt-Befehl
- short nForLevel; // #29955 for-Schleifen-Ebene
- sal_Bool bStmnt; // sal_True: Statement-Opcode liegt an
+class SbiCodeGen {
+ SbiParser* pParser; // for error messages, line, column etc.
+ SbModule& rMod;
+ SbiBuffer aCode;
+ short nLine, nCol; // for stmnt command
+ short nForLevel; // #29955
+ sal_Bool bStmnt; // sal_True: statement-opcode is pending
public:
SbiCodeGen( SbModule&, SbiParser*, short );
SbiParser* GetParser() { return pParser; }
@@ -52,12 +52,12 @@ public:
void Patch( sal_uInt32 o, sal_uInt32 v ){ aCode.Patch( o, v ); }
void BackChain( sal_uInt32 off ) { aCode.Chain( off ); }
void Statement();
- void GenStmnt(); // evtl. Statement-Opcode erzeugen
+ void GenStmnt(); // create statement-opcode maybe
sal_uInt32 GetPC();
sal_uInt32 GetOffset() { return GetPC() + 1; }
void Save();
- // #29955 for-Schleifen-Ebene pflegen
+ // #29955 service for-loop-level
void IncForLevel( void ) { nForLevel++; }
void DecForLevel( void ) { nForLevel--; }
diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx
index 2c39e711f993..8465fd4e462d 100644
--- a/basic/source/inc/collelem.hxx
+++ b/basic/source/inc/collelem.hxx
@@ -31,10 +31,10 @@
#include <basic/sbxobj.hxx>
-// Das Sample-Element ist ein kleines Objekt, das die Properties
-// Name und Value enthlt sowie die Methode Say, die den bergebenen
-// Text mit dem eigenen Namen verkoppelt. Der Name ist von aussen setzbar.
-// Die Implementation arbeitet ausschliesslich mit dynamischen Elementen.
+// The sample-element is a small object that contains the
+// properties name and value and the method Say which couples
+// the passed text with its own name. The name can be set from
+// outside. Implementation works with dynamic elements only.
class SampleElement : public SbxObject
{
diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx
index dbb951a9785a..c1f42e90c567 100644
--- a/basic/source/inc/disas.hxx
+++ b/basic/source/inc/disas.hxx
@@ -37,19 +37,19 @@ class SvStream;
class SbiDisas {
const SbiImage& rImg;
SbModule* pMod;
- char cLabels[ MAX_LABELS ]; // Bitvektor fuer Labels
- sal_uInt32 nOff; // aktuelle Position
- sal_uInt32 nPC; // Position des Opcodes
- SbiOpcode eOp; // Opcode
- sal_uInt32 nOp1, nOp2; // Operanden
- sal_uInt32 nParts; // 1, 2 oder 3
- sal_uInt32 nLine; // aktuelle Zeile
+ char cLabels[ MAX_LABELS ]; // bit vector for labels
+ sal_uInt32 nOff; // current position
+ sal_uInt32 nPC; // position of the opcode
+ SbiOpcode eOp; // opcode
+ sal_uInt32 nOp1, nOp2; // operands
+ sal_uInt32 nParts; // 1, 2 or 3
+ sal_uInt32 nLine; // current line
sal_Bool DisasLine( String& );
- sal_Bool Fetch(); // naechster Opcode
+ sal_Bool Fetch(); // next opcode
public:
SbiDisas( SbModule*, const SbiImage* );
void Disas( String& );
- // NICHT AUFRUFEN
+ // DO NOT CALL
void StrOp( String& );
void Str2Op( String& );
void ImmOp( String& );
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 0ae218d14c18..3cc12b0adfc6 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -46,10 +46,10 @@ class SbiProcDef;
#include <vector>
typedef ::std::vector<SbiExprList*> SbiExprListVector;
-struct SbVar { // Variablen-Element:
- SbiExprNode* pNext; // Weiteres Element (bei Strukturen)
- SbiSymDef* pDef; // Symboldefinition
- SbiExprList* pPar; // optionale Parameter (wird geloescht)
+struct SbVar {
+ SbiExprNode* pNext; // next element (for structures)
+ SbiSymDef* pDef; // symbol definition
+ SbiExprList* pPar; // optional parameters (is deleted)
SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])...
};
@@ -60,11 +60,11 @@ struct KeywordSymbolInfo
SbiToken m_eTok;
};
-enum SbiExprType { // Expression-Typen:
- SbSTDEXPR, // normaler Ausdruck
- SbLVALUE, // beliebiger lValue
- SbSYMBOL, // beliebiges zusammengesetztes Symbol
- SbOPERAND // Variable/Funktion
+enum SbiExprType { // expression types:
+ SbSTDEXPR, // normal expression
+ SbLVALUE, // any lValue
+ SbSYMBOL, // any composite symbol
+ SbOPERAND // variable/function
};
enum SbiExprMode { // Expression context:
@@ -79,9 +79,9 @@ enum SbiExprMode { // Expression context:
};
enum SbiNodeType {
- SbxNUMVAL, // nVal = Wert
- SbxSTRVAL, // aStrVal = Wert, before #i59791/#i45570: nStringId = Wert
- SbxVARVAL, // aVar = Wert
+ SbxNUMVAL, // nVal = value
+ SbxSTRVAL, // aStrVal = value, before #i59791/#i45570: nStringId = value
+ SbxVARVAL, // aVar = value
SbxTYPEOF, // TypeOf ObjExpr Is Type
SbxNODE, // Node
SbxNEW, // new <type> expression
@@ -95,37 +95,37 @@ enum RecursiveMode
PREVENT_CALL
};
-class SbiExprNode { // Operatoren (und Operanden)
+class SbiExprNode { // operators (and operands)
friend class SbiExpression;
friend class SbiConstExpression;
union {
- sal_uInt16 nTypeStrId; // gepoolter String-ID, #i59791/#i45570 Now only for TypeOf
- double nVal; // numerischer Wert
- SbVar aVar; // oder Variable
+ sal_uInt16 nTypeStrId; // pooled String-ID, #i59791/#i45570 Now only for TypeOf
+ double nVal; // numeric value
+ SbVar aVar; // or variable
};
String aStrVal; // #i59791/#i45570 Store string directly
- SbiExprNode* pLeft; // linker Zweig
- SbiExprNode* pRight; // rechter Zweig (NULL bei unaeren Ops)
- SbiExprNode* pWithParent; // Knoten, dessen Member this per with ist
- SbiCodeGen* pGen; // Code-Generator
- SbiNodeType eNodeType; // Art des Nodes
- SbxDataType eType; // aktueller Datentyp
- SbiToken eTok; // Token des Operators
- sal_Bool bComposite; // sal_True: Zusammengesetzter Ausdruck
- sal_Bool bError; // sal_True: Fehlerhaft
- void FoldConstants(); // Constant Folding durchfuehren
- void CollectBits(); // Umwandeln von Zahlen in Strings
- sal_Bool IsOperand() // sal_True, wenn Operand
+ SbiExprNode* pLeft; // right branch
+ SbiExprNode* pRight; // right branch (NULL for unary ops)
+ SbiExprNode* pWithParent; // node, whose member is "this per with"
+ SbiCodeGen* pGen; // code-generator
+ SbiNodeType eNodeType;
+ SbxDataType eType;
+ SbiToken eTok;
+ sal_Bool bComposite; // sal_True: composite expression
+ sal_Bool bError; // sal_True: error
+ void FoldConstants();
+ void CollectBits(); // converting numbers to strings
+ sal_Bool IsOperand()
{ return sal_Bool( eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW ); }
sal_Bool IsTypeOf()
{ return sal_Bool( eNodeType == SbxTYPEOF ); }
sal_Bool IsNew()
{ return sal_Bool( eNodeType == SbxNEW ); }
- sal_Bool IsNumber(); // sal_True bei Zahlen
- sal_Bool IsString(); // sal_True bei Strings
- sal_Bool IsLvalue(); // sal_True, falls als Lvalue verwendbar
- void GenElement( SbiOpcode ); // Element
- void BaseInit( SbiParser* p ); // Hilfsfunktion fuer Ctor, AB 17.12.95
+ sal_Bool IsNumber();
+ sal_Bool IsString();
+ sal_Bool IsLvalue(); // sal_True, if usable as Lvalue
+ void GenElement( SbiOpcode );
+ void BaseInit( SbiParser* p ); // help function for Ctor, from 17.12.95
public:
SbiExprNode( void );
SbiExprNode( SbiParser*, double, SbxDataType );
@@ -137,10 +137,10 @@ public:
virtual ~SbiExprNode();
sal_Bool IsValid() { return sal_Bool( !bError ); }
- sal_Bool IsConstant() // sal_True bei konstantem Operanden
+ sal_Bool IsConstant() // sal_True constant operand
{ return sal_Bool( eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL ); }
- sal_Bool IsIntConst(); // sal_True bei Integer-Konstanten
- sal_Bool IsVariable(); // sal_True, wenn Variable
+ sal_Bool IsIntConst();
+ sal_Bool IsVariable();
SbiExprNode* GetWithParent() { return pWithParent; }
void SetWithParent( SbiExprNode* p ) { pWithParent = p; }
@@ -148,33 +148,33 @@ public:
SbxDataType GetType() { return eType; }
void SetType( SbxDataType eTp ) { eType = eTp; }
SbiNodeType GetNodeType() { return eNodeType; }
- SbiSymDef* GetVar(); // Variable (falls vorhanden)
- SbiSymDef* GetRealVar(); // letzte Variable in x.y.z
- SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z
- short GetDepth(); // Tiefe eines Baumes berechnen
+ SbiSymDef* GetVar();
+ SbiSymDef* GetRealVar(); // last variable in x.y.z
+ SbiExprNode* GetRealNode(); // last node in x.y.z
+ short GetDepth(); // compute a tree's depth
const String& GetString() { return aStrVal; }
short GetNumber() { return (short)nVal; }
SbiExprList* GetParameters() { return aVar.pPar; }
SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
- void Optimize(); // Baumabgleich
+ void Optimize(); // tree matching
- void Gen( RecursiveMode eRecMode = UNDEFINED ); // Ausgabe eines Nodes
+ void Gen( RecursiveMode eRecMode = UNDEFINED ); // giving out a node
};
-class SbiExpression { // der Ausdruck:
+class SbiExpression {
friend class SbiExprList;
friend class SbiParameters;
friend class SbiDimList;
protected:
- String aArgName; // Name fuer bananntes Argument
- SbiParser* pParser; // fuer Fehlermeldungen, Parsing
- SbiExpression* pNext; // Link bei Parameterlisten
- SbiExprNode* pExpr; // Der Expression-Baum
- SbiExprType eCurExpr; // Art des Ausdrucks
- SbiExprMode m_eMode; // Expression context
- sal_Bool bBased; // sal_True: einfacher DIM-Teil (+BASE)
- sal_Bool bError; // sal_True: Fehler
+ String aArgName;
+ SbiParser* pParser;
+ SbiExpression* pNext; // link at parameter lists
+ SbiExprNode* pExpr; // expression tree
+ SbiExprType eCurExpr; // type of expression
+ SbiExprMode m_eMode; // expression context
+ sal_Bool bBased; // sal_True: easy DIM-part (+BASE)
+ sal_Bool bError;
sal_Bool bByVal; // sal_True: ByVal-Parameter
sal_Bool bBracket; // sal_True: Parameter list with brackets
sal_uInt16 nParenLevel;
@@ -199,11 +199,11 @@ protected:
SbiExprNode* Boolean();
public:
SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR,
- SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Parsender Ctor
+ SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // parsing Ctor
SbiExpression( SbiParser*, const String& );
SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
- SbiExpression( SbiParser*, SbiToken ); // Spezial-Expr mit Spezial-Tokens
+ SbiExpression( SbiParser*, SbiToken ); // special expr with special tokens
~SbiExpression();
String& GetName() { return aArgName; }
void SetBased() { bBased = sal_True; }
@@ -222,14 +222,14 @@ public:
SbiExprNode* GetExprNode() { return pExpr; }
SbxDataType GetType() { return pExpr->GetType(); }
void SetType( SbxDataType eType){ pExpr->eType = eType; }
- void Gen( RecursiveMode eRecMode = UNDEFINED ); // Ausgabe eines Nodes
+ void Gen( RecursiveMode eRecMode = UNDEFINED );
};
class SbiConstExpression : public SbiExpression {
double nVal;
String aVal;
SbxDataType eType;
-public: // numerische Konstante
+public: // numeric constant
SbiConstExpression( SbiParser* );
SbxDataType GetType() { return eType; }
const String& GetString() { return aVal; }
@@ -237,14 +237,14 @@ public: // numerische Konstante
short GetShortValue();
};
-class SbiExprList { // Basisklasse fuer Parameter und Dims
+class SbiExprList { // base class for parameters and dims
protected:
- SbiParser* pParser; // Parser
- SbiExpression* pFirst; // Expressions
- short nExpr; // Anzahl Expressions
- short nDim; // Anzahl Dimensionen
- sal_Bool bError; // sal_True: Fehler
- sal_Bool bBracket; // sal_True: Klammern
+ SbiParser* pParser;
+ SbiExpression* pFirst;
+ short nExpr;
+ short nDim;
+ sal_Bool bError;
+ sal_Bool bBracket;
public:
SbiExprList( SbiParser* );
virtual ~SbiExprList();
@@ -253,20 +253,20 @@ public:
short GetSize() { return nExpr; }
short GetDims() { return nDim; }
SbiExpression* Get( short );
- sal_Bool Test( const SbiProcDef& ); // Parameter-Checks
- void Gen(); // Code-Erzeugung
+ sal_Bool Test( const SbiProcDef& ); // parameter checks
+ void Gen(); // code generation
void addExpression( SbiExpression* pExpr );
};
class SbiParameters : public SbiExprList {
public:
- SbiParameters( SbiParser*, sal_Bool bConst = sal_False, sal_Bool bPar = sal_True);// parsender Ctor
+ SbiParameters( SbiParser*, sal_Bool bConst = sal_False, sal_Bool bPar = sal_True);// parsing Ctor
};
class SbiDimList : public SbiExprList {
- sal_Bool bConst; // sal_True: Alles sind Integer-Konstanten
+ sal_Bool bConst; // sal_True: everything integer constants
public:
- SbiDimList( SbiParser* ); // Parsender Ctor
+ SbiDimList( SbiParser* ); // parsing Ctor
sal_Bool IsConstant() { return bConst; }
};
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
index caf6131aa9dd..2206106d6907 100644
--- a/basic/source/inc/filefmt.hxx
+++ b/basic/source/inc/filefmt.hxx
@@ -33,36 +33,36 @@
class SvStream;
-// Version 2: Datentyp des Returnwerts fuer Publics
-// Version 3: neue Opcodes
-// Version 4: neue Opcodes
-// Version 5: Bug (Ansprung von STATIC-Variablen im Init-Code)
-// Version 6: Neue Opcodes und Bug (Globals anlegen, ohne BASIC zu beenden)
-// Version 7: Korrektur im WITH-Parsing
-// Version 8: Korrektur im IF-Parsing
-// Version 9: Init-Code auch mit LEAVE beenden, wenn keine SUB/FUNCTION folgt
-// Version A: #36374 Bei DIM AS NEW... auch Variablen anlegen
-// Version B: #40689 Static umgestellt
-// Version C: #41606 Bug bei Static
-// Version D: #42678 Bug bei RTL-Function spc
-// Version E: #56204 DCREATE, um auch bei DIM AS NEW Arrays anzulegen
-// Version F: #57844 Einfuehrung von SvNumberformat::StringToDouble
-// Version 10: #29955 For-Schleifen-Level in Statement-PCodes generieren
-// Version 11: #29955 Wegen Build-Inkonsistenzen Neu-Compilieren erzwingen
+// Version 2: data type of the return value for publics
+// Version 3: new opcodes
+// Version 4: new opcodes
+// Version 5: bug (entry of STATIC-variables in the init code)
+// Version 6: new opcodes and bug (construct globals, without ending the BASIC)
+// Version 7: correction concerning the WITH-Parsing
+// Version 8: correction concerning the IF-Parsing
+// Version 9: end init code with LEAVE, too, if no SUB/FUNCTION follows
+// Version A: #36374 at DIM AS NEW... construct variable too
+// Version B: #40689 reorganized static
+// Version C: #41606 bug at static
+// Version D: #42678 bug at RTL-function spc
+// Version E: #56204 DCREATE, to also construct arrays at DIM AS NEW
+// Version F: #57844 introduction of SvNumberformat::StringToDouble
+// Version 10: #29955 generate for-loop-level in Statement-PCodes
+// Version 11: #29955 force anew compilation because of build-inconsistences
#define B_LEGACYVERSION 0x00000011L
#define B_CURVERSION 0x00000012L
#define B_EXT_IMG_VERSION 0x00000012L
-// Eine Datei enthaelt entweder einen Modul- oder einen Library-Record.
-// Diese Records enthalten wiederum weitere Records. Jeder Record hat
-// den folgenden Header:
+// The file contains either a module- or a library-record.
+// Those records contain further records. Every record's got
+// the following header:
-// sal_uInt16 Kennung
-// sal_uInt32 Laenge des Records ohne Header
-// sal_uInt16 Anzahl Unterelemente
+// sal_uInt16 identifier
+// sal_uInt32 the record's length without the header
+// sal_uInt16 number of sub-elements
-// Alle Datei-Offsets in Records sind relativ zum Start des Moduls!
+// all the file-offsets in records are relative to the module's start!
#define B_LIBRARY 0x4C42 // BL Library Record
#define B_MODULE 0x4D42 // BM Module Record
@@ -84,92 +84,92 @@ class SvStream;
#define B_EXTSOURCE 0x5345 // ES extended source
#endif
-// Ein Library Record enthaelt nur Module Records
-// sal_uInt16 Kennung BL
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl Module
+// A library record contains only module records
+// sal_uInt16 identifier BL
+// sal_uInt32 the record's length
+// sal_uInt16 number of modules
-// Ein Modul-Record enthaelt alle anderen Recordtypen
-// sal_uInt16 Kennung BM
-// sal_uInt32 Laenge des Records
+// A module-record contains all the other record types
+// sal_uInt16 identifier BM
+// sal_uInt32 the record's length
// sal_uInt16 1
-// Daten:
-// sal_uInt32 Versionsnummer
-// sal_uInt32 Zeichensatz
-// sal_uInt32 Startadresse Initialisierungscode
-// sal_uInt32 Startadresse Sub Main
-// sal_uInt32 Reserviert
-// sal_uInt32 Reserviert
-
-// Modulname, Kommentar und Quellcode:
-// sal_uInt16 Kennung MN, MC oder SC
-// sal_uInt32 Laenge des Records
+// Data:
+// sal_uInt32 version number
+// sal_uInt32 character set
+// sal_uInt32 starting address initialisation code
+// sal_uInt32 starting address sub main
+// sal_uInt32 reserved
+// sal_uInt32 reserved
+
+// module name, comment and source code:
+// sal_uInt16 identifier MN, MC or SC
+// sal_uInt32 the record's length
// sal_uInt16 1
-// Daten:
-// String-Instanz
+// Data:
+// string instance
// P-Code:
-// sal_uInt16 Kennung PC
-// sal_uInt32 Laenge des Records
+// sal_uInt16 identifier PC
+// sal_uInt32 the record's length
// sal_uInt16 1
-// Daten:
-// Der P-Code als Bytesack
-
-// Alle Symbole und Strings werden in einem String-Pool gehalten.
-// Verweise auf diese Strings sind in Form eines Indexes in diesen Pool.
-
-// Liste aller Publics:
-// sal_uInt16 Kennung PU oder Pu
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl der Publics
-// Daten fuer jeden Public-Eintrag:
-// sal_uInt16 String-Index
-// sal_uInt32 Startadresse im P-Code-Image (sal_uInt16 fuer alte Publics)
-// sal_uInt16 Datentyp des Returnwertes (ab Version 2)
-
-// Verzeichnis der Symbol-Tabellen:
-// sal_uInt16 Kennung SP
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl der Symboltabellen
-// Daten fuer jede Symboltabelle:
-// sal_uInt16 Stringindex des Namens
-// sal_uInt16 Anzahl Symbole
-// sal_uInt16 Scope-Kennung
-
-// Symboltabelle:
-// sal_uInt16 Kennung SY
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl der Symbole
-// Daten:
-// sal_uInt16 Stringindex des Namens
-// sal_uInt16 Anzahl Symbole
-// Daten fuer jedes Symbol:
-// sal_uInt16 Stringindex des Namens
-// sal_uInt16 Datentyp
-// sal_uInt16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable)
+// Data:
+// the P-Code as bytesack
+
+// All symbols and strings are kept in a string-pool.
+// References to these strings are in this pool in the form of an index.
+
+// List of all publics:
+// sal_uInt16 identifier PU or Pu
+// sal_uInt32 the record's length
+// sal_uInt16 number of publics
+// Data for every public-entry:
+// sal_uInt16 string index
+// sal_uInt32 starting address in the p-code-image (sal_uInt16 for old publics)
+// sal_uInt16 data type of the return value (from version 2)
+
+// Register of the symbol tables:
+// sal_uInt16 identifier SP
+// sal_uInt32 the record's length
+// sal_uInt16 number of symbol tables
+// Data for every symbol table:
+// sal_uInt16 stringindex of the name
+// sal_uInt16 number of symbols
+// sal_uInt16 scope identifier
+
+// symbol table:
+// sal_uInt16 identifier SY
+// sal_uInt32 the record's length
+// sal_uInt16 number of symbols
+// Data:
+// sal_uInt16 stringindex of the name
+// sal_uInt16 number of symbols
+// Data for every symbol:
+// sal_uInt16 stringindex of the name
+// sal_uInt16 data type
+// sal_uInt16 length for STRING*n-symbols (0x8000: STATIC variable)
// Stringpool:
-// sal_uInt16 Kennung ST
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl der Strings
-// Daten fuer jeden String:
-// sal_uInt32 Offset in den Block aller Strings
-// Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen.
-
-// Line Ranges:
-// sal_uInt16 Kennung LR
-// sal_uInt32 Laenge des Records
-// sal_uInt16 Anzahl der Strings
-// Daten fuer jedes Public:
+// sal_uInt16 identifier ST
+// sal_uInt32 the record's length
+// sal_uInt16 number of strings
+// Data for every string:
+// sal_uInt32 Offset in the block of all strings
+// the block of all strings (ASCIIZ) follows then
+
+// line ranges:
+// sal_uInt16 identifier LR
+// sal_uInt32 the record's length
+// sal_uInt16 number of strings
+// Data for every public:
// sal_uInt16 1. Zeile (Sub XXX)
// sal_uInt16 2. Zeile (End Sub)
-// SBX-Objekte:
-// sal_uInt16 Anzahl Objekte
-// .... Objektdaten
+// SBX-objects:
+// sal_uInt16 number of objects
+// .... object data
-// Service-Routinen (in IMAGE.CXX)
+// service routines (in IMAGE.CXX)
sal_Bool SbGood( SvStream& r );
sal_uIntPtr SbOpenRecord( SvStream&, sal_uInt16 nSignature, sal_uInt16 nElem );
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 0f0ffdf7df9a..f91d56f91e05 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -33,13 +33,13 @@
#include <rtl/ustring.hxx>
#include <filefmt.hxx>
-// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet
-// den Zugriff auf die einzelnen Elemente.
+// This class reads in the image that's been produced by the compiler
+// and manages the access to the single elements.
struct SbPublicEntry;
class SbiImage {
- friend class SbiCodeGen; // Compiler-Klassen, die die private-
+ friend class SbiCodeGen; // compiler classes, that the private-
SbxArrayRef rTypes; // User defined types
SbxArrayRef rEnums; // Enum types
@@ -47,35 +47,35 @@ class SbiImage {
sal_Unicode* pStrings; // StringPool
char* pCode; // Code-Image
char* pLegacyPCode; // Code-Image
- sal_Bool bError; // sal_True: Fehler
- sal_uInt16 nFlags; // Flags (s.u.)
- short nStrings; // Anzahl Strings
- sal_uInt32 nStringSize; // Groesse des String-Puffers
- sal_uInt32 nCodeSize; // Groesse des Code-Blocks
- sal_uInt16 nLegacyCodeSize; // Groesse des Code-Blocks
- sal_uInt16 nDimBase; // OPTION BASE-Wert
- rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings
- // temporaere Verwaltungs-Variable:
- short nStringIdx; // aktueller String-Index
- sal_uInt32 nStringOff; // aktuelle Pos im Stringpuffer
- // Routinen fuer Compiler:
- void MakeStrings( short ); // StringPool einrichten
- void AddString( const String& );// String zufuegen
- void AddCode( char*, sal_uInt32 ); // Codeblock dazu
- void AddType(SbxObject *); // User-Type mit aufnehmen
- void AddEnum(SbxObject *); // Register enum type
+ sal_Bool bError;
+ sal_uInt16 nFlags;
+ short nStrings;
+ sal_uInt32 nStringSize;
+ sal_uInt32 nCodeSize;
+ sal_uInt16 nLegacyCodeSize;
+ sal_uInt16 nDimBase; // OPTION BASE value
+ rtl_TextEncoding eCharSet;
+ // temporary management-variable:
+ short nStringIdx;
+ sal_uInt32 nStringOff; // current Pos in the stringbuffer
+ // routines for the compiler:
+ void MakeStrings( short ); // establish StringPool
+ void AddString( const String& );
+ void AddCode( char*, sal_uInt32 );
+ void AddType(SbxObject *);
+ void AddEnum(SbxObject *);
public:
- String aName; // Makroname
- ::rtl::OUString aOUSource; // Quellcode
- String aComment; // Kommentar
- sal_Bool bInit; // sal_True: Init-Code ist gelaufen
- sal_Bool bFirstInit; // sal_True, wenn das Image das erste mal nach
- // dem Compilieren initialisiert wird.
+ String aName; // macro name
+ ::rtl::OUString aOUSource; // source code
+ String aComment;
+ sal_Bool bInit;
+ sal_Bool bFirstInit;
+
SbiImage();
~SbiImage();
- void Clear(); // Inhalt loeschen
- sal_Bool Load( SvStream&, sal_uInt32& nVer ); // Loads image from stream
+ void Clear();
+ sal_Bool Load( SvStream&, sal_uInt32& nVer );
// nVer is set to version
// of image
sal_Bool Load( SvStream& );
@@ -100,9 +100,9 @@ public:
};
-#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT ist aktiv
-#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv
-#define SBIMG_INITCODE 0x0004 // Init-Code vorhanden
+#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT is active
+#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT is active
+#define SBIMG_INITCODE 0x0004 // Init-Code does exist
#define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
#endif
diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx
index 48d6ce39d506..f9e7319f0e4e 100644
--- a/basic/source/inc/iosys.hxx
+++ b/basic/source/inc/iosys.hxx
@@ -34,29 +34,28 @@
class SvStream;
-// Zur Zeit sind globale Dateien (Kanalnummern 256 bis 511)
-// nicht implementiert.
+// Global files (channel numbers 256 to 511) are not
+// implemented at the moment.
#define CHANNELS 256
#define CONSOLE 0
-#define SBSTRM_INPUT 0x0001 // Input
-#define SBSTRM_OUTPUT 0x0002 // Output
-#define SBSTRM_RANDOM 0x0004 // Random
-#define SBSTRM_APPEND 0x0008 // Append
-#define SBSTRM_BINARY 0x0010 // Binary
+#define SBSTRM_INPUT 0x0001
+#define SBSTRM_OUTPUT 0x0002
+#define SBSTRM_RANDOM 0x0004
+#define SBSTRM_APPEND 0x0008
+#define SBSTRM_BINARY 0x0010
class SbiStream {
- SvStream* pStrm; // der Stream
- sal_uIntPtr nExpandOnWriteTo; // bei Schreibzugriff, den Stream
- // bis zu dieser Groesse aufblasen
- ByteString aLine; // aktuelle Zeile
- sal_uIntPtr nLine; // aktuelle Zeilennummer
- short nLen; // Pufferlaenge
- short nMode; // Bits:
- short nChan; // aktueller Kanal
- SbError nError; // letzter Fehlercode
- void MapError(); // Fehlercode mappen
+ SvStream* pStrm;
+ sal_uIntPtr nExpandOnWriteTo; // during writing access expand the stream to this size
+ ByteString aLine;
+ sal_uIntPtr nLine;
+ short nLen; // buffer length
+ short nMode;
+ short nChan;
+ SbError nError;
+ void MapError();
public:
SbiStream();
@@ -82,10 +81,10 @@ public:
class SbiIoSystem {
SbiStream* pChan[ CHANNELS ];
- ByteString aPrompt; // Input-Prompt
- ByteString aIn, aOut; // Console-Buffer
- short nChan; // aktueller Kanal
- SbError nError; // letzter Fehlercode
+ ByteString aPrompt;
+ ByteString aIn, aOut;
+ short nChan;
+ SbError nError;
void ReadCon( ByteString& );
void WriteCon( const ByteString& );
public:
diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx
index 52af24b2b994..bf9440cacb44 100644
--- a/basic/source/inc/object.hxx
+++ b/basic/source/inc/object.hxx
@@ -34,27 +34,26 @@
#include <basic/sbxobj.hxx>
// 1) Properties:
-// Name der Name, R/O
-// Value ein double-Wert, R/W
-// 2) Methoden:
-// Display Ausgabe eines Textes
-// Square Argument * Argument
-// Event Aufruf eines Basic-Programms
-// 3) Unterobjekte:
-// eine Collection names "Elements". Der Zugriff ist sowohl als
-// Property (fuer das gesamte Objekt) als auch als Methode (fuer
-// einzelne Elemente, wird durchgereicht) implementiert.
-// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte
-// Version, die sehr viele Elemente enthalten kann.
-// Die Collection findet sich in COLLECTN.*, die in der Collection
-// enthaltenen Objekte in COLLELEM.*
+// Name R/O
+// Value a double-value, R/W
+// 2) Methods:
+// Display display a text
+// Square argument * argument
+// Event call of a Basic-program
+// 3) Sub-objects:
+// a collection named "elements". The access is implemented as
+// property (for the whole object) and as method (for single
+// elements, is passed through).
+// This implementation is an example for a table controlled
+// version that can contain many elements.
+// The collection is located in COLLECTN.*, the collection's
+// objects in COLLELEM.*
class SampleObject : 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
+ // methods and properties can be declared private that way.
#if defined ( ICC ) || defined ( C50 )
public:
#endif
@@ -65,30 +64,29 @@ private:
#endif
struct Methods {
- const char* pName; // Name des Eintrags
- SbxDataType eType; // Datentyp
- pMeth pFunc; // Function Pointer
- short nArgs; // Argumente und Flags
+ const char* pName; // name of an entry
+ SbxDataType eType; // data type
+ pMeth pFunc;
+ short nArgs; // arguments and flags
};
- static Methods aMethods[]; // Methodentabelle
+ static Methods aMethods[]; // method table
- // Methoden
+ // methods
void Display( SbxVariable*, SbxArray*, sal_Bool );
void Event( SbxVariable*, SbxArray*, sal_Bool );
void Square( SbxVariable*, SbxArray*, sal_Bool );
void Create( SbxVariable*, SbxArray*, sal_Bool );
- // Infoblock auffuellen
+ // fill infoblock
SbxInfo* GetInfo( short nIdx );
// Broadcaster Notification
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
public:
SampleObject( const String& );
- // Suchen eines Elements
+
virtual SbxVariable* Find( const String&, SbxClassType );
};
-// Die dazugehoerige Factory:
class SampleObjectFac : public SbxFactory
{
diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx
index 156ef8bd625a..bf8b20fb2942 100644
--- a/basic/source/inc/opcodes.hxx
+++ b/basic/source/inc/opcodes.hxx
@@ -31,60 +31,60 @@
#include "sbintern.hxx"
-// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen
-// Wert des Opcodes (s.u.).
+// An opcode can have a length of 1, 3 or 5 bytes,
+// depending on its numeric value (see below).
enum SbiOpcode {
- // Alle Opcodes ohne Operanden
+ // all opcodes without operands
_NOP = 0,
SbOP0_START = _NOP,
- // Operatoren
- // die folgenden Operatoren sind genauso angeordnet
- // wie der enum SbxVarOp
+ // operators
+ // the following operators are ordered
+ // the same way as the 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 of enum SbxVarOp
_LIKE, _IS,
- // Laden/speichern
- _ARGC, // neuen Argv einrichten
- _ARGV, // TOS ==> aktueller Argv
+ // load/save
+ _ARGC, // establish new Argv
+ _ARGV, // TOS ==> current Argv
_INPUT, // Input ==> TOS
_LINPUT, // Line Input ==> TOS
- _GET, // TOS anfassen
- _SET, // Speichern Objekt TOS ==> TOS-1
+ _GET, // touch TOS
+ _SET, // save object TOS ==> TOS-1
_PUT, // TOS ==> TOS-1
- _PUTC, // TOS ==> TOS-1, dann ReadOnly
+ _PUTC, // TOS ==> TOS-1, then 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
- _STDERROR, // Standard-Fehlerbehandlung
- _NOERROR, // keine Fehlerbehandlung
- _LEAVE, // UP verlassen
+ _ERASE, // delete TOS
+ // branch
+ _STOP, // end of program
+ _INITFOR, // initialize FOR-variable
+ _NEXT, // increment FOR-variable
+ _CASE, // beginning CASE
+ _ENDCASE, // end CASE
+ _STDERROR, // standard error handling
+ _NOERROR, // no error handling
+ _LEAVE, // leave UP
// E/A
- _CHANNEL, // TOS = Kanalnummer
+ _CHANNEL, // TOS = channel number
_BPRINT, // print TOS
_PRINTF, // print TOS in field
_BWRITE, // write TOS
_RENAME, // Rename Tos+1 to Tos
_PROMPT, // TOS = Prompt for Input
- _RESTART, // Restartpunkt definieren
- _CHAN0, // I/O-Kanal 0
- // Sonstiges
- _EMPTY, // Leeren Ausdruck auf Stack
- _ERROR, // TOS = Fehlercode
- _LSET, // Speichern Objekt TOS ==> TOS-1
- _RSET, // Speichern Objekt TOS ==> TOS-1
+ _RESTART, // define restart point
+ _CHAN0, // I/O-channel 0
+ // miscellaneous
+ _EMPTY, // empty expression on stack
+ _ERROR, // TOS = error code
+ _LSET, // saving object TOS ==> TOS-1
+ _RSET, // saving object TOS ==> TOS-1
_REDIMP_ERASE, // Copies array to be later used by REDIM PRESERVE before erasing it
_INITFOREACH,
_VBASET, // VBA-like Set
@@ -94,70 +94,70 @@ enum SbiOpcode {
SbOP0_END = _BYVAL,
- // Alle Opcodes mit einem Operanden
+ // all opcodes with one operand
- _NUMBER = 0x40, // Laden einer numerischen Konstanten (+ID)
+ _NUMBER = 0x40, // loading a numeric constant (+ID)
SbOP1_START = _NUMBER,
- _SCONST, // Laden einer Stringkonstanten (+ID)
- _CONST, // Immediate Load (+Wert)
- _ARGN, // Speichern eines named Args in Argv (+StringID)
- _PAD, // String auf feste Laenge bringen (+Laenge)
+ _SCONST, // loading a stringconstant (+ID)
+ _CONST, // Immediate Load (+ value)
+ _ARGN, // saving a named Arg in Argv (+StringID)
+ _PAD, // bring string to a firm length (+length)
// Verzweigungen
- _JUMP, // Sprung (+Target)
- _JUMPT, // TOS auswerten, bedingter Sprung (+Target)
- _JUMPF, // 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)
+ _JUMP, // jump (+target)
+ _JUMPT, // evaluate TOS, conditional jump (+target)
+ _JUMPF, // 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, // Fehler-Handler (+Offset)
- _RESUME, // Resume nach Fehlern (+0 or 1 or Label)
+ _ERRHDL, // error handler (+Offset)
+ _RESUME, // Resume after errors (+0 or 1 or Label)
// E/A
- _CLOSE, // (+Kanal/0)
+ _CLOSE, // (+channel/0)
_PRCHAR, // (+char)
// Verwaltung
- _SETCLASS, // Set + Klassennamen testen (+StringId)
+ _SETCLASS, // test set + class names (+StringId)
_TESTCLASS, // Check TOS class (+StringId)
- _LIB, // Libnamen fuer Declare-Procs setzen (+StringId)
- _BASED, // TOS wird um BASE erhoeht, BASE davor gepusht (+base)
- // Typanpassung im Argv
- _ARGTYP, // Letzten Parameter in Argv konvertieren (+Typ)
+ _LIB, // set lib name for declar-procs (+StringId)
+ _BASED, // TOS is incremented by BASE, BASE is pushed before (+base)
+ // type adjustment in the Argv
+ _ARGTYP, // convert last parameter in Argv (+type)
_VBASETCLASS, // VBA-like Set
SbOP1_END = _VBASETCLASS,
- // Alle Opcodes mit zwei Operanden
+ // all opcodes with two operands
- _RTL = 0x80, // Laden aus RTL (+StringID+Typ)
+ _RTL = 0x80, // load from the RTL (+StringID+Typ)
SbOP2_START = _RTL,
- _FIND, // Laden (+StringID+Typ)
- _ELEM, // Laden Element (+StringID+Typ)
- _PARAM, // Parameter (+Offset+Typ)
- // Verzweigen
- _CALL, // DECLARE-Methode rufen (+StringID+Typ)
- _CALLC, // Cdecl-DECLARE-Methode rufen (+StringID+Typ)
- _CASEIS, // Case-Test (+Test-Opcode+True-Target)
- // Verwaltung
- _STMNT, // Beginn eines Statements (+Line+Col)
+ _FIND, // load (+StringID+Typ)
+ _ELEM, // load element (+StringID+Typ)
+ _PARAM, // parameters (+Offset+Typ)
+ // branch
+ _CALL, // call DECLARE-method (+StringID+Typ)
+ _CALLC, // call Cdecl-DECLARE-Method (+StringID+Typ)
+ _CASEIS, // case-test (+Test-Opcode+True-Target)
+ // management
+ _STMNT, // begin of a statement (+Line+Col)
// E/A
_OPEN, // (+SvStreamFlags+Flags)
- // Objekte
- _LOCAL, // Lokale Variable definieren (+StringID+Typ)
- _PUBLIC, // Modulglobale Variable (+StringID+Typ)
- _GLOBAL, // Globale Variable definieren, public-Anweisung (+StringID+Typ)
- _CREATE, // Objekt kreieren (+StringId+StringID)
- _STATIC, // Statische Variabl (+StringID+Typ) JSM
- _TCREATE, // User Defined Objekt kreieren
- _DCREATE, // 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, // Objekt-Array redimensionieren (+StringId+StringID)
+ // objects
+ _LOCAL, // define locals variables (+StringID+Typ)
+ _PUBLIC, // module global variables (+StringID+Typ)
+ _GLOBAL, // define global variables, public command (+StringID+Typ)
+ _CREATE, // create object (+StringId+StringID)
+ _STATIC, // static variable (+StringID+Typ) JSM
+ _TCREATE, // create user-defined object
+ _DCREATE, // create object-array (+StringId+StringID)
+ _GLOBAL_P, // define global variable that's not overwritten on restarting
+ // the Basic, P=PERSIST (+StringID+Typ)
+ _FIND_G, // finds global variable with special treatment due to _GLOBAL_P
+ _DCREATE_REDIMP, // redimension 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)
_FIND_STATIC, // local static var lookup (+StringID+Typ)
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 1b58e5d39f0b..c17c99daa8b3 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -43,42 +43,42 @@ class SbiParser : public SbiTokenizer
{
friend class SbiExpression;
- SbiParseStack* pStack; // Block-Stack
- SbiProcDef* pProc; // aktuelle Prozedur
- SbiExprNode* pWithVar; // aktuelle With-Variable
- SbiToken eEndTok; // das Ende-Token
- sal_uInt32 nGblChain; // Chainkette fuer globale DIMs
- sal_Bool bGblDefs; // sal_True globale Definitionen allgemein
- sal_Bool bNewGblDefs; // sal_True globale Definitionen vor Sub
- sal_Bool bSingleLineIf; // sal_True einzeiliges if-Statement
-
- SbiSymDef* VarDecl( SbiDimList**,sal_Bool,sal_Bool );// Variablen-Deklaration
- SbiProcDef* ProcDecl(sal_Bool bDecl);// Prozedur-Deklaration
+ SbiParseStack* pStack;
+ SbiProcDef* pProc;
+ SbiExprNode* pWithVar;
+ SbiToken eEndTok;
+ sal_uInt32 nGblChain; // for global DIMs
+ sal_Bool bGblDefs; // sal_True global definitions general
+ sal_Bool bNewGblDefs; // sal_True globale definitions before sub
+ sal_Bool bSingleLineIf;
+
+ SbiSymDef* VarDecl( SbiDimList**,sal_Bool,sal_Bool );
+ SbiProcDef* ProcDecl(sal_Bool bDecl);
void DefStatic( sal_Bool bPrivate );
- void DefProc( sal_Bool bStatic, sal_Bool bPrivate ); // Prozedur einlesen
- void DefVar( SbiOpcode eOp, sal_Bool bStatic ); // DIM/REDIM einlesen
- void TypeDecl( SbiSymDef&, sal_Bool bAsNewAlreadyParsed=sal_False ); // AS-Deklaration
- void OpenBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen
- void CloseBlock(); // Block aufloesen
- sal_Bool Channel( sal_Bool=sal_False ); // Kanalnummer parsen
- void StmntBlock( SbiToken ); // Statement-Block abarbeiten
+ void DefProc( sal_Bool bStatic, sal_Bool bPrivate ); // read in procedure
+ void DefVar( SbiOpcode eOp, sal_Bool bStatic ); // read in DIM/REDIM
+ void TypeDecl( SbiSymDef&, sal_Bool bAsNewAlreadyParsed=sal_False ); // AS-declaration
+ void OpenBlock( SbiToken, SbiExprNode* = NULL );
+ void CloseBlock();
+ sal_Bool Channel( sal_Bool=sal_False ); // parse channel number
+ void StmntBlock( SbiToken );
void DefType( sal_Bool bPrivate ); // Parse type declaration
void DefEnum( sal_Bool bPrivate ); // Parse enum declaration
void DefDeclare( sal_Bool bPrivate );
void EnableCompatibility();
public:
- SbxArrayRef rTypeArray; // das Type-Array
- SbxArrayRef rEnumArray; // Enum types
- SbiStringPool aGblStrings; // der String-Pool
- SbiStringPool aLclStrings; // der String-Pool
- SbiSymPool aGlobals; // globale Variable
- SbiSymPool aPublics; // modulglobale Variable
+ SbxArrayRef rTypeArray;
+ SbxArrayRef rEnumArray;
+ SbiStringPool aGblStrings; // string-pool
+ SbiStringPool aLclStrings; // string-pool
+ SbiSymPool aGlobals;
+ SbiSymPool aPublics; // module global
SbiSymPool aRtlSyms; // Runtime-Library
SbiCodeGen aGen; // Code-Generator
- StarBASIC* pBasic; // StarBASIC-Instanz
- SbiSymPool* pPool; // aktueller Pool
- SbiExprType eCurExpr; // aktueller Expr-Typ
- short nBase; // OPTION BASE-Wert
+ StarBASIC* pBasic; // StarBASIC instance
+ SbiSymPool* pPool;
+ SbiExprType eCurExpr;
+ short nBase; // OPTION BASE-value
sal_Bool bText; // OPTION COMPARE TEXT
sal_Bool bExplicit; // sal_True: OPTION EXPLICIT
sal_Bool bClassModule; // sal_True: OPTION ClassModule
@@ -87,28 +87,28 @@ public:
SbxDataType eDefTypes[26]; // DEFxxx-Datentypen
SbiParser( StarBASIC*, SbModule* );
- sal_Bool Parse(); // die Aktion
- SbiExprNode* GetWithVar(); // Innerste With-Variable liefern
+ sal_Bool Parse();
+ SbiExprNode* GetWithVar();
- // AB 31.3.1996, Symbol in Runtime-Library suchen
+ // from 31.3.1996, search symbol in the runtime-library
SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType );
void AddConstants( void );
- sal_Bool HasGlobalCode(); // Globaler Code definiert?
+ sal_Bool HasGlobalCode();
- sal_Bool TestToken( SbiToken ); // bestimmtes TOken?
- sal_Bool TestSymbol( sal_Bool=sal_False ); // Symbol?
- sal_Bool TestComma(); // Komma oder EOLN?
- void TestEoln(); // EOLN?
+ sal_Bool TestToken( SbiToken );
+ sal_Bool TestSymbol( sal_Bool=sal_False );
+ sal_Bool TestComma();
+ void TestEoln();
- void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call
+ void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // let or call
void ErrorStmnt(); // ERROR n
- void NotImp(); // nicht implementiert
+ void NotImp(); // not implemented
void BadBlock(); // LOOP/WEND/NEXT
- void BadSyntax(); // Falsches SbiToken
- void NoIf(); // ELSE/ELSE IF ohne IF
+ void BadSyntax(); // wrong SbiToken
+ void NoIf(); // ELSE/ELSE IF without IF
void Assign(); // LET
- void Attribute(); // Attribute
+ void Attribute();
void Call(); // CALL
void Close(); // CLOSE
void Declare(); // DECLARE
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index d8e8b2507640..b81e88b2db64 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -61,16 +61,16 @@ public:
}
-class SbiInstance; // aktiver StarBASIC-Prozess
-class SbiRuntime; // aktive StarBASIC-Prozedur-Instanz
+class SbiInstance; // active StarBASIC process
+class SbiRuntime; // active StarBASIC procedure instance
struct SbiArgvStack; // Argv stack element
struct SbiGosubStack; // GOSUB stack element
class SbiImage; // Code-Image
-class SbiIoSystem; // Dateisystem
-class SbiDdeControl; // DDE-Steuerung
-class SbiDllMgr; // Aufrufe in DLLs
-class SvNumberFormatter; // Zeit/Datumsfunktionen
+class SbiIoSystem;
+class SbiDdeControl;
+class SbiDllMgr;
+class SvNumberFormatter; // time/date functions
enum ForType
{
@@ -113,7 +113,7 @@ struct SbiGosubStack { // GOSUB-Stack:
sal_uInt16 nStartForLvl; // #118235: For Level in moment of gosub
};
-#define MAXRECURSION 500 // max. 500 Rekursionen
+#define MAXRECURSION 500
#define Sb_ATTR_NORMAL 0x0000
#define Sb_ATTR_HIDDEN 0x0002
@@ -143,9 +143,9 @@ public:
~SbiRTLData();
};
-// Die Instanz entspricht einem laufenden StarBASIC. Mehrere gleichzeitig
-// laufende BASICs werden ueber verkettete Instanzen verwaltet. Hier liegen
-// alle Daten, die nur leben, wenn BASIC auch lebt, wie z.B. das I/O-System.
+// The instance matches a running StarBASIC. Many basics running at the same
+// time are managed by chained instances. There is all the data that only lives
+// when the BASIC is living too, like the I/O-system.
typedef ::std::vector
<
@@ -160,7 +160,7 @@ class SbiInstance
SbiRTLData aRTLData;
- SbiIoSystem* pIosys; // Dateisystem
+ SbiIoSystem* pIosys; // file system
SbiDdeControl* pDdeCtrl; // DDE
SbiDllMgr* pDllMgr; // DLL-Calls (DECLARE)
StarBASIC* pBasic;
@@ -169,33 +169,33 @@ class SbiInstance
DateFormat meFormatterDateFormat;
sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
- SbError nErr; // aktueller Fehlercode
- String aErrorMsg; // letzte Error-Message fuer $ARG
- sal_uInt16 nErl; // aktuelle Fehlerzeile
- sal_Bool bReschedule; // Flag: sal_True = Reschedule in Hauptschleife
+ SbError nErr;
+ String aErrorMsg; // last error message for $ARG
+ sal_uInt16 nErl; // current error line
+ sal_Bool bReschedule; // Flag: sal_True = Reschedule in main loop
sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
public:
SbiRuntime* pRun; // Call-Stack
- SbiInstance* pNext; // Instanzen-Chain
+ SbiInstance* pNext; // instances chain
- // #31460 Neues Konzept fuer StepInto/Over/Out,
- // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel()
- sal_uInt16 nCallLvl; // Call-Level (wg. Rekursion)
- sal_uInt16 nBreakCallLvl; // Call-Level zum Anhalten
- void CalcBreakCallLevel( sal_uInt16 nFlags ); // Gemaess Flags setzen
+ // #31460 new concept for StepInto/Over/Out,
+ // Explaination see runtime.cxx at SbiInstance::CalcBreakCallLevel()
+ sal_uInt16 nCallLvl;
+ sal_uInt16 nBreakCallLvl;
+ void CalcBreakCallLevel( sal_uInt16 nFlags );
SbiInstance( StarBASIC* );
~SbiInstance();
void Error( SbError ); // trappable Error
- void Error( SbError, const String& rMsg ); // trappable Error mit Message
+ void Error( SbError, const String& rMsg ); // trappable Error with message
void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
void FatalError( SbError ); // non-trappable Error
void FatalError( SbError, const String& ); // non-trappable Error
- void Abort(); // Abbruch mit aktuellem Fehlercode
+ void Abort(); // with current error code
void Stop();
SbError GetErr() { return nErr; }
@@ -223,16 +223,16 @@ public:
sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
- // NumberFormatter auch statisch anbieten
+ // offer NumberFormatter also static
static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType* peFormatterLangType=NULL, DateFormat* peFormatterDateFormat=NULL );
};
-SbiIoSystem* SbGetIoSystem(); // das aktuelle I/O-System
+SbiIoSystem* SbGetIoSystem();
-// Verkettbare Items, um Referenzen temporaer zu halten
+// chainable items to keep references temporary
struct RefSaveItem
{
SbxVariableRef xRef;
@@ -242,9 +242,8 @@ struct RefSaveItem
};
-// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm
-// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt
-// nur lokale Daten.
+// There's one instance of this class for every executed sub-program.
+// This instance is the heart of the BASIC-machine and contains only local data.
class SbiRuntime
{
@@ -253,52 +252,52 @@ class SbiRuntime
typedef void( SbiRuntime::*pStep0 )();
typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 );
typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 );
- static pStep0 aStep0[]; // Opcode-Tabelle Gruppe 0
- static pStep1 aStep1[]; // Opcode-Tabelle Gruppe 1
- static pStep2 aStep2[]; // Opcode-Tabelle Gruppe 2
-
- StarBASIC& rBasic; // StarBASIC-Instanz
- SbiInstance* pInst; // aktiver Thread
- SbModule* pMod; // aktuelles Modul
- SbMethod* pMeth; // Methoden-Instanz
+ static pStep0 aStep0[]; // opcode-table group 0
+ static pStep1 aStep1[];
+ static pStep2 aStep2[];
+
+ StarBASIC& rBasic; // StarBASIC instance
+ SbiInstance* pInst; // current thread
+ SbModule* pMod; // current module
+ SbMethod* pMeth; // method instance
SbiIoSystem* pIosys; // I/O-System
const SbiImage* pImg; // Code-Image
SbxArrayRef refExprStk; // expression stack
SbxArrayRef refCaseStk; // CASE expression stack
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
SbxVariableRef refRedim; // Array saved to use for REDIM
- SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
+ SbxVariableRef xDummyVar; // substitute for variables that weren't found
SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
SbiArgvStack* pArgvStk; // ARGV-Stack
SbiGosubStack* pGosubStk; // GOSUB stack
SbiForStack* pForStk; // FOR/NEXT-Stack
- sal_uInt16 nExprLvl; // Tiefe des Expr-Stacks
- sal_uInt16 nGosubLvl; // Zum Vermeiden von Tot-Rekursionen
+ sal_uInt16 nExprLvl; // depth of the expr-stack
+ sal_uInt16 nGosubLvl; // to prevent dead-recursions
sal_uInt16 nForLvl; // #118235: Maintain for level
- const sal_uInt8* pCode; // aktueller Code-Pointer
- const sal_uInt8* pStmnt; // Beginn des lezten Statements
- const sal_uInt8* pError; // Adresse des aktuellen Error-Handlers
- const sal_uInt8* pRestart; // Restart-Adresse
- const sal_uInt8* pErrCode; // Restart-Adresse RESUME NEXT
+ const sal_uInt8* pCode; // current Code-Pointer
+ const sal_uInt8* pStmnt; // beginning of the last statement
+ const sal_uInt8* pError; // address of the current error handler
+ const sal_uInt8* pRestart; // restart-address
+ const sal_uInt8* pErrCode; // restart-adresse RESUME NEXT
const sal_uInt8* pErrStmnt; // Restart-Adresse RESUMT 0
- String aLibName; // Lib-Name fuer Declare-Call
- SbxArrayRef refParams; // aktuelle Prozedur-Parameter
- SbxArrayRef refLocals; // lokale Variable
- SbxArrayRef refArgv; // aktueller Argv
- // #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
- short nArgc; // aktueller Argc
- sal_Bool bRun; // sal_True: Programm ist aktiv
- sal_Bool bError; // sal_True: Fehler behandeln
- sal_Bool bInError; // sal_True: in einem Fehler-Handler
+ String aLibName; // Lib-name for declare-call
+ SbxArrayRef refParams; // current procedure parameters
+ SbxArrayRef refLocals; // local variable
+ SbxArrayRef refArgv;
+ // #74254, one refSaveObj is not enough! new: pRefSaveList (see above)
+ short nArgc;
+ sal_Bool bRun;
+ sal_Bool bError; // sal_True: handle errors
+ sal_Bool bInError; // sal_True: in an error handler
sal_Bool bBlocked; // sal_True: blocked by next call level, #i48868
sal_Bool bVBAEnabled;
sal_uInt16 nFlags; // Debugging-Flags
- SbError nError; // letzter Fehler
- sal_uInt16 nOps; // Opcode-Zaehler
+ SbError nError;
+ sal_uInt16 nOps; // opcode counter
sal_uInt32 m_nLastTime;
- RefSaveItem* pRefSaveList; // #74254 Temporaere Referenzen sichern
- RefSaveItem* pItemStoreList; // Unbenutzte Items aufbewahren
+ RefSaveItem* pRefSaveList; // #74254 save temporary references
+ RefSaveItem* pItemStoreList; // keep unused items
void SaveRef( SbxVariable* pVar )
{
RefSaveItem* pItem = pItemStoreList;
@@ -327,43 +326,43 @@ class SbiRuntime
void SetupArgs( SbxVariable*, sal_uInt32 );
SbxVariable* CheckArray( SbxVariable* );
- void PushVar( SbxVariable* ); // Variable push
- SbxVariableRef PopVar(); // Variable pop
- SbxVariable* GetTOS( short=0 ); // Variable vom TOS holen
- void TOSMakeTemp(); // TOS in temp. Variable wandeln
- sal_Bool ClearExprStack(); // Expr-Stack freigeben
+ void PushVar( SbxVariable* );
+ SbxVariableRef PopVar();
+ SbxVariable* GetTOS( short=0 );
+ void TOSMakeTemp();
+ sal_Bool ClearExprStack();
- void PushGosub( const sal_uInt8* ); // GOSUB-Element push
- void PopGosub(); // GOSUB-Element pop
- void ClearGosubStack(); // GOSUB-Stack freigeben
+ void PushGosub( const sal_uInt8* );
+ void PopGosub();
+ void ClearGosubStack();
- void PushArgv(); // Argv-Element push
- void PopArgv(); // Argv-Element pop
- void ClearArgvStack(); // Argv-Stack freigeben
+ void PushArgv();
+ void PopArgv();
+ void ClearArgvStack();
- void PushFor(); // For-Element push
- void PushForEach(); // For-Each-Element push
- void PopFor(); // For-Element pop
- void ClearForStack(); // For-Stack freigeben
+ void PushFor();
+ void PushForEach();
+ void PopFor();
+ void ClearForStack();
- void StepArith( SbxOperator ); // arithmetische Verknuepfungen
- void StepUnary( SbxOperator ); // unaere Verknuepfungen
- void StepCompare( SbxOperator );// Vergleiche
+ void StepArith( SbxOperator );
+ void StepUnary( SbxOperator );
+ void StepCompare( SbxOperator );
- void SetParameters( SbxArray* );// Parameter uebernehmen
+ void SetParameters( SbxArray* );
- // MUSS NOCH IMPLEMENTIERT WERDEN
+ // HAS TO BE IMPLEMENTED SOME TIME
void DllCall( const String&, const String&, SbxArray*, SbxDataType, sal_Bool );
- // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
+ // #56204 swap out DIM-functionality into help method (step0.cxx)
void DimImpl( SbxVariableRef refVar );
bool implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass );
void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt = false );
- // Die nachfolgenden Routinen werden vom Single Stepper
- // gerufen und implementieren die einzelnen Opcodes
+ // the following routines are called by the single
+ // stepper and implement the single opcodes
void StepNOP(), StepEXP(), StepMUL(), StepDIV();
void StepMOD(), StepPLUS(), StepMINUS(), StepNEG();
void StepEQ(), StepNE(), StepLT(), StepGT();
@@ -382,7 +381,7 @@ class SbiRuntime
void StepRESTART(), StepEMPTY(), StepLEAVE();
void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR();
void StepARRAYACCESS(), StepBYVAL();
- // Alle Opcodes mit einem Operanden
+ // all opcodes with one operand
void StepLOADNC( sal_uInt32 ), StepLOADSC( sal_uInt32 ), StepLOADI( sal_uInt32 );
void StepARGN( sal_uInt32 ), StepBASED( sal_uInt32 ), StepPAD( sal_uInt32 );
void StepJUMP( sal_uInt32 ), StepJUMPT( sal_uInt32 );
@@ -392,7 +391,7 @@ class SbiRuntime
void StepRESUME( sal_uInt32 ), StepSETCLASS( sal_uInt32 ), StepVBASETCLASS( sal_uInt32 ), StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 );
bool checkClass_Impl( const SbxVariableRef& refVal, const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault = true );
void StepCLOSE( sal_uInt32 ), StepPRCHAR( sal_uInt32 ), StepARGTYP( sal_uInt32 );
- // Alle Opcodes mit zwei Operanden
+ // all opcodes with two operands
void StepRTL( sal_uInt32, sal_uInt32 ), StepPUBLIC( sal_uInt32, sal_uInt32 ), StepPUBLIC_P( sal_uInt32, sal_uInt32 );
void StepPUBLIC_Impl( sal_uInt32, sal_uInt32, bool bUsedForClassModule );
void StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, sal_Bool bLocal, sal_Bool bStatic = sal_False );
@@ -413,18 +412,18 @@ public:
void SetVBAEnabled( bool bEnabled );
sal_uInt16 GetImageFlag( sal_uInt16 n ) const;
sal_uInt16 GetBase();
- xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
+ xub_StrLen nLine,nCol1,nCol2;
SbiRuntime* pNext; // Stack-Chain
SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
~SbiRuntime();
- void Error( SbError, bool bVBATranslationAlreadyDone = false ); // Fehler setzen, falls != 0
- void Error( SbError, const String& ); // Fehler setzen, falls != 0
- void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
- void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
+ void Error( SbError, bool bVBATranslationAlreadyDone = false ); // set error if != 0
+ void Error( SbError, const String& ); // set error if != 0
+ void FatalError( SbError ); // error handling = standard, set error
+ void FatalError( SbError, const String& ); // error handling = standard, set error
static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
void DumpPCode();
- sal_Bool Step(); // Einzelschritt (ein Opcode)
+ sal_Bool Step(); // single step (one opcode)
void Stop() { bRun = sal_False; }
sal_Bool IsRun() { return bRun; }
void block( void ) { bBlocked = sal_True; }
@@ -460,7 +459,7 @@ inline void checkArithmeticOverflow( SbxVariable* pVar )
}
}
-// Hilfsfunktion, um aktives Basic zu finden
+
StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic );
// Get information if security restrictions should be
diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx
index 2918e67880f0..1cb8e14d9271 100644
--- a/basic/source/inc/sbcomp.hxx
+++ b/basic/source/inc/sbcomp.hxx
@@ -29,12 +29,12 @@
#ifndef _SBCOMP_HXX
#define _SBCOMP_HXX
-// das folgende habe ich der neuen Datei von MD entnommen! (MT)
+// I've taken the following from the new file by MD! (MT)
#include "sbintern.hxx"
-#include "token.hxx" // Tokenizer
-#include "symtbl.hxx" // Symbolverwaltung
-#include "parser.hxx" // Parser
-#include "codegen.hxx" // Code-Generator
+#include "token.hxx"
+#include "symtbl.hxx"
+#include "parser.hxx"
+#include "codegen.hxx"
#endif
diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx
index 501b278c4e52..df6ce57152b8 100644
--- a/basic/source/inc/sbintern.hxx
+++ b/basic/source/inc/sbintern.hxx
@@ -87,7 +87,7 @@ public:
SbModule* FindClass( const String& rClassName );
};
-// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
+// stack for the SbiRuntime chain which is removed in the case of an error
class BASIC_DLLPUBLIC SbErrorStackEntry
{
public:
@@ -153,27 +153,27 @@ private:
struct SbiGlobals
{
- SbiInstance* pInst; // alle aktiven Runtime-Instanzen
+ SbiInstance* pInst; // all active runtime instances
SbiFactory* pSbFac; // StarBASIC-Factory
- SbUnoFactory* pUnoFac; // Factory fuer Uno-Structs bei DIM AS NEW
+ SbUnoFactory* pUnoFac; // Factory for Uno-Structs at DIM AS NEW
SbTypeFactory* pTypeFac; // Factory for user defined types
SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules)
SbOLEFactory* pOLEFac; // Factory for OLE types
SbFormFactory* pFormFac; // Factory for user forms
- SbModule* pMod; // aktuell aktives Modul
- SbModule* pCompMod; // aktuell compiliertes Modul
- short nInst; // Anzahl BASICs
- Link aErrHdl; // globaler Error-Handler
- Link aBreakHdl; // globaler Break-Handler
- SbError nCode; // aktueller Fehlercode
- xub_StrLen nLine; // aktuelle Zeile
- xub_StrLen nCol1,nCol2; // aktuelle Spalten (von,bis)
- sal_Bool bCompiler; // Flag fuer Compiler-Error
- sal_Bool bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf
- sal_Bool bRunInit; // sal_True, wenn RunInit vom Basic aktiv ist
- String aErrMsg; // Puffer fuer GetErrorText()
- SbLanguageMode eLanguageMode; // Flag fuer Visual-Basic-Script-Modus
- SbErrorStack* pErrStack; // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
+ SbModule* pMod; // currently active module
+ SbModule* pCompMod; // currently compiled module
+ short nInst; // number of BASICs
+ Link aErrHdl; // global error handler
+ Link aBreakHdl; // global break handler
+ SbError nCode;
+ xub_StrLen nLine;
+ xub_StrLen nCol1,nCol2; // from... to...
+ sal_Bool bCompiler; // flag for compiler error
+ sal_Bool bGlobalInitErr;
+ sal_Bool bRunInit; // sal_True, if RunInit active from the Basic
+ String aErrMsg; // buffer for GetErrorText()
+ SbLanguageMode eLanguageMode; // flag for Visual-Basic-Script-Modus
+ SbErrorStack* pErrStack; // for the SbiRuntime chain
::utl::TransliterationWrapper* pTransliterationWrapper; // For StrComp
sal_Bool bBlockCompilerError;
BasicManager* pAppBasMgr;
@@ -183,7 +183,7 @@ struct SbiGlobals
~SbiGlobals();
};
-// Utility-Makros und -Routinen
+// utility macros and routines
BASIC_DLLPUBLIC SbiGlobals* GetSbData();
diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx
index f2cc8a3d3865..d37ba22a4de1 100644
--- a/basic/source/inc/sbjsmeth.hxx
+++ b/basic/source/inc/sbjsmeth.hxx
@@ -32,9 +32,9 @@
#include <basic/sbmeth.hxx>
-// Basic-Modul fuer JavaScript-Sourcen.
-// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert
-// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI.
+// basic module for JavaScript sources
+// All the basic-specific methods must be overloaded virtually and must
+// be deactivated. The differentiation of normal modules is done by RTTI.
class SbJScriptMethod : public SbMethod
{
diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx
index 55091dc681c5..7c00874de63a 100644
--- a/basic/source/inc/sbjsmod.hxx
+++ b/basic/source/inc/sbjsmod.hxx
@@ -31,9 +31,9 @@
#include <basic/sbmod.hxx>
-// Basic-Modul fuer JavaScript-Sourcen.
-// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert
-// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI.
+// basic module for JavaScript sources
+// All the basic-specific methods must be overloaded virtually and must
+// be deactivated. The differentiation of normal modules is done by RTTI.
class SbJScriptModule : public SbModule
{
@@ -42,7 +42,7 @@ class SbJScriptModule : public SbModule
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1);
TYPEINFO();
- SbJScriptModule( const String& ); // DURCHREICHEN
+ SbJScriptModule( const String& ); // hand through
};
#endif
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index cc0f03903f17..5e833c26795d 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -56,11 +56,11 @@ class SbUnoObject: public SbxObject
sal_Bool bNativeCOMObject;
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
- // Hilfs-Methode zum Anlegen der dbg_-Properties
+ // help method to establish the dbg_-properties
void implCreateDbgProperties( void );
- // Hilfs-Methode zum Anlegen aller Properties und Methoden
- // (Beim on-demand-Mechanismus erforderlich fuer die dbg_-Properties)
+ // help method to establish all properties and methods
+ // (on the on-demand-mechanism required for the dbg_-properties)
void implCreateAll( void );
public:
@@ -69,17 +69,17 @@ public:
SbUnoObject( const ::rtl::OUString& aName_, const ::com::sun::star::uno::Any& aUnoObj_ );
~SbUnoObject();
- // #76470 Introspection on Demand durchfuehren
+ // #76470 do introspection on demand
void doIntrospection( void );
- // Find ueberladen, um z.B. NameAccess zu unterstuetzen
+ // Find overloaded to support e. g. NameAccess
virtual SbxVariable* Find( const String&, SbxClassType );
// Force creation of all properties for debugging
void createAllProperties( void )
{ implCreateAll(); }
- // Wert rausgeben
+ // give out value
::com::sun::star::uno::Any getUnoAny( void );
::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > getIntrospectionAccess( void ) { return mxUnoAccess; }
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; }
@@ -92,7 +92,7 @@ public:
SV_DECL_IMPL_REF(SbUnoObject);
-// #67781 Rueckgabewerte der Uno-Methoden loeschen
+// #67781 delete return values of the uno-methods
void clearUnoMethods( void );
void clearUnoMethodsForBasic( StarBASIC* pBasic );
@@ -105,7 +105,7 @@ class SbUnoMethod : public SbxMethod
::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod;
::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq;
- // #67781 Verweis auf vorige und naechste Methode in der Methoden-Liste
+ // #67781 reference to the previous and the next method in the method list
SbUnoMethod* pPrev;
SbUnoMethod* pNext;
@@ -134,7 +134,6 @@ class SbUnoProperty : public SbxProperty
{
friend class SbUnoObject;
- // Daten der Uno-Property
::com::sun::star::beans::Property aUnoProp;
sal_Int32 nId;
@@ -150,7 +149,7 @@ public:
{ return mbInvocation; }
};
-// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW
+// factory class to create uno-structs per DIM AS NEW
class SbUnoFactory : public SbxFactory
{
public:
@@ -158,7 +157,7 @@ public:
virtual SbxObject* CreateObject( const String& );
};
-// Wrapper fuer eine Uno-Klasse
+// wrapper for an uno-class
class SbUnoClass : public SbxObject
{
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > m_xClass;
@@ -173,18 +172,18 @@ public:
, m_xClass( xClass_ )
{}
- // Find ueberladen, um Elemente on Demand anzulegen
+
virtual SbxVariable* Find( const String&, SbxClassType );
- // Wert rausgeben
+
const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass >& getUnoClass( void ) { return m_xClass; }
};
SV_DECL_IMPL_REF(SbUnoClass);
-// Funktion, um einen globalen Bezeichner im
-// UnoScope zu suchen und fuer Sbx zu wrappen
+// function to find a global identifier in
+// the UnoScope and to wrap it for Sbx
SbUnoClass* findUnoClass( const ::rtl::OUString& rName );
@@ -290,7 +289,7 @@ public:
class StarBASIC;
-// Impl-Methoden fuer RTL
+// Impl-methods for RTL
void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 5abfc1efdd3c..06447faa9e3b 100644
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -32,43 +32,42 @@
#include <tools/string.hxx>
#include <basic/sberrors.hxx>
-// Der Scanner ist stand-alone, d.h. er kann von ueberallher verwendet
-// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
-// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn
-// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet
-// werden soll.
+// The scanner is stand-alone, i. e. it can be used from everywhere.
+// A BASIC-instance is necessary for error messages. Without BASIC
+// the errors are only counted. Also the BASICC is necessary when an
+// advanced SBX-variable shall be used for data type recognition etc.
class StarBASIC;
class SbiScanner
{
- ::rtl::OUString aBuf; // Input-Puffer
- ::rtl::OUString aLine; // aktuelle Zeile
- const sal_Unicode* pLine; // Pointer
- const sal_Unicode* pSaveLine; // Merker fuer Line
+ ::rtl::OUString aBuf; // input buffer
+ ::rtl::OUString aLine;
+ const sal_Unicode* pLine;
+ const sal_Unicode* pSaveLine;
protected:
- String aSym; // Symbolpuffer
- String aError; // Fehler-String
- SbxDataType eScanType; // evtl. Datentyp
- StarBASIC* pBasic; // Instanz fuer Fehler-Callbacks
- double nVal; // numerischer Wert
- short nCurCol1; // aktuelle Spalte 1
- short nSavedCol1; // gerettete Spalte 1
- short nCol; // aktuelle Spaltennummer
- short nErrors; // Anzahl Fehler
- short nColLock; // Lock-Zaehler fuer Col1
- sal_Int32 nBufPos; // aktuelle Buffer-Pos
- sal_uInt16 nLine; // aktuelle Zeile
- sal_uInt16 nCol1, nCol2; // aktuelle 1. und 2. Spalte
- sal_Bool bSymbol; // sal_True: Symbol gescannt
- sal_Bool bNumber; // sal_True: Zahl gescannt
- sal_Bool bSpaces; // sal_True: Whitespace vor Token
- sal_Bool bErrors; // sal_True: Fehler generieren
- sal_Bool bAbort; // sal_True: abbrechen
- sal_Bool bHash; // sal_True: # eingelesen
- sal_Bool bError; // sal_True: Fehler generieren
- sal_Bool bUsedForHilite; // sal_True: Nutzung fuer Highlighting
- sal_Bool bCompatible; // sal_True: OPTION Compatibl
+ String aSym;
+ String aError;
+ SbxDataType eScanType;
+ StarBASIC* pBasic; // instance for error callbacks
+ double nVal; // numeric value
+ short nCurCol1;
+ short nSavedCol1;
+ short nCol;
+ short nErrors;
+ short nColLock; // lock counter for Col1
+ sal_Int32 nBufPos;
+ sal_uInt16 nLine;
+ sal_uInt16 nCol1, nCol2;
+ sal_Bool bSymbol; // sal_True: symbol scanned
+ sal_Bool bNumber; // sal_True: number scanned
+ sal_Bool bSpaces; // sal_True: whitespace before token
+ sal_Bool bErrors; // sal_True: generate errors
+ sal_Bool bAbort;
+ sal_Bool bHash; // sal_True: # has been read in
+ sal_Bool bError; // sal_True: generate error
+ sal_Bool bUsedForHilite;
+ sal_Bool bCompatible; // sal_True: OPTION compatible
sal_Bool bVBASupportOn; // sal_True: OPTION VBASupport 1 otherwise default False
sal_Bool bPrevLineExtentsComment; // sal_True: Previous line is comment and ends on "... _"
@@ -96,7 +95,7 @@ public:
void UnlockColumn();
sal_Bool DoesColonFollow();
- sal_Bool NextSym(); // naechstes Symbol lesen
+ sal_Bool NextSym();
const String& GetSym() { return aSym; }
SbxDataType GetType() { return eScanType; }
double GetDbl() { return nVal; }
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index a52d8c499a07..60223ba617fa 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -34,11 +34,11 @@
#include <basic/sbxdef.hxx>
#include <basic/sbdef.hxx>
-class SbiSymDef; // Basisklasse
-class SbiProcDef; // Prozedur
-class SbiConstDef; // Konstante
-class SbiSymPool; // Symbol-Pool
-class SbiStringPool; // gepoolte Strings
+class SbiSymDef; // base class
+class SbiProcDef;
+class SbiConstDef;
+class SbiSymPool;
+class SbiStringPool;
class SvStream;
class SbiParser;
@@ -46,21 +46,21 @@ class SbiParser;
enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
-// Der String-Pool nimmt String-Eintraege auf und sorgt dafuer,
-// dass sie nicht doppelt vorkommen.
+// The string-pool collects string entries and
+// makes sure that they don't exist twice.
SV_DECL_PTRARR_DEL(SbiStrings,String*,5,5)
-class SbiStringPool { // String-Pool
- SbiStrings aData; // Daten
+class SbiStringPool {
+ SbiStrings aData;
String aEmpty; // for convenience
- SbiParser* pParser; // der Parser
+ SbiParser* pParser;
public:
SbiStringPool( SbiParser* );
~SbiStringPool();
sal_uInt16 GetSize() const { return aData.Count(); }
- // AB 8.4.1999, Default wegen #64236 auf sal_True geaendert
- // Wenn der Bug sauber behoben ist, wieder auf sal_False aendern.
+ // From 8.4.1999: default changed to sal_True because of #64236 -
+ // change it back to sal_False when the bug is cleanly removed.
short Add( const String&, sal_Bool=sal_True );
short Add( double, SbxDataType );
const String& Find( sal_uInt16 ) const;
@@ -70,17 +70,17 @@ public:
SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5,5)
-class SbiSymPool { // Symbol-Pool
+class SbiSymPool {
friend class SbiSymDef;
friend class SbiProcDef;
protected:
- SbiStringPool& rStrings; // verwendeter Stringpool
- SbiSymbols aData; // Daten
- SbiSymPool* pParent; // uebergeordneter Symbol-Pool
- SbiParser* pParser; // der Parser
- SbiSymScope eScope; // Scope des Pools
- sal_uInt16 nProcId; // aktuelles ProcId fuer STATIC-Variable
- sal_uInt16 nCur; // Iterator
+ SbiStringPool& rStrings;
+ SbiSymbols aData;
+ SbiSymPool* pParent;
+ SbiParser* pParser;
+ SbiSymScope eScope;
+ sal_uInt16 nProcId; // for STATIC-variable
+ sal_uInt16 nCur; // iterator
public:
SbiSymPool( SbiStringPool&, SbiSymScope );
~SbiSymPool();
@@ -94,41 +94,41 @@ public:
void SetScope( SbiSymScope s ) { eScope = s; }
SbiParser* GetParser() { return pParser; }
- SbiSymDef* AddSym( const String& ); // Symbol hinzufuegen
- SbiProcDef* AddProc( const String& );// Prozedur hinzufuegen
- void Add( SbiSymDef* ); // Symbol uebernehmen
- SbiSymDef* Find( const String& ) const;// Variablenname
- SbiSymDef* FindId( sal_uInt16 ) const; // Variable per ID suchen
- SbiSymDef* Get( sal_uInt16 ) const; // Variable per Position suchen
- SbiSymDef* First(), *Next(); // Iteratoren
-
- sal_uInt32 Define( const String& ); // Label definieren
- sal_uInt32 Reference( const String& ); // Label referenzieren
- void CheckRefs(); // offene Referenzen suchen
+ SbiSymDef* AddSym( const String& );
+ SbiProcDef* AddProc( const String& );
+ void Add( SbiSymDef* );
+ SbiSymDef* Find( const String& ) const; // variable name
+ SbiSymDef* FindId( sal_uInt16 ) const;
+ SbiSymDef* Get( sal_uInt16 ) const; // find variable per position
+ SbiSymDef* First(), *Next(); // iterators
+
+ sal_uInt32 Define( const String& );
+ sal_uInt32 Reference( const String& );
+ void CheckRefs();
};
-class SbiSymDef { // Allgemeiner Symboleintrag
+class SbiSymDef { // general symbol entry
friend class SbiSymPool;
protected:
- String aName; // Name des Eintrags
- SbxDataType eType; // Typ des Eintrags
- SbiSymPool* pIn; // Parent-Pool
- SbiSymPool* pPool; // Pool fuer Unterelemente
- short nLen; // Stringlaenge bei STRING*n
- short nDims; // Array-Dimensionen
- sal_uInt16 nId; // Symbol-Nummer
- sal_uInt16 nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp)
- sal_uInt16 nProcId; // aktuelles ProcId fuer STATIC-Variable
- sal_uInt16 nPos; // Positions-Nummer
- sal_uInt32 nChain; // Backchain-Kette
+ String aName;
+ SbxDataType eType;
+ SbiSymPool* pIn; // parent pool
+ SbiSymPool* pPool; // pool for sub-elements
+ short nLen; // string length for STRING*n
+ short nDims;
+ sal_uInt16 nId;
+ sal_uInt16 nTypeId; // Dim X AS data type
+ sal_uInt16 nProcId;
+ sal_uInt16 nPos;
+ sal_uInt32 nChain;
sal_Bool bNew : 1; // sal_True: Dim As New...
- sal_Bool bChained : 1; // sal_True: Symbol ist in Code definiert
- sal_Bool bByVal : 1; // sal_True: ByVal-Parameter
- sal_Bool bOpt : 1; // sal_True: optionaler Parameter
- sal_Bool bStatic : 1; // sal_True: STATIC-Variable
- sal_Bool bAs : 1; // sal_True: Datentyp per AS XXX definiert
- sal_Bool bGlobal : 1; // sal_True: Global-Variable
+ sal_Bool bChained : 1; // sal_True: symbol is defined in code
+ sal_Bool bByVal : 1; // sal_True: ByVal-parameter
+ sal_Bool bOpt : 1; // sal_True: optional parameter
+ sal_Bool bStatic : 1; // sal_True: STATIC variable
+ sal_Bool bAs : 1; // sal_True: data type defined per AS XXX
+ sal_Bool bGlobal : 1; // sal_True: global variable
sal_Bool bParamArray : 1; // sal_True: ParamArray parameter
sal_Bool bWithEvents : 1; // sal_True: Declared WithEvents
sal_Bool bWithBrackets : 1; // sal_True: Followed by ()
@@ -180,24 +180,24 @@ public:
void SetFixedStringLength( short n ) { nFixedStringLength = n; }
SbiSymPool& GetPool();
- sal_uInt32 Define(); // Symbol in Code definieren
- sal_uInt32 Reference(); // Symbol in Code referenzieren
+ sal_uInt32 Define(); // define symbol in code
+ sal_uInt32 Reference(); // reference symbol in code
private:
SbiSymDef( const SbiSymDef& );
};
-class SbiProcDef : public SbiSymDef { // Prozedur-Definition (aus Basic):
- SbiSymPool aParams; // Parameter
- SbiSymPool aLabels; // lokale Sprungziele
- String aLibName; // LIB "name"
- String aAlias; // ALIAS "name"
- sal_uInt16 nLine1, nLine2; // Zeilenbereich
+class SbiProcDef : public SbiSymDef { // procedure definition (from basic):
+ SbiSymPool aParams;
+ SbiSymPool aLabels; // local jump targets
+ String aLibName;
+ String aAlias;
+ sal_uInt16 nLine1, nLine2; // line area
PropertyMode mePropMode; // Marks if this is a property procedure and which
String maPropName; // Property name if property procedure (!= proc name)
- sal_Bool bCdecl : 1; // sal_True: CDECL angegeben
- sal_Bool bPublic : 1; // sal_True: proc ist PUBLIC
+ sal_Bool bCdecl : 1; // sal_True: CDECL given
+ sal_Bool bPublic : 1; // sal_True: proc is PUBLIC
sal_Bool mbProcDecl : 1; // sal_True: instanciated by SbiParser::ProcDecl
public:
SbiProcDef( SbiParser*, const String&, sal_Bool bProcDecl=false );
@@ -222,9 +222,8 @@ public:
void setPropertyMode( PropertyMode ePropMode );
const String& GetPropName() { return maPropName; }
- // Match mit einer Forward-Deklaration. Die Parameternamen
- // werden abgeglichen und die Forward-Deklaration wird
- // durch this ersetzt
+ // Match with a forward-declaration. The parameter names are
+ // compared and the forward declaration is replaced by this
void Match( SbiProcDef* pForward );
private:
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index deb6764f2e2c..666c8e4ee8ff 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -37,28 +37,28 @@
#undef SHARED
#endif
-// Der Tokenizer ist stand-alone, d.h. er kann von ueberallher verwendet
-// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne
-// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn
-// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet
-// werden soll.
+// The tokenizer is stand-alone, i. e. he can be used from everywhere.
+// A BASIC-instance is necessary for error messages. Without BASIC the
+// errors are only counted. The BASIC is also necessary when an advanced
+// SBX-variable shall be used for recognition of data types etc.
+
enum SbiToken {
NIL = 0,
- // Token zwischen 0x20 und 0x3F sind Literale:
+ // tokens between 0x20 and 0x3F are literals:
LPAREN = '(', RPAREN = ')', COMMA = ',', DOT = '.', EXCLAM = '!',
HASH = '#', SEMICOLON = ';',
- // Anweisungen:
+ // commands:
FIRSTKWD = 0x40,
AS = FIRSTKWD, ALIAS, ASSIGN,
CALL, CASE, CLOSE, COMPARE, _CONST_,
DECLARE, DIM, DO,
- // in der Reihenfolge der Datentyp-Enums!
+ // in the order of the data type enums!
DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFCUR, DEFDATE, DEFSTR, DEFOBJ,
DEFERR, DEFBOOL, DEFVAR,
- // in der Reihenfolge der Datentyp-Enums!
+ // in the order of the data type enums!
DATATYPE1,
TINTEGER = DATATYPE1,
TLONG, TSINGLE, TDOUBLE, TCURRENCY, TDATE, TSTRING, TOBJECT,
@@ -79,29 +79,29 @@ enum SbiToken {
UNTIL,
WEND, WHILE, WITH, WRITE,
ENDENUM, ENDIF, ENDFUNC, ENDPROPERTY, ENDSUB, ENDTYPE, ENDSELECT, ENDWITH,
- // Ende aller Keywords
+ // end of all keywords
LASTKWD = ENDWITH,
- // Statement-Ende
+ // statement end
EOS, EOLN,
- // Operatoren:
+ // operators:
EXPON, NEG, MUL,
DIV, IDIV, MOD, PLUS, MINUS,
EQ, NE, LT, GT, LE, GE,
NOT, AND, OR, XOR, EQV,
IMP, CAT, LIKE, IS, TYPEOF,
- // Sonstiges:
+ // miscellaneous:
FIRSTEXTRA,
NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, BYREF,
OUTPUT, RANDOM, APPEND, BINARY, ACCESS,
LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_,
EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY, WITHEVENTS,
- // Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ)
+ // from here there are JavaScript-tokens (same enum so that same type)
FIRSTJAVA,
JS_BREAK=FIRSTJAVA, JS_CONTINUE, JS_FOR, JS_FUNCTION, JS_IF, JS_NEW,
JS_RETURN, JS_THIS, JS_VAR, JS_WHILE, JS_WITH,
- // JavaScript-Operatoren
+ // JavaScript-operators
// _ASS_ = Assignment
JS_COMMA, JS_ASSIGNMENT, JS_ASS_PLUS, JS_ASS_MINUS, JS_ASS_MUL,
JS_ASS_DIV, JS_ASS_MOD, JS_ASS_LSHIFT, JS_ASS_RSHIFT, JS_ASS_RSHIFT_Z,
@@ -139,13 +139,13 @@ class SbiTokenizer : public SbiScanner {
TokenLabelInfo m_aTokenLabelInfo;
protected:
- SbiToken eCurTok; // aktuelles Token
- SbiToken ePush; // Pushback-Token
- sal_uInt16 nPLine, nPCol1, nPCol2; // Pushback-Location
- sal_Bool bEof; // sal_True bei Dateiende
- sal_Bool bEos; // sal_True bei Statement-Ende
- sal_Bool bKeywords; // sal_True, falls Keywords geparst werden
- sal_Bool bAs; // letztes Keyword war AS
+ SbiToken eCurTok;
+ SbiToken ePush;
+ sal_uInt16 nPLine, nPCol1, nPCol2; // pushback location
+ sal_Bool bEof;
+ sal_Bool bEos;
+ sal_Bool bKeywords; // sal_True, if keywords are parsed
+ sal_Bool bAs; // last keyword was AS
sal_Bool bErrorIsSymbol; // Handle Error token as Symbol, not keyword
public:
SbiTokenizer( const ::rtl::OUString&, StarBASIC* = NULL );
@@ -154,14 +154,14 @@ public:
inline sal_Bool IsEof() { return bEof; }
inline sal_Bool IsEos() { return bEos; }
- void Push( SbiToken ); // Pushback eines Tokens
- const String& Symbol( SbiToken );// Rueckumwandlung
+ void Push( SbiToken );
+ const String& Symbol( SbiToken ); // reconversion
- SbiToken Peek(); // das naechste Token lesen
- SbiToken Next(); // Ein Token lesen
- sal_Bool MayBeLabel( sal_Bool= sal_False ); // Kann es ein Label sein?
+ SbiToken Peek(); // read the next token
+ SbiToken Next(); // read a token
+ sal_Bool MayBeLabel( sal_Bool= sal_False );
- void Hilite( SbTextPortions& ); // Syntax-Highlighting
+ void Hilite( SbTextPortions& );
void Error( SbError c ) { GenError( c ); }
void Error( SbError, SbiToken );
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 1f05688087f2..cd3c24f1dee7 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -79,8 +79,8 @@ void BasicDLL::SetDebugMode( sal_Bool bDebugMode )
void BasicDLL::BasicBreak()
{
- //bJustStopping: Wenn jemand wie wild x-mal STOP drueckt, aber das Basic
- // nicht schnell genug anhaelt, kommt die Box ggf. oefters...
+ // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
+ // but the Basic doesn't stop early enough, the box might appear more often...
static sal_Bool bJustStopping = sal_False;
BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC);
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index c14afa075155..86a7578f5d34 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -167,7 +167,7 @@ RTLFUNC(InputBox)
{
String aTitle;
String aDefault;
- sal_Int32 nX = -1, nY = -1; // zentrieren
+ sal_Int32 nX = -1, nY = -1; // center
const String& rPrompt = rPar.Get(1)->GetString();
if ( nArgCount > 2 && !rPar.Get(2)->IsErr() )
aTitle = rPar.Get(2)->GetString();
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 77654904e017..7f4274cba9fc 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -73,7 +73,7 @@ using namespace com::sun::star::bridge;
#include "iosys.hxx"
#include "sbintern.hxx"
-// Der Input-Dialog:
+
class SbiInputDialog : public ModalDialog {
Edit aInput;
@@ -145,7 +145,7 @@ SbiStream::~SbiStream()
delete pStrm;
}
-// Ummappen eines SvStream-Fehlers auf einen StarBASIC-Code
+// map an SvStream-error to StarBASIC-code
void SbiStream::MapError()
{
@@ -560,7 +560,7 @@ void UCBStream::SetSize( sal_uIntPtr nSize )
SetError( ERRCODE_IO_GENERAL );
}
-// Oeffnen eines Streams
+
SbError SbiStream::Open
( short nCh, const ByteString& rName, short nStrmMode, short nFlags, short nL )
{
@@ -706,8 +706,8 @@ SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n )
if( IsText() )
{
aLine += rBuf;
- // Raus damit, wenn das Ende ein LF ist, aber CRLF vorher
- // strippen, da der SvStrm ein CRLF anfuegt!
+ // Get it out, if the end is an LF, but strip CRLF before,
+ // because the SvStrm adds a CRLF!
sal_uInt16 nLineLen = aLine.Len();
if( nLineLen && aLine.GetBuffer()[ --nLineLen ] == 0x0A )
{
@@ -730,7 +730,6 @@ SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n )
}
-// Zugriff auf das aktuelle I/O-System:
SbiIoSystem* SbGetIoSystem()
{
@@ -776,7 +775,6 @@ void SbiIoSystem::Open
nChan = 0;
}
-// Aktuellen Kanal schliessen
void SbiIoSystem::Close()
{
@@ -793,7 +791,6 @@ void SbiIoSystem::Close()
nChan = 0;
}
-// Shutdown nach Programmlauf
void SbiIoSystem::Shutdown()
{
@@ -809,7 +806,7 @@ void SbiIoSystem::Shutdown()
}
}
nChan = 0;
- // Noch was zu PRINTen?
+ // anything left to PRINT?
if( aOut.Len() )
{
String aOutStr( aOut, gsl_getSystemTextEncoding() );
@@ -823,7 +820,6 @@ void SbiIoSystem::Shutdown()
aOut.Erase();
}
-// Aus aktuellem Kanal lesen
void SbiIoSystem::Read( ByteString& rBuf, short n )
{
@@ -907,7 +903,6 @@ void SbiIoSystem::CloseAll(void)
*
***************************************************************************/
-// Einlesen einer Zeile von der Console
void SbiIoSystem::ReadCon( ByteString& rIn )
{
@@ -920,7 +915,7 @@ void SbiIoSystem::ReadCon( ByteString& rIn )
aPrompt.Erase();
}
-// Ausgabe einer MessageBox, wenn im Console-Puffer ein CR ist
+// output of a MessageBox, if theres a CR in the console-buffer
void SbiIoSystem::WriteCon( const ByteString& rText )
{
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 562b2891afa9..2f110304d5b5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -141,7 +141,7 @@ static long GetDayDiff( const Date& rDate )
}
else
nDiffDays = (long)(rDate - aRefDate);
- nDiffDays += 2; // Anpassung VisualBasic: 1.Jan.1900 == 2
+ nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2
return nDiffDays;
}
@@ -202,9 +202,8 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void
-// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert
-// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus
-// Element 0 gespeichert.
+// Properties and methods lie down the return value at the Get (bPut = sal_False) in the
+// element 0 of the Argv; the value of element 0 is saved at Put (bPut = sal_True)
// CreateObject( class )
@@ -218,7 +217,7 @@ RTLFUNC(CreateObject)
StarBASIC::Error( SbERR_CANNOT_LOAD );
else
{
- // Convenience: BASIC als Parent eintragen
+ // Convenience: enter BASIC as parent
p->SetParent( pBasic );
rPar.Get( 0 )->PutObject( p );
}
@@ -291,7 +290,6 @@ RTLFUNC(Sin)
}
}
-// Cosinus
RTLFUNC(Cos)
{
@@ -307,7 +305,6 @@ RTLFUNC(Cos)
}
}
-// Atn
RTLFUNC(Atn)
{
@@ -417,10 +414,10 @@ RTLFUNC(CurDir)
(void)pBasic;
(void)bWrite;
- // #57064 Obwohl diese Funktion nicht mit DirEntry arbeitet, ist sie von
- // der Anpassung an virtuelle URLs nich betroffen, da bei Nutzung der
- // DirEntry-Funktionalitaet keine Moeglichkeit besteht, das aktuelle so
- // zu ermitteln, dass eine virtuelle URL geliefert werden koennte.
+ // #57064 Although this function doesn't work with DirEntry, it isn't touched
+ // by the adjustment to virtual URLs, as, using the DirEntry-functionality,
+ // there's no possibility to detect the current one in a way that a virtual URL
+ // could be delivered.
#if defined (WNT)
int nCurDir = 0; // Current dir // JSM
@@ -1208,10 +1205,10 @@ RTLFUNC(Mid)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #23178: Funktionalitaet von Mid$ als Anweisung nachbilden, indem
- // als weiterer (4.) Parameter ein Ersetzungsstring aufgenommen wird.
- // Anders als im Original kann in dieser Variante der 3. Parameter
- // nLength nicht weggelassen werden. Ist ueber bWrite schon vorgesehen.
+ // #23178: replicate the functionality of Mid$ as a command
+ // by adding a replacement-string as a fourth parameter.
+ // In contrast to the original the third parameter (nLength)
+ // can't be left out here. That's considered in bWrite already.
if( nArgCount == 4 )
bWrite = sal_True;
@@ -1527,7 +1524,7 @@ RTLFUNC(Str)
// Numbers start with a space
if( pArg->IsNumericRTL() )
{
- // Kommas durch Punkte ersetzen, damit es symmetrisch zu Val ist!
+ // replace commas by points so that it's symmetric to Val!
aStr.SearchAndReplace( ',', '.' );
SbiInstance* pInst = pINST;
@@ -1712,7 +1709,7 @@ RTLFUNC(Val)
}
else
{
- // #57844 Lokalisierte Funktion benutzen
+ // #57844 use localized function
nResult = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL );
checkArithmeticOverflow( nResult );
}
@@ -1725,7 +1722,7 @@ RTLFUNC(Val)
// Helper functions for date conversion
sal_Int16 implGetDateDay( double aDate )
{
- aDate -= 2.0; // normieren: 1.1.1900 => 0.0
+ aDate -= 2.0; // standardize: 1.1.1900 => 0.0
Date aRefDate( 1, 1, 1900 );
if ( aDate >= 0.0 )
{
@@ -1746,7 +1743,7 @@ sal_Int16 implGetDateMonth( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long)aDate;
- nDays -= 2; // normieren: 1.1.1900 => 0.0
+ nDays -= 2; // standardize: 1.1.1900 => 0.0
aRefDate += nDays;
sal_Int16 nRet = (sal_Int16)( aRefDate.GetMonth() );
return nRet;
@@ -1756,7 +1753,7 @@ sal_Int16 implGetDateYear( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long) aDate;
- nDays -= 2; // normieren: 1.1.1900 => 0.0
+ nDays -= 2; // standardize: 1.1.1900 => 0.0
aRefDate += nDays;
sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() );
return nRet;
@@ -1893,7 +1890,7 @@ RTLFUNC(TimeSerial)
}
sal_Int16 nHour = rPar.Get(1)->GetInteger();
if ( nHour == 24 )
- nHour = 0; // Wegen UNO DateTimes, die bis 24 Uhr gehen
+ nHour = 0; // because of UNO DateTimes, which go till 24 o'clock
sal_Int16 nMinute = rPar.Get(2)->GetInteger();
sal_Int16 nSecond = rPar.Get(3)->GetInteger();
if ((nHour < 0 || nHour > 23) ||
@@ -1921,7 +1918,7 @@ RTLFUNC(DateValue)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden
+ // #39629 check pINST, can be called from the URL line
SvNumberFormatter* pFormatter = NULL;
if( pINST )
pFormatter = pINST->GetNumberFormatter();
@@ -1956,7 +1953,7 @@ RTLFUNC(DateValue)
{
if ( nType == NUMBERFORMAT_DATETIME )
{
- // Zeit abschneiden
+ // cut time
if ( fResult > 0.0 )
fResult = floor( fResult );
else
@@ -1967,7 +1964,7 @@ RTLFUNC(DateValue)
else
StarBASIC::Error( SbERR_CONVERSION );
- // #39629 pFormatter kann selbst angefordert sein
+ // #39629 pFormatter can be requested itself
if( !pINST )
delete pFormatter;
}
@@ -1982,13 +1979,12 @@ RTLFUNC(TimeValue)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden
SvNumberFormatter* pFormatter = NULL;
if( pINST )
pFormatter = pINST->GetNumberFormatter();
else
{
- sal_uInt32 n; // Dummy
+ sal_uInt32 n;
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, n );
}
@@ -2000,14 +1996,13 @@ RTLFUNC(TimeValue)
if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME))
{
if ( nType == NUMBERFORMAT_DATETIME )
- // Tage abschneiden
+ // cut days
fResult = fmod( fResult, 1 );
rPar.Get(0)->PutDate( fResult );
}
else
StarBASIC::Error( SbERR_CONVERSION );
- // #39629 pFormatter kann selbst angefordert sein
if( !pINST )
delete pFormatter;
}
@@ -2194,7 +2189,6 @@ RTLFUNC(Time)
double nDays = (double)nSeconds * ( 1.0 / (24.0*3600.0) );
Color* pCol;
- // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
if( pINST )
@@ -2210,7 +2204,6 @@ RTLFUNC(Time)
pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
- // #39629 pFormatter kann selbst angefordert sein
if( !pINST )
delete pFormatter;
}
@@ -2251,7 +2244,6 @@ RTLFUNC(Date)
String aRes;
Color* pCol;
- // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
if( pINST )
@@ -2261,14 +2253,13 @@ RTLFUNC(Date)
}
else
{
- sal_uInt32 n; // Dummy
+ sal_uInt32 n;
SbiInstance::PrepareNumberFormatter( pFormatter, nIndex, n, n );
}
pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
pMeth->PutString( aRes );
- // #39629 pFormatter kann selbst angefordert sein
if( !pINST )
delete pFormatter;
}
@@ -2330,7 +2321,7 @@ RTLFUNC(IsDate)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #46134 Nur String wird konvertiert, andere Typen ergeben sal_False
+ // #46134 only string is converted, all other types result in sal_False
SbxVariableRef xArg = rPar.Get( 1 );
SbxDataType eType = xArg->GetType();
sal_Bool bDate = sal_False;
@@ -2341,17 +2332,14 @@ RTLFUNC(IsDate)
}
else if( eType == SbxSTRING )
{
- // Error loeschen
SbxError nPrevError = SbxBase::GetError();
SbxBase::ResetError();
- // Konvertierung des Parameters nach SbxDATE erzwingen
+ // force conversion of the parameter to SbxDATE
xArg->SbxValue::GetDate();
- // Bei Fehler ist es kein Date
bDate = !SbxBase::IsError();
- // Error-Situation wiederherstellen
SbxBase::ResetError();
SbxBase::SetError( nPrevError );
}
@@ -2416,8 +2404,8 @@ RTLFUNC(IsNull)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
- // #51475 Wegen Uno-Objekten auch true liefern,
- // wenn der pObj-Wert NULL ist
+ // #51475 because of Uno-objects return true
+ // even if the pObj value is NULL
SbxVariableRef pArg = rPar.Get( 1 );
sal_Bool bNull = rPar.Get(1)->IsNull();
if( !bNull && pArg->GetType() == SbxOBJECT )
@@ -2441,7 +2429,7 @@ RTLFUNC(IsNumeric)
rPar.Get( 0 )->PutBool( rPar.Get( 1 )->IsNumericRTL() );
}
-// Das machen wir auf die billige Tour
+
RTLFUNC(IsMissing)
{
@@ -2451,7 +2439,7 @@ RTLFUNC(IsMissing)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- // #57915 Missing wird durch Error angezeigt
+ // #57915 Missing is reported by an error
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
}
@@ -2573,8 +2561,8 @@ RTLFUNC(Dir)
{
SbiRTLData* pRTLData = pINST->GetRTLData();
- // #34645: Kann auch von der URL-Zeile ueber 'macro: Dir' aufgerufen werden
- // dann existiert kein pRTLData und die Methode muss verlassen werden
+ // #34645: can also be called from the URL line via 'macro: Dir'
+ // there's no pRTLDate existing in that case and the method must be left
if( !pRTLData )
return;
@@ -2837,7 +2825,7 @@ RTLFUNC(GetAttr)
DirEntry aEntry( rPar.Get(1)->GetString() );
aEntry.ToAbs();
- // #57064 Bei virtuellen URLs den Real-Path extrahieren
+ // #57064 extract the real-path for virtual URLs
ByteString aByteStrFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() );
DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.GetBuffer());
if (nRealFlags != 0xffffffff)
@@ -2964,7 +2952,6 @@ RTLFUNC(FileDateTime)
Color* pCol;
- // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
if( pINST )
@@ -2974,7 +2961,7 @@ RTLFUNC(FileDateTime)
}
else
{
- sal_uInt32 n; // Dummy
+ sal_uInt32 n;
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, nIndex );
}
@@ -2982,7 +2969,6 @@ RTLFUNC(FileDateTime)
pFormatter->GetOutputString( fSerial, nIndex, aRes, &pCol );
rPar.Get(0)->PutString( aRes );
- // #39629 pFormatter kann selbst angefordert sein
if( !pINST )
delete pFormatter;
}
@@ -3012,13 +2998,13 @@ RTLFUNC(EOF)
if ( pSbStrm->IsText() )
{
char cBla;
- (*pSvStrm) >> cBla; // koennen wir noch ein Zeichen lesen
+ (*pSvStrm) >> cBla; // can we read another character?
bIsEof = pSvStrm->IsEof();
if ( !bIsEof )
pSvStrm->SeekRel( -1 );
}
else
- bIsEof = pSvStrm->IsEof(); // fuer binaerdateien!
+ bIsEof = pSvStrm->IsEof(); // for binary data!
rPar.Get(0)->PutBool( bIsEof );
}
}
@@ -3029,9 +3015,9 @@ RTLFUNC(FileAttr)
(void)bWrite;
// No changes for UCB
- // #57064 Obwohl diese Funktion nicht mit DirEntry arbeitet, ist sie von
- // der Anpassung an virtuelle URLs nich betroffen, da sie nur auf bereits
- // geoeffneten Dateien arbeitet und der Name hier keine Rolle spielt.
+ // #57064 Although this function doesn't operate with DirEntry, it is
+ // not touched by the adjustment to virtual URLs, as it only works on
+ // already opened files and the name doesn't matter there.
if ( rPar.Count() != 3 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -3078,7 +3064,7 @@ RTLFUNC(Loc)
{
short nBlockLen = pSbStrm->GetBlockLen();
nPos = nBlockLen ? (pSvStrm->Tell() / nBlockLen) : 0;
- nPos++; // Blockpositionen beginnen bei 1
+ nPos++; // block positions starting at 1
}
else if ( pSbStrm->IsText() )
nPos = pSbStrm->GetLine();
@@ -3146,7 +3132,7 @@ RTLFUNC(Seek)
sal_uIntPtr nPos = pStrm->Tell();
if( pSbStrm->IsRandom() )
nPos = nPos / pSbStrm->GetBlockLen();
- nPos++; // Basic zaehlt ab 1
+ nPos++; // Basic counts from 1
rPar.Get(0)->PutLong( (sal_Int32)nPos );
}
else // Seek-Statement
@@ -3157,7 +3143,7 @@ RTLFUNC(Seek)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- nPos--; // Basic zaehlt ab 1, SvStreams zaehlen ab 0
+ nPos--; // Basic counts from 1, SvStreams count from 0
pSbStrm->SetExpandOnWriteTo( 0 );
if ( pSbStrm->IsRandom() )
nPos *= pSbStrm->GetBlockLen();
@@ -3251,7 +3237,7 @@ RTLFUNC(Shell)
oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED;
String aCmdLine = rPar.Get(1)->GetString();
- // Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden
+ // attach additional parameters - everything must be parsed anyway
if( nArgCount >= 4 )
{
aCmdLine.AppendAscii( " " );
@@ -3259,20 +3245,19 @@ RTLFUNC(Shell)
}
else if( !aCmdLine.Len() )
{
- // Spezial-Behandlung (leere Liste) vermeiden
+ // avaoid special treatment (empty list)
aCmdLine.AppendAscii( " " );
}
sal_uInt16 nLen = aCmdLine.Len();
- // #55735 Wenn Parameter dabei sind, muessen die abgetrennt werden
- // #72471 Auch die einzelnen Parameter trennen
+ // #55735 if there are parameters, they have to be seperated
+ // #72471 also seperate the single parameters
std::list<String> aTokenList;
String aToken;
sal_uInt16 i = 0;
sal_Unicode c;
while( i < nLen )
{
- // Spaces weg
for ( ;; ++i )
{
c = aCmdLine.GetBuffer()[ i ];
@@ -3284,7 +3269,6 @@ RTLFUNC(Shell)
{
sal_uInt16 iFoundPos = aCmdLine.Search( c, i + 1 );
- // Wenn nichts gefunden wurde, Rest kopieren
if( iFoundPos == STRING_NOTFOUND )
{
aToken = aCmdLine.Copy( i, STRING_LEN );
@@ -3302,7 +3286,6 @@ RTLFUNC(Shell)
sal_uInt16 iFoundTabPos = aCmdLine.Search( '\t', i );
sal_uInt16 iFoundPos = Min( iFoundSpacePos, iFoundTabPos );
- // Wenn nichts gefunden wurde, Rest kopieren
if( iFoundPos == STRING_NOTFOUND )
{
aToken = aCmdLine.Copy( i, STRING_LEN );
@@ -3315,10 +3298,10 @@ RTLFUNC(Shell)
}
}
- // In die Liste uebernehmen
+ // insert into the list
aTokenList.push_back( aToken );
}
- // #55735 / #72471 Ende
+ // #55735 / #72471 end
sal_Int16 nWinStyle = 0;
if( nArgCount >= 3 )
@@ -3344,7 +3327,7 @@ RTLFUNC(Shell)
nOptions |= osl_Process_WAIT;
}
- // #72471 Parameter aufbereiten
+ // #72471 work parameter(s) up
std::list<String>::const_iterator iter = aTokenList.begin();
const String& rStr = *iter;
::rtl::OUString aOUStrProg( rStr.GetBuffer(), rStr.Len() );
@@ -4031,7 +4014,7 @@ RTLFUNC(Load)
return;
}
- // Diesen Call einfach an das Object weiterreichen
+
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if ( pObj )
{
@@ -4061,7 +4044,7 @@ RTLFUNC(Unload)
return;
}
- // Diesen Call einfach an das Object weitereichen
+
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if ( pObj )
{
@@ -4172,7 +4155,7 @@ RTLFUNC(MsgBox)
if( nArgCount >= 3 )
nType = (WinBits)rPar.Get(2)->GetInteger();
WinBits nStyle = nType;
- nStyle &= 15; // Bits 4-16 loeschen
+ nStyle &= 15; // delete bits 4-16
if( nStyle > 5 )
nStyle = 0;
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 20191cbdcf00..f54ff7baea4f 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -331,7 +331,7 @@ RTLFUNC(CDbl) // JSM
SbxVariable *pSbxVariable = rPar.Get(1);
if( pSbxVariable->GetType() == SbxSTRING )
{
- // AB #41690 , String holen
+ // #41690
String aScanStr = pSbxVariable->GetString();
SbError Error = SbxValue::ScanNumIntnl( aScanStr, nVal );
if( Error != SbxERR_OK )
@@ -393,7 +393,7 @@ RTLFUNC(CSng) // JSM
SbxVariable *pSbxVariable = rPar.Get(1);
if( pSbxVariable->GetType() == SbxSTRING )
{
- // AB #41690 , String holen
+ // #41690
double dVal = 0.0;
String aScanStr = pSbxVariable->GetString();
SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/sal_True );
@@ -566,7 +566,7 @@ RTLFUNC(Switch)
sal_uInt16 nCount = rPar.Count();
if( !(nCount & 0x0001 ))
- // Anzahl der Argumente muss ungerade sein
+ // number of arguments must be odd
StarBASIC::Error( SbERR_BAD_ARGUMENT );
sal_uInt16 nCurExpr = 1;
while( nCurExpr < (nCount-1) )
@@ -764,7 +764,7 @@ RTLFUNC(Array)
SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
sal_uInt16 nArraySize = rPar.Count() - 1;
- // Option Base zunaechst ignorieren (kennt leider nur der Compiler)
+ // ignore Option Base so far (unfortunately only known by the compiler)
bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if( nArraySize )
{
@@ -778,7 +778,7 @@ RTLFUNC(Array)
pArray->unoAddDim( 0, -1 );
}
- // Parameter ins Array uebernehmen
+ // insert parameters into the array
// ATTENTION: Using type sal_uInt16 for loop variable is
// mandatory to workaround a problem with the
// Solaris Intel compiler optimizer! See i104354
@@ -793,7 +793,7 @@ RTLFUNC(Array)
pArray->Put( pNew, &index );
}
- // Array zurueckliefern
+ // return array
SbxVariableRef refVar = rPar.Get(0);
sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
@@ -803,13 +803,13 @@ RTLFUNC(Array)
}
-// Featurewunsch #57868
-// Die Funktion liefert ein Variant-Array, wenn keine Parameter angegeben
-// werden, wird ein leeres Array erzeugt (entsprechend dim a(), entspricht
-// einer Sequence der Laenge 0 in Uno).
-// Wenn Parameter angegeben sind, wird fuer jeden eine Dimension erzeugt
-// DimArray( 2, 2, 4 ) entspricht DIM a( 2, 2, 4 )
-// Das Array ist immer vom Typ Variant
+// Featurewish #57868
+// The function returns a variant-array; if there are no parameters passed,
+// an empty array is created (according to dim a(); equal to a sequence of
+// the length 0 in Uno).
+// If there are parameters passed, there's a dimension created for each of
+// them; DimArray( 2, 2, 4 ) is equal to DIM a( 2, 2, 4 )
+// the array is always of the type variant
RTLFUNC(DimArray)
{
(void)pBasic;
@@ -833,7 +833,6 @@ RTLFUNC(DimArray)
else
pArray->unoAddDim( 0, -1 );
- // Array zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
@@ -843,14 +842,14 @@ RTLFUNC(DimArray)
}
/*
- * FindObject und FindPropertyObject ermoeglichen es,
- * Objekte und Properties vom Typ Objekt zur Laufzeit
- * ueber ihren Namen als String-Parameter anzusprechen.
+ * FindObject and FindPropertyObject make it possible to
+ * address objects and properties of the type Object with
+ * their name as string-pararmeters at the runtime.
*
- * Bsp.:
+ * Example:
* MyObj.Prop1.Bla = 5
*
- * entspricht:
+ * is equal to:
* dim ObjVar as Object
* dim ObjProp as Object
* ObjName$ = "MyObj"
@@ -859,56 +858,49 @@ RTLFUNC(DimArray)
* ObjProp = FindPropertyObject( ObjVar, PropName$ )
* ObjProp.Bla = 5
*
- * Dabei koennen die Namen zur Laufzeit dynamisch
- * erzeugt werden und, so dass z.B. ueber Controls
- * "TextEdit1" bis "TextEdit5" in einem Dialog in
- * einer Schleife iteriert werden kann.
+ * The names can be created dynamically at the runtime
+ * so that e. g. via controls "TextEdit1" to "TextEdit5"
+ * can be iterated in a dialog in a loop.
*/
-// Objekt ueber den Namen ansprechen
-// 1. Parameter = Name des Objekts als String
+
+// 1st parameter = the object's name as string
RTLFUNC(FindObject)
{
(void)pBasic;
(void)bWrite;
- // Wir brauchen einen Parameter
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // 1. Parameter ist der Name
String aNameStr = rPar.Get(1)->GetString();
- // Basic-Suchfunktion benutzen
SbxBase* pFind = StarBASIC::FindSBXInCurrentScope( aNameStr );
SbxObject* pFindObj = NULL;
if( pFind )
pFindObj = PTR_CAST(SbxObject,pFind);
- // Objekt zurueckliefern
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( pFindObj );
}
-// Objekt-Property in einem Objekt ansprechen
-// 1. Parameter = Objekt
-// 2. Parameter = Name der Property als String
+// address object-property in an object
+// 1st parameter = object
+// 2nd parameter = the property's name as string
RTLFUNC(FindPropertyObject)
{
(void)pBasic;
(void)bWrite;
- // Wir brauchen 2 Parameter
if ( rPar.Count() < 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- // 1. Parameter holen, muss Objekt sein
SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject();
SbxObject* pObj = NULL;
if( pObjVar )
@@ -919,21 +911,18 @@ RTLFUNC(FindPropertyObject)
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
- // 2. Parameter ist der Name
String aNameStr = rPar.Get(2)->GetString();
- // Jetzt muss ein Objekt da sein, sonst Error
SbxObject* pFindObj = NULL;
if( pObj )
{
- // Im Objekt nach Objekt suchen
SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_OBJECT );
pFindObj = PTR_CAST(SbxObject,pFindVar);
}
else
StarBASIC::Error( SbERR_BAD_PARAMETER );
- // Objekt zurueckliefern
+
SbxVariableRef refVar = rPar.Get(0);
refVar->PutObject( pFindObj );
}
@@ -1008,7 +997,7 @@ sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm,
}
else
{
- // ohne Laengenangabe! ohne Endekennung!
+ // without any length information! without end-identifier!
// What does that mean for Unicode?! Choosing conversion to ByteString...
ByteString aByteStr( rStr, gsl_getSystemTextEncoding() );
*pStrm << (const char*)aByteStr.GetBuffer();
@@ -1166,7 +1155,6 @@ sal_Bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm,
void PutGet( SbxArray& rPar, sal_Bool bPut )
{
- // Wir brauchen 3 Parameter
if ( rPar.Count() != 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1182,10 +1170,10 @@ void PutGet( SbxArray& rPar, sal_Bool bPut )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
- nRecordNo--; // wir moegen's ab 0!
+ nRecordNo--;
SbiIoSystem* pIO = pINST->GetIoSystem();
SbiStream* pSbStrm = pIO->GetStream( nFileNo );
- // das File muss Random (feste Record-Laenge) oder Binary sein
+
if ( !pSbStrm || !(pSbStrm->GetMode() & (SBSTRM_BINARY | SBSTRM_RANDOM)) )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
@@ -1198,11 +1186,9 @@ void PutGet( SbxArray& rPar, sal_Bool bPut )
if( bPut )
{
- // Datei aufplustern, falls jemand uebers Dateiende hinaus geseekt hat
pSbStrm->ExpandFile();
}
- // auf die Startposition seeken
if( bHasRecordNo )
{
sal_uIntPtr nFilePos = bRandom ? (sal_uIntPtr)(nBlockLen*nRecordNo) : (sal_uIntPtr)nRecordNo;
@@ -1267,7 +1253,7 @@ RTLFUNC(Environ)
return;
}
String aResult;
- // sollte ANSI sein, aber unter Win16 in DLL nicht moeglich
+ // should be ANSI but that's not possible under Win16 in the DLL
ByteString aByteStr( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() );
const char* pEnvStr = getenv( aByteStr.GetBuffer() );
if ( pEnvStr )
@@ -1461,8 +1447,7 @@ RTLFUNC(TypeLen)
}
-// Uno-Struct eines beliebigen Typs erzeugen
-// 1. Parameter == Klassename, weitere Parameter zur Initialisierung
+// 1st parameter == class name, other parameters for initialisation
RTLFUNC(CreateUnoStruct)
{
(void)pBasic;
@@ -1471,8 +1456,8 @@ RTLFUNC(CreateUnoStruct)
RTL_Impl_CreateUnoStruct( pBasic, rPar, bWrite );
}
-// Uno-Service erzeugen
-// 1. Parameter == Service-Name
+
+// 1st parameter == service-name
RTLFUNC(CreateUnoService)
{
(void)pBasic;
@@ -1499,7 +1484,7 @@ RTLFUNC(CreateUnoValue)
}
-// ServiceManager liefern (keine Parameter)
+// no parameters
RTLFUNC(GetProcessServiceManager)
{
(void)pBasic;
@@ -1508,8 +1493,8 @@ RTLFUNC(GetProcessServiceManager)
RTL_Impl_GetProcessServiceManager( pBasic, rPar, bWrite );
}
-// PropertySet erzeugen
-// 1. Parameter == Sequence<PropertyValue>
+
+// 1st parameter == Sequence<PropertyValue>
RTLFUNC(CreatePropertySet)
{
(void)pBasic;
@@ -1518,8 +1503,8 @@ RTLFUNC(CreatePropertySet)
RTL_Impl_CreatePropertySet( pBasic, rPar, bWrite );
}
-// Abfragen, ob ein Interface unterstuetzt wird
-// Mehrere Interface-Namen als Parameter
+
+// multiple interface-names as parameters
RTLFUNC(HasUnoInterfaces)
{
(void)pBasic;
@@ -1528,7 +1513,7 @@ RTLFUNC(HasUnoInterfaces)
RTL_Impl_HasInterfaces( pBasic, rPar, bWrite );
}
-// Abfragen, ob ein Basic-Objekt ein Uno-Struct repraesentiert
+
RTLFUNC(IsUnoStruct)
{
(void)pBasic;
@@ -1537,7 +1522,7 @@ RTLFUNC(IsUnoStruct)
RTL_Impl_IsUnoStruct( pBasic, rPar, bWrite );
}
-// Abfragen, ob zwei Uno-Objekte identisch sind
+
RTLFUNC(EqualUnoObjects)
{
(void)pBasic;
@@ -1737,7 +1722,7 @@ RTLFUNC(Split)
SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
pArray->unoAddDim( 0, nArraySize-1 );
- // Parameter ins Array uebernehmen
+ // insert parameter(s) into the array
for( short i = 0 ; i < nArraySize ; i++ )
{
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
@@ -1745,7 +1730,7 @@ RTLFUNC(Split)
pArray->Put( (SbxVariable*)xVar, &i );
}
- // Array zurueckliefern
+ // return array
SbxVariableRef refVar = rPar.Get(0);
sal_uInt16 nFlags = refVar->GetFlags();
refVar->ResetFlag( SBX_FIXED );
@@ -1863,9 +1848,9 @@ sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 n
if ( aDay != SUNDAY )
nDay = (sal_Int16)aDay + 2;
else
- nDay = 1; // 1==Sonntag
+ nDay = 1; // 1 == Sunday
- // #117253 Optional 2. parameter "firstdayofweek"
+ // #117253 optional 2nd parameter "firstdayofweek"
if( bFirstDayParam )
{
if( nFirstDay < 0 || nFirstDay > 7 )
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 1c6723904e08..5610e20f420e 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -36,9 +36,9 @@
#include "basegfx/numeric/ftools.hxx"
-// Properties und Methoden legen beim Get (bWrite = sal_False) den Returnwert
-// im Element 0 des Argv ab; beim Put (bWrite = sal_True) wird der Wert aus
-// Element 0 gespeichert.
+// Properties and methods lay the return value down at Get (bWrite = sal_False)
+// at the element 0 of the Argv; at Put (bWrite = sal_True) the value from
+// element 0 is stored.
RTLFUNC(Erl)
{
@@ -99,7 +99,7 @@ RTLFUNC(Null)
(void)pBasic;
(void)bWrite;
- // liefert eine leere Objekt-Variable.
+ // returns an empty object-variable
rPar.Get( 0 )->PutNull();
}
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index b7bcfe38057d..af18d7129ce5 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -87,7 +87,7 @@ struct SbiArgvStack { // Argv stack:
short nArgc; // Argc
};
-SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // Alle Opcodes ohne Operanden
+SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // all opcodes without operands
&SbiRuntime::StepNOP,
&SbiRuntime::StepEXP,
&SbiRuntime::StepMUL,
@@ -113,41 +113,41 @@ SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // Alle Opcodes ohne Operanden
&SbiRuntime::StepLIKE,
&SbiRuntime::StepIS,
- // Laden/speichern
- &SbiRuntime::StepARGC, // neuen Argv einrichten
- &SbiRuntime::StepARGV, // TOS ==> aktueller Argv
+ // load/save
+ &SbiRuntime::StepARGC, // establish new Argv
+ &SbiRuntime::StepARGV, // TOS ==> current Argv
&SbiRuntime::StepINPUT, // Input ==> TOS
&SbiRuntime::StepLINPUT, // Line Input ==> TOS
- &SbiRuntime::StepGET, // TOS anfassen
- &SbiRuntime::StepSET, // Speichern Objekt TOS ==> TOS-1
+ &SbiRuntime::StepGET, // touch TOS
+ &SbiRuntime::StepSET, // save object TOS ==> TOS-1
&SbiRuntime::StepPUT, // TOS ==> TOS-1
- &SbiRuntime::StepPUTC, // TOS ==> TOS-1, dann ReadOnly
+ &SbiRuntime::StepPUTC, // TOS ==> TOS-1, then ReadOnly
&SbiRuntime::StepDIM, // DIM
&SbiRuntime::StepREDIM, // REDIM
&SbiRuntime::StepREDIMP, // REDIM PRESERVE
- &SbiRuntime::StepERASE, // TOS loeschen
- // Verzweigen
- &SbiRuntime::StepSTOP, // Programmende
- &SbiRuntime::StepINITFOR, // FOR-Variable initialisieren
- &SbiRuntime::StepNEXT, // FOR-Variable inkrementieren
- &SbiRuntime::StepCASE, // Anfang CASE
- &SbiRuntime::StepENDCASE, // Ende CASE
- &SbiRuntime::StepSTDERROR, // Standard-Fehlerbehandlung
- &SbiRuntime::StepNOERROR, // keine Fehlerbehandlung
- &SbiRuntime::StepLEAVE, // UP verlassen
+ &SbiRuntime::StepERASE, // delete TOS
+ // branch
+ &SbiRuntime::StepSTOP, // program end
+ &SbiRuntime::StepINITFOR, // intitialize FOR-Variable
+ &SbiRuntime::StepNEXT, // increment FOR-Variable
+ &SbiRuntime::StepCASE, // beginning CASE
+ &SbiRuntime::StepENDCASE, // end CASE
+ &SbiRuntime::StepSTDERROR, // standard error handling
+ &SbiRuntime::StepNOERROR, // no error handling
+ &SbiRuntime::StepLEAVE, // leave UP
// E/A
- &SbiRuntime::StepCHANNEL, // TOS = Kanalnummer
+ &SbiRuntime::StepCHANNEL, // TOS = channel number
&SbiRuntime::StepPRINT, // print TOS
&SbiRuntime::StepPRINTF, // print TOS in field
&SbiRuntime::StepWRITE, // write TOS
&SbiRuntime::StepRENAME, // Rename Tos+1 to Tos
- &SbiRuntime::StepPROMPT, // Input Prompt aus TOS definieren
+ &SbiRuntime::StepPROMPT, // define Input Prompt from TOS
&SbiRuntime::StepRESTART, // Set restart point
- &SbiRuntime::StepCHANNEL0, // E/A-Kanal 0 einstellen
- &SbiRuntime::StepEMPTY, // Leeren Ausdruck auf Stack
- &SbiRuntime::StepERROR, // TOS = Fehlercode
- &SbiRuntime::StepLSET, // Speichern Objekt TOS ==> TOS-1
- &SbiRuntime::StepRSET, // Speichern Objekt TOS ==> TOS-1
+ &SbiRuntime::StepCHANNEL0, // set E/A-channel 0
+ &SbiRuntime::StepEMPTY, // empty expression on stack
+ &SbiRuntime::StepERROR, // TOS = error code
+ &SbiRuntime::StepLSET, // save object TOS ==> TOS-1
+ &SbiRuntime::StepRSET, // save object TOS ==> TOS-1
&SbiRuntime::StepREDIMP_ERASE,// Copy array object for REDIMP
&SbiRuntime::StepINITFOREACH,// Init for each loop
&SbiRuntime::StepVBASET,// vba-like set statement
@@ -156,60 +156,60 @@ SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // Alle Opcodes ohne Operanden
&SbiRuntime::StepBYVAL, // access TOS as array
};
-SbiRuntime::pStep1 SbiRuntime::aStep1[] = { // Alle Opcodes mit einem Operanden
- &SbiRuntime::StepLOADNC, // Laden einer numerischen Konstanten (+ID)
- &SbiRuntime::StepLOADSC, // Laden einer Stringkonstanten (+ID)
+SbiRuntime::pStep1 SbiRuntime::aStep1[] = { // all opcodes with one operand
+ &SbiRuntime::StepLOADNC, // loading a numeric constant (+ID)
+ &SbiRuntime::StepLOADSC, // loading a string constant (+ID)
&SbiRuntime::StepLOADI, // Immediate Load (+Wert)
- &SbiRuntime::StepARGN, // Speichern eines named Args in Argv (+StringID)
- &SbiRuntime::StepPAD, // String auf feste Laenge bringen (+Laenge)
- // Verzweigungen
- &SbiRuntime::StepJUMP, // Sprung (+Target)
- &SbiRuntime::StepJUMPT, // TOS auswerten), bedingter Sprung (+Target)
- &SbiRuntime::StepJUMPF, // TOS auswerten), bedingter Sprung (+Target)
- &SbiRuntime::StepONJUMP, // TOS auswerten), Sprung in JUMP-Tabelle (+MaxVal)
- &SbiRuntime::StepGOSUB, // UP-Aufruf (+Target)
- &SbiRuntime::StepRETURN, // UP-Return (+0 oder Target)
- &SbiRuntime::StepTESTFOR, // FOR-Variable testen), inkrementieren (+Endlabel)
+ &SbiRuntime::StepARGN, // save a named Args in Argv (+StringID)
+ &SbiRuntime::StepPAD, // bring string to a definite length (+length)
+ // branches
+ &SbiRuntime::StepJUMP, // jump (+Target)
+ &SbiRuntime::StepJUMPT, // evaluate TOS, conditional jump (+Target)
+ &SbiRuntime::StepJUMPF, // evaluate TOS, conditional jump (+Target)
+ &SbiRuntime::StepONJUMP, // evaluate TOS, jump into JUMP-table (+MaxVal)
+ &SbiRuntime::StepGOSUB, // UP-call (+Target)
+ &SbiRuntime::StepRETURN, // UP-return (+0 or Target)
+ &SbiRuntime::StepTESTFOR, // check FOR-variable, increment (+Endlabel)
&SbiRuntime::StepCASETO, // Tos+1 <= Case <= Tos), 2xremove (+Target)
- &SbiRuntime::StepERRHDL, // Fehler-Handler (+Offset)
- &SbiRuntime::StepRESUME, // Resume nach Fehlern (+0 or 1 or Label)
+ &SbiRuntime::StepERRHDL, // error handler (+Offset)
+ &SbiRuntime::StepRESUME, // resume after errors (+0 or 1 or Label)
// E/A
- &SbiRuntime::StepCLOSE, // (+Kanal/0)
+ &SbiRuntime::StepCLOSE, // (+channel/0)
&SbiRuntime::StepPRCHAR, // (+char)
- // Verwaltung
- &SbiRuntime::StepSETCLASS, // Set + Klassennamen testen (+StringId)
+ // management
+ &SbiRuntime::StepSETCLASS, // check set + class names (+StringId)
&SbiRuntime::StepTESTCLASS, // Check TOS class (+StringId)
- &SbiRuntime::StepLIB, // Lib fuer Declare-Call (+StringId)
- &SbiRuntime::StepBASED, // TOS wird um BASE erhoeht, BASE davor gepusht
- &SbiRuntime::StepARGTYP, // Letzten Parameter in Argv konvertieren (+Typ)
+ &SbiRuntime::StepLIB, // lib for declare-call (+StringId)
+ &SbiRuntime::StepBASED, // TOS is incremented by BASE, BASE is pushed before
+ &SbiRuntime::StepARGTYP, // convert last parameter in Argv (+Type)
&SbiRuntime::StepVBASETCLASS,// vba-like set statement
};
-SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// Alle Opcodes mit zwei Operanden
- &SbiRuntime::StepRTL, // Laden aus RTL (+StringID+Typ)
- &SbiRuntime::StepFIND, // Laden (+StringID+Typ)
- &SbiRuntime::StepELEM, // Laden Element (+StringID+Typ)
+SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// all opcodes with two operands
+ &SbiRuntime::StepRTL, // load from RTL (+StringID+Typ)
+ &SbiRuntime::StepFIND, // load (+StringID+Typ)
+ &SbiRuntime::StepELEM, // load element (+StringID+Typ)
&SbiRuntime::StepPARAM, // Parameter (+Offset+Typ)
// Verzweigen
&SbiRuntime::StepCALL, // Declare-Call (+StringID+Typ)
&SbiRuntime::StepCALLC, // CDecl-Declare-Call (+StringID+Typ)
&SbiRuntime::StepCASEIS, // Case-Test (+Test-Opcode+False-Target)
// Verwaltung
- &SbiRuntime::StepSTMNT, // Beginn eines Statements (+Line+Col)
+ &SbiRuntime::StepSTMNT, // beginning of a statement (+Line+Col)
// E/A
&SbiRuntime::StepOPEN, // (+SvStreamFlags+Flags)
// Objekte
- &SbiRuntime::StepLOCAL, // Lokale Variable definieren (+StringId+Typ)
- &SbiRuntime::StepPUBLIC, // Modulglobale Variable (+StringID+Typ)
- &SbiRuntime::StepGLOBAL, // Globale Variable definieren (+StringID+Typ)
- &SbiRuntime::StepCREATE, // Objekt kreieren (+StringId+StringId)
- &SbiRuntime::StepSTATIC, // Statische Variable (+StringId+StringId)
- &SbiRuntime::StepTCREATE, // User Defined Objekte (+StringId+StringId)
- &SbiRuntime::StepDCREATE, // Objekt-Array kreieren (+StringID+StringID)
- &SbiRuntime::StepGLOBAL_P, // Globale Variable definieren, die beim Neustart
- // von Basic nicht ueberschrieben wird (+StringID+Typ)
- &SbiRuntime::StepFIND_G, // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P
- &SbiRuntime::StepDCREATE_REDIMP, // Objekt-Array redimensionieren (+StringID+StringID)
+ &SbiRuntime::StepLOCAL, // define local variable (+StringId+Typ)
+ &SbiRuntime::StepPUBLIC, // module global variable (+StringID+Typ)
+ &SbiRuntime::StepGLOBAL, // define global variable (+StringID+Typ)
+ &SbiRuntime::StepCREATE, // create object (+StringId+StringId)
+ &SbiRuntime::StepSTATIC, // static variable (+StringId+StringId)
+ &SbiRuntime::StepTCREATE, // user-defined objects (+StringId+StringId)
+ &SbiRuntime::StepDCREATE, // create object-array (+StringID+StringID)
+ &SbiRuntime::StepGLOBAL_P, // define global variable which is not overwritten
+ // by the Basic on a restart (+StringID+Typ)
+ &SbiRuntime::StepFIND_G, // finds global variable with special treatment because of _GLOBAL_P
+ &SbiRuntime::StepDCREATE_REDIMP, // redimension object array (+StringID+StringID)
&SbiRuntime::StepFIND_CM, // Search inside a class module (CM) to enable global search in time
&SbiRuntime::StepPUBLIC_P, // Search inside a class module (CM) to enable global search in time
&SbiRuntime::StepFIND_STATIC, // Search inside a class module (CM) to enable global search in time
@@ -235,39 +235,38 @@ SbiRTLData::~SbiRTLData()
// SbiInstance //
-// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
-// Die Entscheidung, ob StepPoint aufgerufen werden soll, wird anhand des
-// CallLevels getroffen. Angehalten wird, wenn der aktuelle CallLevel <=
-// nBreakCallLvl ist. Der aktuelle CallLevel kann niemals kleiner als 1
-// sein, da er beim Aufruf einer Methode (auch main) inkrementiert wird.
-// Daher bedeutet ein BreakCallLvl von 0, dass das Programm gar nicht
-// angehalten wird.
-// (siehe auch step2.cxx, SbiRuntime::StepSTMNT() )
+// 16.10.96: #31460 new concept for StepInto/Over/Out
+// The decision whether StepPoint shall be called is done with the help of
+// the CallLevel. It's stopped when the current CallLevel is <= nBreakCallLvl.
+// The current CallLevel can never be smaller than 1, as it's also incremented
+// during the call of a method (also main). Therefore a BreakCallLvl from 0
+// means that the program isn't stopped at all.
+// (also have a look at: step2.cxx, SbiRuntime::StepSTMNT() )
+
-// Hilfsfunktion, um den BreakCallLevel gemaess der der Debug-Flags zu ermitteln
void SbiInstance::CalcBreakCallLevel( sal_uInt16 nFlags )
{
- // Break-Flag wegfiltern
+
nFlags &= ~((sal_uInt16)SbDEBUG_BREAK);
sal_uInt16 nRet;
switch( nFlags )
{
case SbDEBUG_STEPINTO:
- nRet = nCallLvl + 1; // CallLevel+1 wird auch angehalten
+ nRet = nCallLvl + 1; // CallLevel+1 is also stopped
break;
case SbDEBUG_STEPOVER | SbDEBUG_STEPINTO:
- nRet = nCallLvl; // Aktueller CallLevel wird angehalten
+ nRet = nCallLvl; // current CallLevel is stopped
break;
case SbDEBUG_STEPOUT:
- nRet = nCallLvl - 1; // Kleinerer CallLevel wird angehalten
+ nRet = nCallLvl - 1; // smaller CallLevel is stopped
break;
case SbDEBUG_CONTINUE:
- // Basic-IDE liefert 0 statt SbDEBUG_CONTINUE, also auch default=continue
+ // Basic-IDE returns 0 instead of SbDEBUG_CONTINUE, so also default=continue
default:
- nRet = 0; // CallLevel ist immer >0 -> kein StepPoint
+ nRet = 0; // CallLevel is always > 0 -> no StepPoint
}
- nBreakCallLvl = nRet; // Ergebnis uebernehmen
+ nBreakCallLvl = nRet; // take result
}
SbiInstance::SbiInstance( StarBASIC* p )
@@ -328,7 +327,7 @@ SbiDllMgr* SbiInstance::GetDllMgr()
return pDllMgr;
}
-// #39629 NumberFormatter jetzt ueber statische Methode anlegen
+// #39629 create NumberFormatter with the help of a static method now
SvNumberFormatter* SbiInstance::GetNumberFormatter()
{
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
@@ -351,7 +350,7 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter()
return pNumberFormatter;
}
-// #39629 NumberFormatter auch statisch anbieten
+// #39629 offer NumberFormatter static too
void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat )
@@ -379,13 +378,13 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
xub_StrLen nCheckPos = 0; short nType;
rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType );
- // Standard-Vorlagen des Formatters haben nur zweistellige
- // Jahreszahl. Deshalb eigenes Format registrieren
+ // the formatter's standard templates have only got a two-digit date
+ // -> registering an own format
- // HACK, da der Numberformatter in PutandConvertEntry die Platzhalter
- // fuer Monat, Tag, Jahr nicht entsprechend der Systemeinstellung
- // austauscht. Problem: Print Year(Date) unter engl. BS
- // siehe auch svtools\source\sbx\sbxdate.cxx
+ // HACK, beause the numberformatter doesn't swap the place holders
+ // for month, day and year according to the system setting.
+ // Problem: Print Year(Date) under engl. BS
+ // also have a look at: svtools\source\sbx\sbxdate.cxx
String aDateStr;
switch( eDate )
@@ -408,7 +407,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
-// Engine laufenlassen. Falls Flags == SbDEBUG_CONTINUE, Flags uebernehmen
+// Let engine run. If Flags == SbDEBUG_CONTINUE, take Flags over
void SbiInstance::Stop()
{
@@ -479,13 +478,12 @@ void SbiInstance::FatalError( SbError _errCode, const String& _details )
void SbiInstance::Abort()
{
- // Basic suchen, in dem der Fehler auftrat
StarBASIC* pErrBasic = GetCurrentBasic( pBasic );
pErrBasic->RTError( nErr, aErrorMsg, pRun->nLine, pRun->nCol1, pRun->nCol2 );
pBasic->Stop();
}
-// Hilfsfunktion, um aktives Basic zu finden, kann ungleich pRTBasic sein
+// can be unequal to pRTBasic
StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic )
{
StarBASIC* pCurBasic = pRTBasic;
@@ -531,7 +529,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
// SbiInstance //
-// Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes)
+// Attention: pMeth can also be NULL (on a call of the init-code)
SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart )
: rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
@@ -579,7 +577,7 @@ SbiRuntime::~SbiRuntime()
ClearArgvStack();
ClearForStack();
- // #74254 Items zum Sichern temporaere Referenzen freigeben
+ // #74254 free items for saving temporary references
ClearRefs();
while( pItemStoreList )
{
@@ -601,14 +599,14 @@ void SbiRuntime::SetVBAEnabled(bool bEnabled )
mpExtCaller = 0;
}
-// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
-// uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls
-// ein bestimmter Datentyp verlangt wird, wird konvertiert.
+// Construction of the parameter list. All ByRef-parameters are directly
+// taken over; copies of ByVal-parameters are created. If a particular
+// data type is requested, it is converted.
void SbiRuntime::SetParameters( SbxArray* pParams )
{
refParams = new SbxArray;
- // fuer den Returnwert
+ // for the return value
refParams->Put( pMeth, 0 );
SbxInfo* pInfo = pMeth ? pMeth->GetInfo() : NULL;
@@ -642,7 +640,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
}
SbxVariable* v = pParams->Get( i );
- // Methoden sind immer byval!
+ // methods are always byval!
sal_Bool bByVal = v->IsA( TYPE(SbxMethod) );
SbxDataType t = v->GetType();
bool bTargetTypeIsArray = false;
@@ -670,7 +668,6 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
{
if( t != SbxVARIANT && t != ( v->GetType() & 0x0FFF ) )
{
- // Array konvertieren??
if( p && (p->eType & SbxARRAY) )
Error( SbERR_CONVERSION );
else
@@ -701,13 +698,13 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
}
-// Einen P-Code ausfuehren
+// execute a P-Code
sal_Bool SbiRuntime::Step()
{
if( bRun )
{
- // Unbedingt gelegentlich die Kontrolle abgeben!
+ // in any case check casually!
if( !( ++nOps & 0xF ) && pInst->IsReschedule() )
{
sal_uInt32 nTime = osl_getGlobalTimer();
@@ -746,19 +743,19 @@ sal_Bool SbiRuntime::Step()
else
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
- // SBX-Fehler aufgetreten?
+
SbError nSbError = SbxBase::GetError();
- Error( ERRCODE_TOERROR(nSbError) ); // Warnings rausfiltern
+ Error( ERRCODE_TOERROR(nSbError) );
- // AB 13.2.1997, neues Error-Handling:
- // ACHTUNG: Hier kann nError auch dann gesetzt sein, wenn !nSbError,
- // da nError jetzt auch von anderen RT-Instanzen gesetzt werden kann
+ // from 13.2.1997, new error handling:
+ // ATTENTION: nError can be set already even if !nSbError
+ // since nError can now also be set from other RT-instances
if( nError )
SbxBase::ResetError();
- // AB,15.3.96: Fehler nur anzeigen, wenn BASIC noch aktiv
- // (insbesondere nicht nach Compiler-Fehlern zur Laufzeit)
+ // from 15.3.96: display errors only if BASIC is still active
+ // (especially not after compiler errors at the runtime)
if( nError && bRun )
{
SbError err = nError;
@@ -773,7 +770,7 @@ sal_Bool SbiRuntime::Step()
// to handle the error
bool bLetParentHandleThis = false;
- // Im Error Handler? Dann Std-Error
+ // in the error handler? so std-error
if ( !bInError )
{
bInError = sal_True;
@@ -792,15 +789,14 @@ sal_Bool SbiRuntime::Step()
}
if ( bLetParentHandleThis )
{
- // AB 13.2.1997, neues Error-Handling:
- // Uebergeordnete Error-Handler beruecksichtigen
+ // from 13.2.1997, new error handling:
+ // consider superior error handlers
- // Wir haben keinen Error-Handler -> weiter oben suchen
+ // there's no error handler -> find one farther above
SbiRuntime* pRtErrHdl = NULL;
SbiRuntime* pRt = this;
while( NULL != (pRt = pRt->pNext) )
{
- // Gibt es einen Error-Handler?
if( pRt->bError == sal_False || pRt->pError != NULL )
{
pRtErrHdl = pRt;
@@ -808,37 +804,33 @@ sal_Bool SbiRuntime::Step()
}
}
- // Error-Hdl gefunden?
+
if( pRtErrHdl )
{
- // (Neuen) Error-Stack anlegen
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
if( rErrStack )
delete rErrStack;
rErrStack = new SbErrorStack();
- // Alle im Call-Stack darunter stehenden RTs manipulieren
+ // manipulate all the RTs that are below in the call-stack
pRt = this;
do
{
- // Fehler setzen
pRt->nError = err;
if( pRt != pRtErrHdl )
pRt->bRun = sal_False;
- // In Error-Stack eintragen
SbErrorStackEntry *pEntry = new SbErrorStackEntry
( pRt->pMeth, pRt->nLine, pRt->nCol1, pRt->nCol2 );
rErrStack->C40_INSERT(SbErrorStackEntry, pEntry, rErrStack->Count() );
- // Nach RT mit Error-Handler aufhoeren
if( pRt == pRtErrHdl )
break;
pRt = pRt->pNext;
}
while( pRt );
}
- // Kein Error-Hdl gefunden -> altes Vorgehen
+ // no error-hdl found -> old behaviour
else
{
pInst->Abort();
@@ -945,8 +937,8 @@ SbxArray* SbiRuntime::GetParams()
// Stacks
-// Der Expression-Stack steht fuer die laufende Auswertung von Expressions
-// zur Verfuegung.
+// The expression-stack is available for the continous evaluation
+// of expressions.
void SbiRuntime::PushVar( SbxVariable* pVar )
{
@@ -968,7 +960,7 @@ SbxVariableRef SbiRuntime::PopVar()
if ( xVar->GetName().EqualsAscii( "Cells" ) )
OSL_TRACE( "" );
#endif
- // Methods halten im 0.Parameter sich selbst, also weghauen
+ // methods hold themselves in parameter 0
if( xVar->IsA( TYPE(SbxMethod) ) )
xVar->SetParameters(0);
return xVar;
@@ -976,7 +968,7 @@ SbxVariableRef SbiRuntime::PopVar()
sal_Bool SbiRuntime::ClearExprStack()
{
- // Achtung: Clear() reicht nicht, da Methods geloescht werden muessen
+ // Attention: Clear() doesn't suffice as methods must be deleted
while ( nExprLvl )
{
PopVar();
@@ -985,8 +977,8 @@ sal_Bool SbiRuntime::ClearExprStack()
return sal_False;
}
-// Variable auf dem Expression-Stack holen, ohne sie zu entfernen
-// n zaehlt ab 0.
+// Take variable from the expression-stack without removing it
+// n counts from 0
SbxVariable* SbiRuntime::GetTOS( short n )
{
@@ -1001,7 +993,6 @@ SbxVariable* SbiRuntime::GetTOS( short n )
return refExprStk->Get( (sal_uInt16) n );
}
-// Sicherstellen, dass TOS eine temporaere Variable ist
void SbiRuntime::TOSMakeTemp()
{
@@ -1031,7 +1022,7 @@ void SbiRuntime::TOSMakeTemp()
}
}
-// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
+// the GOSUB-stack collects return-addresses for GOSUBs
void SbiRuntime::PushGosub( const sal_uInt8* pc )
{
if( ++nGosubLvl > MAXRECURSION )
@@ -1057,7 +1048,6 @@ void SbiRuntime::PopGosub()
}
}
-// Entleeren des GOSUB-Stacks
void SbiRuntime::ClearGosubStack()
{
@@ -1067,7 +1057,7 @@ void SbiRuntime::ClearGosubStack()
nGosubLvl = 0;
}
-// Der Argv-Stack nimmt aktuelle Argument-Vektoren auf
+// the Argv-stack collects current argument-vectors
void SbiRuntime::PushArgv()
{
@@ -1092,7 +1082,6 @@ void SbiRuntime::PopArgv()
}
}
-// Entleeren des Argv-Stacks
void SbiRuntime::ClearArgvStack()
{
@@ -1100,8 +1089,8 @@ void SbiRuntime::ClearArgvStack()
PopArgv();
}
-// Push des For-Stacks. Der Stack hat Inkrement, Ende, Beginn und Variable.
-// Nach Aufbau des Stack-Elements ist der Stack leer.
+// Push of the for-stack. The stack has increment, end, begin and variable.
+// After the creation of the stack-element the stack's empty.
void SbiRuntime::PushFor()
{
@@ -1109,7 +1098,7 @@ void SbiRuntime::PushFor()
p->eForType = FOR_TO;
p->pNext = pForStk;
pForStk = p;
- // Der Stack ist wie folgt aufgebaut:
+
p->refInc = PopVar();
p->refEnd = PopVar();
SbxVariableRef xBgn = PopVar();
@@ -1207,7 +1196,6 @@ void SbiRuntime::PushForEach()
nForLvl++;
}
-// Poppen des FOR-Stacks
void SbiRuntime::PopFor()
{
@@ -1220,7 +1208,6 @@ void SbiRuntime::PopFor()
}
}
-// Entleeren des FOR-Stacks
void SbiRuntime::ClearForStack()
{
@@ -1246,14 +1233,14 @@ SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* p
//////////////////////////////////////////////////////////////////////////
//
-// DLL-Aufrufe
+// DLL-calls
void SbiRuntime::DllCall
- ( const String& aFuncName, // Funktionsname
- const String& aDLLName, // Name der DLL
- SbxArray* pArgs, // Parameter (ab Index 1, kann NULL sein)
- SbxDataType eResType, // Returnwert
- sal_Bool bCDecl ) // sal_True: nach C-Konventionen
+ ( const String& aFuncName,
+ const String& aDLLName,
+ SbxArray* pArgs, // parameter (from index 1, can be NULL)
+ SbxDataType eResType, // return value
+ sal_Bool bCDecl ) // sal_True: according to C-conventions
{
// No DllCall for "virtual" portal users
if( needSecurityRestrictions() )
@@ -1262,7 +1249,7 @@ void SbiRuntime::DllCall
return;
}
- // MUSS NOCH IMPLEMENTIERT WERDEN
+ // NOT YET IMPLEMENTED
SbxVariable* pRes = new SbxVariable( eResType );
SbiDllMgr* pDllMgr = pInst->GetDllMgr();
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 53b2ae11c76b..72ec66a88351 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -36,9 +36,9 @@
#include "rtlproto.hxx"
#include "sbintern.hxx"
#include <boost/unordered_map.hpp>
-// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
-// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
-// benoetigen!
+// The nArgs-field of a table entry is encrypted as follows:
+// At the moment it is assumed that properties don't need any
+// parameters!
// previously _ARGSMASK was 0x007F ( e.g. up to 127 args ) however 63 should be
// enough, if not we need to increase the size of nArgs member in the Methods
@@ -52,33 +52,33 @@
#define _COMPATONLY 0x0080 // procedure is visible in vba mode only
#define _NORMONLY 0x0040 // procedure is visible in normal mode only
-#define _RWMASK 0x0F00 // Maske fuer R/W-Bits
-#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags
-
-#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 // Parameter ist optional
-#define _CONST 0x0800 // Property ist const
-#define _METHOD 0x3000 // Masken-Bits fuer eine Methode
-#define _PROPERTY 0x4000 // Masken-Bit fuer eine Property
-#define _OBJECT 0x8000 // Masken-Bit fuer ein Objekt
- // Kombination von oberen Bits:
-#define _FUNCTION 0x1100 // Maske fuer Function
-#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht
-#define _SUB 0x2100 // Maske fuer Sub
-#define _ROPROP 0x4100 // Maske Read Only-Property
-#define _WOPROP 0x4200 // Maske Write Only-Property
-#define _RWPROP 0x4300 // Maske Read/Write-Property
-#define _CPROP 0x4900 // Maske fuer Konstante
+#define _RWMASK 0x0F00 // mask for R/W-bits
+#define _TYPEMASK 0xF000 // mask for the entry's type
+
+#define _READ 0x0100 // can be read
+#define _BWRITE 0x0200 // can be used as Lvalue
+#define _LVALUE _BWRITE // can be used as Lvalue
+#define _READWRITE 0x0300 // both
+#define _OPT 0x0400 // parameter is optional
+#define _CONST 0x0800 // property is const
+#define _METHOD 0x3000
+#define _PROPERTY 0x4000
+#define _OBJECT 0x8000
+ // combination of bits above:
+#define _FUNCTION 0x1100
+#define _LFUNCTION 0x1300 // mask for function which also works as Lvalue
+#define _SUB 0x2100
+#define _ROPROP 0x4100 // mask Read Only-Property
+#define _WOPROP 0x4200 // mask Write Only-Property
+#define _RWPROP 0x4300 // mask Read/Write-Property
+#define _CPROP 0x4900 // mask for constant
struct Methods {
- const char* pName; // Name des Eintrags
- SbxDataType eType; // Datentyp
- short nArgs; // Argumente und Flags
- RtlCall pFunc; // Function Pointer
- sal_uInt16 nHash; // Hashcode
+ const char* pName;
+ SbxDataType eType;
+ short nArgs;
+ RtlCall pFunc;
+ sal_uInt16 nHash;
};
struct StringHashCode
@@ -722,11 +722,11 @@ static Methods aMethods[] = {
{ "Year", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Year),0 },
{ "Date", SbxDATE, 0,NULL,0 },
-{ NULL, SbxNULL, -1,NULL,0 }}; // Tabellenende
+{ NULL, SbxNULL, -1,NULL,0 }}; // end of the table
SbiStdObject::SbiStdObject( const String& r, StarBASIC* pb ) : SbxObject( r )
{
- // Muessen wir die Hashcodes initialisieren?
+ // do we have to initialize the hashcodes?
Methods* p = aMethods;
if( !p->nHash )
while( p->nArgs != -1 )
@@ -754,21 +754,21 @@ SbiStdObject::~SbiStdObject()
delete pStdFactory;
}
-// Suche nach einem Element:
-// Hier wird linear durch die Methodentabelle gegangen, bis eine
-// passende Methode gefunden wurde. Auf Grund der Bits im nArgs-Feld
-// wird dann die passende Instanz eines SbxObjElement generiert.
-// 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.
+// Finding an element:
+// It runs linearly through the method table here until an
+// adequate method is has been found. Because of the bits in
+// the nArgs-field the adequate instance of an SbxObjElement
+// is created then. If the method/property hasn't been found,
+// return NULL without error code, so that a whole chain of
+// objects can be asked for the method/property.
SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
{
- // Bereits eingetragen?
+ // entered already?
SbxVariable* pVar = SbxObject::Find( rName, t );
if( !pVar )
{
- // sonst suchen
+ // else search one
sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName );
Methods* p = aMethods;
sal_Bool bFound = sal_False;
@@ -802,7 +802,7 @@ SbxVariable* SbiStdObject::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 );
if( p->nArgs & _CONST )
@@ -821,12 +821,11 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
return pVar;
}
-// SetModified mu� bei der RTL abgklemmt werden
+// SetModified must be pinched off at the RTL
void SbiStdObject::SetModified( sal_Bool )
{
}
-// Aufruf einer Property oder Methode.
void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType )
@@ -866,8 +865,8 @@ void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
-// Zusammenbau der Infostruktur fuer einzelne Elemente
-// Falls nIdx = 0, nix erzeugen (sind Std-Props!)
+// building the info-structure for single elements
+// if nIdx = 0, don't create anything (Std-Props!)
SbxInfo* SbiStdObject::GetInfo( short nIdx )
{
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index b8759d7826ae..831b6631392c 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -148,7 +148,7 @@ SbStdPicture::~SbStdPicture()
SbxVariable* SbStdPicture::Find( const String& rName, SbxClassType t )
{
- // Bereits eingetragen?
+ // entered already?
return SbxObject::Find( rName, t );
}
@@ -258,7 +258,7 @@ SbStdFont::SbStdFont() :
p->SetFlags( SBX_READWRITE | SBX_DONTSTORE );
p->SetUserData( ATTR_IMP_SIZE );
- // Name Property selbst verarbeiten
+ // handle name property yourself
p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
DBG_ASSERT( p, "Keine Name Property" );
p->SetUserData( ATTR_IMP_NAME );
@@ -271,7 +271,6 @@ SbStdFont::~SbStdFont()
SbxVariable* SbStdFont::Find( const String& rName, SbxClassType t )
{
- // Bereits eingetragen?
return SbxObject::Find( rName, t );
}
@@ -409,12 +408,11 @@ TYPEINIT1( SbStdClipboard, SbxObject );
SbStdClipboard::SbStdClipboard() :
SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Clipboard") ) )
{
- // Name Property selbst verarbeiten
SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY );
DBG_ASSERT( p, "Keine Name Property" );
p->SetUserData( ATTR_IMP_NAME );
- //Methoden registrieren
+ // register methods
p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Clear") ), SbxCLASS_METHOD, SbxEMPTY );
p->SetFlag( SBX_DONTSTORE );
p->SetUserData( METH_CLEAR );
@@ -442,7 +440,6 @@ SbStdClipboard::~SbStdClipboard()
SbxVariable* SbStdClipboard::Find( const String& rName, SbxClassType t )
{
- // Bereits eingetragen?
return SbxObject::Find( rName, t );
}
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index bc3aeabf0255..3f3aca86b035 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -296,7 +296,7 @@ void SbiRuntime::StepLIKE()
PushVar( pRes );
}
-// TOS und TOS-1 sind beides Objektvariable und enthalten den selben Pointer
+// TOS and TOS-1 are both object variables and contain the same pointer
void SbiRuntime::StepIS()
{
@@ -325,7 +325,7 @@ void SbiRuntime::StepIS()
PushVar( pRes );
}
-// Aktualisieren des Wertes von TOS
+// update the value of TOS
void SbiRuntime::StepGET()
{
@@ -333,7 +333,7 @@ void SbiRuntime::StepGET()
p->Broadcast( SBX_HINT_DATAWANTED );
}
-// #67607 Uno-Structs kopieren
+// #67607 copy Uno-Structs
inline void checkUnoStructCopy( SbxVariableRef& refVal, SbxVariableRef& refVar )
{
SbxDataType eVarType = refVar->GetType();
@@ -359,7 +359,7 @@ inline void checkUnoStructCopy( SbxVariableRef& refVal, SbxVariableRef& refVar )
if( aAny.getValueType().getTypeClass() == TypeClass_STRUCT )
{
SbUnoObject* pNewUnoObj = new SbUnoObject( pUnoObj->GetName(), aAny );
- // #70324: ClassName uebernehmen
+ // #70324: adopt ClassName
pNewUnoObj->SetClassName( pUnoObj->GetClassName() );
refVar->PutObject( pNewUnoObj );
}
@@ -368,13 +368,13 @@ inline void checkUnoStructCopy( SbxVariableRef& refVal, SbxVariableRef& refVar )
}
-// Ablage von TOS in TOS-1
+// laying down TOS in TOS-1
void SbiRuntime::StepPUT()
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
- // Store auf die eigene Methode (innerhalb einer Function)?
+ // store on its own method (inside a function)?
sal_Bool bFlagsChanged = sal_False;
sal_uInt16 n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
@@ -458,14 +458,14 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar )
}
-// Speichern Objektvariable
-// Nicht-Objekt-Variable fuehren zu Fehlern
+// saving object variable
+// not-object variables will cause errors
static const char pCollectionStr[] = "Collection";
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
- // #67733 Typen mit Array-Flag sind auch ok
+ // #67733 types with array-flag are OK too
// Check var, !object is no error for sure if, only if type is fixed
SbxDataType eVarType = refVar->GetType();
@@ -487,13 +487,12 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// if they are SbxEMPTY I guess
if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) )
{
- // Auf refVal GetObject fuer Collections ausloesen
+ // activate GetOject for collections on refVal
SbxBase* pObjVarObj = refVal->GetObject();
if( pObjVarObj )
{
SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
- // #67733 Typen mit Array-Flag sind auch ok
if( refObjVal )
refVal = refObjVal;
else if( !(eValType & SbxARRAY) )
@@ -501,16 +500,15 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
}
- // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
- // Object deklarierten Variable zugewiesen werden, kann hier
- // refVal ungueltig sein!
+ // #52896 refVal can be invalid here, if uno-sequences - or more
+ // general arrays - are assigned to variables that are declared
+ // as an object!
if( !refVal )
{
Error( SbERR_INVALID_USAGE_OBJECT );
}
else
{
- // Store auf die eigene Methode (innerhalb einer Function)?
sal_Bool bFlagsChanged = sal_False;
sal_uInt16 n = 0;
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
@@ -666,7 +664,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
- // #67607 Uno-Structs kopieren
+ // #67607 copy Uno-Structs
checkUnoStructCopy( refVal, refVar );
if( bFlagsChanged )
refVar->SetFlags( n );
@@ -698,7 +696,6 @@ void SbiRuntime::StepLSET()
Error( SbERR_INVALID_USAGE_OBJECT );
else
{
- // Store auf die eigene Methode (innerhalb einer Function)?
sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
refVar->SetFlag( SBX_WRITE );
@@ -733,7 +730,6 @@ void SbiRuntime::StepRSET()
Error( SbERR_INVALID_USAGE_OBJECT );
else
{
- // Store auf die eigene Methode (innerhalb einer Function)?
sal_uInt16 n = refVar->GetFlags();
if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
refVar->SetFlag( SBX_WRITE );
@@ -755,7 +751,7 @@ void SbiRuntime::StepRSET()
}
}
-// Ablage von TOS in TOS-1, dann ReadOnly-Bit setzen
+// laying down TOS in TOS-1, then set ReadOnly-Bit
void SbiRuntime::StepPUTC()
{
@@ -768,7 +764,7 @@ void SbiRuntime::StepPUTC()
}
// DIM
-// TOS = Variable fuer das Array mit Dimensionsangaben als Parameter
+// TOS = variable for the array with dimension information as parameter
void SbiRuntime::StepDIM()
{
@@ -776,7 +772,7 @@ void SbiRuntime::StepDIM()
DimImpl( refVar );
}
-// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
+// #56204 swap out DIM-functionality into a help method (step0.cxx)
void SbiRuntime::DimImpl( SbxVariableRef refVar )
{
// If refDim then this DIM statement is terminating a ReDIM and
@@ -791,15 +787,15 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
refRedim = NULL;
}
SbxArray* pDims = refVar->GetParameters();
- // Muss eine gerade Anzahl Argumente haben
- // Man denke daran, dass Arg[0] nicht zaehlt!
+ // must have an even number of arguments
+ // have in mind that Arg[0] does not count!
if( pDims && !( pDims->Count() & 1 ) )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
SbxDataType eType = refVar->IsFixed() ? refVar->GetType() : SbxVARIANT;
SbxDimArray* pArray = new SbxDimArray( eType );
- // auch Arrays ohne Dimensionsangaben zulassen (VB-komp.)
+ // allow arrays without dimension information, too (VB-compatible)
if( pDims )
{
refVar->ResetFlag( SBX_VAR_TO_DIM );
@@ -817,8 +813,8 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
}
else
{
- // #62867 Beim Anlegen eines Arrays der Laenge 0 wie bei
- // Uno-Sequences der Laenge 0 eine Dimension anlegen
+ // #62867 On creating an array of the length 0, create
+ // a dimension (like for Uno-Sequences of the length 0)
pArray->unoAddDim( 0, -1 );
}
sal_uInt16 nSavFlags = refVar->GetFlags();
@@ -830,13 +826,13 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
}
// REDIM
-// TOS = Variable fuer das Array
-// argv = Dimensionsangaben
+// TOS = variable for the array
+// argv = dimension information
void SbiRuntime::StepREDIM()
{
- // Im Moment ist es nichts anderes als Dim, da doppeltes Dim
- // bereits vom Compiler erkannt wird.
+ // Nothing different than dim at the moment because
+ // a double dim is already recognized by the compiler.
StepDIM();
}
@@ -864,8 +860,8 @@ void implCopyDimArray( SbxDimArray* pNewArray, SbxDimArray* pOldArray, short nMa
}
// REDIM PRESERVE
-// TOS = Variable fuer das Array
-// argv = Dimensionsangaben
+// TOS = variable for the array
+// argv = dimension information
void SbiRuntime::StepREDIMP()
{
@@ -997,11 +993,11 @@ void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
}
}
else
- // Arrays haben bei Erase nach VB ein recht komplexes Verhalten. Hier
- // werden zunaechst nur die Typ-Probleme bei REDIM (#26295) beseitigt:
- // Typ hart auf den Array-Typ setzen, da eine Variable mit Array
- // SbxOBJECT ist. Bei REDIM entsteht dann ein SbxOBJECT-Array und
- // der ursruengliche Typ geht verloren -> Laufzeitfehler
+ // Arrays have on an erase to VB quite a complex behaviour. Here are
+ // only the type problems at REDIM (#26295) removed at first:
+ // Set type hard onto the array-type, because a variable with array is
+ // SbxOBJECT. At REDIM there's an SbxOBJECT-array generated then and
+ // the original type is lost -> runtime error
lcl_clearImpl( refVar, eType );
}
else
@@ -1011,8 +1007,8 @@ void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
refVar->SetType( SbxEMPTY );
}
-// Variable loeschen
-// TOS = Variable
+// delete variable
+// TOS = variable
void SbiRuntime::StepERASE()
{
@@ -1048,8 +1044,8 @@ void SbiRuntime::StepBYVAL()
PushVar( pCopyVar );
}
-// Einrichten eines Argvs
-// nOp1 bleibt so -> 1. Element ist Returnwert
+// establishing an argv
+// nOp1 stays as it is -> 1st element is the return value
void SbiRuntime::StepARGC()
{
@@ -1058,7 +1054,7 @@ void SbiRuntime::StepARGC()
nArgc = 1;
}
-// Speichern eines Arguments in Argv
+// storing an argument in Argv
void SbiRuntime::StepARGV()
{
@@ -1071,7 +1067,7 @@ void SbiRuntime::StepARGV()
// Before fix of #94916:
if( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) )
{
- // Methoden und Properties evaluieren!
+ // evaluate methods and properties!
SbxVariable* pRes = new SbxVariable( *pVal );
pVal = pRes;
}
@@ -1079,8 +1075,8 @@ void SbiRuntime::StepARGV()
}
}
-// Input to Variable. Die Variable ist auf TOS und wird
-// anschliessend entfernt.
+// Input to Variable. The variable is on TOS and is
+// is removed afterwards.
void SbiRuntime::StepINPUT()
{
@@ -1124,8 +1120,8 @@ void SbiRuntime::StepINPUT()
if( !err )
{
SbxVariableRef pVar = GetTOS();
- // Zuerst versuchen, die Variable mit einem numerischen Wert
- // zu fuellen, dann mit einem Stringwert
+ // try to fill the variable with a numeric value first,
+ // then with a string value
if( !pVar->IsFixed() || pVar->IsNumeric() )
{
sal_uInt16 nLen = 0;
@@ -1134,7 +1130,7 @@ void SbiRuntime::StepINPUT()
err = SbxBase::GetError();
SbxBase::ResetError();
}
- // Der Wert muss komplett eingescant werden
+ // the value has to be scanned in completely
else if( nLen != s.Len() && !pVar->PutString( s ) )
{
err = SbxBase::GetError();
@@ -1176,8 +1172,8 @@ void SbiRuntime::StepINPUT()
}
}
-// Line Input to Variable. Die Variable ist auf TOS und wird
-// anschliessend entfernt.
+// Line Input to Variable. The variable is on TOS and is
+// deleted afterwards.
void SbiRuntime::StepLINPUT()
{
@@ -1188,14 +1184,13 @@ void SbiRuntime::StepLINPUT()
p->PutString( String( aInput, gsl_getSystemTextEncoding() ) );
}
-// Programmende
+// end of program
void SbiRuntime::StepSTOP()
{
pInst->Stop();
}
-// FOR-Variable initialisieren
void SbiRuntime::StepINITFOR()
{
@@ -1207,7 +1202,7 @@ void SbiRuntime::StepINITFOREACH()
PushForEach();
}
-// FOR-Variable inkrementieren
+// increment FOR-variable
void SbiRuntime::StepNEXT()
{
@@ -1220,7 +1215,7 @@ void SbiRuntime::StepNEXT()
pForStk->refVar->Compute( SbxPLUS, *pForStk->refInc );
}
-// Anfang CASE: TOS in CASE-Stack
+// beginning CASE: TOS in CASE-stack
void SbiRuntime::StepCASE()
{
@@ -1230,7 +1225,7 @@ void SbiRuntime::StepCASE()
refCaseStk->Put( xVar, refCaseStk->Count() );
}
-// Ende CASE: Variable freigeben
+// end CASE: free variable
void SbiRuntime::StepENDCASE()
{
@@ -1240,7 +1235,6 @@ void SbiRuntime::StepENDCASE()
refCaseStk->Remove( refCaseStk->Count() - 1 );
}
-// Standard-Fehlerbehandlung
void SbiRuntime::StepSTDERROR()
{
@@ -1262,7 +1256,7 @@ void SbiRuntime::StepNOERROR()
bError = sal_False;
}
-// UP verlassen
+// leave UP
void SbiRuntime::StepLEAVE()
{
@@ -1272,7 +1266,7 @@ void SbiRuntime::StepLEAVE()
SbxErrObject::getUnoErrObject()->Clear();
}
-void SbiRuntime::StepCHANNEL() // TOS = Kanalnummer
+void SbiRuntime::StepCHANNEL() // TOS = channel number
{
SbxVariableRef pChan = PopVar();
short nChan = pChan->GetInteger();
@@ -1291,7 +1285,7 @@ void SbiRuntime::StepPRINT() // print TOS
String s1 = p->GetString();
String s;
if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE )
- s = ' '; // ein Blank davor
+ s = ' '; // one blank before
s += s1;
ByteString aByteStr( s, gsl_getSystemTextEncoding() );
pIosys->Write( aByteStr );
@@ -1304,7 +1298,7 @@ void SbiRuntime::StepPRINTF() // print TOS in field
String s1 = p->GetString();
String s;
if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE )
- s = ' '; // ein Blank davor
+ s = ' ';
s += s1;
s.Expand( 14, ' ' );
ByteString aByteStr( s, gsl_getSystemTextEncoding() );
@@ -1315,7 +1309,7 @@ void SbiRuntime::StepPRINTF() // print TOS in field
void SbiRuntime::StepWRITE() // write TOS
{
SbxVariableRef p = PopVar();
- // Muss der String gekapselt werden?
+ // Does the string have to be encapsulated?
char ch = 0;
switch (p->GetType() )
{
@@ -1369,20 +1363,20 @@ void SbiRuntime::StepRESTART()
pRestart = pCode;
}
-// Leerer Ausdruck auf Stack fuer fehlenden Parameter
+// empty expression on stack for missing parameter
void SbiRuntime::StepEMPTY()
{
- // #57915 Die Semantik von StepEMPTY() ist die Repraesentation eines fehlenden
- // Arguments. Dies wird in VB durch ein durch den Wert 448 (SbERR_NAMED_NOT_FOUND)
- // vom Typ Error repraesentiert. StepEmpty jetzt muesste besser StepMISSING()
- // heissen, aber der Name wird der Einfachkeit halber beibehalten.
+ // #57915 The semantics of StepEMPTY() is the representation of a missing argument.
+ // This is represented by the value 448 (SbERR_NAMED_NOT_FOUND) of the type error
+ // in VB. StepEmpty should now rather be named StepMISSING() but the name is kept
+ // to simplify matters.
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
xVar->PutErr( 448 );
PushVar( xVar );
}
-// TOS = Fehlercode
+// TOS = error code
void SbiRuntime::StepERROR()
{
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 74d698974631..7dbf23e2d319 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -41,15 +41,15 @@
bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
-// Laden einer numerischen Konstanten (+ID)
+// loading a numeric constant (+ID)
void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
{
SbxVariable* p = new SbxVariable( SbxDOUBLE );
- // #57844 Lokalisierte Funktion benutzen
+ // #57844 use localized function
String aStr = pImg->GetString( static_cast<short>( nOp1 ) );
- // Auch , zulassen !!!
+ // also allow , !!!
sal_uInt16 iComma = aStr.Search( ',' );
if( iComma != STRING_NOTFOUND )
{
@@ -65,7 +65,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
PushVar( p );
}
-// Laden einer Stringkonstanten (+ID)
+// loading a string constant (+ID)
void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 )
{
@@ -83,7 +83,7 @@ void SbiRuntime::StepLOADI( sal_uInt32 nOp1 )
PushVar( p );
}
-// Speichern eines named Arguments in Argv (+Arg-Nr ab 1!)
+// stora a named argument in Argv (+Arg-no. from 1!)
void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
{
@@ -98,7 +98,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
// named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
if ( pVal->GetType() == SbxEMPTY )
pVal->Broadcast( SBX_HINT_DATAWANTED );
- // Methoden und Properties evaluieren!
+ // evaluate methods and properties!
SbxVariable* pRes = new SbxVariable( *pVal );
pVal = pRes;
}
@@ -107,7 +107,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
}
}
-// Konvertierung des Typs eines Arguments in Argv fuer DECLARE-Fkt. (+Typ)
+// converting the type of an argument in Argv for DECLARE-Fkt. (+type)
void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
{
@@ -115,44 +115,44 @@ void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
- sal_Bool bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt?
+ sal_Bool bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL requested?
SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF);
- SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // letztes Arg
+ SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // last Arg
- // BYVAL pr�fen
- if( pVar->GetRefCount() > 2 ) // 2 ist normal f�r BYVAL
+ // check BYVAL
+ if( pVar->GetRefCount() > 2 ) // 2 is normal for BYVAL
{
- // Parameter ist eine Referenz
+ // parameter is a reference
if( bByVal )
{
- // Call by Value ist verlangt -> Kopie anlegen
+ // Call by Value is requested -> create a copy
pVar = new SbxVariable( *pVar );
pVar->SetFlag( SBX_READWRITE );
refExprStk->Put( pVar, refArgv->Count() - 1 );
}
else
- pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag f�r DllMgr
+ pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag for DllMgr
}
else
{
- // Parameter ist KEINE Referenz
+ // parameter is NO reference
if( bByVal )
- pVar->ResetFlag( SBX_REFERENCE ); // Keine Referenz -> OK
+ pVar->ResetFlag( SBX_REFERENCE ); // no reference -> OK
else
- Error( SbERR_BAD_PARAMETERS ); // Referenz verlangt
+ Error( SbERR_BAD_PARAMETERS ); // reference needed
}
if( pVar->GetType() != t )
{
- // Variant, damit richtige Konvertierung
- // Ausserdem Fehler, wenn SbxBYREF
+ // variant for correct conversion
+ // besides error, if SbxBYREF
pVar->Convert( SbxVARIANT );
pVar->Convert( t );
}
}
}
-// String auf feste Laenge bringen (+Laenge)
+// bring string to a definite length (+length)
void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
{
@@ -164,7 +164,7 @@ void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
s.Expand( static_cast<xub_StrLen>( nOp1 ), ' ' );
}
-// Sprung (+Target)
+// jump (+target)
void SbiRuntime::StepJUMP( sal_uInt32 nOp1 )
{
@@ -177,7 +177,7 @@ void SbiRuntime::StepJUMP( sal_uInt32 nOp1 )
pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
}
-// TOS auswerten, bedingter Sprung (+Target)
+// evaluate TOS, conditional jump (+target)
void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 )
{
@@ -186,7 +186,7 @@ void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 )
StepJUMP( nOp1 );
}
-// TOS auswerten, bedingter Sprung (+Target)
+// evaluate TOS, conditional jump (+target)
void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 )
{
@@ -197,13 +197,13 @@ void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 )
StepJUMP( nOp1 );
}
-// TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal)
-// Sieht so aus:
+// evaluate TOS, jump into JUMP-table (+MaxVal)
+// looks like this:
// ONJUMP 2
// JUMP target1
// JUMP target2
// ...
-//Falls im Operanden 0x8000 gesetzt ist, Returnadresse pushen (ON..GOSUB)
+// if 0x8000 is set in the operand, push the return address (ON..GOSUB)
void SbiRuntime::StepONJUMP( sal_uInt32 nOp1 )
{
@@ -220,7 +220,7 @@ void SbiRuntime::StepONJUMP( sal_uInt32 nOp1 )
StepJUMP( nOp1 );
}
-// UP-Aufruf (+Target)
+// UP-call (+target)
void SbiRuntime::StepGOSUB( sal_uInt32 nOp1 )
{
@@ -230,7 +230,7 @@ void SbiRuntime::StepGOSUB( sal_uInt32 nOp1 )
pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
}
-// UP-Return (+0 oder Target)
+// UP-return (+0 or target)
void SbiRuntime::StepRETURN( sal_uInt32 nOp1 )
{
@@ -239,7 +239,7 @@ void SbiRuntime::StepRETURN( sal_uInt32 nOp1 )
StepJUMP( nOp1 );
}
-// FOR-Variable testen (+Endlabel)
+// check FOR-variable (+Endlabel)
void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
{
@@ -357,7 +357,6 @@ void SbiRuntime::StepCASETO( sal_uInt32 nOp1 )
}
}
-// Fehler-Handler
void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 )
{
@@ -372,11 +371,11 @@ void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 )
SbxErrObject::getUnoErrObject()->Clear();
}
-// Resume nach Fehlern (+0=statement, 1=next or Label)
+// Resume after errors (+0=statement, 1=next or Label)
void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
{
- // #32714 Resume ohne Error? -> Fehler
+ // #32714 Resume without error? -> error
if( !bInError )
{
Error( SbERR_BAD_RESUME );
@@ -384,7 +383,7 @@ void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
}
if( nOp1 )
{
- // Code-Zeiger auf naechstes Statement setzen
+ // set Code-pointer to the next statement
sal_uInt16 n1, n2;
pCode = pMod->FindNextStmnt( pErrCode, n1, n2, sal_True, pImg );
}
@@ -401,13 +400,13 @@ void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
nError = 0;
bInError = sal_False;
- // Error-Stack loeschen
+
SbErrorStack*& rErrStack = GetSbData()->pErrStack;
delete rErrStack;
rErrStack = NULL;
}
-// Kanal schliessen (+Kanal, 0=Alle)
+// close channel (+channel, 0=all)
void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
{
SbError err;
@@ -425,7 +424,7 @@ void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
Error( err );
}
-// Zeichen ausgeben (+char)
+// output character (+char)
void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
{
@@ -434,7 +433,7 @@ void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
Error( pIosys->GetError() );
}
-// Check, ob TOS eine bestimmte Objektklasse ist (+StringID)
+// check whether TOS is a certain object class (+StringID)
bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
{
@@ -551,16 +550,16 @@ void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
PushVar( pRet );
}
-// Library fuer anschliessenden Declare-Call definieren
+// define library for following declare-call
void SbiRuntime::StepLIB( sal_uInt32 nOp1 )
{
aLibName = pImg->GetString( static_cast<short>( nOp1 ) );
}
-// TOS wird um BASE erhoeht, BASE davor gepusht (+BASE)
-// Dieser Opcode wird vor DIM/REDIM-Anweisungen gepusht,
-// wenn nur ein Index angegeben wurde.
+// TOS is incremented by BASE, BASE is pushed before (+BASE)
+// This opcode is pushed before DIM/REDIM-commands,
+// if there's been only one index named.
void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
{
@@ -573,8 +572,8 @@ void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
p1->PutInteger( uBase );
if( !bCompatible )
x2->Compute( SbxPLUS, *p1 );
- PushVar( x2 ); // erst die Expr
- PushVar( p1 ); // dann die Base
+ PushVar( x2 ); // first the Expr
+ PushVar( p1 ); // then the Base
}
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 89c369a95adf..3220ae97a433 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -52,9 +52,9 @@ using com::sun::star::uno::Reference;
SbxVariable* getVBAConstant( const String& rName );
-// Suchen eines Elements
-// Die Bits im String-ID:
-// 0x8000 - Argv ist belegt
+
+// the bits in the String-ID:
+// 0x8000 - Argv is reserved
SbxVariable* SbiRuntime::FindElement
( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError nNotFound, sal_Bool bLocal, sal_Bool bStatic )
@@ -106,7 +106,6 @@ SbxVariable* SbiRuntime::FindElement
}
if( !pElem )
{
- // Die RTL brauchen wir nicht mehr zu durchsuchen!
sal_Bool bSave = rBasic.bNoRtl;
rBasic.bNoRtl = sal_True;
pElem = pObj->Find( aName, SbxCLASS_DONTCARE );
@@ -125,7 +124,7 @@ SbxVariable* SbiRuntime::FindElement
}
rBasic.bNoRtl = bSave;
- // Ist es ein globaler Uno-Bezeichner?
+ // is it a global uno-identifier?
if( bLocal && !pElem )
{
bool bSetName = true; // preserve normal behaviour
@@ -144,8 +143,8 @@ SbxVariable* SbiRuntime::FindElement
if( !pElem )
{
- // #72382 VORSICHT! Liefert jetzt wegen unbekannten
- // Modulen IMMER ein Ergebnis!
+ // #72382 ATTENTION! ALWAYS returns a result now
+ // because of unknown modules!
SbUnoClass* pUnoClass = findUnoClass( aName );
if( pUnoClass )
{
@@ -156,18 +155,18 @@ SbxVariable* SbiRuntime::FindElement
}
}
- // #62939 Wenn eine Uno-Klasse gefunden wurde, muss
- // das Wrapper-Objekt gehalten werden, da sonst auch
- // die Uno-Klasse, z.B. "stardiv" immer wieder neu
- // aus der Registry gelesen werden muss
+ // #62939 If an uno-class has been found, the wrapper
+ // object has to be held, because the uno-class, e. g.
+ // "stardiv", has to be read out of the registry
+ // every time again otherwise
if( pElem )
{
- // #63774 Darf nicht mit gespeichert werden!!!
+ // #63774 May not be saved too!!!
pElem->SetFlag( SBX_DONTSTORE );
pElem->SetFlag( SBX_NO_MODIFY);
- // #72382 Lokal speichern, sonst werden alle implizit
- // deklarierten Vars automatisch global !
+ // #72382 save locally, all variables that have been declared
+ // implicit would become global automatically otherwise!
if ( bSetName )
pElem->SetName( aName );
refLocals->Put( pElem, refLocals->Count() );
@@ -176,32 +175,30 @@ SbxVariable* SbiRuntime::FindElement
if( !pElem )
{
- // Nicht da und nicht im Objekt?
- // Hat das Ding Parameter, nicht einrichten!
+ // not there and not in the object?
+ // don't establish if that thing has parameters!
if( nOp1 & 0x8000 )
bFatalError = sal_True;
- // Sonst, falls keine Parameter sind, anderen Error Code verwenden
+ // else, if there are parameters, use different error code
if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) )
{
- // #39108 Bei explizit und als ELEM immer ein Fatal Error
+ // #39108 if explicit and as ELEM always a fatal error
bFatalError = sal_True;
- // Falls keine Parameter sind, anderen Error Code verwenden
+
if( !( nOp1 & 0x8000 ) && nNotFound == SbERR_PROC_UNDEFINED )
nNotFound = SbERR_VAR_UNDEFINED;
}
if( bFatalError )
{
- // #39108 Statt FatalError zu setzen, Dummy-Variable liefern
+ // #39108 use dummy variable instead of fatal error
if( !xDummyVar.Is() )
xDummyVar = new SbxVariable( SbxVARIANT );
pElem = xDummyVar;
- // Parameter von Hand loeschen
ClearArgvStack();
- // Normalen Error setzen
Error( nNotFound, aName );
}
else
@@ -210,7 +207,6 @@ SbxVariable* SbiRuntime::FindElement
pElem = StepSTATIC_Impl( aName, t );
if ( !pElem )
{
- // Sonst Variable neu anlegen
pElem = new SbxVariable( t );
if( t != SbxVARIANT )
pElem->SetFlag( SBX_FIXED );
@@ -220,15 +216,14 @@ SbxVariable* SbiRuntime::FindElement
}
}
}
- // #39108 Args koennen schon geloescht sein!
+ // #39108 Args can already be deleted!
if( !bFatalError )
SetupArgs( pElem, nOp1 );
- // Ein bestimmter Call-Type wurde gewuenscht, daher muessen
- // wir hier den Typ setzen und das Ding anfassen, um den
- // korrekten Returnwert zu erhalten!
+
+ // because a particular call-type is requested
if( pElem->IsA( TYPE(SbxMethod) ) )
{
- // Soll der Typ konvertiert werden?
+ // shall the type be converted?
SbxDataType t2 = pElem->GetType();
sal_Bool bSet = sal_False;
if( !( pElem->GetFlags() & SBX_FIXED ) )
@@ -237,75 +232,70 @@ SbxVariable* SbiRuntime::FindElement
t >= SbxINTEGER && t <= SbxSTRING )
pElem->SetType( t ), bSet = sal_True;
}
- // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
+ // assign pElem to a Ref, to delete a temp-var if applicable
SbxVariableRef refTemp = pElem;
- // Moegliche Reste vom letzten Aufruf der SbxMethod beseitigen
- // Vorher Schreiben freigeben, damit kein Error gesetzt wird.
+ // remove potential rests of the last call of the SbxMethod
+ // free Write before, so that there's no error
sal_uInt16 nSavFlags = pElem->GetFlags();
pElem->SetFlag( SBX_READWRITE | SBX_NO_BROADCAST );
pElem->SbxValue::Clear();
pElem->SetFlags( nSavFlags );
- // Erst nach dem Setzen anfassen, da z.B. LEFT()
- // den Unterschied zwischen Left$() und Left() kennen muss
+ // don't touch before setting, as e. g. LEFT()
+ // has to know the difference between Left$() and Left()
- // Da in PopVar() die Parameter von Methoden weggehauen
- // werden, muessen wir hier explizit eine neue SbxMethod anlegen
- SbxVariable* pNew = new SbxMethod( *((SbxMethod*)pElem) ); // das ist der Call!
- //ALT: SbxVariable* pNew = new SbxVariable( *pElem ); // das ist der Call!
+ // because the methods' parameters are cut away in PopVar()
+ SbxVariable* pNew = new SbxMethod( *((SbxMethod*)pElem) );
+ //OLD: SbxVariable* pNew = new SbxVariable( *pElem );
- pElem->SetParameters(0); // sonst bleibt Ref auf sich selbst
+ pElem->SetParameters(0);
pNew->SetFlag( SBX_READWRITE );
- // den Datentypen zuruecksetzen?
if( bSet )
pElem->SetType( t2 );
pElem = pNew;
}
- // Index-Access bei UnoObjekten beruecksichtigen
+ // consider index-access for UnoObjects
// definitely we want this for VBA where properties are often
// collections ( which need index access ), but lets only do
// this if we actually have params following
else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
{
- // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
SbxVariableRef refTemp = pElem;
- // Variable kopieren und dabei den Notify aufloesen
- SbxVariable* pNew = new SbxVariable( *((SbxVariable*)pElem) ); // das ist der Call!
- pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst
+ // dissolve the notify while copying variable
+ SbxVariable* pNew = new SbxVariable( *((SbxVariable*)pElem) );
+ pElem->SetParameters( NULL );
pElem = pNew;
}
}
return CheckArray( pElem );
}
-// Find-Funktion ueber Name fuer aktuellen Scope (z.B. Abfrage aus BASIC-IDE)
+// for current scope (e. g. query from BASIC-IDE)
SbxBase* SbiRuntime::FindElementExtern( const String& rName )
{
- // Hinweis zu: Es darf nicht davon ausgegangen werden, dass
- // pMeth != null, da im RunInit noch keine gesetzt ist.
+ // don't expect pMeth to be != 0, as there are none set
+ // in the RunInit yet
SbxVariable* pElem = NULL;
if( !pMod || !rName.Len() )
return NULL;
- // Lokal suchen
if( refLocals )
pElem = refLocals->Find( rName, SbxCLASS_DONTCARE );
- // In Statics suchen
if ( !pElem && pMeth )
{
- // Bei Statics, Name der Methode davor setzen
+ // for statics, set the method's name in front
String aMethName = pMeth->GetName();
aMethName += ':';
aMethName += rName;
pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
}
- // In Parameter-Liste suchen
+ // search in parameter list
if( !pElem && pMeth )
{
SbxInfo* pInfo = pMeth->GetInfo();
@@ -335,10 +325,9 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
}
}
- // Im Modul suchen
+ // search in module
if( !pElem )
{
- // RTL nicht durchsuchen!
sal_Bool bSave = rBasic.bNoRtl;
rBasic.bNoRtl = sal_True;
pElem = pMod->Find( rName, SbxCLASS_DONTCARE );
@@ -348,9 +337,6 @@ SbxBase* SbiRuntime::FindElementExtern( const String& rName )
}
-// Argumente eines Elements setzen
-// Dabei auch die Argumente umsetzen, falls benannte Parameter
-// verwendet wurden
void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
{
@@ -370,9 +356,6 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
}
if( bHasNamed )
{
- // Wir haben mindestens einen benannten Parameter!
- // Wir muessen also umsortieren
- // Gibt es Parameter-Infos?
SbxInfo* pInfo = p->GetInfo();
if( !pInfo )
{
@@ -449,7 +432,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
const String& rName = refArgv->GetAlias( i );
if( rName.Len() )
{
- // nCurPar wird auf den gefundenen Parameter gesetzt
+ // nCurPar is set to the found parameter
sal_uInt16 j = 1;
const SbxParamInfo* pParam = pInfo->GetParam( j );
while( pParam )
@@ -471,7 +454,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
refArgv = pArg;
}
}
- // Eigene Var als Parameter 0
+ // own var as parameter 0
refArgv->Put( p, 0 );
p->SetParameters( refArgv );
PopArgv();
@@ -480,11 +463,10 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
p->SetParameters( NULL );
}
-// Holen eines Array-Elements
+// getting an array element
SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
- // Falls wir ein Array haben, wollen wir bitte das Array-Element!
SbxArray* pPar;
if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
{
@@ -493,8 +475,8 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pPar = pElem->GetParameters();
if( pDimArray )
{
- // Die Parameter koennen fehlen, wenn ein Array als
- // Argument uebergeben wird.
+ // parameters may be missing, if an array is
+ // passed as an argument
if( pPar )
pElem = pDimArray->Get( pPar );
}
@@ -513,17 +495,17 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
}
- // #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt
+ // #42940, set parameter 0 to NULL so that var doesn't contain itself
if( pPar )
pPar->Put( NULL, 0 );
}
- // Index-Access bei UnoObjekten beruecksichtigen
+ // consider index-access for UnoObjects
else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) )
{
pPar = pElem->GetParameters();
if ( pPar )
{
- // Ist es ein Uno-Objekt?
+ // is it an uno-object?
SbxBaseRef pObj = (SbxBase*)pElem->GetObject();
if( pObj )
{
@@ -538,7 +520,6 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
Reference< XIndexAccess > xIndexAccess( x, UNO_QUERY );
if ( !bVBAEnabled )
{
- // Haben wir Index-Access?
if( xIndexAccess.is() )
{
sal_uInt32 nParamCount = (sal_uInt32)pPar->Count() - 1;
@@ -548,7 +529,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
return pElem;
}
- // Index holen
+ // get index
sal_Int32 nIndex = pPar->Get( 1 )->GetLong();
Reference< XInterface > xRet;
try
@@ -560,18 +541,18 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
catch (const IndexOutOfBoundsException&)
{
- // Bei Exception erstmal immer von Konvertierungs-Problem ausgehen
+ // usually expect converting problem
StarBASIC::Error( SbERR_OUT_OF_RANGE );
}
- // #57847 Immer neue Variable anlegen, sonst Fehler
- // durch PutObject(NULL) bei ReadOnly-Properties.
+ // #57847 always create a new variable, else error
+ // due to PutObject(NULL) at ReadOnly-properties
pElem = new SbxVariable( SbxVARIANT );
if( xRet.is() )
{
aAny <<= xRet;
- // #67173 Kein Namen angeben, damit echter Klassen-Namen eintragen wird
+ // #67173 don't specify a name so that the real class name is entered
String aName;
SbxObjectRef xWrapper = (SbxObject*)new SbUnoObject( aName, aAny );
pElem->PutObject( xWrapper );
@@ -607,7 +588,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
}
}
- // #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt
+ // #42940, set parameter 0 to NULL so that var doesn't contain itself
pPar->Put( NULL, 0 );
}
else if( pObj->ISA(BasicCollection) )
@@ -630,7 +611,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
return pElem;
}
-// Laden eines Elements aus der Runtime-Library (+StringID+Typ)
+// loading an element from the runtime-library (+StringID+type)
void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -644,7 +625,7 @@ SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, Sb
refLocals = new SbxArray;
PushVar( FindElement( pObj, nOp1, nOp2, nNotFound, bLocal, bStatic ) );
}
-// Laden einer lokalen/globalen Variablen (+StringID+Typ)
+// loading a local/global variable (+StringID+type)
void SbiRuntime::StepFIND( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -670,12 +651,11 @@ void SbiRuntime::StepFIND_STATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, sal_True, sal_True );
}
-// Laden eines Objekt-Elements (+StringID+Typ)
-// Das Objekt liegt auf TOS
+// loading an object-element (+StringID+type)
+// the object lies on TOS
void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- // Liegt auf dem TOS ein Objekt?
SbxVariableRef pObjVar = PopVar();
SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pObjVar);
@@ -685,20 +665,20 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
- // #56368 Bei StepElem Referenz sichern, sonst koennen Objekte
- // in Qualifizierungsketten wie ActiveComponent.Selection(0).Text
- // zu fueh die Referenz verlieren
- // #74254 Jetzt per Liste
+ // #56368 save reference at StepElem, otherwise objects could
+ // lose their reference too early in qualification chains like
+ // ActiveComponent.Selection(0).Text
+ // #74254 now per list
if( pObj )
SaveRef( (SbxVariable*)pObj );
PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, sal_False ) );
}
-// Laden eines Parameters (+Offset+Typ)
-// Wenn der Datentyp nicht stimmen sollte, eine Kopie anlegen
-// Der Datentyp SbxEMPTY zeigt an, daa kein Parameter angegeben ist.
-// Get( 0 ) darf EMPTY sein
+// loading a parameter (+offset+type)
+// If the data type is wrong, create a copy.
+// The data type SbxEMPTY shows that no parameters are given.
+// Get( 0 ) may be EMPTY
void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -706,7 +686,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxDataType t = (SbxDataType) nOp2;
SbxVariable* p;
- // #57915 Missing sauberer loesen
+ // #57915 solve missing in a cleaner way
sal_uInt16 nParamCount = refParams->Count();
if( i >= nParamCount )
{
@@ -724,7 +704,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
p->PutString( String() );
}
else
- p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
+ p->PutErr( 448 ); // like in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
refParams->Put( p, iLoop );
iLoop--;
@@ -734,7 +714,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
if( p->GetType() == SbxERROR && ( i ) )
{
- // Wenn ein Parameter fehlt, kann er OPTIONAL sein
+ // if there's a parameter missing, it can be OPTIONAL
sal_Bool bOpt = sal_False;
if( pMeth )
{
@@ -789,8 +769,8 @@ void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
-// Aufruf einer DLL-Prozedur (+StringID+Typ)
-// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist
+// call of a DLL-procedure (+StringID+type)
+// the StringID's MSB shows that Argv is occupied
void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -804,8 +784,7 @@ void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
PopArgv();
}
-// Aufruf einer DLL-Prozedur nach CDecl (+StringID+Typ)
-// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist
+// call of a DLL-procedure after CDecl (+StringID+type)
void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -820,12 +799,12 @@ void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
-// Beginn eines Statements (+Line+Col)
+// beginning of a statement (+Line+Col)
void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- // Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt,
- // hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist!
+ // If the Expr-Stack at the beginning of a statement constains a variable,
+ // some fool has called X as a function, although it's a variable!
sal_Bool bFatalExpr = sal_False;
String sUnknownMethodName;
if( nExprLvl > 1 )
@@ -840,13 +819,13 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
bFatalExpr = sal_True;
}
}
- // Der Expr-Stack ist nun nicht mehr notwendig
+
ClearExprStack();
ClearRefs();
- // Wir muessen hier hart abbrechen, da sonst Zeile und Spalte nicht mehr
- // stimmen!
+ // We have to cancel hard here because line and column
+ // would be wrong later otherwise!
if( bFatalExpr)
{
StarBASIC::FatalError( SbERR_NO_METHOD, sUnknownMethodName );
@@ -856,13 +835,11 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
sal_uInt16 nOld = nLine;
nLine = static_cast<short>( nOp1 );
- // #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern
+ // #29955 & 0xFF, to filter out for-loop-level
nCol1 = static_cast<short>( nOp2 & 0xFF );
- // Suchen des naechsten STMNT-Befehls,
- // um die End-Spalte dieses Statements zu setzen
- // Searches of the next STMNT instruction,
- // around the final column of this statement to set
+ // find the next STMNT-command to set the final column
+ // of this statement
nCol2 = 0xffff;
sal_uInt16 n1, n2;
@@ -871,37 +848,36 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
if( n1 == nOp1 )
{
- // #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern
+ // #29955 & 0xFF, to filter out for-loop-level
nCol2 = (n2 & 0xFF) - 1;
}
}
- // #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos
+ // #29955 correct for-loop-level, #67452 NOT in the error-handler
if( !bInError )
{
- // (Bei Spr�ngen aus Schleifen tritt hier eine Differenz auf)
+ // (there's a difference here in case of a jump out of a loop)
sal_uInt16 nExspectedForLevel = static_cast<sal_uInt16>( nOp2 / 0x100 );
if( pGosubStk )
nExspectedForLevel = nExspectedForLevel + pGosubStk->nStartForLvl;
- // Wenn der tatsaechliche For-Level zu klein ist, wurde aus
- // einer Schleife heraus gesprungen -> korrigieren
+ // if the actual for-level is too small it'd jump out
+ // of a loop -> corrected
while( nForLvl > nExspectedForLevel )
PopFor();
}
- // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erkl�rung siehe bei _ImplGetBreakCallLevel.
+ // 16.10.96: #31460 new concept for StepInto/Over/Out
+ // see explanation at _ImplGetBreakCallLevel
if( pInst->nCallLvl <= pInst->nBreakCallLvl )
{
StarBASIC* pStepBasic = GetCurrentBasic( &rBasic );
sal_uInt16 nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 );
- // Neuen BreakCallLevel ermitteln
pInst->CalcBreakCallLevel( nNewFlags );
}
- // Breakpoints nur bei STMNT-Befehlen in neuer Zeile!
+ // break points only at STMNT-commands in a new line!
else if( ( nOp1 != nOld )
&& ( nFlags & SbDEBUG_BREAK )
&& pMod->IsBP( static_cast<sal_uInt16>( nOp1 ) ) )
@@ -909,15 +885,14 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 )
StarBASIC* pBreakBasic = GetCurrentBasic( &rBasic );
sal_uInt16 nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 );
- // Neuen BreakCallLevel ermitteln
pInst->CalcBreakCallLevel( nNewFlags );
}
}
// (+SvStreamFlags+Flags)
-// Stack: Blocklaenge
-// Kanalnummer
-// Dateiname
+// Stack: block length
+// channel number
+// file name
void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -932,7 +907,7 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 )
Error( pIosys->GetError() );
}
-// Objekt kreieren (+StringID+StringID)
+// create object (+StringID+StringID)
void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -944,7 +919,7 @@ void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
pObj->SetName( aName );
- // Das Objekt muss BASIC rufen koennen
+ // the object must be able to call the BASIC
pObj->SetParent( &rBasic );
SbxVariable* pNew = new SbxVariable;
pNew->PutObject( pObj );
@@ -983,14 +958,14 @@ void implCopyDimArray_DCREATE( SbxDimArray* pNewArray, SbxDimArray* pOldArray, s
}
}
-// #56204 Objekt-Array kreieren (+StringID+StringID), DCREATE == Dim-Create
+// #56204 create object array (+StringID+StringID), DCREATE == Dim-Create
void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
SbxVariableRef refVar = PopVar();
DimImpl( refVar );
- // Das Array mit Instanzen der geforderten Klasse fuellen
+ // fill the array with instances of the requested class
SbxBaseRef xObj = (SbxBase*)refVar->GetObject();
if( !xObj )
{
@@ -1004,11 +979,10 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxBase* pObj = (SbxBase*)xObj;
pArray = (SbxDimArray*)pObj;
- // Dimensionen auswerten
short nDims = pArray->GetDims();
sal_Int32 nTotalSize = 0;
- // es muss ein eindimensionales Array sein
+ // must be a one-dimensional array
sal_Int32 nLower, nUpper, nSize;
sal_Int32 i;
for( i = 0 ; i < nDims ; i++ )
@@ -1021,7 +995,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
nTotalSize *= nSize;
}
- // Objekte anlegen und ins Array eintragen
+ // create objects and insert them into the array
String aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
for( i = 0 ; i < nTotalSize ; i++ )
{
@@ -1035,7 +1009,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
pClassObj->SetName( aName );
- // Das Objekt muss BASIC rufen koennen
+ // the object must be able to call the basic
pClassObj->SetParent( &rBasic );
pArray->SbxArray::Put32( pClassObj, i );
}
@@ -1095,7 +1069,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
-// Objekt aus User-Type kreieren (+StringID+StringID)
+// create object from user-type (+StringID+StringID)
SbxObject* createUserTypeImpl( const String& rClassName ); // sb.cxx
@@ -1137,7 +1111,7 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3
pVar->SetFlag( SBX_VAR_TO_DIM );
}
-// Einrichten einer lokalen Variablen (+StringID+Typ)
+// establishing a local variable (+StringID+type)
void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -1154,7 +1128,7 @@ void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
-// Einrichten einer modulglobalen Variablen (+StringID+Typ)
+// establishing a module-global variable (+StringID+type)
void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedForClassModule )
{
@@ -1173,7 +1147,7 @@ void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedFo
if( pProp )
{
pProp->SetFlag( SBX_DONTSTORE );
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ // from 2.7.1996: HACK because of 'reference can't be saved'
pProp->SetFlag( SBX_NO_MODIFY);
implHandleSbxFlags( pProp, t, nOp2 );
@@ -1196,7 +1170,7 @@ void SbiRuntime::StepPUBLIC_P( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
-// Einrichten einer globalen Variablen (+StringID+Typ)
+// establishing a global variable (+StringID+type)
void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
@@ -1227,7 +1201,7 @@ void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
if( p )
{
p->SetFlag( SBX_DONTSTORE );
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ // from 2.7.1996: HACK because of 'reference can't be saved'
p->SetFlag( SBX_NO_MODIFY);
}
}
@@ -1285,7 +1259,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t )
}
return p;
}
-// Einrichten einer statischen Variablen (+StringID+Typ)
+// establishing a static variable (+StringID+type)
void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx
index 80ee91db309f..0646c3eca011 100644
--- a/basic/source/sample/collelem.cxx
+++ b/basic/source/sample/collelem.cxx
@@ -33,13 +33,13 @@
#include <basic/sbx.hxx>
#include "collelem.hxx"
-// Das Sample-Element ist ein kleines Objekt, das die Properties
-// Name und Value enthlt sowie die Methode Say, die den bergebenen
-// Text mit dem eigenen Namen verkoppelt und ausgibt.
+// The sample-element is a small object that contains the properties
+// name and value and the method say, which couples the passed text
+// with its own name and outputs it.
SampleElement::SampleElement( const String& r ) : SbxObject( r )
{
- // Methode Say mit einem String-Parameter
+ // method say with a string-parameter
SbxVariable* pMeth = Make( String( RTL_CONSTASCII_USTRINGPARAM("Say") ), SbxCLASS_METHOD, SbxEMPTY );
pMeth->SetUserData( 0x12345678 );
pMeth->ResetFlag( SBX_FIXED );
@@ -59,8 +59,8 @@ void SampleElement::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
sal_uIntPtr t = pHint->GetId();
if( t == SBX_HINT_DATAWANTED && pVar->GetUserData() == 0x12345678 )
{
- // Die Say-Methode:
- // 1 Parameter + Returnwert
+ // the say-method:
+ // 1 parameter + return value
if( !pPar_ || pPar_->Count() != 2 )
SetError( SbxERR_WRONG_ARGS );
else
diff --git a/basic/source/sample/object.cxx b/basic/source/sample/object.cxx
index 4322d5e1fe62..de802da278ce 100644
--- a/basic/source/sample/object.cxx
+++ b/basic/source/sample/object.cxx
@@ -37,93 +37,90 @@
#include "object.hxx"
#include "collelem.hxx"
-// Das Sample-Objekt hat folgende Elemente:
+// The sample-object has got the following elements:
// 1) Properties:
-// Name der Name
-// Value ein double-Wert, beide bereits als Default drin
-// 2) Methoden:
-// Create Erzeugen eines neuen Unterelements
-// Display Ausgabe eines Textes
+// Name the name
+// Value a double-value, both already as default
+// 2) Methods:
+// Create creating a new sub-element
+// Display display a text
// Square Argument * Argument
-// Event Aufruf eines Basic-Eventhandlers
-// 3) Unterobjekte:
-// Per Create() kann ein neues Unterelement eingerichtet werden,
-// das indiziert werden kann, falls mehrere Objekte gleichen Namens
-// existieren.
-// 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.
-// Die Collection findet sich in COLLECTN.*, die in der Collection
-// enthaltenen Objekte in COLLELEM.*
+// Event calling a basic event handler
+// 3) Subobjects:
+// With Create() a new sub-element can be established, which
+// can be indexed if multiple objects of the same name exist.
+// This implementation is an example for a table-controlled version,
+// which can contain a lot of elements. The elements are taken from
+// the table into the object as required.
+// The collection can be found in COLLECTN.*, the collection's
+// objects in COLLELEM.*
-// Das Sample-Objekt wird in ..\app\mybasic.cxx wie folgt in StarBASIC
-// eingebaut:
+// The sample-object is in ..\app\mybasic.cxx implemented as follows
+// in StarBASIC:
-// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
+// The nArgs-field of a table entry is encrypted as follows:
-#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 _ARGSMASK 0x00FF // up to 255 arguments
+#define _RWMASK 0x0F00 // mask for R/W-bits
+#define _TYPEMASK 0xF000 // mask for the entry's type
-#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 // sal_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 _READ 0x0100 // can be read
+#define _BWRITE 0x0200 // can be used as Lvalue
+#define _LVALUE _BWRITE // can be used as Lvalue
+#define _READWRITE 0x0300 // both
+#define _OPT 0x0400 // sal_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
+ // combination of the bits above:
+#define _FUNCTION 0x1100 // mask for function
+#define _LFUNCTION 0x1300 // mask for function that also works 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 der Collection, hier mal hart verdrahtet
+#define COLLNAME "Elements" // the collection's name, wired hard here
SampleObject::Methods SampleObject::aMethods[] = {
-// Eine Sample-Methode (der Returnwert ist SbxNULL)
+// a sample-method (the return value is SbxNULL)
{ "Display", SbxEMPTY, &SampleObject::Display, 1 | _FUNCTION },
- // Ein Named Parameter
+ // a named parameter
{ "message", SbxSTRING, NULL, 0 },
-// Eine Sample-Funktion
+// a sample-function
{ "Square", SbxDOUBLE, &SampleObject::Square, 1 | _FUNCTION },
- // Ein Named Parameter
+ // a named parameter
{ "value", SbxDOUBLE, NULL, 0 },
// Basic-Callback
{ "Event", SbxEMPTY, &SampleObject::Event, 1 | _FUNCTION },
- // Ein Named Parameter
+ // a named parameter
{ "event", SbxSTRING, NULL, 0 },
-// Element erzeugen
+// create element
{ "Create", SbxEMPTY, &SampleObject::Create, 1 | _FUNCTION },
- // Ein Named Parameter
+ // a named parameter
{ "name", SbxSTRING, NULL, 0 },
-{ NULL, SbxNULL, NULL, -1 }}; // Tabellenende
+{ NULL, SbxNULL, NULL, -1 }}; // end of the table
SampleObject::SampleObject( const String& rClass ) : SbxObject( rClass )
{
SetName( String( RTL_CONSTASCII_USTRINGPARAM("Sample") ) );
- PutDouble( 1.0 ); // Startwert fuer Value
+ PutDouble( 1.0 );
}
-// 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.
+// Finding an element:
+// It goes linearly through the method table until an adequate
+// method is found.
+// If the method/property hasn't been found, return only NULL
+// without error code so that a whole chain of objects can be
+// asked for their method/property.
SbxVariable* SampleObject::Find( const String& rName, SbxClassType t )
{
- // Ist das Element bereits vorhanden?
SbxVariable* pRes = SbxObject::Find( rName, t );
if( !pRes && t != SbxCLASS_OBJECT )
{
- // sonst suchen
Methods* p = aMethods;
short nIndex = 0;
sal_Bool bFound = sal_False;
@@ -138,7 +135,7 @@ SbxVariable* SampleObject::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 aName_ = String::CreateFromAscii( p->pName );
@@ -148,9 +145,8 @@ SbxVariable* SampleObject::Find( const String& rName, SbxClassType t )
else if( nType & _METHOD )
eCT = SbxCLASS_METHOD;
pRes = Make( aName_, eCT, p->eType );
- // Wir setzen den Array-Index + 1, da ja noch andere
- // Standard-Properties existieren, die auch aktiviert
- // werden muessen.
+ // We set the array-index + 1 because there are other standard-
+ // properties existing which have to activated too.
pRes->SetUserData( nIndex + 1 );
pRes->SetFlags( nAccess );
}
@@ -158,7 +154,7 @@ SbxVariable* SampleObject::Find( const String& rName, SbxClassType t )
return pRes;
}
-// Aktivierung eines Elements oder Anfordern eines Infoblocks
+// activation of an element or ask for an info block
void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
const SfxHint& rHint, const TypeId& rHT )
@@ -169,7 +165,7 @@ void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData();
- // kein Index: weiterreichen!
+ // no index: hand on!
if( nIndex )
{
sal_uIntPtr t = pHint->GetId();
@@ -182,13 +178,13 @@ void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
bWrite = sal_True;
if( t == SBX_HINT_DATAWANTED || bWrite )
{
- // Parameter-Test fuer Methoden:
+ // parameter-test for methods:
sal_uInt16 nPar = aMethods[ --nIndex ].nArgs & 0x00FF;
- // Element 0 ist der Returnwert
+ // element 0 is the return value
if( ( !pPar_ && nPar )
|| ( pPar_->Count() != nPar+1 ) )
SetError( SbxERR_WRONG_ARGS );
- // Alles klar, man kann den Call ausfuehren
+ // alright, the call can be done
else
{
(this->*(aMethods[ nIndex ].pFunc))( pVar, pPar_, bWrite );
@@ -200,7 +196,7 @@ void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
}
}
-// Zusammenbau der Infostruktur fuer einzelne Elemente
+// construction of the info structure for single elements
SbxInfo* SampleObject::GetInfo( short nIdx )
{
@@ -220,15 +216,14 @@ SbxInfo* SampleObject::GetInfo( short nIdx )
}
-// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert
-// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus
-// Element 0 gespeichert.
+// Properties and methods lay down the return value in element 0 of the
+// Argv at Get (bPut = sal_False); at Put (bPut = sal_True) the value from
+// element 0 is saved.
-// Die Methoden:
void SampleObject::Display( SbxVariable*, SbxArray* pPar_, sal_Bool )
{
- // GetString() loest u.U. auch einen Error aus!
+ // GetString() might perhaps cause an error!
String s( pPar_->Get( 1 )->GetString() );
if( !IsError() )
InfoBox( NULL, s ).Execute();
@@ -240,14 +235,13 @@ void SampleObject::Square( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
pVar->PutDouble( n * n );
}
-// Callback nach BASIC:
+// Callback to BASIC:
void SampleObject::Event( SbxVariable*, SbxArray* pPar_, sal_Bool )
{
Call( pPar_->Get( 1 )->GetString(), NULL );
}
-// Neues Element anlegen
void SampleObject::Create( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
{
@@ -255,7 +249,6 @@ void SampleObject::Create( SbxVariable* pVar, SbxArray* pPar_, sal_Bool )
MakeObject( pPar_->Get( 1 )->GetString(), String( RTL_CONSTASCII_USTRINGPARAM("SampleElement") ) ) );
}
-// Die Factory legt unsere beiden Objekte an.
SbxObject* SampleObjectFac::CreateObject( const String& rClass )
{
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 7efb748355cc..d4479a6b706e 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -85,7 +85,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
nRes = SbxTRUE;
else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
{
- // Jetzt kann es noch in eine Zahl konvertierbar sein
+ // it can be convertable to a number
sal_Bool bError = sal_True;
double n;
SbxDataType t;
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 61fbafdd37cf..2404d357e2aa 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -34,21 +34,21 @@
#include <basic/sbxform.hxx>
/*
-TODO: gibt es noch irgend welche Star-Basic Besonderheiten ?
+TODO: are there any Star-Basic characteristics unconsidered?
- was bedeutet: * als Platzhalter
+ what means: * as placeholder
-BEMERKUNG: Visual-Basic behandelt folgende (ung"ultige) Format-Strings
- wie angezeigt:
+COMMENT: Visual-Basic treats the following (invalid) format-strings
+ as shown:
##0##.##0## --> ##000.000##
- (diese Klasse verh"alt sich genau so).
+ (this class behaves the same way)
*/
-#include <stdio.h> // f"ur: sprintf()
-#include <float.h> // f"ur: DBL_DIG, DBL_EPSILON
-#include <math.h> // f"ur: floor(), fabs(), log10(), pow()
+#include <stdio.h> // for: sprintf()
+#include <float.h> // for: DBL_DIG, DBL_EPSILON
+#include <math.h> // for: floor(), fabs(), log10(), pow()
//=================================================================
//=========================== DEFINES =============================
@@ -57,18 +57,18 @@ BEMERKUNG: Visual-Basic behandelt folgende (ung"ultige) Format-Strings
#define _NO_DIGIT -1
#define MAX_NO_OF_EXP_DIGITS 5
- // +4 wegen dem Wertebereich: zwischen -308 und +308
- // +1 f"ur abschliessende 0
+ // +4 because of the value range: between -308 and +308
+ // +1 for closing 0
#define MAX_NO_OF_DIGITS DBL_DIG
#define MAX_DOUBLE_BUFFER_LENGTH MAX_NO_OF_DIGITS + 9
- // +1 f"ur Vorzeichen
- // +1 f"ur Ziffer vor dem Dezimal-Punkt
- // +1 f"ur Dezimal-Punkt
- // +2 f"ur Exponent E und Exp. Vorzeichen
- // +3 f"ur den Wert des Exponenten
- // +1 f"ur abschliessende 0
-
-// Defines f"ur die Ziffern:
+ // +1 for leading sign
+ // +1 for digit before the decimal point
+ // +1 for decimal point
+ // +2 for exponent E and exp. leading sign
+ // +3 for the exponent's value
+ // +1 for closing 0
+
+// Defines for the digits:
#define ASCII_0 '0' // 48
#define ASCII_9 '9' // 57
@@ -76,7 +76,7 @@ BEMERKUNG: Visual-Basic behandelt folgende (ung"ultige) Format-Strings
#define FORMAT_SEPARATOR ';'
-// vordefinierte Formate f"ur den Format$()-Befehl:
+// predefined formats for the Format$()-command:
#define BASICFORMAT_GENERALNUMBER "General Number"
#define BASICFORMAT_CURRENCY "Currency"
#define BASICFORMAT_FIXED "Fixed"
@@ -89,28 +89,26 @@ BEMERKUNG: Visual-Basic behandelt folgende (ung"ultige) Format-Strings
#define EMPTYFORMATSTRING ""
-// Bem.: Visual-Basic hat bei Floating-Point-Zahlen maximal 12 Stellen
-// nach dem Dezimal-Punkt.
-// Alle Format-Strings sind kompatibel zu Visual-Basic:
+// Comment: Visual-Basic has a maximum of 12 positions after the
+// decimal point for floating-point-numbers.
+// all format-strings are compatible to Visual-Basic:
#define GENERALNUMBER_FORMAT "0.############"
- // max. 12 Stellen in Visual-Basic !
#define CURRENCY_FORMAT "@$0.00;@($0.00)"
#define FIXED_FORMAT "0.00"
#define STANDARD_FORMAT "@0.00"
#define PERCENT_FORMAT "0.00%"
#define SCIENTIFIC_FORMAT "#.00E+00"
-// BEMERKUNG: das Zeichen @ bedeutet, das Tausender-Separatoren erzeugt
-// weden sollen. Dies ist eine StarBasic 'Erweiterung'.
+// Comment: the character @ means that thousand-separators shall
+// be generated. That's a StarBasic 'extension'.
//=================================================================
-// zur Bestimmung der Anzahl Stellen in dNumber
+
double get_number_of_digits( double dNumber )
//double floor_log10_fabs( double dNumber )
{
if( dNumber==0.0 )
- // 0 hat zumindest auch eine Stelle !
- return 0.0; //ehemals 1.0, jetzt 0.0 wegen #40025;
+ return 0.0; // used to be 1.0, now 0.0 because of #40025;
else
return floor( log10( fabs( dNumber ) ) );
}
@@ -141,87 +139,74 @@ SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousa
sCurrencyFormatStrg = _sCurrencyFormatStrg;
}
-// Funktion zur Ausgabe eines Fehler-Textes (zum Debuggen)
-// verschiebt alle Zeichen des Strings, angefangen von der nStartPos,
-// um eine Position zu gr"osseren Indizes, d.h. es wird Platz f"ur
-// ein neues (einzuf"ugendes) Zeichen geschafft.
-// ACHTUNG: der String MUSS gross genug sein !
+// function for ouput of a error-text (for debugging)
+// displaces all characters of the string, starting from nStartPos
+// for one position to larger indexes, i. e. place for a new
+// character (which is to be inserted) is created.
+// ATTENTION: the string MUST be long enough!
inline void SbxBasicFormater::ShiftString( String& sStrg, sal_uInt16 nStartPos )
{
sStrg.Erase( nStartPos,1 );
}
-// Funktion um ein Zeichen an einen String anzuh"angen
inline void SbxBasicFormater::StrAppendChar( String& sStrg, sal_Unicode ch )
{
sStrg.Insert( ch );
}
-// h"angt die "ubergebene Ziffer nDigit an den "ubergebenen String sStrg
-// an, dabei wird "uberpr"uft ob nDigit eine g"ultige Ziffer ist,
-// falls dies nicht der Fall ist, wird nichts gemacht.
void SbxBasicFormater::AppendDigit( String& sStrg, short nDigit )
{
if( nDigit>=0 && nDigit<=9 )
StrAppendChar( sStrg, (sal_Unicode)(nDigit+ASCII_0) );
}
-// verschiebt den Dezimal-Punkt um eine Stelle nach links
void SbxBasicFormater::LeftShiftDecimalPoint( String& sStrg )
{
sal_uInt16 nPos = sStrg.Search( cDecPoint );
if( nPos!=STRING_NOTFOUND )
{
- // vertausche Dezimal-Punkt
+ // swap decimal point
sStrg.SetChar( nPos, sStrg.GetChar( nPos - 1 ) );
sStrg.SetChar( nPos-1, cDecPoint );
}
}
-// rundet in einem String die Ziffer an der angegebenen Stelle,
-// es wird ein Flag zur"uckgeliefert, falls ein Overflow auftrat,
-// d.h. 99.99 --> 100.00, d.h. ein Gr"ossenordung ge"andert wurde
-// (geschieht beim Runden einer 9).
+// returns a flag if rounding a 9
void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOverflow )
{
- // wurde ggf ein falscher Index uebergeben --> Aufruf ignorieren
if( nPos<0 )
return;
bOverflow = sal_False;
- // "uberspringe den Dezimalpunkt und Tausender-Trennzeichen
+
sal_Unicode c = sStrg.GetChar( nPos );
if( nPos>0 && (c == cDecPoint || c == cThousandSep) )
{
StrRoundDigit( sStrg,nPos-1,bOverflow );
- // AENDERUNG ab 9.3.1997: nach rekursivem Call die Methode SOFORT beenden !
+ // CHANGE from 9.3.1997: end the method immediately after recursive call!
return;
}
- // "uberspringe alle nicht-Ziffern:
- // BEMERKUNG:
- // in einem g"ultigen Format-String sollte die Ausgabe
- // der Zahl an einem St"uck geschen, d.h. Sonderzeichen sollten
- // NUR vor ODER nach der Zahl stehen und nicht mitten in der
- // Format-Angabe f"ur die Zahl
+ // skip non-digits:
+ // COMMENT:
+ // in a valid format-string the number's output should be done
+ // in one piece, i. e. special characters should ONLY be in
+ // front OR behind the number and not right in the middle of
+ // the format information for the number
while( nPos>=0 && (sStrg.GetChar( nPos )<ASCII_0 || sStrg.GetChar( nPos )>ASCII_9) )
nPos--;
- // muss ggf. noch Platz f"ur eine weitere (f"uhrende) Ziffer
- // geschaffen werden ?
+
if( nPos==-1 )
{
ShiftString( sStrg,0 );
- // f"uhrende 1 einf"ugen: z.B. 99.99 f"ur 0.0
sStrg.SetChar( 0, '1' );
bOverflow = sal_True;
}
else
{
- // ist die zu rundende Position eine Ziffer ?
sal_Unicode c2 = sStrg.GetChar( nPos );
if( c2 >= ASCII_0 && c2 <= ASCII_9 )
{
- // muss eine 9 gerundet werden? Falls: Ja --> rekursiver Aufruf
if( c2 == ASCII_9 )
{
sStrg.SetChar( nPos, '0' );
@@ -232,18 +217,14 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos, sal_Bool& bOver
}
else
{
- // --> Nein, d.h. Platz f"ur Ziffer schaffen: z.B. -99.99 f"ur #0.0
- // da gerundet wird MUSS es immer eine g"ultige Position
- // nPos+1 geben !
ShiftString( sStrg,nPos+1 );
- // f"uhrende 1 einf"ugen
sStrg.SetChar( nPos+1, '1' );
bOverflow = sal_True;
}
}
}
-// rundet in einem String die Ziffer an der angegebenen Stelle
+
void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos )
{
sal_Bool bOverflow;
@@ -251,12 +232,9 @@ void SbxBasicFormater::StrRoundDigit( String& sStrg, short nPos )
StrRoundDigit( sStrg,nPos,bOverflow );
}
-// parse den Formatstring von der "ubergebenen Position zur"uck
-// und l"osche ggf. "uberf"ussige 0en, z.B. 4.50 in 0.0#
void SbxBasicFormater::ParseBack( String& sStrg, const String& sFormatStrg,
short nFormatPos )
{
- // WICHTIG: nFormatPos kann auch negativ sein, in diesem Fall Aufruf ignorieren
for( short i=nFormatPos;
i>0 && sFormatStrg.GetChar( i ) == '#' && sStrg.GetChar( (sStrg.Len()-1) ) == '0';
i-- )
@@ -265,54 +243,45 @@ void SbxBasicFormater::ParseBack( String& sStrg, const String& sFormatStrg,
#ifdef _with_sprintf
-/*
- Bemerkung:
- Zahl wird mit maximaler (sinnvollen) Genauigkeit in einen String
- umgewandelt (mit sprintf()), dieser String wird dann im Schleifen-
- Durchlauf nach der entsprechenden Ziffer durchsucht.
-*/
-// initialisiert die Daten der Klasse um einen Scan-Durchlauf durchzuf"uhren
+
void SbxBasicFormater::InitScan( double _dNum )
{
char sBuffer[ MAX_DOUBLE_BUFFER_LENGTH ];
dNum = _dNum;
InitExp( get_number_of_digits( dNum ) );
- // maximal 15 Nachkomma-Stellen, Format-Beispiel: -1.234000000000000E-001
+ // maximum of 15 positions behind the decimal point, example: -1.234000000000000E-001
/*int nCount =*/ sprintf( sBuffer,"%+22.15lE",dNum );
sSciNumStrg.AssignAscii( sBuffer );
}
+
void SbxBasicFormater::InitExp( double _dNewExp )
{
char sBuffer[ MAX_DOUBLE_BUFFER_LENGTH ];
- // bestimme den Exponenten (kann immer GENAU durch int dargestellt werden)
nNumExp = (short)_dNewExp;
- // und dessen String
/*int nCount =*/ sprintf( sBuffer,"%+i",nNumExp );
sNumExpStrg.AssignAscii( sBuffer );
- // bestimme die Anzahl der Stellen im Exponenten
nExpExp = (short)get_number_of_digits( (double)nNumExp );
}
-// bestimmt die Ziffer an der angegebenen Stelle (gedacht zur Anwendung im
-// Scan-Durchlauf)
+
short SbxBasicFormater::GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit )
{
- // Versuch eine gr"ossere Ziffer zu lesen,
- // z.B. Stelle 4 in 1.234,
- // oder eine Ziffer ausserhalb der Aufl"osung der
- // Zahl (double) zu lesen (z.B. max. 15 Stellen).
+ // trying to read a higher digit,
+ // e. g. position 4 in 1.234,
+ // or to read a digit outside of the
+ // number's dissolution (double)
if( nPos>nNumExp || abs(nNumExp-nPos)>MAX_NO_OF_DIGITS )
return _NO_DIGIT;
- // bestimme den Index der Stelle in dem Number-String:
- // "uberlese das Vorzeichen
+ // determine the index of the position in the number-string:
+ // skip the leading sign
sal_uInt16 no = 1;
- // falls notwendig den Dezimal-Punkt "uberlesen:
+ // skip the decimal point if necessary
if( nPos<nNumExp )
no++;
no += nNumExp-nPos;
- // Abfrage der ersten (g"ultigen) Ziffer der Zahl --> Flag setzen
+ // query of the number's first valid digit --> set flag
if( nPos==nNumExp )
bFoundFirstDigit = sal_True;
return (short)(sSciNumStrg.GetChar( no ) - ASCII_0);
@@ -320,110 +289,93 @@ short SbxBasicFormater::GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigi
short SbxBasicFormater::GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit )
{
- // ist die abgefragte Stelle zu gross f"ur den Exponenten ?
if( nPos>nExpExp )
return -1;
- // bestimme den Index der Stelle in dem Number-String:
- // "uberlese das Vorzeichen
sal_uInt16 no = 1;
no += nExpExp-nPos;
- // Abfrage der ersten (g"ultigen) Ziffer der Zahl --> Flag setzen
+
if( nPos==nExpExp )
bFoundFirstDigit = sal_True;
return (short)(sNumExpStrg.GetChar( no ) - ASCII_0);
}
-// es kann ein Wert f"ur den Exponent angegeben werden, da ggf. die
-// Zahl ggf. NICHT normiert (z.B. 1.2345e-03) dargestellt werden soll,
-// sondern eventuell 123.345e-3 !
+// a value for the exponent can be given because the number maybe shall
+// not be displayed in a normed way (e. g. 1.2345e-03) but maybe 123.345e-3 !
short SbxBasicFormater::GetDigitAtPosExpScan( double dNewExponent, short nPos,
sal_Bool& bFoundFirstDigit )
{
- // neuer Exponent wurde "ubergeben, aktualisiere
- // die tempor"aren Klassen-Variablen
InitExp( dNewExponent );
- // und jetzt die Stelle bestimmen
+
return GetDigitAtPosExpScan( nPos,bFoundFirstDigit );
}
#else
-/* Probleme mit der folgenden Methode:
+/* Problems with the following method:
-TODO: ggf einen 'intelligenten' Peek-Parser um Rundungsfehler bei
- double-Zahlen herauszufinden ? z.B. f"ur 0.00115 #.#e-000
+TODO: an 'intelligent' peek-parser might be needed to detect rounding
+ mistakes at double-numbers - e. g. for 0.00115 #.#e-000
- Problem mit: format( 0.3345 , "0.000" )
- Problem mit: format( 0.00115 , "0.0000" )
+ problem with: format( 0.3345 , "0.000" )
+ problem with: format( 0.00115 , "0.0000" )
*/
-// liefert die Ziffer an der angegebenen '10er System'-Position,
-// d.h. positive nPos f"ur Stellen vor dem Komma und negative
-// f"ur Stellen nach dem Komma.
-// nPos==0 bedeutet erste Stelle vor dem Komma, also 10^0.
-// liefert 0..9 f"ur g"ultige Ziffern und -1 f"ur nicht vorhanden,
-// d.h. falls die "ubergebene Zahl zu klein ist
-// (z.B. Stelle 5 bei dNumber=123).
-// Weiter wird in dNextNumber die um die f"uhrenden Stellen
-// (bis nPos) gek"urzte Zahl zur"uckgeliefert, z.B.
+// returns the digit at the given '10 system'-position,
+// i. e. positive nPos for positions before the decimal
+// point and negative for positions after.
+// nPos==0 means first position after the decimalpoint, so 10^0.
+// returns 0..9 for valid digits and -1 for not existing,
+// i. e. if the passed number is too small
+// (e. g. position 5 of dNumber=123).
+// Furthermore in dNextNumber the number shorted by leading
+// positions (till nPos) is returned, e. g.
// GetDigitAtPos( 3434.565 , 2 , dNewNumber ) --> dNewNumber = 434.565
-// dies kann f"ur Schleifenabarbeitung g"unstiger sein, d.h.
-// die Zahlen immer von der gr"ossten Stelle abarbeiten/scanen.
-// In bFoundFirstDigit wird ggf. ein Flag gesetzt wenn eine Ziffer
-// gefunden wurde, dies wird dazu verwendet um 'Fehler' beim Parsen 202
-// zu vermeiden, die
-// ACHTUNG: anscheinend gibt es manchmal noch Probleme mit Rundungs-Fehlern!
+// In bFoundFirstDigit a flag is set if a digit has been found,
+// this is used to prevent 'errors' on parsing 202
+// ATTENTION: apparently there are sometimes still problems with rounding mistakes!
short SbxBasicFormater::GetDigitAtPos( double dNumber, short nPos,
double& dNextNumber, sal_Bool& bFoundFirstDigit )
-// ACHTUNG: nPos kann auch negativ werden, f"ur Stellen nach dem Dezimal-Punkt
{
double dDigit;
short nMaxDigit;
- // erst mal aus der Zahl eine positive Zahl machen:
dNumber = fabs( dNumber );
- // "uberpr"ufe ob Zahl zu klein f"ur angegebene Stelle ist
nMaxDigit = (short)get_number_of_digits( dNumber );
- // f"uhrende Ziffern 'l"oschen'
- // Bem.: Fehler nur bei Zahlen gr"osser 0, d.h. bei Ziffern vor dem
- // Dezimal-Punkt
+ // error only at numbers > 0, i. e. for digits before
+ // the decimal point
if( nMaxDigit<nPos && !bFoundFirstDigit && nPos>=0 )
return _NO_DIGIT;
- // Ziffer gefunden, setze Flag:
+
bFoundFirstDigit = sal_True;
for( short i=nMaxDigit; i>=nPos; i-- )
{
double dI = (double)i;
double dTemp1 = pow( 10.0,dI );
- // pr"apariere nun die gesuchte Ziffer:
+
dDigit = floor( pow( 10.0,log10( fabs( dNumber ) )-dI ) );
dNumber -= dTemp1 * dDigit;
}
- // Zuweisung f"ur optimierte Schleifen-Durchl"aufe
+ // for optimized loop run
dNextNumber = dNumber;
- // und zum Schluss noch die float-Rundungsungenauigkeiten heraus filtern
+
return RoundDigit( dDigit );
}
-// rundet eine double-Zahl zwischen 0 und 9 auf die genaue
-// Integer-Zahl, z.B. 2.8 -> 3 und 2.2 -> 2
+
short SbxBasicFormater::RoundDigit( double dNumber )
{
- // ist der Wertebereich g"ultig ?
if( dNumber<0.0 || dNumber>10.0 )
return -1;
- short nTempHigh = (short)(dNumber+0.5); // ggf. floor( )
+ short nTempHigh = (short)(dNumber+0.5); // maybe floor( )
return nTempHigh;
}
#endif
-// kopiert den entsprechenden Teil des Format-Strings, falls vorhanden,
-// und liefert diesen zur"uck.
-// Somit wird ein neuer String erzeugt, der vom Aufrufer wieder freigegeben
-// werden muss
+// Copies the respective part of the format-string, if existing, and returns it.
+// So a new string is created, which has to be freed by the caller later.
String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
@@ -432,17 +384,17 @@ String SbxBasicFormater::GetPosFormatString( const String& sFormatStrg, sal_Bool
if( nPos!=STRING_NOTFOUND )
{
bFound = sal_True;
- // der Format-String f"ur die positiven Zahlen ist alles
- // vor dem ersten ';'
+ // the format-string for positive numbers is
+ // everything before the first ';'
return sFormatStrg.Copy( 0,nPos );
}
- // kein ; gefunden, liefere Leerstring
+
String aRetStr;
aRetStr.AssignAscii( EMPTYFORMATSTRING );
return aRetStr;
}
-// siehe auch GetPosFormatString()
+// see also GetPosFormatString()
String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
@@ -450,18 +402,14 @@ String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, sal_Bool
if( nPos!=STRING_NOTFOUND )
{
- // der Format-String f"ur die negative Zahlen ist alles
- // zwischen dem ersten und dem zweiten ';'.
- // Daher: hole erst mal alles nach dem ersten ';'
+ // the format-string for negative numbers is
+ // everything between the first and the second ';'
String sTempStrg = sFormatStrg.Copy( nPos+1 );
- // und suche darin ggf. ein weiteres ';'
nPos = sTempStrg.Search( FORMAT_SEPARATOR );
bFound = sal_True;
if( nPos==STRING_NOTFOUND )
- // keins gefunden, liefere alles...
return sTempStrg;
else
- // ansonsten den String zwischen den beiden ';' liefern
return sTempStrg.Copy( 0,nPos );
}
String aRetStr;
@@ -469,7 +417,7 @@ String SbxBasicFormater::GetNegFormatString( const String& sFormatStrg, sal_Bool
return aRetStr;
}
-// siehe auch GetPosFormatString()
+// see also GetPosFormatString()
String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
@@ -477,11 +425,9 @@ String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, sal_Bool &
if( nPos!=STRING_NOTFOUND )
{
- // der Format-String f"ur die Null ist alles
- // was nach dem zweiten ';' kommt.
- // Daher: hole erst mal alles nach dem ersten ';'
+ // the format string for the zero is
+ // everything after the second ';'
String sTempStrg = sFormatStrg.Copy( nPos+1 );
- // und suche darin ggf. ein weiteres ';'
nPos = sTempStrg.Search( FORMAT_SEPARATOR );
if( nPos!=STRING_NOTFOUND )
{
@@ -489,19 +435,18 @@ String SbxBasicFormater::Get0FormatString( const String& sFormatStrg, sal_Bool &
sTempStrg = sTempStrg.Copy( nPos+1 );
nPos = sTempStrg.Search( FORMAT_SEPARATOR );
if( nPos==STRING_NOTFOUND )
- // keins gefunden, liefere alles...
return sTempStrg;
else
return sTempStrg.Copy( 0,nPos );
}
}
- // kein ; gefunden, liefere Leerstring
+
String aRetStr;
aRetStr.AssignAscii( EMPTYFORMATSTRING );
return aRetStr;
}
-// siehe auch GetPosFormatString()
+// see also GetPosFormatString()
String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, sal_Bool & bFound )
{
bFound = sal_False; // default...
@@ -509,15 +454,12 @@ String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, sal_Boo
if( nPos!=STRING_NOTFOUND )
{
- // der Format-String f"ur die Null ist alles
- // was nach dem dritten ';' kommt.
- // Daher: hole erst mal alles nach dem ersten ';'
+ // the format-string for the Null is
+ // everything after the third ';'
String sTempStrg = sFormatStrg.Copy( nPos+1 );
- // und suche darin ggf. ein weiteres ';'
nPos = sTempStrg.Search( FORMAT_SEPARATOR );
if( nPos!=STRING_NOTFOUND )
{
- // und suche nun nach dem dritten ';'
sTempStrg = sTempStrg.Copy( nPos+1 );
nPos = sTempStrg.Search( FORMAT_SEPARATOR );
if( nPos!=STRING_NOTFOUND )
@@ -527,14 +469,14 @@ String SbxBasicFormater::GetNullFormatString( const String& sFormatStrg, sal_Boo
}
}
}
- // kein ; gefunden, liefere Leerstring
+
String aRetStr;
aRetStr.AssignAscii( EMPTYFORMATSTRING );
return aRetStr;
}
-// analysiert den Format-String, liefert Wert <> 0 falls ein Fehler
-// aufgetreten ist
+
+// returns value <> 0 in case of an error
short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
short& nNoOfOptionalDigitsLeft,
@@ -547,7 +489,6 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
short nState = 0;
nLen = sFormatStrg.Len();
- // initialisiere alle Z"ahler und Flags
nNoOfDigitsLeft = 0;
nNoOfDigitsRight = 0;
nNoOfOptionalDigitsLeft = 0;
@@ -556,14 +497,11 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
bPercent = sal_False;
bCurrency = sal_False;
bScientific = sal_False;
- // ab 11.7.97: sobald ein Komma in dem Format String gefunden wird,
- // werden alle 3 Zehnerpotenzen markiert (d.h. tausender, milionen, ...)
- // bisher wurde nur an den gesetzten Position ein Tausender-Separator
- // ausgegeben oder wenn ein @ im Format-String stand.
- // Dies war ein Missverstaendnis der VB Kompatiblitaet.
+ // from 11.7.97: as soon as a comma (point?) is found in the format string,
+ // all three decimal powers are marked (i. e. thousand, million, ...)
bGenerateThousandSeparator = sFormatStrg.Search( ',' ) != STRING_NOTFOUND;
nMultipleThousandSeparators = 0;
- // und untersuche den Format-String nach den gew"unschten Informationen
+
for( sal_uInt16 i=0; i<nLen; i++ )
{
sal_Unicode c = sFormatStrg.GetChar( i );
@@ -573,29 +511,28 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
if( nState==0 )
{
nNoOfDigitsLeft++;
-// TODO hier ggf. bessere Fehler-"Uberpr"ufung der Mantisse auf g"ultige Syntax (siehe Grammatik)
- // ACHTUNG: 'undefiniertes' Verhalten falls # und 0
- // gemischt werden !!!
- // BEMERKUNG: eigentlich sind #-Platzhalter bei Scientific
- // Darstellung vor dem Dezimal-Punkt sinnlos !
+// TODO here maybe better error inspection of the mantissa for valid syntax (see grammar)h
+ // ATTENTION: 'undefined' behaviour if # and 0 are combined!
+ // REMARK: #-placeholders are actually useless for
+ // scientific display before the decimal point!
if( c=='#' )
nNoOfOptionalDigitsLeft++;
}
else if( nState==1 )
nNoOfDigitsRight++;
- else if( nState==-1 ) // suche 0 im Exponent
+ else if( nState==-1 ) // search 0 in the exponent
{
- if( c=='#' ) // # schaltet den Zustand weiter
+ if( c=='#' ) // # switches on the condition
{
nNoOfOptionalExponentDigits++;
nState = -2;
}
nNoOfExponentDigits++;
}
- else if( nState==-2 ) // suche # im Exponent
+ else if( nState==-2 ) // search # in the exponent
{
if( c=='0' )
- // ERROR: 0 nach # im Exponent ist NICHT erlaubt !!
+ // ERROR: 0 after # in the exponent is NOT allowed!!
return -4;
nNoOfOptionalExponentDigits++;
nNoOfExponentDigits++;
@@ -604,7 +541,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
case '.':
nState++;
if( nState>1 )
- return -1; // ERROR: zu viele Dezimal-Punkte
+ return -1; // ERROR: too many decimal points
break;
case '%':
bPercent = sal_True;
@@ -615,8 +552,7 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
case ',':
{
sal_Unicode ch = sFormatStrg.GetChar( i+1 );
- // vorl"aufig wird NUR auf zwei aufeinanderfolgede
- // Zeichen gepr"uft
+
if( ch!=0 && (ch==',' || ch=='.') )
nMultipleThousandSeparators++;
} break;
@@ -625,12 +561,12 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
// #i13821 not when no digits before
if( nNoOfDigitsLeft > 0 || nNoOfDigitsRight > 0 )
{
- nState = -1; // breche jetzt das Z"ahlen der Stellen ab
+ nState = -1; // abort counting digits
bScientific = sal_True;
}
break;
- // EIGENES Kommando-Zeichen, das die Erzeugung der
- // Tausender-Trennzeichen einschaltet
+ // OWN command-character which turns on
+ // the creation of thousand-separators
case '\\':
// Ignore next char
i++;
@@ -643,8 +579,8 @@ short SbxBasicFormater::AnalyseFormatString( const String& sFormatStrg,
return 0;
}
-// das Flag bCreateSign zeigt an, dass bei der Mantisse ein Vorzeichen
-// erzeugt werden soll
+// the flag bCreateSign says that at the mantissa a leading sign
+// shall be created
void SbxBasicFormater::ScanFormatString( double dNumber,
const String& sFormatStrg, String& sReturnStrg,
sal_Bool bCreateSign )
@@ -654,47 +590,44 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
nMultipleThousandSeparators;
sal_Bool bPercent,bCurrency,bScientific,bGenerateThousandSeparator;
- // Initialisiere den Return-String
sReturnStrg = String();
- // analysiere den Format-String, d.h. bestimme folgende Werte:
+ // analyse the format-string, i. e. determine the following values:
/*
- - Anzahl der Ziffern vor dem Komma
- - Anzahl der Ziffern nach dem Komma
- - optionale Ziffern vor dem Komma
- - Anzahl der Ziffern im Exponent
- - optionale Ziffern im Exponent
- - Prozent-Zeichen gefunden ?
- - () f"ur negatives Vorzeichen ?
- - Exponetial-Schreibweise ?
- - sollen Tausender-Separatoren erzeugt werden ?
- - wird ein Prozent-Zeichen gefunden ? --> dNumber *= 100.0;
- - gibt es aufeinanderfolgende Tausender-Trennzeichen ?
- ,, oder ,. --> dNumber /= 1000.0;
- - sonstige Fehler ? mehrfache Dezimalpunkte, E's, etc.
- --> Fehler werden zur Zeit einfach ignoriert
+ - number of digits before decimal point
+ - number of digits after decimal point
+ - optional digits before decimal point
+ - number of digits in the exponent
+ - optional digits in the exponent
+ - percent-character found?
+ - () for negative leading sign?
+ - exponetial-notation?
+ - shall thousand-separators be generated?
+ - is a percent-character being found? --> dNumber *= 100.0;
+ - are there thousand-separators in a row?
+ ,, or ,. --> dNumber /= 1000.0;
+ - other errors? multiple decimal points, E's, etc.
+ --> errors are simply ignored at the moment
*/
AnalyseFormatString( sFormatStrg,nNoOfDigitsLeft,nNoOfDigitsRight,
nNoOfOptionalDigitsLeft,nNoOfExponentDigits,
nNoOfOptionalExponentDigits,
bPercent,bCurrency,bScientific,bGenerateThousandSeparator,
nMultipleThousandSeparators );
- // Spezialbehandlung f"ur Spezialzeichen
+ // special handling for special characters
if( bPercent )
dNumber *= 100.0;
-// TODO: diese Vorgabe (,, oder ,.) ist NICHT Visual-Basic kompatibel !
- // Frage: soll das hier stehen bleiben (Anforderungen) ?
+// TODO: this condition (,, or ,.) is NOT Visual-Basic compatible!
+ // Question: shall this stay here (requirements)?
if( nMultipleThousandSeparators )
dNumber /= 1000.0;
- // einige Arbeits-Variablen
double dExponent;
short i,nLen;
short nState,nDigitPos,nExponentPos,nMaxDigit,nMaxExponentDigit;
sal_Bool bFirstDigit,bFirstExponentDigit,bFoundFirstDigit,
bIsNegative,bZeroSpaceOn, bSignHappend,bDigitPosNegative;
- // Initialisierung der Arbeits-Variablen
bSignHappend = sal_False;
bFoundFirstDigit = sal_False;
bIsNegative = dNumber<0.0;
@@ -706,7 +639,6 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
bDigitPosNegative = false;
if( bScientific )
{
- // beim Exponent ggf. "uberz"ahlige Stellen vor dem Komma abziehen
dExponent = dExponent - (double)(nNoOfDigitsLeft-1);
nDigitPos = nMaxDigit;
nMaxExponentDigit = (short)get_number_of_digits( dExponent );
@@ -714,20 +646,20 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
}
else
{
- nDigitPos = nNoOfDigitsLeft-1; // Z"ahlweise f"angt bei 0 an, 10^0
- // hier ben"otigt man keine Exponent-Daten !
+ nDigitPos = nNoOfDigitsLeft-1; // counting starts at 0, 10^0
+ // no exponent-data is needed here!
bDigitPosNegative = (nDigitPos < 0);
}
bFirstDigit = sal_True;
bFirstExponentDigit = sal_True;
- nState = 0; // 0 --> Mantisse; 1 --> Exponent
+ nState = 0; // 0 --> mantissa; 1 --> exponent
bZeroSpaceOn = 0;
#ifdef _with_sprintf
InitScan( dNumber );
#endif
- // scanne jetzt den Format-String:
+ // scanning the format-string:
sal_Unicode cForce = 0;
for( i=0; i<nLen; i++ )
{
@@ -746,20 +678,18 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
case '#':
if( nState==0 )
{
- // Behandlung der Mantisse
+ // handling of the mantissa
if( bFirstDigit )
{
- // ggf. Vorzeichen erzeugen
- // Bem.: bei bCurrency soll das negative
- // Vorzeichen durch () angezeigt werden
+ // remark: at bCurrency the negative
+ // leading sign shall be shown with ()
if( bIsNegative && !bCreateSign && !bSignHappend )
{
- // nur einmal ein Vorzeichen ausgeben
bSignHappend = sal_True;
StrAppendChar( sReturnStrg,'-' );
}
- // hier jetzt "uberz"ahlige Stellen ausgeben,
- // d.h. vom Format-String nicht erfasste Stellen
+ // output redundant positions, i. e. those which
+ // are undocumented by the format-string
if( nMaxDigit>nDigitPos )
{
for( short j=nMaxDigit; j>nDigitPos; j-- )
@@ -770,27 +700,26 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
#else
AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPos( dNumber,j,dNumber,bFoundFirstDigit ) );
#endif
- // wurde wirklich eine Ziffer eingefuegt ?
+
if( nTempDigit!=_NO_DIGIT )
- // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen
bFirstDigit = sal_False;
- // muss ggf. ein Tausender-Trennzeichen erzeugt werden?
+
if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && j>0 && (j % 3 == 0) )
StrAppendChar( sReturnStrg,cThousandSep );
}
}
}
- // muss f"ur eine leere Stelle eventuell eine 0 ausgegeben werden ?
+
if( nMaxDigit<nDigitPos && ( c=='0' || bZeroSpaceOn ) )
{
- AppendDigit( sReturnStrg,0 ); // Ja
- // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen
+ AppendDigit( sReturnStrg,0 );
+
bFirstDigit = sal_False;
bZeroSpaceOn = 1;
- // BEM.: bei Visual-Basic schaltet die erste 0 f"ur alle
- // nachfolgenden # (bis zum Dezimal-Punkt) die 0 ein,
- // dieses Verhalten wird hier mit dem Flag simmuliert.
- // muss ggf. ein Tausender-Trennzeichen erzeugt werden?
+ // Remark: in Visual-Basic the first 0 turns on the 0 for
+ // all the following # (up to the decimal point),
+ // this behaviour is simulated here with the flag.
+
if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
StrAppendChar( sReturnStrg,cThousandSep );
}
@@ -802,27 +731,26 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
#else
AppendDigit( sReturnStrg,nTempDigit = GetDigitAtPos( dNumber,nDigitPos,dNumber,bFoundFirstDigit ) );
#endif
- // wurde wirklich eine Ziffer eingefuegt ?
+
if( nTempDigit!=_NO_DIGIT )
- // jetzt wurde wirklich eine Ziffer ausgegeben, Flag setzen
bFirstDigit = sal_False;
- // muss ggf. ein Tausender-Trennzeichen erzeugt werden?
+
if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit>=nDigitPos ) && nDigitPos>0 && (nDigitPos % 3 == 0) )
StrAppendChar( sReturnStrg,cThousandSep );
}
- // und Position aktualisieren
+
nDigitPos--;
}
else
{
- // Behandlung des Exponenten
+ // handling the exponent
if( bFirstExponentDigit )
{
- // Vorzeichen wurde schon bei e/E ausgegeben
+ // leading sign has been given out at e/E already
bFirstExponentDigit = sal_False;
if( nMaxExponentDigit>nExponentPos )
- // hier jetzt "uberz"ahlige Stellen ausgeben,
- // d.h. vom Format-String nicht erfasste Stellen
+ // output redundant positions, i. e. those which
+ // are undocumented by the format-string
{
for( short j=nMaxExponentDigit; j>nExponentPos; j-- )
{
@@ -834,9 +762,9 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
}
}
}
- // muss f"ur eine leere Stelle eventuell eine 0 ausgegeben werden ?
+
if( nMaxExponentDigit<nExponentPos && c=='0' )
- AppendDigit( sReturnStrg,0 ); // Ja
+ AppendDigit( sReturnStrg,0 );
else
#ifdef _with_sprintf
AppendDigit( sReturnStrg,GetDigitAtPosExpScan( dExponent,nExponentPos,bFoundFirstDigit ) );
@@ -855,25 +783,23 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
i-=2;
break;
}
- // gebe Komma aus
StrAppendChar( sReturnStrg,cDecPoint );
break;
case '%':
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
ParseBack( sReturnStrg,sFormatStrg,i-1 );
- // gebe Prozent-Zeichen aus
sReturnStrg.Insert('%');
break;
case 'e':
case 'E':
- // muss Mantisse noch gerundet werden, bevor der Exponent angezeigt wird ?
+ // does mantissa have to be rounded, before the exponent is displayed?
{
- // gibt es ueberhaupt eine Mantisse ?
+ // is there a mantissa at all?
if( bFirstDigit )
{
- // anscheinend nicht, d.h. ungueltiger Format String, z.B. E000.00
- // d.h. ignoriere diese e bzw. E Zeichen
- // ggf. einen Fehler (wie Visual Basic) ausgeben ?
+ // apparently not, i. e. invalid format string, e. g. E000.00
+ // so ignore these e and E characters
+ // maybe output an error (like in Visual Basic)?
// #i13821: VB 6 behaviour
StrAppendChar( sReturnStrg,c );
@@ -890,37 +816,30 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
StrRoundDigit( sReturnStrg,sReturnStrg.Len()-1,bOverflow );
if( bOverflow )
{
- // es wurde eine f"uhrende 9 gerundet, d.h.
- // verschiebe den Dezimal-Punkt um eine Stelle nach links
+ // a leading 9 has been rounded
LeftShiftDecimalPoint( sReturnStrg );
- // und l"osche die letzte Ziffer, diese wird
- // duch die f"uhrende 1 ersetzt:
sReturnStrg.SetChar( sReturnStrg.Len()-1 , 0 );
- // der Exponent muss um 1 erh"oht werden,
- // da der Dezimalpunkt verschoben wurde
dExponent += 1.0;
}
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
ParseBack( sReturnStrg,sFormatStrg,i-1 );
}
- // "andere Zustand des Scanners
+ // change the scanner's condition
nState++;
- // gebe Exponent-Zeichen aus
+ // output exponent character
StrAppendChar( sReturnStrg,c );
- // i++; // MANIPULATION der Schleifen-Variable !
+ // i++; // MANIPULATION of the loop-variable!
c = sFormatStrg.GetChar( ++i );
- // und gebe Vorzeichen / Exponent aus
+ // output leading sign / exponent
if( c!=0 )
{
if( c=='-' )
{
- // falls Exponent < 0 gebe - aus
if( dExponent<0.0 )
StrAppendChar( sReturnStrg,'-' );
}
else if( c=='+' )
{
- // gebe auf jeden Fall das Vorzeichen des Exponenten aus !
if( dExponent<0.0 )
StrAppendChar( sReturnStrg,'-' );
else
@@ -934,50 +853,43 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
break;
case '(':
case ')':
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00
+ // maybe remove redundant 0s, e. g. 4.500e4 in 0.0##e-00
ParseBack( sReturnStrg,sFormatStrg,i-1 );
if( bIsNegative )
StrAppendChar( sReturnStrg,c );
break;
case '$':
- // den String fuer die Waehrung dranhengen:
+ // append the string for the currency:
sReturnStrg += sCurrencyStrg;
break;
case ' ':
case '-':
case '+':
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00
ParseBack( sReturnStrg,sFormatStrg,i-1 );
- // gebe das jeweilige Zeichen direkt aus
StrAppendChar( sReturnStrg,c );
break;
case '\\':
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00
- // falls Sonderzeichen am Ende oder mitten in
- // Format-String vorkommen
ParseBack( sReturnStrg,sFormatStrg,i-1 );
- // Sonderzeichen gefunden, gebe N"ACHSTES
- // Zeichen direkt aus (falls es existiert)
+ // special character found, output next
+ // character directly (if existing)
c = sFormatStrg.GetChar( ++i );
if( c!=0 )
StrAppendChar( sReturnStrg,c );
break;
case CREATE_1000SEP_CHAR:
- // hier ignorieren, Aktion wurde schon in
- // AnalyseFormatString durchgef"uhrt
+ // ignore here, action has already been
+ // executed in AnalyseFormatString
break;
default:
- // auch die Zeichen und Ziffern ausgeben (wie in Visual-Basic)
+ // output characters and digits, too (like in Visual-Basic)
if( ( c>='a' && c<='z' ) ||
( c>='A' && c<='Z' ) ||
( c>='1' && c<='9' ) )
StrAppendChar( sReturnStrg,c );
}
}
- // Format-String wurde vollst"andig gescanned,
- // muss die letzte Stelle nun gerundet werden ?
- // Dies hier ist jedoch NUR notwendig, falls das
- // Zahlenformat NICHT Scientific-Format ist !
+
+ // scan completed - rounding necessary?
if( !bScientific )
{
#ifdef _with_sprintf
@@ -988,9 +900,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
if( nNextDigit>=5 )
StrRoundDigit( sReturnStrg,sReturnStrg.Len()-1 );
}
- // und ganz zum Schluss:
- // ggf. "uberf"ussige 0en l"oschen, z.B. 4.500e4 in 0.0##e-00#,
- // ABER nur Stellen nach dem Dezimal-Punkt k"onnen gel"oscht werden
+
if( nNoOfDigitsRight>0 )
ParseBack( sReturnStrg,sFormatStrg,sFormatStrg.Len()-1 );
}
@@ -1011,7 +921,7 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
{
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
- // analysiere Format-String auf vordefinierte Formate:
+ // analyse format-string concerning predefined formats:
if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_GENERALNUMBER ) )
sFormatStrg.AssignAscii( GENERALNUMBER_FORMAT );
if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_CURRENCY ) )
@@ -1031,8 +941,8 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
if( sFormatStrg.EqualsIgnoreCaseAscii( BASICFORMAT_ONOFF ) )
return ( dNumber==0.0 ) ? sOffStrg : sOnStrg ;
- // analysiere Format-String auf ';', d.h. Format-Strings f"ur
- // positive-, negative- und 0-Werte
+ // analyse format-string concerning ';', i. e. format-strings for
+ // positive-, negative- and 0-values
String sPosFormatStrg = GetPosFormatString( sFormatStrg, bPosFormatFound );
String sNegFormatStrg = GetNegFormatString( sFormatStrg, bNegFormatFound );
String s0FormatStrg = Get0FormatString( sFormatStrg, b0FormatFound );
@@ -1045,16 +955,13 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
sTempStrg = sFormatStrg;
if( b0FormatFound )
{
- // wurde ggf. Leer-String uebergeben ?
if( s0FormatStrg.Len() == 0 && bPosFormatFound )
- // --> Ja, dann verwende String fuer positive Werte
sTempStrg = sPosFormatStrg;
else
sTempStrg = s0FormatStrg;
}
else if( bPosFormatFound )
{
- // verwende String fuer positive Werte
sTempStrg = sPosFormatStrg;
}
ScanFormatString( dNumber, sTempStrg, sReturnStrg,/*bCreateSign=*/sal_False );
@@ -1065,11 +972,8 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
{
if( bNegFormatFound )
{
- // wurde ggf. Leer-String uebergeben ?
if( sNegFormatStrg.Len() == 0 && bPosFormatFound )
{
- // --> Ja, dann verwende String fuer positive Werte
- // und setzte Minus-Zeichen davor !
sTempStrg = String::CreateFromAscii("-");
sTempStrg += sPosFormatStrg;
}
@@ -1078,8 +982,8 @@ String SbxBasicFormater::BasicFormat( double dNumber, String sFormatStrg )
}
else
sTempStrg = sFormatStrg;
- // falls KEIN Format-String speziell f"ur negative Werte angegeben
- // wurde, so soll das Vorzeichen ausgegeben werden
+ // if NO format-string especially for negative
+ // values is given, output the leading sign
ScanFormatString( dNumber, sTempStrg, sReturnStrg,/*bCreateSign=*/bNegFormatFound/*sNegFormatStrg!=EMPTYFORMATSTRING*/ );
}
else // if( dNumber>0.0 )
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 95d4b8dbc836..57cc69d5e5d6 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -63,19 +63,15 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep )
rcThousandSep = rData.getNumThousandSep().GetBuffer()[0];
}
-// Scannen eines Strings nach BASIC-Konventionen
-// Dies entspricht den ueblichen Konventionen, nur dass der Exponent
-// auch ein D sein darf, was den Datentyp auf SbxDOUBLE festlegt.
-// Die Routine versucht, den Datentyp so klein wie moeglich zu gestalten.
-// Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp
-// Fixed ist und das ganze nicht hineinpasst!
+// scanning a string according to BASIC-conventions
+// but exponent may also be a D, so data type is SbxDOUBLED
+// conversion error if data type is fixed and it doesn't fit
SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType,
sal_uInt16* pLen, sal_Bool bAllowIntntl, sal_Bool bOnlyIntntl )
{
::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) );
- // Bei International Komma besorgen
char cIntntlComma, cIntntl1000;
char cNonIntntlComma = '.';
@@ -86,13 +82,13 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
cIntntlComma = (char)cDecimalSep;
cIntntl1000 = (char)cThousandSep;
}
- // Sonst einfach auch auf . setzen
+
else
{
cIntntlComma = cNonIntntlComma;
- cIntntl1000 = cNonIntntlComma; // Unschaedlich machen
+ cIntntl1000 = cNonIntntlComma;
}
- // Nur International -> IntnlComma uebernehmen
+
if( bOnlyIntntl )
{
cNonIntntlComma = cIntntlComma;
@@ -106,20 +102,17 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
sal_Bool bMinus = sal_False;
nVal = 0;
SbxDataType eScanType = SbxSINGLE;
- // Whitespace wech
while( *p &&( *p == ' ' || *p == '\t' ) ) p++;
- // Zahl? Dann einlesen und konvertieren.
if( *p == '-' )
p++, bMinus = sal_True;
if( isdigit( *p ) ||( (*p == cNonIntntlComma || *p == cIntntlComma ||
*p == cIntntl1000) && isdigit( *(p+1 ) ) ) )
{
- short exp = 0; // >0: Exponentteil
- short comma = 0; // >0: Nachkomma
- short ndig = 0; // Anzahl Ziffern
- short ncdig = 0; // Anzahl Ziffern nach Komma
+ short exp = 0;
+ short comma = 0;
+ short ndig = 0;
+ short ncdig = 0; // number of digits after decimal point
ByteString aSearchStr( "0123456789DEde" );
- // Kommas ergaenzen
aSearchStr += cNonIntntlComma;
if( cIntntlComma != cNonIntntlComma )
aSearchStr += cIntntlComma;
@@ -128,17 +121,15 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
const char* pSearchStr = aSearchStr.GetBuffer();
while( strchr( pSearchStr, *p ) && *p )
{
- // 1000er-Trenner ueberlesen
if( bOnlyIntntl && *p == cIntntl1000 )
{
p++;
continue;
}
- // Komma oder Exponent?
if( *p == cNonIntntlComma || *p == cIntntlComma )
{
- // Immer '.' einfuegen, damit atof funktioniert
+ // always insert '.' so that atof works
p++;
if( ++comma > 1 )
continue;
@@ -154,7 +145,7 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
if( toupper( *p ) == 'D' )
eScanType = SbxDOUBLE;
*q++ = 'E'; p++;
- // Vorzeichen hinter Exponent?
+
if( *p == '+' )
p++;
else
@@ -169,10 +160,10 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
if( !exp ) ndig++;
}
*q = 0;
- // Komma, Exponent mehrfach vorhanden?
+
if( comma > 1 || exp > 1 )
bRes = sal_False;
- // Kann auf Integer gefaltet werden?
+
if( !comma && !exp )
{
if( nVal >= SbxMININT && nVal <= SbxMAXINT )
@@ -183,14 +174,14 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
nVal = atof( buf );
ndig = ndig - comma;
- // zu viele Zahlen fuer SINGLE?
+ // too many numbers for SINGLE?
if( ndig > 15 || ncdig > 6 )
eScanType = SbxDOUBLE;
- // Typkennung?
+ // type detection?
if( strchr( "%!&#", *p ) && *p ) p++;
}
- // Hex/Oktalzahl? Einlesen und konvertieren:
+ // hex/octal number? read in and convert:
else if( *p == '&' )
{
p++;
@@ -243,21 +234,21 @@ SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType
return SbxERR_OK;
}
-// Schnittstelle fuer CDbl im Basic
+// port for CDbl in the Basic
SbxError SbxValue::ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle )
{
SbxDataType t;
sal_uInt16 nLen = 0;
SbxError nRetError = ImpScan( rSrc, nVal, t, &nLen,
/*bAllowIntntl*/sal_False, /*bOnlyIntntl*/sal_True );
- // Komplett gelesen?
+ // read completely?
if( nRetError == SbxERR_OK && nLen != rSrc.Len() )
nRetError = SbxERR_CONVERSION;
if( bSingle )
{
SbxValues aValues( nVal );
- nVal = (double)ImpGetSingle( &aValues ); // Hier Error bei Overflow
+ nVal = (double)ImpGetSingle( &aValues ); // here error at overflow
}
return nRetError;
}
@@ -271,13 +262,13 @@ static double roundArray[] = {
|*
|* void myftoa( double, char *, short, short, sal_Bool, sal_Bool )
|*
-|* Beschreibung: Konversion double --> ASCII
-|* Parameter: double die Zahl.
-|* char * der Zielpuffer
-|* short Anzahl Nachkommastellen
-|* short Weite des Exponenten( 0=kein E )
-|* sal_Bool sal_True: mit 1000er Punkten
-|* sal_Bool sal_True: formatfreie Ausgabe
+|* description: conversion double --> ASCII
+|* parameters: double the number
+|* char * target buffer
+|* short number of positions after decimal point
+|* short range of the exponent ( 0=no E )
+|* sal_Bool sal_True: with 1000-separators
+|* sal_Bool sal_True: output without formatting
|*
***************************************************************************/
@@ -285,18 +276,17 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
sal_Bool bPt, sal_Bool bFix, sal_Unicode cForceThousandSep = 0 )
{
- short nExp = 0; // Exponent
- short nDig = nPrec + 1; // Anzahl Digits in Zahl
- short nDec; // Anzahl Vorkommastellen
+ short nExp = 0;
+ short nDig = nPrec + 1;
+ short nDec; // number of positions before decimal point
register int i;
- // Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
ImpGetIntntlSep( cDecimalSep, cThousandSep );
if( cForceThousandSep )
cThousandSep = cForceThousandSep;
- // Exponentberechnung:
+ // compute exponent
nExp = 0;
if( nNum > 0.0 )
{
@@ -308,7 +298,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
else if( bFix && !nPrec )
nDig = nExp + 1;
- // Zahl runden:
+ // round number
if( (nNum += roundArray [( nDig > 16 ) ? 16 : nDig] ) >= 10.0 )
{
nNum = 1.0;
@@ -316,12 +306,12 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
if( !nExpWidth ) ++nDig;
}
- // Bestimmung der Vorkommastellen:
+ // determine positions before decimal point
if( !nExpWidth )
{
if( nExp < 0 )
{
- // #41691: Auch bei bFix eine 0 spendieren
+ // #41691: also a 0 at bFix
*pBuf++ = '0';
if( nPrec ) *pBuf++ = (char)cDecimalSep;
i = -nExp - 1;
@@ -335,7 +325,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
else
nDec = 1;
- // Zahl ausgeben:
+ // output number
if( nDig > 0 )
{
register int digit;
@@ -360,7 +350,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
}
}
- // Exponent ausgeben:
+ // output exponent
if( nExpWidth )
{
if( nExpWidth < 3 ) nExpWidth = 3;
@@ -380,10 +370,10 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth,
*pBuf = 0;
}
-// Die Zahl wird unformatiert mit der angegebenen Anzahl NK-Stellen
-// aufbereitet. Evtl. wird ein Minus vorangestellt.
-// Diese Routine ist public, weil sie auch von den Put-Funktionen
-// der Klasse SbxImpSTRING verwendet wird.
+// The number is prepared unformattedly with the given number of
+// NK-positions. A leading minus is added if applicable.
+// This routine is public because it's also used by the Put-functions
+// in the class SbxImpSTRING.
#ifdef _MSC_VER
#pragma optimize( "", off )
@@ -407,7 +397,7 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreS
double dMaxNumWithoutExp = (nPrec == 6) ? 1E6 : 1E14;
myftoa( nNum, p, nPrec,( nNum &&( nNum < 1E-1 || nNum >= dMaxNumWithoutExp ) ) ? 4:0,
sal_False, sal_True, cDecimalSep );
- // Trailing Zeroes weg:
+ // remove trailing zeros
for( p = cBuf; *p &&( *p != 'E' ); p++ ) {}
q = p; p--;
while( nPrec && *p == '0' ) nPrec--, p--;
@@ -423,26 +413,23 @@ void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, sal_Bool bCoreS
sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
{
- // Merken, ob ueberhaupt was geaendert wurde
sal_Bool bChanged = sal_False;
::rtl::OUString aNewString;
- // Nur Spezial-F�lle behandeln, als Default tun wir nichts
+ // only special cases are handled, nothing on default
switch( eTargetType )
{
- // Bei Fliesskomma International beruecksichtigen
+ // consider international for floating point
case SbxSINGLE:
case SbxDOUBLE:
case SbxCURRENCY:
{
::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc, RTL_TEXTENCODING_ASCII_US ) );
- // Komma besorgen
sal_Unicode cDecimalSep, cThousandSep;
ImpGetIntntlSep( cDecimalSep, cThousandSep );
aNewString = rSrc;
- // Ersetzen, wenn DecimalSep kein '.' (nur den ersten)
if( cDecimalSep != (sal_Unicode)'.' )
{
sal_Int32 nPos = aNewString.indexOf( cDecimalSep );
@@ -456,7 +443,7 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
break;
}
- // Bei sal_Bool sal_True und sal_False als String pruefen
+ // check as string in case of sal_Bool sal_True and sal_False
case SbxBOOL:
{
if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) )
@@ -474,39 +461,38 @@ sal_Bool ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
}
default: break;
}
- // String bei Aenderung uebernehmen
+
if( bChanged )
rSrc = aNewString;
return bChanged;
}
-// Formatierte Zahlenausgabe
-// Der Returnwert ist die Anzahl Zeichen, die aus dem
-// Format verwendt wurden.
+// formatted number output
+// the return value is the number of characters used
+// from the format
#ifdef _old_format_code_
-// lasse diesen Code vorl"aufig drin, zum 'abgucken'
-// der bisherigen Implementation
+// leave the code provisionally to copy the previous implementation
static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rWFmt )
{
const String& rFmt = rWFmt;
- char cFill = ' '; // Fuellzeichen
- char cPre = 0; // Startzeichen( evtl. "$" )
- short nExpDig= 0; // Anzahl Exponentstellen
- short nPrec = 0; // Anzahl Nachkommastellen
- short nWidth = 0; // Zahlenweite gesamnt
- short nLen; // Laenge konvertierte Zahl
- sal_Bool bPoint = sal_False; // sal_True: mit 1000er Kommas
- sal_Bool bTrail = sal_False; // sal_True, wenn folgendes Minus
- sal_Bool bSign = sal_False; // sal_True: immer mit Vorzeichen
- sal_Bool bNeg = sal_False; // sal_True: Zahl ist negativ
- char cBuf [1024]; // Zahlenpuffer
+ char cFill = ' '; // filling characters
+ char cPre = 0; // start character ( maybe "$" )
+ short nExpDig= 0; // number of exponent positions
+ short nPrec = 0; // number of positions after decimal point
+ short nWidth = 0; // number range completely
+ short nLen; // length of converted number
+ sal_Bool bPoint = sal_False; // sal_True: with 1000 seperators
+ sal_Bool bTrail = sal_False; // sal_True, if following minus
+ sal_Bool bSign = sal_False; // sal_True: always with leading sign
+ sal_Bool bNeg = sal_False; // sal_True: number is negative
+ char cBuf [1024]; // number buffer
char * p;
const char* pFmt = rFmt;
rRes.Erase();
- // $$ und ** abfangen. Einfach wird als Zeichen ausgegeben.
+ // catch $$ and **, is simply output as character
if( *pFmt == '$' )
if( *++pFmt != '$' ) rRes += '$';
if( *pFmt == '*' )
@@ -529,30 +515,30 @@ static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rW
case ',':
pFmt--; break;
}
- // Vorkomma:
+ // pre point
for( ;; )
{
while( *pFmt == '#' ) pFmt++, nWidth++;
- // 1000er Kommas?
+ // 1000 separators?
if( *pFmt == ',' )
{
nWidth++; pFmt++; bPoint = sal_True;
} else break;
}
- // Nachkomma:
+ // after point
if( *pFmt == '.' )
{
while( *++pFmt == '#' ) nPrec++;
nWidth += nPrec + 1;
}
- // Exponent:
+ // exponent
while( *pFmt == '^' )
pFmt++, nExpDig++, nWidth++;
- // Folgendes Minus:
+ // following minus
if( !bSign && *pFmt == '-' )
pFmt++, bTrail = sal_True;
- // Zahl konvertieren:
+ // convert number
if( nPrec > 15 ) nPrec = 15;
if( nNum < 0.0 ) nNum = -nNum, bNeg = sal_True;
p = cBuf;
@@ -560,7 +546,7 @@ static sal_uInt16 printfmtnum( double nNum, XubString& rRes, const XubString& rW
myftoa( nNum, p, nPrec, nExpDig, bPoint, sal_False );
nLen = strlen( cBuf );
- // Ueberlauf?
+ // overflow?
if( cPre ) nLen++;
if( nLen > nWidth ) rRes += '%';
else {
@@ -849,7 +835,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
case SbxULONG:
case SbxINT:
case SbxUINT:
- case SbxNULL: // #45929 NULL mit durchschummeln
+ case SbxNULL: // #45929 NULL with a little cheating
nComma = 0; goto cvt;
case SbxSINGLE:
nComma = 6; goto cvt;
@@ -860,11 +846,10 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
if( eType != SbxNULL )
d = GetDouble();
- // #45355 weiterer Einsprungpunkt fuer isnumeric-String
+ // #45355 another point to jump in for isnumeric-String
cvt2:
if( pFmt )
{
- // hole die 'statischen' Daten f"ur Sbx
SbxAppData* pData = GetSbxData_Impl();
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
@@ -878,8 +863,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
pData->eBasicFormaterLangType = eLangType;
- // falls bisher noch kein BasicFormater-Objekt
- // existiert, so erzeuge dieses
+
if( !pData->pBasicFormater )
{
SvtSysLocale aSysLocale;
@@ -888,9 +872,9 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
sal_Unicode c1000 = rData.getNumThousandSep().GetBuffer()[0];
String aCurrencyStrg = rData.getCurrSymbol();
- // Initialisierung des Basic-Formater-Hilfsobjekts:
- // hole die Resourcen f"ur die vordefinierten Ausgaben
- // des Format()-Befehls, z.B. f"ur "On/Off".
+ // initialize the Basic-formater help object:
+ // get resources for predefined output
+ // of the Format()-command, e. g. for "On/Off"
String aOnStrg = String( SbxValueFormatResId(
STR_BASICKEY_FORMAT_ON ) );
String aOffStrg = String( SbxValueFormatResId(
@@ -905,22 +889,22 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
STR_BASICKEY_FORMAT_FALSE) );
String aCurrencyFormatStrg = String( SbxValueFormatResId(
STR_BASICKEY_FORMAT_CURRENCY) );
- // erzeuge das Basic-Formater-Objekt
+
pData->pBasicFormater
= new SbxBasicFormater( cComma,c1000,aOnStrg,aOffStrg,
aYesStrg,aNoStrg,aTrueStrg,aFalseStrg,
aCurrencyStrg,aCurrencyFormatStrg );
}
- // Bem.: Aus Performance-Gr"unden wird nur EIN BasicFormater-
- // Objekt erzeugt und 'gespeichert', dadurch erspart man
- // sich das teure Resourcen-Laden (f"ur landesspezifische
- // vordefinierte Ausgaben, z.B. "On/Off") und die st"andige
- // String-Erzeugungs Operationen.
- // ABER: dadurch ist dieser Code NICHT multithreading f"ahig !
-
- // hier gibt es Probleme mit ;;;Null, da diese Methode nur aufgerufen
- // wird, wenn der SbxValue eine Zahl ist !!!
- // dazu koennte: pData->pBasicFormater->BasicFormatNull( *pFmt ); aufgerufen werden !
+ // Remark: For performance reasons there's only ONE BasicFormater-
+ // object created and 'stored', so that the expensive resource-
+ // loading is saved (for country-specific predefined outputs,
+ // e. g. "On/Off") and the continous string-creation
+ // operations, too.
+ // BUT: therefore this code is NOT multithreading capable!
+
+ // here are problems with ;;;Null because this method is only
+ // called, if SbxValue is a number!!!
+ // in addition pData->pBasicFormater->BasicFormatNull( *pFmt ); could be called!
if( eType != SbxNULL )
{
rRes = pData->pBasicFormater->BasicFormat( d ,*pFmt );
@@ -941,7 +925,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
case SbxSTRING:
if( pFmt )
{
- // #45355 wenn es numerisch ist, muss gewandelt werden
+ // #45355 converting if numeric
if( IsNumericRTL() )
{
ScanNumIntnl( GetString(), d, /*bSingle*/sal_False );
@@ -949,7 +933,6 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
}
else
{
- // Sonst String-Formatierung
printfmtstr( GetString(), rRes, *pFmt );
}
}
diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx
index a269bcde5b7b..49d63ad6ee3f 100644
--- a/basic/workben/mgrtest.cxx
+++ b/basic/workben/mgrtest.cxx
@@ -327,7 +327,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // liegt in einem anderen Storage !!!
+ // is in another storage!!!
sal_uInt16 nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) );
if ( nLib != LIB_NOTFOUND )
{
@@ -366,7 +366,7 @@ IMPL_LINK( TestWindow, TBSelect, ToolBox *, p )
{
if ( pBasMgr )
{
- // liegt in einem anderen Storage !!!
+ // is in another storage!!!
SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" );
if ( !pBasMgr->AddLib( *xStorage, pLib3Str, sal_False ) )
Sound::Beep();
@@ -528,7 +528,7 @@ void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt )
{
sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- // Nur bei Alt-Return
+ // only for Alt-Return
if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() )
;
else