LCOV - code coverage report
Current view: top level - basic/source/inc - codegen.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 11 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_BASIC_SOURCE_INC_CODEGEN_HXX
      21             : #define INCLUDED_BASIC_SOURCE_INC_CODEGEN_HXX
      22             : 
      23             : class SbiParser;
      24             : class SbModule;
      25             : #include "opcodes.hxx"
      26             : #include "buffer.hxx"
      27             : #include <basic/codecompletecache.hxx>
      28             : 
      29           0 : class SbiCodeGen {
      30             :     SbiParser* pParser;         // for error messages, line, column etc.
      31             :     SbModule& rMod;
      32             :     SbiBuffer aCode;
      33             :     short  nLine, nCol;         // for stmnt command
      34             :     short  nForLevel;           // #29955
      35             :     bool bStmnt;            // true: statement-opcode is pending
      36             : 
      37             : public:
      38             :     SbiCodeGen( SbModule&, SbiParser*, short );
      39           0 :     SbiParser* GetParser() { return pParser; }
      40           0 :     SbModule& GetModule() { return rMod; }
      41             :     sal_uInt32 Gen( SbiOpcode );
      42             :     sal_uInt32 Gen( SbiOpcode, sal_uInt32 );
      43             :     sal_uInt32 Gen( SbiOpcode, sal_uInt32, sal_uInt32 );
      44           0 :     void Patch( sal_uInt32 o, sal_uInt32 v ){ aCode.Patch( o, v ); }
      45           0 :     void BackChain( sal_uInt32 off )    { aCode.Chain( off );  }
      46             :     void Statement();
      47             :     void GenStmnt();            // create statement-opcode maybe
      48             :     sal_uInt32 GetPC();
      49           0 :     sal_uInt32 GetOffset()              { return GetPC() + 1; }
      50             :     void Save();
      51             : 
      52             :     // #29955 service for-loop-level
      53           0 :     void IncForLevel( void ) { nForLevel++; }
      54           0 :     void DecForLevel( void ) { nForLevel--; }
      55             : 
      56             :     static sal_uInt32 calcNewOffSet( sal_uInt8* pCode, sal_uInt16 nOffset );
      57             :     static sal_uInt16 calcLegacyOffSet( sal_uInt8* pCode, sal_uInt32 nOffset );
      58             : 
      59             : };
      60             : 
      61             : template < class T, class S >
      62             : class PCodeBuffConvertor
      63             : {
      64             :     T m_nSize;
      65             :     sal_uInt8* m_pStart;
      66             :     sal_uInt8* m_pCnvtdBuf;
      67             :     S m_nCnvtdSize;
      68             : 
      69             :     //  Disable usual copying symantics and bodgy default ctor
      70             :     PCodeBuffConvertor();
      71             :     PCodeBuffConvertor(const PCodeBuffConvertor& );
      72             :     PCodeBuffConvertor& operator = ( const PCodeBuffConvertor& );
      73             : public:
      74           0 :     PCodeBuffConvertor( sal_uInt8* pCode, T nSize ): m_nSize( nSize ),  m_pStart( pCode ), m_pCnvtdBuf( NULL ), m_nCnvtdSize( 0 ){ convert(); }
      75           0 :     S GetSize(){ return m_nCnvtdSize; }
      76             :     void convert();
      77             :     // Caller owns the buffer returned
      78           0 :     sal_uInt8* GetBuffer() { return m_pCnvtdBuf; }
      79             : };
      80             : 
      81             : // #111897 PARAM_INFO flags start at 0x00010000 to not
      82             : // conflict with DefaultId in SbxParamInfo::nUserData
      83             : #define PARAM_INFO_PARAMARRAY       0x0010000
      84             : #define PARAM_INFO_WITHBRACKETS     0x0020000
      85             : 
      86             : #endif
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10