stage1_2/stage1_2.hh
author mjsousa
Sat, 27 Sep 2014 20:09:19 +0100
changeset 932 061824c45a5b
parent 924 9e824bb0c3d4
child 934 2a42a68f4b59
permissions -rwxr-xr-x
Add support for REF_TO inside arrays and structs (a non-standard feature!)
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
     1
/*
264
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
     3
 *
264
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
     4
 *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
279
c0453b7f99df Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents: 264
diff changeset
     5
 *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
     6
 *
264
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
     7
 *  This program is free software: you can redistribute it and/or modify
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
     8
 *  it under the terms of the GNU General Public License as published by
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
     9
 *  the Free Software Foundation, either version 3 of the License, or
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    10
 *  (at your option) any later version.
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    11
 *
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    12
 *  This program is distributed in the hope that it will be useful,
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    15
 *  GNU General Public License for more details.
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    16
 *
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    17
 *  You should have received a copy of the GNU General Public License
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    19
 *
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    20
 *
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    21
 * This code is made available on the understanding that it will not be
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    22
 * used in safety-critical situations without a full and competent review.
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    23
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    24
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    25
/*
264
6facabd9c2cd Updating License info (with Edoaurd's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents: 177
diff changeset
    26
 * An IEC 61131-3 compiler.
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    27
 *
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    28
 * Based on the
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    29
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    30
 *
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    31
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    32
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    33
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    34
/*
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    35
 * The public interface to stage1_2.cc 
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    36
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    37
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    38
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    39
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    40
#ifndef _STAGE1_2_HH
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    41
#define _STAGE1_2_HH
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    42
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    43
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    44
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    45
/*
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    46
 * This file includes the interface through which the main function accesses the stage1_2 services 
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    47
 */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    48
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    49
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    50
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    51
typedef struct {
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    52
		/******************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    53
		/* whether we are suporting safe extensions           */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    54
		/* as defined in PLCopen - Technical Committee 5      */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    55
		/* Safety Software Technical Specification,           */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    56
		/* Part 1: Concepts and Function Blocks,              */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    57
		/* Version 1.0 – Official Release                     */
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    58
		/******************************************************/
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    59
	bool safe_extensions;
867
a435684a5223 Add option to control support for nested comments (default is off, as defined in IEC 61131-3 v2)
mjsousa
parents: 746
diff changeset
    60
	bool full_token_loc;       /* error messages specify full token location */
a435684a5223 Add option to control support for nested comments (default is off, as defined in IEC 61131-3 v2)
mjsousa
parents: 746
diff changeset
    61
	bool conversion_functions; /* Create a conversion function for derived datatype */
a435684a5223 Add option to control support for nested comments (default is off, as defined in IEC 61131-3 v2)
mjsousa
parents: 746
diff changeset
    62
	bool nested_comments;      /* Allow the use of nested comments. */
924
9e824bb0c3d4 Make support for REF_TO ANY a command line option.
mjsousa
parents: 873
diff changeset
    63
	bool ref_operator;         /* Allow the use of REFerences (keywords REF_TO, REF, NULL). */
9e824bb0c3d4 Make support for REF_TO ANY a command line option.
mjsousa
parents: 873
diff changeset
    64
	bool ref_to_any;           /* Allow the use of REF_TO ANY datatypes - non-standard extension! */
867
a435684a5223 Add option to control support for nested comments (default is off, as defined in IEC 61131-3 v2)
mjsousa
parents: 746
diff changeset
    65
	const char *includedir;    /* Include directory, where included files will be searched for... */
177
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    66
} stage1_2_options_t;
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    67
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    68
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    69
int stage1_2(const char *filename, symbol_c **tree_root, stage1_2_options_t options);
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    70
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    71
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    72
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    73
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    74
697562a5da7c Adding support for SAFEBOOL. Some code generation yet to do...
mario
parents:
diff changeset
    75
#endif   /* _STAGE1_2_HH */