diff options
Diffstat (limited to 'basic/source/inc')
-rw-r--r-- | basic/source/inc/buffer.hxx | 98 | ||||
-rw-r--r-- | basic/source/inc/codegen.hxx | 101 | ||||
-rw-r--r-- | basic/source/inc/collelem.hxx | 83 | ||||
-rw-r--r-- | basic/source/inc/disas.hxx | 106 | ||||
-rw-r--r-- | basic/source/inc/expr.hxx | 255 | ||||
-rw-r--r-- | basic/source/inc/filefmt.hxx | 207 | ||||
-rw-r--r-- | basic/source/inc/image.hxx | 123 | ||||
-rw-r--r-- | basic/source/inc/iosys.hxx | 149 | ||||
-rw-r--r-- | basic/source/inc/object.hxx | 137 | ||||
-rw-r--r-- | basic/source/inc/opcodes.hxx | 191 | ||||
-rw-r--r-- | basic/source/inc/parser.hxx | 192 | ||||
-rw-r--r-- | basic/source/inc/propacc.hxx | 235 | ||||
-rw-r--r-- | basic/source/inc/runtime.hxx | 473 | ||||
-rw-r--r-- | basic/source/inc/sbcomp.hxx | 72 | ||||
-rw-r--r-- | basic/source/inc/sbintern.hxx | 131 | ||||
-rw-r--r-- | basic/source/inc/sbjsmeth.hxx | 89 | ||||
-rw-r--r-- | basic/source/inc/sbjsmod.hxx | 84 | ||||
-rw-r--r-- | basic/source/inc/sbunoobj.hxx | 226 | ||||
-rw-r--r-- | basic/source/inc/scanner.hxx | 136 | ||||
-rw-r--r-- | basic/source/inc/stdobj.hxx | 86 | ||||
-rw-r--r-- | basic/source/inc/symtbl.hxx | 266 | ||||
-rw-r--r-- | basic/source/inc/token.hxx | 199 |
22 files changed, 3639 insertions, 0 deletions
diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx new file mode 100644 index 000000000000..4f806f218496 --- /dev/null +++ b/basic/source/inc/buffer.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: buffer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BUFFER_HXX +#define _BUFFER_HXX + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +class SbiParser; + +class SbiBuffer { // Code/Konstanten-Puffer: + SbiParser* pParser; // fuer Fehlermeldungen + char* pBuf; // Puffer-Pointer + char* pCur; // aktueller Puffer-Pointer + USHORT nOff; // aktuelles Offset + USHORT nSize; // aktuelle Groesse + short nInc; // Inkrement + BOOL Check( USHORT ); // Buffergroesse testen +public: + SbiBuffer( SbiParser*, short ); // Inkrement + ~SbiBuffer(); + void Patch( USHORT, USHORT ); // Patchen + void Chain( USHORT ); // Back-Chain + void Align( short ); // Alignment + BOOL Add( const void*, USHORT );// Element anfuegen + BOOL operator += (const String&);// Basic-String speichern + BOOL operator += (INT8); // Zeichen speichern + BOOL operator += (INT16); // Integer speichern + BOOL operator += (UINT8); // Zeichen speichern + BOOL operator += (UINT16); // Integer speichern + char* GetBuffer(); // Puffer rausgeben (selbst loeschen!) + USHORT GetSize() { return nOff; } +}; + +#endif diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx new file mode 100644 index 000000000000..c748399b7b93 --- /dev/null +++ b/basic/source/inc/codegen.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: codegen.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CODEGEN_HXX +#define _CODEGEN_HXX + +class SbiImage; +class SbiParser; +class SbModule; +#ifndef _OPCODES_HXX +#include "opcodes.hxx" +#endif +#ifndef _BUFFER_HXX +#include "buffer.hxx" +#endif + +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 + BOOL bStmnt; // TRUE: Statement-Opcode liegt an +public: + SbiCodeGen( SbModule&, SbiParser*, short ); + SbiParser* GetParser() { return pParser; } + USHORT Gen( SbiOpcode ); + USHORT Gen( SbiOpcode, UINT16 ); + USHORT Gen( SbiOpcode, UINT16, UINT16 ); + void Patch( USHORT o, USHORT v ){ aCode.Patch( o, v ); } + void BackChain( USHORT off ) { aCode.Chain( off ); } + void Statement(); + void GenStmnt(); // evtl. Statement-Opcode erzeugen + USHORT GetPC(); + USHORT GetOffset() { return GetPC() + 1; } + void Save(); + + // #29955 for-Schleifen-Ebene pflegen + void IncForLevel( void ) { nForLevel++; } + void DecForLevel( void ) { nForLevel--; } +}; + +#endif diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx new file mode 100644 index 000000000000..389b690479d4 --- /dev/null +++ b/basic/source/inc/collelem.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * $RCSfile: collelem.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SAMPLE_COLLELEM_HXX +#define _SAMPLE_COLLELEM_HXX + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +// 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. + +class SampleElement : public SbxObject +{ + // Broadcaster Notification + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SampleElement( const String& ); +}; + +#endif diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx new file mode 100644 index 000000000000..dda0ee20f1a7 --- /dev/null +++ b/basic/source/inc/disas.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: disas.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DISAS_HXX +#define _DISAS_HXX + +#include "image.hxx" +#include "opcodes.hxx" + +class SvStream; + +class SbiDisas { + const SbiImage& rImg; + SbModule* pMod; + char cLabels[ 8192 ]; // Bitvektor fuer Labels + USHORT nOff; // aktuelle Position + USHORT nPC; // Position des Opcodes + SbiOpcode eOp; // Opcode + USHORT nOp1, nOp2; // Operanden + short nParts; // 1, 2 oder 3 + short nLine; // aktuelle Zeile + BOOL DisasLine( String& ); + BOOL Fetch(); // naechster Opcode +public: + SbiDisas( SbModule*, const SbiImage* ); + void Disas( SvStream& ); + void Disas( String& ); + // NICHT AUFRUFEN + void StrOp( String& ); + void Str2Op( String& ); + void ImmOp( String& ); + void OnOp( String& ); + void LblOp( String& ); + void ReturnOp( String& ); + void ResumeOp( String& ); + void PromptOp( String& ); + void CloseOp( String& ); + void CharOp( String& ); + void VarOp( String& ); + void VarDefOp( String& ); + void OffOp( String& ); + void TypeOp( String& ); + void CaseOp( String& ); + void StmntOp( String& ); + void StrmOp( String& ); +}; + +#endif diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx new file mode 100644 index 000000000000..0b41dbeb3b3e --- /dev/null +++ b/basic/source/inc/expr.hxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * $RCSfile: expr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _EXPR_HXX +#define _EXPR_HXX + +#ifndef _OPCODES_HXX +#include "opcodes.hxx" +#endif +#ifndef _TOKEN_HXX +#include "token.hxx" +#endif + +class SbiExprNode; +class SbiExpression; +class SbiExprList; +class SbiDimList; +class SbiParameters; +class SbiParser; +class SbiCodeGen; +class SbiSymDef; +class SbiProcDef; + +struct SbVar { // Variablen-Element: + SbiExprNode* pNext; // Weiteres Element (bei Strukturen) + SbiSymDef* pDef; // Symboldefinition + SbiExprList* pPar; // optionale Parameter (wird geloescht) +}; + +enum SbiExprType { // Expression-Typen: + SbSTDEXPR, // normaler Ausdruck + SbLVALUE, // beliebiger lValue + SbSYMBOL, // beliebiges zusammengesetztes Symbol + SbOPERAND // Variable/Funktion +}; + +enum SbiNodeType { + SbxNUMVAL, // nVal = Wert + SbxSTRVAL, // nStringId = Wert + SbxVARVAL, // aVar = Wert + SbxNODE // Node +}; + +class SbiExprNode { // Operatoren (und Operanden) + friend class SbiExpression; + friend class SbiConstExpression; + union { + USHORT nStringId; // gepoolter String-ID + double nVal; // numerischer Wert + SbVar aVar; // oder Variable + }; + SbiExprNode* pLeft; // linker Zweig + SbiExprNode* pRight; // rechter Zweig (NULL bei unaeren Ops) + SbiCodeGen* pGen; // Code-Generator + SbiNodeType eNodeType; // Art des Nodes + SbxDataType eType; // aktueller Datentyp + SbiToken eTok; // Token des Operators + BOOL bComposite; // TRUE: Zusammengesetzter Ausdruck + BOOL bError; // TRUE: Fehlerhaft + BOOL bPartOfWith; // TRUE: .-Anweisung in with-Block + void FoldConstants(); // Constant Folding durchfuehren + void CollectBits(); // Umwandeln von Zahlen in Strings + BOOL IsOperand(); // TRUE, wenn Operand + BOOL IsNumber(); // TRUE bei Zahlen + BOOL IsString(); // TRUE bei Strings + BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar + void GenElement( SbiOpcode ); // Element + void BaseInit( SbiParser* p ); // Hilfsfunktion fuer Ctor, AB 17.12.95 +public: + SbiExprNode( SbiParser*, double, SbxDataType ); + SbiExprNode( SbiParser*, const String& ); + SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); + SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* ); + virtual ~SbiExprNode(); + + BOOL IsValid() { return BOOL( !bError ); } + BOOL IsConstant(); // TRUE bei konstantem Operanden + BOOL IsIntConst(); // TRUE bei Integer-Konstanten + BOOL IsVariable(); // TRUE, wenn Variable + + BOOL IsPartOfWith() { return bPartOfWith; } + void SetPartOfWith( BOOL b ) { bPartOfWith = b; } + + 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 + const String& GetString(); // String liefern + + void Optimize(); // Baumabgleich + + void Gen(); // Ausgabe eines Nodes +}; + +class SbiExpression { // der Ausdruck: + 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 + BOOL bBased; // TRUE: einfacher DIM-Teil (+BASE) + BOOL bError; // TRUE: Fehler + BOOL bByVal; // TRUE: ByVal-Parameter + SbiExprNode* Term(); + SbiExprNode* ObjTerm( SbiSymDef& ); + SbiExprNode* Operand(); + SbiExprNode* Unary(); + SbiExprNode* Exp(); + SbiExprNode* MulDiv(); + SbiExprNode* IntDiv(); + SbiExprNode* Mod(); + SbiExprNode* AddSub(); + SbiExprNode* Cat(); + SbiExprNode* Like(); + SbiExprNode* Comp(); + SbiExprNode* Boolean(); +public: + SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR ); // Parsender 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(); + String& GetName() { return aArgName; } + void SetBased() { bBased = TRUE; } + BOOL IsBased() { return bBased; } + void SetByVal() { bByVal = TRUE; } + BOOL IsByVal() { return bByVal; } + BOOL IsValid() { return pExpr->IsValid(); } + BOOL IsConstant() { return pExpr->IsConstant(); } + BOOL IsVariable() { return pExpr->IsVariable(); } + BOOL IsLvalue() { return pExpr->IsLvalue(); } + BOOL IsIntConstant() { return pExpr->IsIntConst(); } + const String& GetString() { return pExpr->GetString(); } + SbiSymDef* GetVar() { return pExpr->GetVar(); } + SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); } + SbiExprNode* GetExprNode() { return pExpr; } + SbxDataType GetType() { return pExpr->GetType(); } + void SetType( SbxDataType eType){ pExpr->eType = eType; } + void Gen(); +}; + +class SbiConstExpression : public SbiExpression { + double nVal; + String aVal; + SbxDataType eType; +public: // numerische Konstante + SbiConstExpression( SbiParser* ); + SbxDataType GetType() { return eType; } + const String& GetString() { return aVal; } + double GetValue() { return nVal; } + short GetShortValue(); +}; + +class SbiExprList { // Basisklasse fuer Parameter und Dims +protected: + SbiParser* pParser; // Parser + SbiExpression* pFirst; // Expressions + SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung) + short nExpr; // Anzahl Expressions + short nDim; // Anzahl Dimensionen + BOOL bError; // TRUE: Fehler + BOOL bBracket; // TRUE: Klammern +public: + SbiExprList( SbiParser* ); + virtual ~SbiExprList(); + BOOL IsBracket() { return bBracket; } + BOOL IsValid() { return BOOL( !bError ); } + short GetSize() { return nExpr; } + short GetDims() { return nDim; } + SbiExpression* Get( short ); + BOOL Test( const SbiProcDef& ); // Parameter-Checks + void Gen(); // Code-Erzeugung + // Setzen einer Funktionsdefinition zum Abgleich der Parameter + void SetProc( SbiProcDef* p ) { pProc = p; } +}; + +class SbiParameters : public SbiExprList { +public: + SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE);// parsender Ctor +}; + +class SbiDimList : public SbiExprList { + BOOL bConst; // TRUE: Alles sind Integer-Konstanten +public: + SbiDimList( SbiParser* ); // Parsender Ctor + BOOL IsConstant() { return bConst; } +}; + +#endif diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx new file mode 100644 index 000000000000..777688a1935e --- /dev/null +++ b/basic/source/inc/filefmt.hxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * $RCSfile: filefmt.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_FILEFMT_HXX +#define _SB_FILEFMT_HXX + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +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 + +#define B_CURVERSION 0x00000011L + +// Eine Datei enthaelt entweder einen Modul- oder einen Library-Record. +// Diese Records enthalten wiederum weitere Records. Jeder Record hat +// den folgenden Header: + +// UINT16 Kennung +// UINT32 Laenge des Records ohne Header +// UINT16 Anzahl Unterelemente + +// Alle Datei-Offsets in Records sind relativ zum Start des Moduls! + +#define B_LIBRARY 0x4C42 // BL Library Record +#define B_MODULE 0x4D42 // BM Module Record +#define B_NAME 0x4E4D // MN module name +#define B_COMMENT 0x434D // MC comment +#define B_SOURCE 0x4353 // SC source code +#define B_PCODE 0x4350 // PC p-code +#define B_OLDPUBLICS 0x7550 // Pu publics +#define B_PUBLICS 0x5550 // PU publics +#define B_POOLDIR 0x4450 // PD symbol pool directory +#define B_SYMPOOL 0x5953 // SY symbol pool +#define B_STRINGPOOL 0x5453 // ST symbol pool +#define B_LINERANGES 0x524C // LR line ranges for publics +#define B_MODEND 0x454D // ME module end +#define B_SBXOBJECTS 0x5853 // SX SBX objects + +// Ein Library Record enthaelt nur Module Records +// UINT16 Kennung BL +// UINT32 Laenge des Records +// UINT16 Anzahl Module + +// Ein Modul-Record enthaelt alle anderen Recordtypen +// UINT16 Kennung BM +// UINT32 Laenge des Records +// UINT16 1 +// Daten: +// UINT32 Versionsnummer +// UINT32 Zeichensatz +// UINT32 Startadresse Initialisierungscode +// UINT32 Startadresse Sub Main +// UINT32 Reserviert +// UINT32 Reserviert + +// Modulname, Kommentar und Quellcode: +// UINT16 Kennung MN, MC oder SC +// UINT32 Laenge des Records +// UINT16 1 +// Daten: +// String-Instanz + +// P-Code: +// UINT16 Kennung PC +// UINT32 Laenge des Records +// 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: +// UINT16 Kennung PU oder Pu +// UINT32 Laenge des Records +// UINT16 Anzahl der Publics +// Daten fuer jeden Public-Eintrag: +// UINT16 String-Index +// UINT32 Startadresse im P-Code-Image (UINT16 fuer alte Publics) +// UINT16 Datentyp des Returnwertes (ab Version 2) + +// Verzeichnis der Symbol-Tabellen: +// UINT16 Kennung SP +// UINT32 Laenge des Records +// UINT16 Anzahl der Symboltabellen +// Daten fuer jede Symboltabelle: +// UINT16 Stringindex des Namens +// UINT16 Anzahl Symbole +// UINT16 Scope-Kennung + +// Symboltabelle: +// UINT16 Kennung SY +// UINT32 Laenge des Records +// UINT16 Anzahl der Symbole +// Daten: +// UINT16 Stringindex des Namens +// UINT16 Anzahl Symbole +// Daten fuer jedes Symbol: +// UINT16 Stringindex des Namens +// UINT16 Datentyp +// UINT16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable) + +// Stringpool: +// UINT16 Kennung ST +// UINT32 Laenge des Records +// UINT16 Anzahl der Strings +// Daten fuer jeden String: +// UINT32 Offset in den Block aller Strings +// Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen. + +// Line Ranges: +// UINT16 Kennung LR +// UINT32 Laenge des Records +// UINT16 Anzahl der Strings +// Daten fuer jedes Public: +// UINT16 1. Zeile (Sub XXX) +// UINT16 2. Zeile (End Sub) + +// SBX-Objekte: +// UINT16 Anzahl Objekte +// .... Objektdaten + +//////////////////////////////////////////////////////////////////////////// + +// Service-Routinen (in IMAGE.CXX) + +BOOL SbGood( SvStream& r ); +ULONG SbOpenRecord( SvStream&, UINT16 nSignature, UINT16 nElem ); +void SbCloseRecord( SvStream&, ULONG ); + +#endif diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx new file mode 100644 index 000000000000..5573d97213c3 --- /dev/null +++ b/basic/source/inc/image.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: image.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBIMAGE_HXX +#define _SBIMAGE_HXX + +#include "sbintern.hxx" + +// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet +// den Zugriff auf die einzelnen Elemente. + +struct SbPublicEntry; + +class SbiImage { + friend class SbiCodeGen; // Compiler-Klassen, die die private- + + SbxArrayRef rTypes; // + UINT16* pStringOff; // StringId-Offsets + sal_Unicode* pStrings; // StringPool + char* pCode; // Code-Image + BOOL bError; // TRUE: Fehler + USHORT nFlags; // Flags (s.u.) + short nStrings; // Anzahl Strings + UINT16 nStringSize; // Groesse des String-Puffers + UINT16 nCodeSize; // Groesse des Code-Blocks + UINT16 nDimBase; // OPTION BASE-Wert + rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings + // temporaere Verwaltungs-Variable: + short nStringIdx; // aktueller String-Index + UINT16 nStringOff; // aktuelle Pos im Stringpuffer + // Routinen fuer Compiler: + void MakeStrings( short ); // StringPool einrichten + void AddString( const String& );// String zufuegen + void AddCode( char*, USHORT ); // Codeblock dazu + void AddType(SbxObject *); // User-Type mit aufnehmen + +public: + String aName; // Makroname + String aSource; // Quellcode + String aComment; // Kommentar + BOOL bInit; // TRUE: Init-Code ist gelaufen + SbiImage(); + ~SbiImage(); + void Clear(); // Inhalt loeschen + BOOL Load( SvStream& ); + BOOL Save( SvStream& ); + BOOL IsError() { return bError; } + + const char* GetCode() const { return pCode; } + USHORT GetCodeSize() const { return nCodeSize; } + String& GetSource() { return aSource; } + USHORT GetBase() const { return nDimBase; } + String GetString( short nId ) const; + //const char* GetString( short nId ) const; + const SbxObject* FindType (String aTypeName) const; + + void SetFlag( USHORT n ) { nFlags |= n; } + USHORT GetFlag( USHORT n ) const { return nFlags & n; } +}; + +#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT ist aktiv +#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv +#define SBIMG_INITCODE 0x0004 // Init-Code vorhanden + +#endif diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx new file mode 100644 index 000000000000..ff0a41e3ace5 --- /dev/null +++ b/basic/source/inc/iosys.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: iosys.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBIOSYS_HXX +#define _SBIOSYS_HXX + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef _SBERRORS_HXX +#include "sberrors.hxx" +#endif + +class SvStream; + +// Zur Zeit sind globale Dateien (Kanalnummern 256 bis 511) +// nicht implementiert. + +#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 + +class SbiStream { + SvStream* pStrm; // der Stream + ULONG nExpandOnWriteTo; // bei Schreibzugriff, den Stream + // bis zu dieser Groesse aufblasen + ByteString aLine; // aktuelle Zeile + ULONG nLine; // aktuelle Zeilennummer + short nLen; // Pufferlaenge + short nMode; // Bits: + short nChan; // aktueller Kanal + SbError nError; // letzter Fehlercode + void MapError(); // Fehlercode mappen + +public: + SbiStream(); + ~SbiStream(); + SbError Open( short, const ByteString&, short, short, short ); + SbError Close(); + SbError Read( ByteString&, USHORT = 0 ); + SbError Read( char& ); + SbError Write( const ByteString&, USHORT = 0 ); + + BOOL IsText() const { return !(nMode & SBSTRM_BINARY); } + BOOL IsRandom() const { return (nMode & SBSTRM_RANDOM); } + BOOL IsBinary() const { return (nMode & SBSTRM_BINARY); } + BOOL IsSeq() const { return !(nMode & SBSTRM_RANDOM); } + BOOL IsAppend() const { return (nMode & SBSTRM_APPEND); } + short GetBlockLen() const { return nLen; } + short GetMode() const { return nMode; } + ULONG GetLine() const { return nLine; } + void SetExpandOnWriteTo( ULONG n ) { nExpandOnWriteTo = n; } + void ExpandFile(); + SvStream* GetStrm() { return pStrm; } +}; + +class SbiIoSystem { + SbiStream* pChan[ CHANNELS ]; + ByteString aPrompt; // Input-Prompt + ByteString aIn, aOut; // Console-Buffer + short nChan; // aktueller Kanal + SbError nError; // letzter Fehlercode + void ReadCon( ByteString& ); + void WriteCon( const ByteString& ); +public: + SbiIoSystem(); + ~SbiIoSystem(); + SbError GetError(); + void Shutdown(); + void SetPrompt( const ByteString& r ) { aPrompt = r; } + void SetChannel( short n ) { nChan = n; } + short GetChannel() const { return nChan;} + void ResetChannel() { nChan = 0; } + void Open( short, const ByteString&, short, short, short ); + void Close(); + void Read( ByteString&, short = 0 ); + char Read(); + void Write( const ByteString&, short = 0 ); + short NextChannel(); + // 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1) + SbiStream* GetStream( short nChannel ) const; + void CloseAll(); // JSM +}; + +#endif + diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx new file mode 100644 index 000000000000..e96d51dbe56f --- /dev/null +++ b/basic/source/inc/object.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * $RCSfile: object.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SAMPLE_OBJECT_HXX +#define _SAMPLE_OBJECT_HXX + +#ifndef __SBX_SBX_FACTORY_HXX //autogen +#include <svtools/sbxfac.hxx> +#endif +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +// 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.* + +class SampleObject : public SbxObject +{ + // Definition eines Tabelleneintrags. Dies wird hier gemacht, + // da dadurch die Methoden und Properties als private deklariert + // werden koennen. +#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) +public: +#endif + typedef void( SampleObject::*pMeth ) + ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); +#if defined ( ICC ) || defined ( HPUX ) +private: +#endif + + struct Methods { + const char* pName; // Name des Eintrags + SbxDataType eType; // Datentyp + short nArgs; // Argumente und Flags + pMeth pFunc; // Function Pointer + }; + static Methods aMethods[]; // Methodentabelle + + // Methoden + void Display( SbxVariable*, SbxArray*, BOOL ); + void Event( SbxVariable*, SbxArray*, BOOL ); + void Square( SbxVariable*, SbxArray*, BOOL ); + void Create( SbxVariable*, SbxArray*, BOOL ); + // Infoblock auffuellen + 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 +{ +public: + virtual SbxObject* CreateObject( const String& ); +}; + +#endif diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx new file mode 100644 index 000000000000..21f3fa6caeb3 --- /dev/null +++ b/basic/source/inc/opcodes.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * $RCSfile: opcodes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OPCODES_HXX +#define _OPCODES_HXX + +#include "sbintern.hxx" + +#ifdef MTW +#undef _NUMBER +#endif + +// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen +// Wert des Opcodes (s.u.). + +enum SbiOpcode { + // Alle Opcodes ohne Operanden + _NOP = 0, + + SbOP0_START = _NOP, + + // Operatoren + // die folgenden Operatoren sind genauso angeordnet + // wie der 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 + _LIKE, _IS, + // Laden/speichern + _ARGC, // neuen Argv einrichten + _ARGV, // TOS ==> aktueller Argv + _INPUT, // Input ==> TOS + _LINPUT, // Line Input ==> TOS + _GET, // TOS anfassen + _SET, // Speichern Objekt TOS ==> TOS-1 + _PUT, // TOS ==> TOS-1 + _PUTC, // TOS ==> TOS-1, dann ReadOnly + _DIM, // DIM + _REDIM, // REDIM + _REDIMP, // REDIM PRESERVE + _ERASE, // TOS loeschen + // Verzweigen + _STOP, // Programmende + _INITFOR, // FOR-Variable initialisieren + _NEXT, // FOR-Variable inkrementieren + _CASE, // Anfang CASE + _ENDCASE, // Ende CASE + _STDERROR, // Standard-Fehlerbehandlung + _NOERROR, // keine Fehlerbehandlung + _LEAVE, // UP verlassen + // E/A + _CHANNEL, // TOS = Kanalnummer + _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 + SbOP0_END, + + // Alle Opcodes mit einem Operanden + + _NUMBER = 0x40, // Laden einer numerischen Konstanten (+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) + // 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) + _CASETO, // Tos+1 <= Case <= Tos, 2xremove (+Target) + _ERRHDL, // Fehler-Handler (+Offset) + _RESUME, // Resume nach Fehlern (+0 or 1 or Label) + // E/A + _CLOSE, // (+Kanal/0) + _PRCHAR, // (+char) + // Verwaltung + _CLASS, // Klassennamen testen (+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) + + SbOP1_END, + + // Alle Opcodes mit zwei Operanden + + _RTL = 0x80, // Laden aus 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) + // E/A + _OPEN, // (+SvStreamFlags+Flags) + // Objekte + _LOCAL, // Lokale Variable definieren (+StringID+Typ) + _PUBLIC, // Modulglobale Variable (+StringID+Typ) + _GLOBAL, // Globale Variable definieren (+StringID+Typ) + _CREATE, // Objekt kreieren (+StringId+StringID) + _STATIC, // Statische Variabl (+StringID+Typ) JSM + _TCREATE, // User Defined Objekt kreieren + _DCREATE, // Objekt-Array kreieren (+StringId+StringID) + SbOP2_END + +}; + + + +#endif diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx new file mode 100644 index 000000000000..c99c587e55b7 --- /dev/null +++ b/basic/source/inc/parser.hxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * $RCSfile: parser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PARSER_HXX +#define _PARSER_HXX + +#ifndef _EXPR_HXX +#include "expr.hxx" +#endif +#ifndef _CODEGEN_HXX +#include "codegen.hxx" +#endif +#ifndef _SYMTBL_HXX +#include "symtbl.hxx" +#endif + + +struct SbiParseStack; + +class SbiParser : public SbiTokenizer +{ + SbiParseStack* pStack; // Block-Stack + SbiProcDef* pProc; // aktuelle Prozedur + SbiExprNode* pWithVar; // aktuelle With-Variable + SbiToken eEndTok; // das Ende-Token + USHORT nGblChain; // Chainkette fuer globale DIMs + BOOL bGblDefs; // TRUE globale Definitionen allgemein + BOOL bNewGblDefs; // TRUE globale Definitionen vor Sub + BOOL bSingleLineIf; // TRUE einzeiliges if-Statement + + SbiSymDef* VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration + SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration + void DefProc( BOOL bStatic ); // Prozedur einlesen + void DefVar( SbiOpcode eOp, BOOL bStatic ); // DIM/REDIM einlesen + void TypeDecl( SbiSymDef& ); // AS-Deklaration + void OpenBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen + void CloseBlock(); // Block aufloesen + BOOL Channel( BOOL=FALSE ); // Kanalnummer parsen + void StmntBlock( SbiToken ); // Statement-Block abarbeiten + +public: + SbxArrayRef rTypeArray; // das Type-Array + SbiStringPool aGblStrings; // der String-Pool + SbiStringPool aLclStrings; // der String-Pool + SbiSymPool aGlobals; // globale Variable + SbiSymPool aPublics; // modulglobale Variable + 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 + BOOL bText; // OPTION COMPARE TEXT + BOOL bExplicit; // TRUE: OPTION EXPLICIT + SbxDataType eDefTypes[26]; // DEFxxx-Datentypen + + SbiParser( StarBASIC*, SbModule* ); + BOOL Parse(); // die Aktion + SbiExprNode* GetWithVar(); // Innerste With-Variable liefern + + // AB 31.3.1996, Symbol in Runtime-Library suchen + SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType ); + + BOOL HasGlobalCode(); // Globaler Code definiert? + + BOOL TestToken( SbiToken ); // bestimmtes TOken? + BOOL TestSymbol( BOOL=FALSE ); // Symbol? + BOOL TestComma(); // Komma oder EOLN? + void TestEoln(); // EOLN? + + void Symbol(); // Let oder Call + void ErrorStmnt(); // ERROR n + void NotImp(); // nicht implementiert + void BadBlock(); // LOOP/WEND/NEXT + void BadSyntax(); // Falsches SbiToken + void NoIf(); // ELSE/ELSE IF ohne IF + void Assign(); // LET + void Call(); // CALL + void Close(); // CLOSE + void Declare(); // DECLARE + void DefXXX(); // DEFxxx + void Dim(); // DIM + void ReDim(); // ReDim(); + void Erase(); // ERASE + void Exit(); // EXIT + void For(); // FOR...NEXT + void Goto(); // GOTO / GOSUB + void If(); // IF + void Input(); // INPUT, INPUT # + void LineInput(); // LINE INPUT, LINE INPUT # + void LSet(); // LSET + void Name(); // NAME .. AS .. + void On(); // ON ERROR/variable + void OnGoto(); // ON...GOTO / GOSUB + void Open(); // OPEN + void Option(); // OPTION + void Print(); // PRINT, PRINT # + void SubFunc(); // SUB / FUNCTION + void Resume(); // RESUME + void Return(); // RETURN + void RSet(); // RSET + void DoLoop(); // DO...LOOP + void Select(); // SELECT ... CASE + void Set(); // SET + void Static(); // STATIC + void Stop(); // STOP/SYSTEM + void Type(); // TYPE...AS...END TYPE + void While(); // WHILE/WEND + void With(); // WITH + void Write(); // WRITE + + // JavaScript-Parsing + void OpenJavaBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen + void CloseJavaBlock(); // Block aufloesen + void JavaStmntBlock( SbiToken ); // Statement-Block abarbeiten + void JavaBreak(); + void JavaContinue(); + void JavaFor(); + void JavaFunction(); + void JavaIf(); + void JavaNew(); + void JavaReturn(); + void JavaThis(); + void JavaVar(); + void JavaWhile(); + void JavaWith(); +}; + + + + + + +#endif diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx new file mode 100644 index 000000000000..9833747cde30 --- /dev/null +++ b/basic/source/inc/propacc.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * $RCSfile: propacc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _SFX_PROPBAG_HXX +#define _SFX_PROPBAG_HXX + +#ifndef _SVARRAY_HXX +#include <svtools/svarray.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_ +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_ +#include <com/sun/star/beans/XPropertyAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_ +#include <com/sun/star/beans/XPropertyContainer.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif + +#define NS_BEANS ::com::sun::star::beans +#define NS_LANG ::com::sun::star::lang +#define NS_UNO ::com::sun::star::uno + +typedef NS_BEANS::PropertyValue* SbPropertyValuePtr; +SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 ); + +typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet, + NS_BEANS::XPropertyAccess > SbPropertyValuesHelper; + + +//========================================================================== + +class SbPropertyValues: public SbPropertyValuesHelper +{ + SbPropertyValueArr_Impl _aPropVals; + NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo; + +private: + INT32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; + +public: + SbPropertyValues(); + virtual ~SbPropertyValues(); + + // XPropertySet + virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL + getPropertySetInfo(void) throw( NS_UNO::RuntimeException ); + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Any& aValue); + virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( NS_BEANS::UnknownPropertyException, + NS_LANG::WrappedTargetException, + NS_UNO::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ); + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ); + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ); + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ); + + // XPropertyAccess + virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); + virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); +}; + +//========================================================================== + +typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper; + +// AB 20.3.2000 Help Class for XPropertySetInfo implementation +class PropertySetInfoImpl +{ + friend class SbPropertySetInfo; + friend class SbPropertyContainer; + + NS_UNO::Sequence< NS_BEANS::Property > _aProps; + + sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; + +public: + PropertySetInfoImpl(); + PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps ); + + // XPropertySetInfo + NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void); + NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw ( NS_UNO::RuntimeException ); +}; + +class SbPropertySetInfo: public SbPropertySetInfoHelper +{ + PropertySetInfoImpl aImpl; + +public: + SbPropertySetInfo(); + SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ); + virtual ~SbPropertySetInfo(); + + // XPropertySetInfo + virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) + throw( NS_UNO::RuntimeException ); + virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); +}; + +//========================================================================== + +typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper; + +class SbPropertyContainer: public SbPropertyContainerHelper +{ + PropertySetInfoImpl aImpl; + +public: + SbPropertyContainer(); + virtual ~SbPropertyContainer(); + + // XPropertyContainer + virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, + INT16 Attributes, + const NS_UNO::Any& DefaultValue) + throw( NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException, + NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException ); + virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name) + throw( NS_BEANS::UnknownPropertyException, NS_UNO::RuntimeException ); + + // XPropertySetInfo + virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void); + virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + + // XPropertyAccess + virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); + virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); +}; + +//========================================================================= + +class StarBASIC; +class SbxArray; + +void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); + + +#undef NS_BEANS +#undef NS_LANG +#undef NS_UNO + + + +#endif + diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx new file mode 100644 index 000000000000..904224620b83 --- /dev/null +++ b/basic/source/inc/runtime.hxx @@ -0,0 +1,473 @@ +/************************************************************************* + * + * $RCSfile: runtime.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBRUNTIME_HXX +#define _SBRUNTIME_HXX + +#include "sb.hxx" + +// Define activates class UCBStream in iosys.cxx +#define _USE_UNO + +#ifdef _USE_UNO +#include <rtl/ustring> +#include <com/sun/star/uno/Sequence.hxx> + +using namespace rtl; +using namespace com::sun::star::uno; + + +//#include <sal/types.h> +//#include <rtl/byteseq.hxx> +//#include <rtl/ustring> + + +namespace basicEncoder +{ + +// TODO: Use exported functionality (code is copied from deamons2/ucb) +class AsciiEncoder +{ +public: + static ::rtl::OUString decodeUnoUrlParamValue(const rtl::OUString & rSource); + //static ::rtl::OUString encodeUnoUrlParamValue(const rtl::OUString & rSource); + //static ::rtl::ByteSequence decode(const ::rtl::OUString & string); + //static ::rtl::OUString encode(const ::rtl::ByteSequence & bytes); + //static void test(); +}; + +} + +#endif /* _USE_UNO */ + +class SbiInstance; // aktiver StarBASIC-Prozess +class SbiRuntime; // aktive StarBASIC-Prozedur-Instanz + +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 + +struct SbiForStack { // for/next stack: + SbiForStack* pNext; // Chain + SbxVariableRef refVar; // loop variable + SbxVariableRef refEnd; // end expression + SbxVariableRef refInc; // increment expression +}; + +#define MAXRECURSION 500 // max. 500 Rekursionen + +#define Sb_ATTR_NORMAL 0x0000 +#define Sb_ATTR_HIDDEN 0x0002 +#define Sb_ATTR_SYSTEM 0x0004 +#define Sb_ATTR_VOLUME 0x0008 +#define Sb_ATTR_DIRECTORY 0x0010 +#define Sb_ATTR_ARCHIVE 0x0020 + + +class Dir; + +class SbiRTLData +{ +public: + Dir* pDir; + INT16 nDirFlags; + USHORT nCurDirPos; +#ifdef _USE_UNO + Sequence< OUString > aDirSeq; +#endif /* _USE_UNO */ + + SbiRTLData(); + ~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. + +class SbiInstance +{ + friend class SbiRuntime; + + SbiRTLData aRTLData; + + SbiIoSystem* pIosys; // Dateisystem + SbiDdeControl* pDdeCtrl; // DDE + SbiDllMgr* pDllMgr; // DLL-Calls (DECLARE) + StarBASIC* pBasic; + SvNumberFormatter* pNumberFormatter; + ULONG nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx; + + SbError nErr; // aktueller Fehlercode + String aErrorMsg; // letzte Error-Message fuer $ARG + USHORT nErl; // aktuelle Fehlerzeile + BOOL bReschedule; // Flag: TRUE = Reschedule in Hauptschleife + +public: + SbiRuntime* pRun; // Call-Stack + SbiInstance* pNext; // Instanzen-Chain + + // #31460 Neues Konzept fuer StepInto/Over/Out, + // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel() + USHORT nCallLvl; // Call-Level (wg. Rekursion) + USHORT nBreakCallLvl; // Call-Level zum Anhalten + void CalcBreakCallLevel( USHORT nFlags ); // Gemaess Flags setzen + + SbiInstance( StarBASIC* ); + ~SbiInstance(); + + void Error( SbError ); // trappable Error + void Error( SbError, const String& rMsg ); // trappable Error mit Message + void FatalError( SbError ); // non-trappable Error + void Abort(); // Abbruch mit aktuellem Fehlercode + + void Stop(); + SbError GetErr() { return nErr; } + String GetErrorMsg() { return aErrorMsg; } + xub_StrLen GetErl() { return nErl; } + void EnableReschedule( BOOL bEnable ) { bReschedule = bEnable; } + BOOL IsReschedule( void ) { return bReschedule; } + + SbMethod* GetCaller( USHORT ); + SbModule* GetActiveModule(); + SbxArray* GetLocals( SbMethod* ); + + SbiIoSystem* GetIoSystem() { return pIosys; } + SbiDdeControl* GetDdeControl() { return pDdeCtrl; } + SbiDllMgr* GetDllMgr(); + SbiRTLData* GetRTLData() const { return (SbiRTLData*)&aRTLData; } + + SvNumberFormatter* GetNumberFormatter(); + ULONG GetStdDateIdx() const { return nStdDateIdx; } + ULONG GetStdTimeIdx() const { return nStdTimeIdx; } + ULONG GetStdDateTimeIdx() const { return nStdDateTimeIdx; } + + // #39629# NumberFormatter auch statisch anbieten + static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, + ULONG &rnStdDateIdx, ULONG &rnStdTimeIdx, ULONG &rnStdDateTimeIdx ); +}; + +SbiIoSystem* SbGetIoSystem(); // das aktuelle I/O-System + + +// Verkettbare Items, um Referenzen temporaer zu halten +struct RefSaveItem +{ + SbxVariableRef xRef; + RefSaveItem* pNext; + + RefSaveItem() { pNext = NULL; } +}; + +// #72488 Spezielle SbxVariable, die beim get das Verhalten +// einer nicht initialisierten Variable simuliert. Wenn als +// Typ SbxOBJECT verlangt wird, geht das jedoch nicht. +class UnoClassSbxVariable : public SbxVariable +{ + SbxDataType meOrgType; + BOOL mbOverWritten; + const SbiImage* mpImg; + SbiRuntime* mpRuntime; + +public: + UnoClassSbxVariable( SbxDataType eType, const SbiImage* pImg_, SbiRuntime* pRuntime_ ) + : SbxVariable( SbxVARIANT ), mpImg( pImg_ ), mpRuntime( pRuntime_ ) + { + meOrgType = eType; + mbOverWritten = FALSE; + } + UnoClassSbxVariable( const UnoClassSbxVariable& r ) + : SbxVariable( r ), meOrgType( r.meOrgType), mbOverWritten( r.mbOverWritten), + mpImg( r.mpImg ), mpRuntime( r.mpRuntime ) + {} + + virtual BOOL Get( SbxValues& ) const; + virtual BOOL Put( const SbxValues& ); + + TYPEINFO(); +}; + +// #72732 Spezielle SbxVariable, die beim put/get prueft, +// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst +// liegt eventuell ein Schreibfehler im Basic-Source vor. +class UnoClassMemberVariable : public SbxVariable +{ + SbiRuntime* mpRuntime; + BOOL bInternalUse; + +public: + UnoClassMemberVariable( SbiRuntime* pRuntime_, const SbxObjectRef& xWrapper ) + : SbxVariable( SbxVARIANT ), mpRuntime( pRuntime_ ) + { + bInternalUse = TRUE; + PutObject( xWrapper ); + bInternalUse = FALSE; + } + + virtual BOOL Get( SbxValues& ) const; + virtual BOOL Put( const SbxValues& ); + + TYPEINFO(); +}; + + +// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm +// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt +// nur lokale Daten. + +class SbiRuntime +{ + typedef void( SbiRuntime::*pStep0 )(); + typedef void( SbiRuntime::*pStep1 )( USHORT nOp1 ); + typedef void( SbiRuntime::*pStep2 )( USHORT nOp1, USHORT 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 + SbiIoSystem* pIosys; // I/O-System + const SbiImage* pImg; // Code-Image + SbxArrayRef refExprStk; // expression stack + SbxArrayRef refCaseStk; // CASE expression stack + SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen + SbiArgvStack* pArgvStk; // ARGV-Stack + SbiGosubStack* pGosubStk; // GOSUB stack + SbiForStack* pForStk; // FOR/NEXT-Stack + USHORT nExprLvl; // Tiefe des Expr-Stacks + USHORT nGosubLvl; // Zum Vermeiden von Tot-Rekursionen + const BYTE* pCode; // aktueller Code-Pointer + const BYTE* pStmnt; // Beginn des lezten Statements + const BYTE* pError; // Adresse des aktuellen Error-Handlers + const BYTE* pRestart; // Restart-Adresse + const BYTE* pErrCode; // Restart-Adresse RESUME NEXT + const BYTE* 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 + // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.) + //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern + short nArgc; // aktueller Argc + BOOL bRun; // TRUE: Programm ist aktiv + BOOL bError; // TRUE: Fehler behandeln + BOOL bInError; // TRUE: in einem Fehler-Handler + USHORT nFlags; // Debugging-Flags + SbError nError; // letzter Fehler + USHORT nOps; // Opcode-Zaehler + + RefSaveItem* pRefSaveList; // #74254 Temporaere Referenzen sichern + RefSaveItem* pItemStoreList; // Unbenutzte Items aufbewahren + void SaveRef( SbxVariable* pVar ) + { + RefSaveItem* pItem = pItemStoreList; + if( pItem ) + pItemStoreList = pItem->pNext; + else + pItem = new RefSaveItem(); + pItem->pNext = pRefSaveList; + pItem->xRef = pVar; + pRefSaveList = pItem; + } + void ClearRefs( void ) + { + while( pRefSaveList ) + { + RefSaveItem* pToClearItem = pRefSaveList; + pRefSaveList = pToClearItem->pNext; + pToClearItem->xRef = NULL; + pToClearItem->pNext = pItemStoreList; + pItemStoreList = pToClearItem; + } + } + + SbxVariable* FindElement + ( SbxObject* pObj, USHORT nOp1, USHORT nOp2, SbError, BOOL ); + void SetupArgs( SbxVariable*, USHORT ); + 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 + BOOL ClearExprStack(); // Expr-Stack freigeben + + void PushGosub( const BYTE* ); // GOSUB-Element push + void PopGosub(); // GOSUB-Element pop + void ClearGosubStack(); // GOSUB-Stack freigeben + + void PushArgv(); // Argv-Element push + void PopArgv(); // Argv-Element pop + void ClearArgvStack(); // Argv-Stack freigeben + + void PushFor(); // For-Element push + void PopFor(); // For-Element pop + void ClearForStack(); // For-Stack freigeben + + void StepArith( SbxOperator ); // arithmetische Verknuepfungen + void StepUnary( SbxOperator ); // unaere Verknuepfungen + void StepCompare( SbxOperator );// Vergleiche + + void SetParameters( SbxArray* );// Parameter uebernehmen + + // MUSS NOCH IMPLEMENTIERT WERDEN + void DllCall( const String&, const String&, SbxArray*, SbxDataType, BOOL ); + + // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx) + void DimImpl( SbxVariableRef refVar ); + + // Die nachfolgenden Routinen werden vom Single Stepper + // gerufen und implementieren die einzelnen Opcodes + void StepNOP(), StepEXP(), StepMUL(), StepDIV(); + void StepMOD(), StepPLUS(), StepMINUS(), StepNEG(); + void StepEQ(), StepNE(), StepLT(), StepGT(); + void StepLE(), StepGE(), StepIDIV(), StepAND(); + void StepOR(), StepXOR(), StepEQV(), StepIMP(); + void StepNOT(), StepCAT(), StepLIKE(), StepIS(); + void StepCLONE(), StepOLDBASED(), StepARGC(); + void StepARGV(), StepINPUT(), StepLINPUT(), StepSTOP(); + void StepGET(), StepSET(), StepPUT(), StepPUTC(); + void StepDIM(), StepREDIM(), StepREDIMP(), StepERASE(); + void StepINITFOR(), StepNEXT(), StepERROR(); + void StepCASE(), StepENDCASE(), StepSTDERROR(); + void StepNOERROR(), StepCHANNEL(), StepCHANNEL0(), StepPRINT(); + void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT(); + void StepRESTART(), StepEMPTY(), StepLEAVE(); + void StepLSET(), StepRSET(); + // Alle Opcodes mit einem Operanden + void StepLOADNC( USHORT ), StepLOADSC( USHORT ), StepLOADI( USHORT ); + void StepARGN( USHORT ), StepBASED( USHORT ), StepPAD( USHORT ); + void StepJUMP( USHORT ), StepJUMPT( USHORT ); + void StepJUMPF( USHORT ), StepONJUMP( USHORT ); + void StepGOSUB( USHORT ), StepRETURN( USHORT ); + void StepTESTFOR( USHORT ), StepCASETO( USHORT ), StepERRHDL( USHORT ); + void StepRESUME( USHORT ), StepCLASS( USHORT ), StepLIB( USHORT ); + void StepCLOSE( USHORT ), StepPRCHAR( USHORT ), StepARGTYP( USHORT ); + // Alle Opcodes mit zwei Operanden + void StepRTL( USHORT, USHORT ), StepPUBLIC( USHORT, USHORT ); + void StepFIND( USHORT, USHORT ), StepELEM( USHORT, USHORT ); + void StepGLOBAL( USHORT, USHORT ), StepLOCAL( USHORT, USHORT ); + void StepPARAM( USHORT, USHORT), StepCREATE( USHORT, USHORT ); + void StepCALL( USHORT, USHORT ), StepCALLC( USHORT, USHORT ); + void StepCASEIS( USHORT, USHORT ), StepSTMNT( USHORT, USHORT ); + void StepOPEN( USHORT, USHORT ), StepSTATIC( USHORT, USHORT ); + void StepTCREATE(USHORT,USHORT), StepDCREATE(USHORT,USHORT); +public: + xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich + SbiRuntime* pNext; // Stack-Chain + + SbiRuntime( SbModule*, SbMethod*, USHORT ); + ~SbiRuntime(); + void Error( SbError ); // Fehler setzen, falls != 0 + void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen + BOOL Step(); // Einzelschritt (ein Opcode) + void Stop() { bRun = FALSE; } + SbMethod* GetMethod() { return pMeth; } + SbModule* GetModule() { return pMod; } + USHORT GetDebugFlags() { return nFlags; } + void SetDebugFlags( USHORT nFl ) { nFlags = nFl; } + SbMethod* GetCaller(); + SbxArray* GetLocals(); + SbxArray* GetParams(); + + SbxBase* FindElementExtern( const String& rName ); +}; + +// Hilfsfunktion, um aktives Basic zu finden +StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ); + +// Get information if security restrictions should be +// used (File IO based on UCB, no RTL function SHELL +// no DDE functionality, no DLLCALL) in basic because +// of portal "virtual" users (portal user != UNIX user) +// (Implemented in iosys.cxx) +BOOL needSecurityRestrictions( void ); + +// Returns TRUE if UNO is available, otherwise the old +// file system implementation has to be used +// (Implemented in iosys.cxx) +BOOL hasUno( void ); + +// Converts possibly relative paths to absolute paths +// according to the setting done by ChDir/ChDrive +// (Implemented in methods.cxx) +String getFullPath( const String& aRelPath ); + +// Sets (virtual) current path for UCB file access +void implChDir( const String& aDir ); + +// Sets (virtual) current drive for UCB file access +void implChDrive( const String& aDrive ); + +// Returns (virtual) current path for UCB file access +String implGetCurDir( void ); + +// Implementation of StepRENAME with UCB +// (Implemented in methods.cxx, so step0.cxx +// has not to be infected with UNO) +void implStepRenameUCB( const String& aSource, const String& aDest ); + +#endif diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx new file mode 100644 index 000000000000..ede7182de510 --- /dev/null +++ b/basic/source/inc/sbcomp.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * $RCSfile: sbcomp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBCOMP_HXX +#define _SBCOMP_HXX + +// das folgende habe ich der neuen Datei von MD entnommen! (MT) +#include "sbintern.hxx" +#include "token.hxx" // Tokenizer +#include "symtbl.hxx" // Symbolverwaltung +#include "parser.hxx" // Parser +#include "codegen.hxx" // Code-Generator + +#endif diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx new file mode 100644 index 000000000000..19ca73c6833c --- /dev/null +++ b/basic/source/inc/sbintern.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: sbintern.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_INTERN_HXX +#define _SB_INTERN_HXX + +#include <svtools/sbxfac.hxx> +#include "sb.hxx" + +class SbUnoFactory; +class SbiInstance; +class SbModule; + + +class SbiFactory : public SbxFactory +{ +public: + virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxObject* CreateObject( const String& ); +}; + +// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette +class SbErrorStackEntry +{ +public: + SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2) + : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {} + SbMethodRef aMethod; + xub_StrLen nLine; + xub_StrLen nCol1, nCol2; +}; + +SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1) + + + +struct SbiGlobals +{ + SbiInstance* pInst; // alle aktiven Runtime-Instanzen + SbiFactory* pSbFac; // StarBASIC-Factory + SbUnoFactory* pUnoFac; // Factory fuer Uno-Structs bei DIM AS NEW + 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) + BOOL bCompiler; // Flag fuer Compiler-Error + BOOL bCompWait; // Flag, beim Compilieren WaitCursor eingeschaltet ist + BOOL bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf + BOOL bRunInit; // 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 + + SbiGlobals(); + ~SbiGlobals(); +}; + +// Utility-Makros und -Routinen + +SbiGlobals* GetSbData(); + +#define pINST GetSbData()->pInst +#define pMOD GetSbData()->pMod +#define pCMOD GetSbData()->pCompMod +#define pSBFAC GetSbData()->pSbFac +#define pUNOFAC GetSbData()->pUnoFac + +#endif + diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx new file mode 100644 index 000000000000..1239aafd3fc5 --- /dev/null +++ b/basic/source/inc/sbjsmeth.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: sbjsmeth.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _SB_SBJSMETH_HXX +#define _SB_SBJSMETH_HXX + +#ifndef _SB_SBMETH_HXX +#include <sbmeth.hxx> +#endif + +// Basic-Modul fuer JavaScript-Sourcen. +// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert +// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI. + +class SbJScriptMethod : public SbMethod +{ +public: + SbJScriptMethod( const String&, SbxDataType, SbModule* ); + virtual ~SbJScriptMethod(); + + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMETH,2); + TYPEINFO(); +}; + +#ifndef __SB_SBJSCRIPTMETHODREF_HXX +#define __SB_SBJSCRIPTMETHODREF_HXX +SV_DECL_IMPL_REF(SbJScriptMethod) +#endif + +#endif diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx new file mode 100644 index 000000000000..265f21e7bd96 --- /dev/null +++ b/basic/source/inc/sbjsmod.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: sbjsmod.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_SBJSMOD_HXX +#define _SB_SBJSMOD_HXX + +#include <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. + +class SbJScriptModule : public SbModule +{ + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1); + TYPEINFO(); + SbJScriptModule( const String& ); // DURCHREICHEN +}; + +#endif + + + diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx new file mode 100644 index 000000000000..1ec293c47448 --- /dev/null +++ b/basic/source/inc/sbunoobj.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * $RCSfile: sbunoobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef SB_UNO_OBJ +#define SB_UNO_OBJ + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif +#ifndef __SBX_SBXMETHOD_HXX //autogen +#include <svtools/sbxmeth.hxx> +#endif +#ifndef __SBX_SBXPROPERTY_HXX //autogen +#include <svtools/sbxprop.hxx> +#endif +#ifndef __SBX_SBX_FACTORY_HXX //autogen +#include <svtools/sbxfac.hxx> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_ +#include <com/sun/star/beans/XMaterialHolder.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XEXACTNAME_HPP_ +#include <com/sun/star/beans/XExactName.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTIONACCESS_HPP_ +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTION_HPP_ +#include <com/sun/star/beans/XIntrospection.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_ +#include <com/sun/star/script/XInvocation.hpp> +#endif +#ifndef _COM_SUN_STAR_REFLECTION_XIDLCLASS_HPP_ +#include <com/sun/star/reflection/XIdlClass.hpp> +#endif + +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::script; +using namespace com::sun::star::reflection; + +class SbUnoObject: public SbxObject +{ + Reference< XIntrospectionAccess > mxUnoAccess; + Reference< XMaterialHolder > mxMaterialHolder; + Reference< XInvocation > mxInvocation; + Reference< XExactName > mxExactName; + BOOL bNeedIntrospection; + Any maTmpUnoObj; // Only to save obj for doIntrospection! + + // Hilfs-Methode zum Anlegen der dbg_-Properties + void implCreateDbgProperties( void ); + + // Hilfs-Methode zum Anlegen aller Properties und Methoden + // (Beim on-demand-Mechanismus erforderlich fuer die dbg_-Properties) + void implCreateAll( void ); + +public: + TYPEINFO(); + SbUnoObject( const String& aName, const Any& aUnoObj_ ); + ~SbUnoObject(); + + // #76470 Introspection on Demand durchfuehren + void doIntrospection( void ); + + // Find ueberladen, um z.B. NameAccess zu unterstuetzen + virtual SbxVariable* Find( const String&, SbxClassType ); + + // Wert rausgeben + Any getUnoAny( void ); + Reference< XIntrospectionAccess > getIntrospectionAccess( void ) { return mxUnoAccess; } + Reference< XInvocation > getInvocation( void ) { return mxInvocation; } + + void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoObject); + + +// #67781 Rueckgabewerte der Uno-Methoden loeschen +void clearUnoMethods( void ); + +class SbUnoMethod : public SbxMethod +{ + friend class SbUnoObject; + friend void clearUnoMethods( void ); + + Reference< XIdlMethod > m_xUnoMethod; + Sequence<ParamInfo>* pParamInfoSeq; + + // #67781 Verweis auf vorige und naechste Methode in der Methoden-Liste + SbUnoMethod* pPrev; + SbUnoMethod* pNext; + +public: + TYPEINFO(); + + SbUnoMethod( const String& aName, SbxDataType eSbxType, Reference< XIdlMethod > xUnoMethod_ ); + virtual ~SbUnoMethod(); + //virtual SbxInfo* GetInfo() { return NULL; } + + const Sequence<ParamInfo>& getParamInfos( void ); +}; + + +class SbUnoProperty : public SbxProperty +{ + friend class SbUnoObject; + + // Daten der Uno-Property + Property aUnoProp; + UINT32 nId; + + virtual ~SbUnoProperty(); +public: + TYPEINFO(); + SbUnoProperty( const String& aName, SbxDataType eSbxType, + const Property& aUnoProp_, UINT32 nId_ ); +}; + +// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW +class SbUnoFactory : public SbxFactory +{ +public: + virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxObject* CreateObject( const String& ); +}; + +// Wrapper fuer eine Uno-Klasse +class SbUnoClass: public SbxObject +{ + const Reference< XIdlClass > m_xClass; +public: + TYPEINFO(); + SbUnoClass( const String& aName, const Reference< XIdlClass >& xClass_ ) + : SbxObject( aName ), m_xClass( xClass_ ) {} + //~SbUnoClass(); + + // Find ueberladen, um Elemente on Demand anzulegen + virtual SbxVariable* Find( const String&, SbxClassType ); + + // Wert rausgeben + const Reference< XIdlClass >& getUnoClass( void ) { return m_xClass; } + + //void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoClass); + + +// Funktion, um einen globalen Bezeichner im +// UnoScope zu suchen und fuer Sbx zu wrappen +SbxVariable* findUnoClass( const String& rName ); + + +class StarBASIC; + +// Impl-Methoden fuer RTL +void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); + +#endif + + diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx new file mode 100644 index 000000000000..760f3f2ba238 --- /dev/null +++ b/basic/source/inc/scanner.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * $RCSfile: scanner.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SCANNER_HXX +#define _SCANNER_HXX + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _SBERRORS_HXX +#include "sberrors.hxx" +#endif + +// 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. + +class StarBASIC; + +class SbiScanner +{ + String aBuf; // Input-Puffer + String aLine; // aktuelle Zeile + const sal_Unicode* pLine; // Pointer + const sal_Unicode* pSaveLine; // Merker fuer Line +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 + USHORT nBufPos; // aktuelle Buffer-Pos + USHORT nLine; // aktuelle Zeile + USHORT nCol1, nCol2; // aktuelle 1. und 2. Spalte + BOOL bSymbol; // TRUE: Symbol gescannt + BOOL bNumber; // TRUE: Zahl gescannt + BOOL bSpaces; // TRUE: Whitespace vor Token + BOOL bErrors; // TRUE: Fehler generieren + BOOL bAbort; // TRUE: abbrechen + BOOL bHash; // TRUE: # eingelesen + BOOL bError; // TRUE: Fehler generieren + BOOL bUsedForHilite; // TRUE: Nutzung fuer Highlighting + + void GenError( SbError ); +public: + SbiScanner( const String&, StarBASIC* = NULL ); + ~SbiScanner(); + + void EnableErrors() { bError = FALSE; } + BOOL IsHash() { return bHash; } + BOOL WhiteSpace() { return bSpaces; } + short GetErrors() { return nErrors; } + short GetLine() { return nLine; } + short GetCol1() { return nCol1; } + short GetCol2() { return nCol2; } + void SetCol1( short n ) { nCol1 = n; } + StarBASIC* GetBasic() { return pBasic; } + void SaveLine(void) { pSaveLine = pLine; } + void RestoreLine(void) { pLine = pSaveLine; } + void LockColumn(); + void UnlockColumn(); + BOOL DoesColonFollow(); + + BOOL NextSym(); // naechstes Symbol lesen + const String& GetSym() { return aSym; } + SbxDataType GetType() { return eScanType; } + double GetDbl() { return nVal; } +}; + + +#endif diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx new file mode 100644 index 000000000000..5313f108ef3f --- /dev/null +++ b/basic/source/inc/stdobj.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * $RCSfile: stdobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBSTDOBJ_HXX +#define _SBSTDOBJ_HXX + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +class StarBASIC; +class SbStdFactory; + +class SbiStdObject : public SbxObject +{ + SbStdFactory* pStdFactory; + + ~SbiStdObject(); + SbxInfo* GetInfo( short ); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SbiStdObject( const String&, StarBASIC* ); + virtual SbxVariable* Find( const String&, SbxClassType ); + virtual void SetModified( BOOL ); +}; + +#endif diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx new file mode 100644 index 000000000000..76d0a9433708 --- /dev/null +++ b/basic/source/inc/symtbl.hxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * $RCSfile: symtbl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SYMTBL_HXX +#define _SYMTBL_HXX + +#ifndef _SVARRAY_HXX //autogen +#include <svtools/svarray.hxx> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _SBXDEF_HXX //autogen +#include <svtools/sbxdef.hxx> +#endif + +class SbiSymDef; // Basisklasse +class SbiProcDef; // Prozedur +class SbiConstDef; // Konstante +class SbiSymPool; // Symbol-Pool +class SbiStringPool; // gepoolte Strings + +class SvStream; +class SbiParser; + +enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL }; + +/////////////////////////////////////////////////////////////////////////// + +// Der String-Pool nimmt String-Eintraege auf und sorgt dafuer, +// dass sie nicht doppelt vorkommen. + +SV_DECL_PTRARR_DEL(SbiStrings,String*,5,5) + +class SbiStringPool { // String-Pool + SbiStrings aData; // Daten + String aEmpty; // for convenience + SbiParser* pParser; // der Parser +public: + SbiStringPool( SbiParser* ); + ~SbiStringPool(); + USHORT GetSize() const { return aData.Count(); } + // AB 8.4.1999, Default wegen #64236 auf TRUE geaendert + // Wenn der Bug sauber behoben ist, wieder auf FALSE aendern. + short Add( const String&, BOOL=TRUE ); + short Add( double, SbxDataType ); + const String& Find( USHORT ) const; + SbiParser* GetParser() { return pParser; } +}; + +/////////////////////////////////////////////////////////////////////////// + +SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5,5) + +class SbiSymPool { // Symbol-Pool + 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 + USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable + USHORT nCur; // Iterator +public: + SbiSymPool( SbiStringPool&, SbiSymScope ); + ~SbiSymPool(); + + void Clear(); + + void SetParent( SbiSymPool* p ) { pParent = p; } + void SetProcId( short n ) { nProcId = n; } + USHORT GetSize() const { return aData.Count(); } + SbiSymScope GetScope() const { return eScope; } + 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( USHORT ) const; // Variable per ID suchen + SbiSymDef* Get( USHORT ) const; // Variable per Position suchen + SbiSymDef* First(), *Next(); // Iteratoren + + USHORT Define( const String& ); // Label definieren + USHORT Reference( const String& ); // Label referenzieren + void CheckRefs(); // offene Referenzen suchen +}; + +/////////////////////////////////////////////////////////////////////////// + +class SbiSymDef { // Allgemeiner Symboleintrag + 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 + USHORT nId; // Symbol-Nummer + USHORT nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp) + USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable + USHORT nPos; // Positions-Nummer + USHORT nChain; // Backchain-Kette + BOOL bNew : 1; // TRUE: Dim As New... + BOOL bChained : 1; // TRUE: Symbol ist in Code definiert + BOOL bByVal : 1; // TRUE: ByVal-Parameter + BOOL bOpt : 1; // TRUE: optionaler Parameter + BOOL bStatic : 1; // TRUE: STATIC-Variable + BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert +public: + SbiSymDef( const String& ); + virtual ~SbiSymDef(); + virtual SbiProcDef* GetProcDef(); + virtual SbiConstDef* GetConstDef(); + + SbxDataType GetType() const { return eType; } + virtual void SetType( SbxDataType ); + const String& GetName(); + SbiSymScope GetScope() const; + USHORT GetProcId() const{ return nProcId; } + USHORT GetAddr() const { return nChain; } + USHORT GetId() const { return nId; } + USHORT GetTypeId() const{ return nTypeId; } + void SetTypeId( USHORT n ) { nTypeId = n; eType = SbxOBJECT; } + USHORT GetPos() const { return nPos; } + void SetLen( short n ){ nLen = n; } + short GetLen() const { return nLen; } + void SetDims( short n ) { nDims = n; } + short GetDims() const { return nDims; } + BOOL IsDefined() const{ return bChained; } + void SetOptional() { bOpt = TRUE; } + void SetByVal() { bByVal = TRUE; } + void SetStatic() { bStatic = TRUE; } + void SetNew() { bNew = TRUE; } + void SetDefinedAs() { bAs = TRUE; } + BOOL IsOptional() const{ return bOpt; } + BOOL IsByVal() const { return bByVal; } + BOOL IsStatic() const { return bStatic; } + BOOL IsNew() const { return bNew; } + BOOL IsDefinedAs() const { return bAs; } + + SbiSymPool& GetPool(); + USHORT Define(); // Symbol in Code definieren + USHORT Reference(); // Symbol in Code referenzieren + +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" + USHORT nLine1, nLine2; // Zeilenbereich + BOOL bCdecl : 1; // TRUE: CDECL angegeben + BOOL bPublic : 1; // TRUE: proc ist PUBLIC +public: + SbiProcDef( SbiParser*, const String& ); // Name + virtual ~SbiProcDef(); + virtual SbiProcDef* GetProcDef(); + virtual void SetType( SbxDataType ); + SbiSymPool& GetParams() { return aParams; } + SbiSymPool& GetLabels() { return aLabels; } + SbiSymPool& GetLocals() { return GetPool();} + String& GetLib() { return aLibName; } + String& GetAlias() { return aAlias; } + void SetPublic( BOOL b ) { bPublic = b; } + BOOL IsPublic() const { return bPublic; } + void SetCdecl( BOOL b = TRUE) { bCdecl = b; } + BOOL IsCdecl() const { return bCdecl; } + void SetLine1( USHORT n ) { nLine1 = n; } + USHORT GetLine1() const { return nLine1; } + void SetLine2( USHORT n ) { nLine2 = n; } + USHORT GetLine2() const { return nLine2; } + + // Match mit einer Forward-Deklaration. Die Parameternamen + // werden abgeglichen und die Forward-Deklaration wird + // durch this ersetzt + void Match( SbiProcDef* pForward ); + +private: + SbiProcDef( const SbiProcDef& ); + +}; + +class SbiConstDef : public SbiSymDef +{ + double nVal; + String aVal; +public: + SbiConstDef( const String& ); + virtual ~SbiConstDef(); + virtual SbiConstDef* GetConstDef(); + void Set( double, SbxDataType ); + void Set( const String& ); + double GetValue() { return nVal; } + const String& GetString() { return aVal; } +}; + + +#endif + diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx new file mode 100644 index 000000000000..022f490895e1 --- /dev/null +++ b/basic/source/inc/token.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * $RCSfile: token.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOKEN_HXX +#define _TOKEN_HXX + +#ifndef _SCANNER_HXX +#include "scanner.hxx" +#endif +#ifndef _SBDEF_HXX +#include "sbdef.hxx" +#endif + +#if defined( SHARED ) +#define SbiTokenSHAREDTMPUNDEF +#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. + +enum SbiToken { + NIL = 0, + // Token zwischen 0x20 und 0x3F sind Literale: + LPAREN = '(', RPAREN = ')', COMMA = ',', DOT = '.', EXCLAM = '!', + HASH = '#', SEMICOLON = ';', + + // Anweisungen: + FIRSTKWD = 0x40, + AS = FIRSTKWD, ALIAS, ASSIGN, + CALL, CASE, CLOSE, COMPARE, _CONST_, + DECLARE, DIM, DO, + + // in der Reihenfolge der Datentyp-Enums! + DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFCUR, DEFDATE, DEFSTR, DEFOBJ, + DEFERR, DEFBOOL, DEFVAR, + // in der Reihenfolge der Datentyp-Enums! + DATATYPE1, + TINTEGER = DATATYPE1, + TLONG, TSINGLE, TDOUBLE, TCURRENCY, TDATE, TSTRING, TOBJECT, + _ERROR_, TBOOLEAN, TVARIANT, + DATATYPE2 = TVARIANT, + + EACH, ELSE, ELSEIF, END, ERASE, EXIT, + FOR, FUNCTION, + GLOBAL, GOSUB, GOTO, + IF, _IN_, INPUT, + LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET, + NAME, NEW, NEXT, + ON, OPEN, OPTION, + PRINT, PRIVATE, PUBLIC, + REDIM, REM, RESUME, RETURN, RSET, + SELECT, SET, SHARED, STATIC, STEP, STOP, SUB, + TEXT, THEN, TO, TYPE, + UNTIL, + WEND, WHILE, WITH, WRITE, + ENDIF, ENDFUNC, ENDSUB, ENDTYPE, ENDSELECT, ENDWITH, + // Ende aller Keywords + LASTKWD = ENDWITH, + // Statement-Ende + EOS, EOLN, + // Operatoren: + EXPON, NEG, MUL, + DIV, IDIV, MOD, PLUS, MINUS, + EQ, NE, LT, GT, LE, GE, + NOT, AND, OR, XOR, EQV, + IMP, CAT, LIKE, IS, + // Sonstiges: + FIRSTEXTRA, + NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, + OUTPUT, RANDOM, APPEND, BINARY, ACCESS, + LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_, + EXPLICIT, + + // Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ) + 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 + // _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, + JS_ASS_AND, JS_ASS_XOR, JS_ASS_OR, + JS_COND_QUEST, JS_COND_SEL, JS_LOG_OR, JS_LOG_AND, JS_BIT_OR, + JS_BIT_XOR, JS_BIT_AND, JS_EQ, JS_NE, JS_LT, JS_LE, + JS_GT, JS_GE, JS_LSHIFT, JS_RSHIFT, JS_RSHIFT_Z, + JS_PLUS, JS_MINUS, JS_MUL, JS_DIV, JS_MOD, JS_LOG_NOT, JS_BIT_NOT, + JS_INC, JS_DEC, JS_LPAREN, JS_RPAREN, JS_LINDEX, JS_RINDEX +}; + +#ifdef SbiTokenSHAREDTMPUNDEF +#define SHARED +#undef SbiTokenSHAREDTMPUNDEF +#endif + +class SbiTokenizer : public SbiScanner { +protected: + SbiToken eCurTok; // aktuelles Token + SbiToken ePush; // Pushback-Token + USHORT nPLine, nPCol1, nPCol2; // Pushback-Location + BOOL bEof; // TRUE bei Dateiende + BOOL bEos; // TRUE bei Statement-Ende + BOOL bKeywords; // TRUE, falls Keywords geparst werden + BOOL bAs; // letztes Keyword war AS +public: + SbiTokenizer( const String&, StarBASIC* = NULL ); + ~SbiTokenizer(); + + inline BOOL IsEof() { return bEof; } + inline BOOL IsEos() { return bEos; } + + void Push( SbiToken ); // Pushback eines Tokens + const String& Symbol( SbiToken );// Rueckumwandlung + + SbiToken Peek(); // das naechste Token lesen + SbiToken Next(); // Ein Token lesen + BOOL MayBeLabel( BOOL= FALSE ); // Kann es ein Label sein? + + void Hilite( SbTextPortions& ); // Syntax-Highlighting + + void Error( SbError c ) { GenError( c ); } + void Error( SbError, SbiToken ); + void Error( SbError, const char* ); + void Error( SbError, String ); + + void Keywords( BOOL b ) { bKeywords = b; } + + static BOOL IsEoln( SbiToken t ) + { return BOOL( t == EOS || t == EOLN || t == REM ); } + static BOOL IsKwd( SbiToken t ) + { return BOOL( t >= FIRSTKWD && t <= LASTKWD ); } + static BOOL IsExtra( SbiToken t ) + { return BOOL( t >= FIRSTEXTRA ); } +}; + + +#endif |