stage4/stage4.hh
changeset 267 0a1204bcc9af
parent 210 8387cac2aba6
child 279 c0453b7f99df
equal deleted inserted replaced
266:2f6d8866ec8d 267:0a1204bcc9af
     1 /*
     1 /*
     2  * (c) 2003 Mario de Sousa
     2  *  matiec - a compiler for the programming languages defined in IEC 61131-3
     3  *
     3  *
     4  * Offered to the public under the terms of the GNU General Public License
     4  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
     5  * as published by the Free Software Foundation; either version 2 of the
       
     6  * License, or (at your option) any later version.
       
     7  *
     5  *
     8  * This program is distributed in the hope that it will be useful, but
     6  *  This program is free software: you can redistribute it and/or modify
     9  * WITHOUT ANY WARRANTY; without even the implied warranty of
     7  *  it under the terms of the GNU General Public License as published by
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
     8  *  the Free Software Foundation, either version 3 of the License, or
    11  * Public License for more details.
     9  *  (at your option) any later version.
       
    10  *
       
    11  *  This program is distributed in the hope that it will be useful,
       
    12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    14  *  GNU General Public License for more details.
       
    15  *
       
    16  *  You should have received a copy of the GNU General Public License
       
    17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    18  *
    12  *
    19  *
    13  * This code is made available on the understanding that it will not be
    20  * This code is made available on the understanding that it will not be
    14  * used in safety-critical situations without a full and competent review.
    21  * used in safety-critical situations without a full and competent review.
    15  */
    22  */
    16 
    23 
    17 /*
    24 /*
    18  * An IEC 61131-3 IL and ST compiler.
    25  * An IEC 61131-3 compiler.
    19  *
    26  *
    20  * Based on the
    27  * Based on the
    21  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
    28  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
    22  *
    29  *
    23  */
    30  */
    39   public:
    46   public:
    40     stage4out_c(std::string indent_level = "  ");
    47     stage4out_c(std::string indent_level = "  ");
    41     stage4out_c(const char *dir, const char *radix, const char *extension, std::string indent_level = "  ");
    48     stage4out_c(const char *dir, const char *radix, const char *extension, std::string indent_level = "  ");
    42     ~stage4out_c(void);
    49     ~stage4out_c(void);
    43 
    50 
       
    51     void enable_output(void);
       
    52     void disable_output(void);
       
    53 
    44     void indent_right(void);
    54     void indent_right(void);
    45     void indent_left(void);
    55     void indent_left(void);
    46 
    56 
    47     void *print(const char *str);
    57     void *print(const char *str);
    48     void *print(std::string str);
    58     void *print(std::string str);
    60     void *printlocation_comasep(const char *str);
    70     void *printlocation_comasep(const char *str);
    61 
    71 
    62   protected:
    72   protected:
    63     std::ostream *out;
    73     std::ostream *out;
    64     std::fstream *m_file;
    74     std::fstream *m_file;
       
    75     
       
    76     /* A flag to tell whether to really print to the file, or to ignore any request to print to the file */
       
    77     /* This is used to implement the no_code_generation pragmas, that lets the user tell the compiler
       
    78      * when to switch on and off the code generation, without stoping the lexical, syntatical, and
       
    79      * semantic analysers from analysing the code.
       
    80      */
       
    81     bool allow_output;
    65 
    82 
    66 };
    83 };
    67 
    84 
    68 
    85 
    69 
    86