xref: /trunk/main/basic/source/inc/runtime.hxx (revision 234bd5c5)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SBRUNTIME_HXX
25 #define _SBRUNTIME_HXX
26 
27 #ifndef _SBX_HXX
28 #include <basic/sbx.hxx>
29 #endif
30 
31 #include "sb.hxx"
32 
33 // Define activates class UCBStream in iosys.cxx
34 #define _USE_UNO
35 
36 #ifdef _USE_UNO
37 #include <rtl/ustring.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
39 #include <osl/file.hxx>
40 #include <rtl/math.hxx>
41 #include <i18npool/lang.h>
42 
43 #include <vector>
44 #include <com/sun/star/lang/XComponent.hpp>
45 #include <com/sun/star/container/XEnumeration.hpp>
46 #include <unotools/localedatawrapper.hxx>
47 
48 using namespace com::sun::star::uno;
49 using namespace com::sun::star::lang;
50 using namespace com::sun::star::container;
51 
52 
53 // Define activates old file implementation
54 // (only in non UCB case)
55 // #define _OLD_FILE_IMPL
56 
57 
58 //#include <sal/types.h>
59 //#include <rtl/byteseq.hxx>
60 //#include <rtl/ustring>
61 
62 
63 namespace basicEncoder
64 {
65 
66 // TODO: Use exported functionality (code is copied from deamons2/ucb)
67 class AsciiEncoder
68 {
69 public:
70 	static ::rtl::OUString decodeUnoUrlParamValue(const rtl::OUString & rSource);
71 	//static ::rtl::OUString encodeUnoUrlParamValue(const rtl::OUString & rSource);
72 	//static ::rtl::ByteSequence decode(const ::rtl::OUString & string);
73 	//static ::rtl::OUString encode(const ::rtl::ByteSequence & bytes);
74 	//static void test();
75 };
76 
77 }
78 
79 #endif /* _USE_UNO */
80 
81 class SbiInstance;					// aktiver StarBASIC-Prozess
82 class SbiRuntime;					// aktive StarBASIC-Prozedur-Instanz
83 
84 struct SbiArgvStack;                // Argv stack element
85 struct SbiGosubStack;               // GOSUB stack element
86 class  SbiImage;                    // Code-Image
87 class  SbiIoSystem;                 // Dateisystem
88 class  SbiDdeControl;				// DDE-Steuerung
89 class  SbiDllMgr;					// Aufrufe in DLLs
90 class  SvNumberFormatter;			// Zeit/Datumsfunktionen
91 
92 enum ForType
93 {
94 	FOR_TO,
95 	FOR_EACH_ARRAY,
96 	FOR_EACH_COLLECTION,
97 	FOR_EACH_XENUMERATION
98 };
99 
100 struct SbiForStack { 		  		// for/next stack:
101 	SbiForStack*	pNext;	   		// Chain
102 	SbxVariableRef	refVar;	   		// loop variable
103 	SbxVariableRef	refEnd;	   		// end expression / for each: Array/BasicCollection object
104 	SbxVariableRef	refInc;	   		// increment expression
105 
106 	// For each support
107 	ForType			eForType;
108 	sal_Int32			nCurCollectionIndex;
109 	sal_Int32*			pArrayCurIndices;
110 	sal_Int32*			pArrayLowerBounds;
111 	sal_Int32*			pArrayUpperBounds;
112 	Reference< XEnumeration > xEnumeration;
113 
SbiForStackSbiForStack114 	SbiForStack( void )
115 		: pArrayCurIndices( NULL )
116 		, pArrayLowerBounds( NULL )
117 		, pArrayUpperBounds( NULL )
118 	{}
~SbiForStackSbiForStack119 	~SbiForStack()
120 	{
121 		delete[] pArrayCurIndices;
122 		delete[] pArrayLowerBounds;
123 		delete[] pArrayUpperBounds;
124 	}
125 };
126 
127 struct SbiGosubStack {				// GOSUB-Stack:
128 	SbiGosubStack* pNext;			// Chain
129 	const sal_uInt8* pCode;				// Return-Pointer
130 	sal_uInt16 nStartForLvl;			// #118235: For Level in moment of gosub
131 };
132 
133 #define MAXRECURSION 500            // max. 500 Rekursionen
134 
135 #define Sb_ATTR_NORMAL		0x0000
136 #define Sb_ATTR_HIDDEN 		0x0002
137 #define Sb_ATTR_SYSTEM		0x0004
138 #define Sb_ATTR_VOLUME		0x0008
139 #define Sb_ATTR_DIRECTORY	0x0010
140 #define Sb_ATTR_ARCHIVE		0x0020
141 
142 
143 class Dir;
144 class WildCard;
145 
146 class SbiRTLData
147 {
148 public:
149 
150 #ifdef _OLD_FILE_IMPL
151 	Dir* 	pDir;
152 #else
153 	::osl::Directory* pDir;
154 #endif
155 	sal_Int16	nDirFlags;
156 	short	nCurDirPos;
157 
158 	String sFullNameToBeChecked;
159 	WildCard* pWildCard;
160 
161 #ifdef _USE_UNO
162 	Sequence< ::rtl::OUString > aDirSeq;
163 #endif /* _USE_UNO */
164 
165 	SbiRTLData();
166 	~SbiRTLData();
167 };
168 
169 // Die Instanz entspricht einem laufenden StarBASIC. Mehrere gleichzeitig
170 // laufende BASICs werden ueber verkettete Instanzen verwaltet. Hier liegen
171 // alle Daten, die nur leben, wenn BASIC auch lebt, wie z.B. das I/O-System.
172 
173 typedef ::std::vector
174 <
175     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
176 >
177 ComponentVector_t;
178 
179 
180 class SbiInstance
181 {
182 	friend class SbiRuntime;
183 
184 	SbiRTLData		aRTLData;
185 
186 	SbiIoSystem* 	pIosys;         // Dateisystem
187 	SbiDdeControl*	pDdeCtrl;       // DDE
188 	SbiDllMgr*		pDllMgr;		// DLL-Calls (DECLARE)
189 	StarBASIC*  	pBasic;
190 	SvNumberFormatter* pNumberFormatter;
191     LanguageType    meFormatterLangType;
192     DateFormat      meFormatterDateFormat;
193 	sal_uInt32 		nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
194 
195 	SbError      	nErr;     		// aktueller Fehlercode
196 	String		    aErrorMsg;		// letzte Error-Message fuer $ARG
197 	sal_uInt16      	nErl;			// aktuelle Fehlerzeile
198 	sal_Bool			bReschedule;	// Flag: sal_True = Reschedule in Hauptschleife
199 	sal_Bool			bCompatibility; // Flag: sal_True = VBA runtime compatibility mode
200 
201     ComponentVector_t ComponentVector;
202 
203 public:
204 	SbiRuntime*  pRun;        		// Call-Stack
205 	SbiInstance* pNext;             // Instanzen-Chain
206 
207 	// #31460 Neues Konzept fuer StepInto/Over/Out,
208 	// Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel()
209 	sal_uInt16	nCallLvl;				// Call-Level (wg. Rekursion)
210 	sal_uInt16	nBreakCallLvl;			// Call-Level zum Anhalten
211 	void	CalcBreakCallLevel( sal_uInt16 nFlags );	// Gemaess Flags setzen
212 
213 	SbiInstance( StarBASIC* );
214    ~SbiInstance();
215 
216 	void Error( SbError );			            // trappable Error
217 	void Error( SbError, const String& rMsg );	// trappable Error mit Message
218 	void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
219 	void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
220 	void FatalError( SbError );		            // non-trappable Error
221 	void FatalError( SbError, const String& );  // non-trappable Error
222 	void Abort();					            // Abbruch mit aktuellem Fehlercode
223 
224 	void    Stop();
GetErr()225 	SbError GetErr()				{ return nErr; }
GetErrorMsg()226 	String	GetErrorMsg()			{ return aErrorMsg; }
GetErl()227 	xub_StrLen GetErl()				{ return nErl; }
EnableReschedule(sal_Bool bEnable)228 	void	EnableReschedule( sal_Bool bEnable ) { bReschedule = bEnable; }
IsReschedule(void)229 	sal_Bool	IsReschedule( void ) { return bReschedule; }
EnableCompatibility(sal_Bool bEnable)230 	void	EnableCompatibility( sal_Bool bEnable ) { bCompatibility = bEnable; }
IsCompatibility(void)231 	sal_Bool	IsCompatibility( void ) { return bCompatibility; }
232 
getComponentVector(void)233     ComponentVector_t& getComponentVector( void )  { return ComponentVector; }
234 
235 	SbMethod* GetCaller( sal_uInt16 );
236 	SbModule* GetActiveModule();
237 	SbxArray* GetLocals( SbMethod* );
238 
GetIoSystem()239 	SbiIoSystem* GetIoSystem() { return pIosys; }
GetDdeControl()240 	SbiDdeControl* GetDdeControl() { return pDdeCtrl; }
GetBasic(void)241     StarBASIC* GetBasic( void ) { return pBasic; }
242 	SbiDllMgr* GetDllMgr();
GetRTLData() const243 	SbiRTLData* GetRTLData() const { return (SbiRTLData*)&aRTLData; }
244 
245 	SvNumberFormatter* GetNumberFormatter();
GetStdDateIdx() const246 	sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
GetStdTimeIdx() const247 	sal_uInt32 GetStdTimeIdx() const { return nStdTimeIdx; }
GetStdDateTimeIdx() const248 	sal_uInt32 GetStdDateTimeIdx() const { return nStdDateTimeIdx; }
249 
250 	// #39629# NumberFormatter auch statisch anbieten
251 	static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
252 		sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
253         LanguageType* peFormatterLangType=NULL, DateFormat* peFormatterDateFormat=NULL );
254 };
255 
256 SbiIoSystem* SbGetIoSystem();		// das aktuelle I/O-System
257 
258 
259 // Verkettbare Items, um Referenzen temporaer zu halten
260 struct RefSaveItem
261 {
262 	SbxVariableRef xRef;
263 	RefSaveItem* pNext;
264 
RefSaveItemRefSaveItem265 	RefSaveItem() { pNext = NULL; }
266 };
267 
268 
269 // Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm
270 // aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt
271 // nur lokale Daten.
272 
273 class SbiRuntime
274 {
275 	friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
276 
277 	typedef void( SbiRuntime::*pStep0 )();
278 	typedef void( SbiRuntime::*pStep1 )( sal_uInt32 nOp1 );
279 	typedef void( SbiRuntime::*pStep2 )( sal_uInt32 nOp1, sal_uInt32 nOp2 );
280 	static pStep0 aStep0[];         // Opcode-Tabelle Gruppe 0
281 	static pStep1 aStep1[];         // Opcode-Tabelle Gruppe 1
282 	static pStep2 aStep2[];         // Opcode-Tabelle Gruppe 2
283 
284 	StarBASIC&    rBasic; 			// StarBASIC-Instanz
285 	SbiInstance*   pInst;			// aktiver Thread
286 	SbModule*	  pMod;				// aktuelles Modul
287 	SbMethod* 	  pMeth;			// Methoden-Instanz
288 	SbiIoSystem*   pIosys;			// I/O-System
289 	const SbiImage* pImg;           // Code-Image
290 	SbxArrayRef   refExprStk;       // expression stack
291 	SbxArrayRef   refCaseStk;       // CASE expression stack
292 	SbxArrayRef   refRedimpArray;   // Array saved to use for REDIM PRESERVE
293 	SbxVariableRef xDummyVar;		// Ersatz fuer nicht gefundene Variablen
294 	SbiArgvStack*  pArgvStk;		// ARGV-Stack
295 	SbiGosubStack* pGosubStk;		// GOSUB stack
296 	SbiForStack*   pForStk;			// FOR/NEXT-Stack
297 	sal_uInt16        nExprLvl;			// Tiefe des Expr-Stacks
298 	sal_uInt16        nGosubLvl;        // Zum Vermeiden von Tot-Rekursionen
299 	sal_uInt16        nForLvl;	        // #118235: Maintain for level
300 	const sal_uInt8*   pCode;            // aktueller Code-Pointer
301 	const sal_uInt8*   pStmnt;           // Beginn des lezten Statements
302 	const sal_uInt8*   pError;           // Adresse des aktuellen Error-Handlers
303 	const sal_uInt8*   pRestart;         // Restart-Adresse
304 	const sal_uInt8*   pErrCode;         // Restart-Adresse RESUME NEXT
305 	const sal_uInt8*   pErrStmnt;        // Restart-Adresse RESUMT 0
306 	String		  aLibName;			// Lib-Name fuer Declare-Call
307 	SbxArrayRef   refParams;        // aktuelle Prozedur-Parameter
308 	SbxArrayRef   refLocals;        // lokale Variable
309 	SbxArrayRef   refArgv;          // aktueller Argv
310 	// AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
311 	//SbxVariableRef refSaveObj;      // #56368 Bei StepElem Referenz sichern
312 	short         nArgc;            // aktueller Argc
313 	sal_Bool          bRun;             // sal_True: Programm ist aktiv
314 	sal_Bool          bError;           // sal_True: Fehler behandeln
315 	sal_Bool          bInError;         // sal_True: in einem Fehler-Handler
316 	sal_Bool          bBlocked;         // sal_True: blocked by next call level, #i48868
317 	sal_Bool          bVBAEnabled;
318 	sal_uInt16		  nFlags;			// Debugging-Flags
319 	SbError		  nError;           // letzter Fehler
320 	sal_uInt16		  nOps;				// Opcode-Zaehler
321 	sal_uInt32    m_nLastTime;
322 
323 	RefSaveItem*  pRefSaveList;     // #74254 Temporaere Referenzen sichern
324 	RefSaveItem*  pItemStoreList;   // Unbenutzte Items aufbewahren
SaveRef(SbxVariable * pVar)325 	void SaveRef( SbxVariable* pVar )
326 	{
327 		RefSaveItem* pItem = pItemStoreList;
328 		if( pItem )
329 			pItemStoreList = pItem->pNext;
330 		else
331 			pItem = new RefSaveItem();
332 		pItem->pNext = pRefSaveList;
333 		pItem->xRef = pVar;
334 		pRefSaveList = pItem;
335 	}
ClearRefs(void)336 	void ClearRefs( void )
337 	{
338 		while( pRefSaveList )
339 		{
340 			RefSaveItem* pToClearItem = pRefSaveList;
341 			pRefSaveList = pToClearItem->pNext;
342 			pToClearItem->xRef = NULL;
343 			pToClearItem->pNext = pItemStoreList;
344 			pItemStoreList = pToClearItem;
345 		}
346 	}
347 
348 	SbxVariable* FindElement
349 	( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, sal_Bool bLocal, sal_Bool bStatic = sal_False );
350 	void SetupArgs( SbxVariable*, sal_uInt32 );
351 	SbxVariable* CheckArray( SbxVariable* );
352 
353 	void PushVar( SbxVariable* );   // Variable push
354 	SbxVariableRef PopVar();          // Variable pop
355 	SbxVariable* GetTOS( short=0 ); // Variable vom TOS holen
356 	void TOSMakeTemp();				// TOS in temp. Variable wandeln
357 	sal_Bool ClearExprStack();          // Expr-Stack freigeben
358 
359 	void PushGosub( const sal_uInt8* );  // GOSUB-Element push
360 	void PopGosub();                // GOSUB-Element pop
361 	void ClearGosubStack();         // GOSUB-Stack freigeben
362 
363 	void PushArgv();                // Argv-Element push
364 	void PopArgv();                 // Argv-Element pop
365 	void ClearArgvStack();          // Argv-Stack freigeben
366 
367 	void PushFor();                 // For-Element push
368 	void PushForEach();             // For-Each-Element push
369 	void PopFor();                  // For-Element pop
370 	void ClearForStack();           // For-Stack freigeben
371 
372 	void StepArith( SbxOperator );  // arithmetische Verknuepfungen
373 	void StepUnary( SbxOperator );  // unaere Verknuepfungen
374 	void StepCompare( SbxOperator );// Vergleiche
375 
376 	void SetParameters( SbxArray* );// Parameter uebernehmen
377 
378 	// MUSS NOCH IMPLEMENTIERT WERDEN
379 	void DllCall( const String&, const String&, SbxArray*, SbxDataType, sal_Bool );
380 
381 	// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
382 	void DimImpl( SbxVariableRef refVar );
383 
384 	// #115829
385 	bool implIsClass( SbxObject* pObj, const String& aClass );
386 
387 	void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt = false );
388 
389 	// Die nachfolgenden Routinen werden vom Single Stepper
390 	// gerufen und implementieren die einzelnen Opcodes
391 	void StepNOP(),     StepEXP(),      StepMUL(),      StepDIV();
392 	void StepMOD(),     StepPLUS(),     StepMINUS(),    StepNEG();
393 	void StepEQ(),      StepNE(),       StepLT(),       StepGT();
394 	void StepLE(),      StepGE(),       StepIDIV(),     StepAND();
395 	void StepOR(),      StepXOR(),      StepEQV(),      StepIMP();
396 	void StepNOT(),     StepCAT(),      StepLIKE(),     StepIS();
397 	void StepCLONE(),   StepOLDBASED(), StepARGC();
398 	void StepARGV(),    StepINPUT(),	StepLINPUT(),	StepSTOP();
399 	void StepGET(),		StepSET(),	StepVBASET(), 	StepPUT(),		StepPUTC();
400 	void StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bDefaultHandling = false );
401 	void StepDIM(),     StepREDIM(),	StepREDIMP(),	StepERASE();
402 	void StepINITFOR(), StepNEXT(),		StepERROR(),	StepINITFOREACH();
403 	void StepCASE(),	StepENDCASE(),  StepSTDERROR();
404 	void StepNOERROR(), StepCHANNEL(),  StepCHANNEL0(),	StepPRINT();
405 	void StepPRINTF(),	StepWRITE(),    StepRENAME(),   StepPROMPT();
406 	void StepRESTART(), StepEMPTY(),    StepLEAVE();
407 	void StepLSET(),	StepRSET(),		StepREDIMP_ERASE(), 	StepERASE_CLEAR();
408 	void StepARRAYACCESS(), StepBYVAL();
409 	// Alle Opcodes mit einem Operanden
410 	void StepLOADNC( sal_uInt32 ),  StepLOADSC( sal_uInt32 ),   StepLOADI( sal_uInt32 );
411 	void StepARGN( sal_uInt32 ),	StepBASED( sal_uInt32 ),	StepPAD( sal_uInt32 );
412 	void StepJUMP( sal_uInt32 ),    StepJUMPT( sal_uInt32 );
413 	void StepJUMPF( sal_uInt32 ),   StepONJUMP( sal_uInt32 );
414 	void StepGOSUB( sal_uInt32 ),   StepRETURN( sal_uInt32 );
415 	void StepTESTFOR( sal_uInt32 ), StepCASETO( sal_uInt32 ),   StepERRHDL( sal_uInt32 );
416 	void StepRESUME( sal_uInt32 ),  StepSETCLASS( sal_uInt32 ),	StepVBASETCLASS( sal_uInt32 ),	StepTESTCLASS( sal_uInt32 ), StepLIB( sal_uInt32 );
417 	bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors, bool bDefault = true );
418 	void StepCLOSE( sal_uInt32 ),   StepPRCHAR( sal_uInt32 ),   StepARGTYP( sal_uInt32 );
419 	// Alle Opcodes mit zwei Operanden
420 	void StepRTL( sal_uInt32, sal_uInt32 ),		StepPUBLIC( sal_uInt32, sal_uInt32 ),	StepPUBLIC_P( sal_uInt32, sal_uInt32 );
421 	void StepPUBLIC_Impl( sal_uInt32, sal_uInt32, bool bUsedForClassModule );
422 	void StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2, SbError, sal_Bool bLocal, sal_Bool bStatic = sal_False );
423 	void StepFIND( sal_uInt32, sal_uInt32 ),    StepELEM( sal_uInt32, sal_uInt32 );
424 	void StepGLOBAL( sal_uInt32, sal_uInt32 ),  StepLOCAL( sal_uInt32, sal_uInt32 );
425 	void StepPARAM( sal_uInt32, sal_uInt32), 	StepCREATE( sal_uInt32, sal_uInt32 );
426 	void StepCALL( sal_uInt32, sal_uInt32 ),    StepCALLC( sal_uInt32, sal_uInt32 );
427 	void StepCASEIS( sal_uInt32, sal_uInt32 ),  StepSTMNT( sal_uInt32, sal_uInt32 );
428 	SbxVariable* StepSTATIC_Impl( String& aName, SbxDataType& t );
429 	void StepOPEN( sal_uInt32, sal_uInt32 ),	StepSTATIC( sal_uInt32, sal_uInt32 );
430 	void StepTCREATE(sal_uInt32,sal_uInt32),	StepDCREATE(sal_uInt32,sal_uInt32);
431 	void StepGLOBAL_P( sal_uInt32, sal_uInt32 ),StepFIND_G( sal_uInt32, sal_uInt32 );
432 	void StepDCREATE_REDIMP(sal_uInt32,sal_uInt32), StepDCREATE_IMPL(sal_uInt32,sal_uInt32);
433 	void StepFIND_CM( sal_uInt32, sal_uInt32 );
434 	void StepFIND_STATIC( sal_uInt32, sal_uInt32 );
435 	void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 );
436 public:
437 	void          SetVBAEnabled( bool bEnabled );
438 	sal_uInt16		GetImageFlag( sal_uInt16 n ) const;
439 	sal_uInt16		GetBase();
440 	xub_StrLen  nLine,nCol1,nCol2;	// aktuelle Zeile, Spaltenbereich
441 	SbiRuntime* pNext;               // Stack-Chain
442 
443 	SbiRuntime( SbModule*, SbMethod*, sal_uInt32 );
444    ~SbiRuntime();
445 	void Error( SbError, bool bVBATranslationAlreadyDone = false );		// Fehler setzen, falls != 0
446 	void Error( SbError, const String& );       // Fehler setzen, falls != 0
447 	void FatalError( SbError );		            // Fehlerbehandlung=Standard, Fehler setzen
448 	void FatalError( SbError, const String& );  // Fehlerbehandlung=Standard, Fehler setzen
449 	static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
450 	void DumpPCode();
451 	sal_Bool Step();                    // Einzelschritt (ein Opcode)
Stop()452 	void Stop()     	   { bRun = sal_False;   }
IsRun()453     sal_Bool IsRun()           { return bRun;    }
block(void)454 	void block( void )	   { bBlocked = sal_True; }
unblock(void)455 	void unblock( void )   { bBlocked = sal_False; }
GetMethod()456 	SbMethod* GetMethod()  { return pMeth;   }
GetModule()457 	SbModule* GetModule()  { return pMod;    }
GetDebugFlags()458 	sal_uInt16 GetDebugFlags() { return nFlags;  }
SetDebugFlags(sal_uInt16 nFl)459 	void SetDebugFlags( sal_uInt16 nFl ) { nFlags = nFl;  }
460 	SbMethod* GetCaller();
461 	SbxArray* GetLocals();
462 	SbxArray* GetParams();
463 
464 	SbiForStack* FindForStackItemForCollection( class BasicCollection* pCollection );
465 
466 	SbxBase* FindElementExtern( const String& rName );
467 	static bool isVBAEnabled();
468 
469 };
470 
checkArithmeticOverflow(double d)471 inline void checkArithmeticOverflow( double d )
472 {
473     if( !::rtl::math::isFinite( d ) )
474     	StarBASIC::Error( SbERR_MATH_OVERFLOW );
475 }
476 
checkArithmeticOverflow(SbxVariable * pVar)477 inline void checkArithmeticOverflow( SbxVariable* pVar )
478 {
479     if( pVar->GetType() == SbxDOUBLE )
480     {
481         double d = pVar->GetDouble();
482         checkArithmeticOverflow( d );
483     }
484 }
485 
486 // Hilfsfunktion, um aktives Basic zu finden
487 StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic );
488 
489 // Get information if security restrictions should be
490 // used (File IO based on UCB, no RTL function SHELL
491 // no DDE functionality, no DLLCALL) in basic because
492 // of portal "virtual" users (portal user != UNIX user)
493 // (Implemented in iosys.cxx)
494 sal_Bool needSecurityRestrictions( void );
495 
496 // Returns sal_True if UNO is available, otherwise the old
497 // file system implementation has to be used
498 // (Implemented in iosys.cxx)
499 sal_Bool hasUno( void );
500 
501 // Converts possibly relative paths to absolute paths
502 // according to the setting done by ChDir/ChDrive
503 // (Implemented in methods.cxx)
504 String getFullPath( const String& aRelPath );
505 
506 // Sets (virtual) current path for UCB file access
507 void implChDir( const String& aDir );
508 
509 // Sets (virtual) current drive for UCB file access
510 void implChDrive( const String& aDrive );
511 
512 // Returns (virtual) current path for UCB file access
513 String implGetCurDir( void );
514 
515 // Implementation of StepRENAME with UCB
516 // (Implemented in methods.cxx, so step0.cxx
517 // has not to be infected with UNO)
518 void implStepRenameUCB( const String& aSource, const String& aDest );
519 
520 //*** OSL file access ***
521 // #87427 OSL need File URLs, so map to getFullPath
getFullPathUNC(const String & aRelPath)522 inline String getFullPathUNC( const String& aRelPath )
523 {
524     return getFullPath( aRelPath );
525 }
526 void implStepRenameOSL( const String& aSource, const String& aDest );
527 bool IsBaseIndexOne();
528 
529 #endif
530 
531