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