generate_IEC_std.py
author laurent
Thu, 21 Apr 2011 11:06:17 +0200
changeset 535 08f32198e932
parent 521 457578c31074
child 542 cce4903be769
permissions -rwxr-xr-x
Adding support for saving frame size while closing and restore it at next launch
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     1
#!/usr/bin/env python
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     2
# -*- coding: utf-8 -*-
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     3
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     4
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     5
#based on the plcopen standard. 
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     6
#
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
     7
#Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     8
#
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
     9
#See COPYING file for copyrights details.
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    10
#
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    11
#This library is free software; you can redistribute it and/or
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    12
#modify it under the terms of the GNU General Public
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    13
#License as published by the Free Software Foundation; either
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    14
#version 2.1 of the License, or (at your option) any later version.
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    15
#
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    16
#This library is distributed in the hope that it will be useful,
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    17
#but WITHOUT ANY WARRANTY; without even the implied warranty of
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    18
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    19
#General Public License for more details.
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    20
#
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    21
#You should have received a copy of the GNU General Public
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    22
#License along with this library; if not, write to the Free Software
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    23
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    24
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
    25
"""
115
017a65259f07 Change generate_cc to generate_c
lbessard
parents: 59
diff changeset
    26
 THIS CODE GENARATES C++ CODE FOR IEC2C COMPILER
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    27
"""
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    28
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    29
file_list = [
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    30
        ('absyntax_utils',      'function_type_decl','h'        ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    31
        ('absyntax_utils',      'get_function_type_decl','c'    ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    32
        ('absyntax_utils',      'search_type_code','c'          ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    33
        ('stage4/generate_c',   'st_code_gen','c'               ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    34
        ('stage4/generate_c',   'il_code_gen','c'               ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    35
        ('stage1_2',            'standard_function_names','c'   ),
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    36
        ('lib',                 'iec_std_lib_generated','h'     )
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    37
        ]
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
    38
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    39
# Get definitions
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    40
from plcopen.structures import *
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    41
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
    42
if len(sys.argv) != 2 :
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
    43
    print "Usage: " + sys.argv[0] + " path_name\n -> create files in path_name"
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
    44
    sys.exit(0)
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
    45
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    46
#import pprint
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    47
#pp = pprint.PrettyPrinter(indent=4)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
    48
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    49
matiec_header = """/*
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    50
 * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    51
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    52
 * See COPYING and COPYING.LESSER files for copyright details.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    53
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    54
 * This program is free software: you can redistribute it and/or modify
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    55
 * it under the terms of the GNU General Public License as published by
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    56
 * the Free Software Foundation, either version 3 of the License, or
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    57
 * (at your option) any later version.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    58
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    59
 * This program is distributed in the hope that it will be useful,
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    60
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    61
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    62
 * GNU General Public License for more details.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    63
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    64
 * You should have received a copy of the GNU General Public License
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    65
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    66
 *
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    67
 */
167
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    68
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    69
/****
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    70
 * IEC 61131-3 standard function library
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    71
 * generated code, do not edit by hand
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    72
 */
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    73
 
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    74
 """
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
    75
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
    76
matiec_lesser_header = """/*
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    77
 * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    78
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    79
 * See COPYING and COPYING.LESSER files for copyright details.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    80
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    81
 * This library is free software; you can redistribute it and/or
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    82
 * modify it under the terms of the GNU Lesser General Public
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    83
 * License as published by the Free Software Foundation; either
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    84
 * version 3 of the License, or (at your option) any later version.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    85
 *
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    86
 * This library is distributed in the hope that it will be useful,
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    87
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    88
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    89
 * Lesser General Public License for more details.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    90
 * 
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    91
 * You should have received a copy of the GNU Lesser General Public License 
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    92
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
    93
 *
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
    94
 */
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
    95
167
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    96
/****
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    97
 * IEC 61131-3 standard function library
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    98
 * generated code, do not edit by hand
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
    99
 */
893ff98ab3be Fixed std code for matiec generation header
etisserant
parents: 115
diff changeset
   100
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
   101
 """
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
   102
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   103
def ANY_to_compiler_test_type_GEN(typename, paramname):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   104
    """
115
017a65259f07 Change generate_cc to generate_c
lbessard
parents: 59
diff changeset
   105
    Convert ANY_XXX IEC type declaration into IEC2C's generated type test.
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   106
    This tests are defined in search_expression_type.cc 
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   107
    """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   108
    return {"ANY" : "",
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   109
    "ANY_BIT" : "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_binary_type(%(paramname)s_type_symbol))",
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   110
    "ANY_NBIT" : "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_nbinary_type(%(paramname)s_type_symbol))",
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   111
    "ANY_NUM" : "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_num_type(%(paramname)s_type_symbol))",
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   112
    "ANY_REAL" : "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_real_type(%(paramname)s_type_symbol))",
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   113
    "ANY_INT" : "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_integer_type(%(paramname)s_type_symbol))"
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   114
    }.get(typename,
40
49c8ebc1ee25 Cleanup in generated C code for STD lib
etisserant
parents: 36
diff changeset
   115
        #"if (typeid(*last_type_symbol) == typeid(%(typename)s_type_name_c))")%{
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   116
        "if(%(paramname)s_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::%(typename)s_type_name, last_type_symbol))")%{
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   117
                "paramname" : paramname, "typename": typename.lower()}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   118
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   119
def recurse_and_indent(fdecls, indent, do_type_search_only = False, do_il = False):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   120
    """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   121
    This function generate visit(function_invocation) code for 
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   122
        - ST code generator
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   123
        - IL code generator
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   124
        - search_expression_type class for ST
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   125
        - search_expression_type class for IL
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   126
        
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   127
    Input data is a 
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   128
    "{fname : {IN[0]paramname : {IN[0]paramtype : {IN[1]paraname : {IN[1]paramtype : {... : {IN[N]paraname : {IN[N]paramtype : (fdecl,)}}}}}}"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   129
    nested dictionary structure.
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   130
    """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   131
    if type(fdecls) != type(tuple()):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   132
        res = ""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   133
        for Paramname, ParamTypes in fdecls.iteritems():
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   134
            if do_il:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   135
                res += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   136
{"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   137
                if not do_type_search_only:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   138
                    res += """
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   139
    symbol_c *%(input_name)s_param_name = (symbol_c *)(new identifier_c("%(input_name)s"));
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   140
    /* Get the value from a foo(<param_name> = <param_value>) style call */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   141
    symbol_c *%(input_name)s_param_value = &this->default_variable_name;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   142
"""%{"input_name":Paramname}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   143
                res += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   144
    symbol_c *%(input_name)s_type_symbol = param_data_type;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   145
    last_type_symbol = param_data_type;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   146
"""%{"input_name":Paramname}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   147
            else:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   148
                res += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   149
{
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   150
    symbol_c *%(input_name)s_param_name = (symbol_c *)(new identifier_c("%(input_name)s"));
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   151
    /* Get the value from a foo(<param_name> = <param_value>) style call */
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   152
    symbol_c *%(input_name)s_param_value = function_call_param_iterator.search_f(%(input_name)s_param_name);
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   153
    symbol_c *%(input_name)s_type_symbol = NULL;
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   154
    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   155
    /* Get the value from a foo(<param_value>) style call */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   156
    if (%(input_name)s_param_value == NULL)
406
af07b091bbee Modify code generated to fit latest modifications in matiec
laurent
parents: 404
diff changeset
   157
      %(input_name)s_param_value = function_call_param_iterator.next_nf();
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   158
    if (%(input_name)s_param_value != NULL) {
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   159
      %(input_name)s_type_symbol = search_expression_type->get_type(%(input_name)s_param_value);
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   160
      last_type_symbol = last_type_symbol && %(input_name)s_type_symbol && search_expression_type->is_same_type(%(input_name)s_type_symbol, last_type_symbol) ? search_expression_type->common_type(%(input_name)s_type_symbol, last_type_symbol) : %(input_name)s_type_symbol ;
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   161
    }
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   162
"""%{"input_name":Paramname}
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   163
                                
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   164
            for ParamType,NextParamDecl in ParamTypes.iteritems():
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   165
            
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   166
                res += """    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   167
    %(type_test)s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   168
    {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   169
%(if_good_type_code)s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   170
    }
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   171
"""%{
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   172
    "type_test":ANY_to_compiler_test_type_GEN(ParamType,Paramname), 
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   173
    "if_good_type_code":recurse_and_indent(NextParamDecl,indent,do_type_search_only).replace('\n','\n    ')}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   174
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   175
            res += """    
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   176
    
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   177
    ERROR;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   178
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   179
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   180
        
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   181
        return res.replace('\n','\n'+indent)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   182
    else:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   183
        res = "\n"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   184
        fdecl=fdecls[0]
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   185
        
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   186
        if not do_type_search_only:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   187
            code_gen = eval(fdecl["python_eval_c_code_format"])
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   188
            
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   189
            if code_gen[1] is not None:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   190
                res += "function_name = (symbol_c*)(new pragma_c(\"%s\"));\n"%code_gen[1]
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   191
            if fdecl["extensible"]:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   192
                res += """
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   193
if (nb_param < %(min_nb_param)d)
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   194
  nb_param = %(min_nb_param)d;
291
e580c945c62a Bug with standard functions nb_params count on Windows fixed
lbessard
parents: 284
diff changeset
   195
char* nb_param_str = new char[10];
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   196
sprintf(nb_param_str, "%%d", nb_param);
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   197
symbol_c * nb_param_name = (symbol_c *)(new identifier_c("nb_param"));
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   198
ADD_PARAM_LIST(nb_param_name, (symbol_c*)(new integer_c((const char *)nb_param_str)), (symbol_c*)(new int_type_name_c()), function_param_iterator_c::direction_in)
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   199
"""%{"min_nb_param" : len(fdecl["inputs"])}
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   200
            for paramname,paramtype,unused in fdecl["inputs"]:
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   201
                res += """
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   202
if (%(input_name)s_type_symbol == NULL)
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   203
  %(input_name)s_type_symbol = last_type_symbol;
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   204
ADD_PARAM_LIST(%(input_name)s_param_name, %(input_name)s_param_value, %(input_name)s_type_symbol, function_param_iterator_c::direction_in)
307
fd1f6ae26d4f Adding support for cancelling code generation of function with no input connected
lbessard
parents: 291
diff changeset
   205
"""%{"input_name" : paramname}
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   206
            if fdecl["extensible"]:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   207
                res += """
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   208
int base_num = %d;
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   209
symbol_c *param_value = NULL;
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   210
symbol_c *param_name = NULL;
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   211
do{
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   212
    char my_name[10];
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   213
    sprintf(my_name, "IN%%d", base_num++);
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   214
    param_name = (symbol_c*)(new identifier_c(my_name));
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   215
    
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   216
    /* Get the value from a foo(<param_name> = <param_value>) style call */
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   217
    param_value = function_call_param_iterator.search_f(param_name);
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   218
    
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   219
    /* Get the value from a foo(<param_value>) style call */
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   220
    if (param_value == NULL)
406
af07b091bbee Modify code generated to fit latest modifications in matiec
laurent
parents: 404
diff changeset
   221
      param_value = function_call_param_iterator.next_nf();
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   222
    if (param_value != NULL){
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   223
        symbol_c *current_type_symbol = search_expression_type->get_type(param_value);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   224
        last_type_symbol = last_type_symbol && search_expression_type->is_same_type(current_type_symbol, last_type_symbol) ? search_expression_type->common_type(current_type_symbol, last_type_symbol) : current_type_symbol ;
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   225
    
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   226
        /*Function specific CODE */
488
93bf600bae11 Bug not refreshing FileMenu when Undo/Redo fixed
laurent
parents: 486
diff changeset
   227
        ADD_PARAM_LIST(param_name, param_value, current_type_symbol, function_param_iterator_c::direction_in)
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   228
    }
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   229
    
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   230
}while(param_value != NULL);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   231
"""%(fdecl["baseinputnumber"] + 2)
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   232
        
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   233
        result_type_rule = fdecl["return_type_rule"]
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   234
        res += {
486
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   235
            "copy_input" : "symbol_c * return_type_symbol = last_type_symbol;\n",
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   236
            "defined" : "symbol_c * return_type_symbol = &search_constant_type_c::%s_type_name;\n"%fdecl["outputs"][0][1].lower(),
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   237
            }.get(result_type_rule, "symbol_c * return_type_symbol = %s;\n"%result_type_rule)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   238
        
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   239
        if not do_type_search_only:
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   240
            if code_gen[0] is not None:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   241
                res += "function_type_prefix = %s;\n"%{"return_type" : "return_type_symbol"}.get(code_gen[0], "(symbol_c*)(new pragma_c(\"%s\"))"%code_gen[0])
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   242
            if code_gen[2] is not None:
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   243
                res += "function_type_suffix = %s_symbol;\n"%{"common_type" : "last_type"}.get(code_gen[2], code_gen[2])
486
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   244
            
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   245
            any_common = reduce(lambda x, y: {"ANY": lambda x: x,
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   246
                                          "ANY_BIT": lambda x: {"ANY": y, "ANY_NUM": y}.get(y, x),
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   247
                                          "ANY_NUM": lambda x: {"ANY": y}.get(y, x),
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   248
                                          "ANY_REAL": lambda x: {"ANY": y, "ANY_NUM": y}.get(y, x)}.get(x, y), 
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   249
                                [paramtype for paramname,paramtype,unused in fdecl["inputs"]], "BOOL")
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   250
            
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   251
            first = True
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   252
            for list, test_type, default_type in [(["ANY", "ANY_NUM"], "integer", "lint"),
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   253
                                                  (["ANY_BIT"], "integer", "lword"),
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   254
                                                  (["ANY", "ANY_REAL"], "real", "lreal")]:
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   255
            
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   256
                if any_common in list:
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   257
                    if not first:
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   258
                        res += "else "
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   259
                    first = False
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   260
                    res += """if (search_expression_type->is_literal_%s_type(function_type_suffix))
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   261
    function_type_suffix = &search_constant_type_c::%s_type_name;
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   262
"""%(test_type, default_type)
0daecbcbfbf4 Bug on standard functions called with literals fixed
laurent
parents: 458
diff changeset
   263
        
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   264
            res += "break;\n"
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   265
        else:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   266
            res += "return return_type_symbol;\n"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   267
        
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   268
        return res.replace('\n','\n'+indent)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   269
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   270
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   271
###                                                             ###
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   272
###                           MAIN                              ###
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   273
###                                                             ###
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   274
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   275
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   276
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   277
Reorganize std_decl from structure.py
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   278
into a nested dictionnary structure (i.e. a tree):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   279
"{fname : {IN[0]paramname : {IN[0]paramtype : {IN[1]paraname : {IN[1]paramtype : {... : {IN[N]paraname : {IN[N]paramtype : (fdecl,)}}}}}}"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   280
Keep ptrack of original declaration order in a 
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   281
separated list called official_order
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   282
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   283
std_fdecls = {}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   284
official_order = []
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   285
for section in std_decl:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   286
    for fdecl in section["list"]:
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
   287
        if len(official_order)==0 or fdecl["name"] not in official_order:
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   288
            official_order.append(fdecl["name"])
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   289
        # store all func by name in a dict
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   290
        std_fdecls_fdecl_name = std_fdecls.get(fdecl["name"], {})
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   291
        current = std_fdecls_fdecl_name
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   292
        for i in fdecl["inputs"]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   293
            current[i[0]] = current.get(i[0], {})
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   294
            current = current[i[0]]
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   295
            last = current
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   296
            current[i[1]] = current.get(i[1], {})
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   297
            current = current[i[1]]
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   298
        last[i[1]]=(fdecl,)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   299
        std_fdecls[fdecl["name"]] = std_fdecls_fdecl_name
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   300
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   301
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   302
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   303
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   304
Generate the long enumeration of std function types
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   305
"""
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
   306
function_type_decl =  matiec_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   307
typedef enum {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   308
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   309
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   310
    function_type_decl += "    function_"+fname.lower()+",\n"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   311
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   312
function_type_decl += """    function_none
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   313
} function_type_t;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   314
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   315
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   316
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   317
Generate the funct that return enumerated according function name
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   318
"""
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
   319
get_function_type_decl = matiec_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   320
function_type_t get_function_type(identifier_c *function_name) {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   321
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   322
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   323
    get_function_type_decl += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   324
if (!strcasecmp(function_name->value, "%s"))
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   325
    return function_%s;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   326
"""%(fname,fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   327
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   328
get_function_type_decl += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   329
    else return function_none;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   330
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   331
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   332
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   333
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   334
"""
115
017a65259f07 Change generate_cc to generate_c
lbessard
parents: 59
diff changeset
   335
Generate the part of generate_c_st_c::visit(function_invocation)
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   336
that is responsible to generate C code for std lib calls.
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   337
"""
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
   338
st_code_gen = matiec_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   339
switch(current_function_type){
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   340
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   341
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   342
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   343
    st_code_gen += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   344
/****
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   345
 *%s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   346
 */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   347
    case function_%s :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   348
    {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   349
        symbol_c *last_type_symbol = NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   350
"""    %(fname, fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   351
    indent =  "    "
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   352
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   353
    st_code_gen += recurse_and_indent(fdecls, indent).replace('\n','\n    ')
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   354
    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   355
    st_code_gen += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   356
    }/*function_%s*/
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   357
    break;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   358
"""    %(fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   359
st_code_gen +=  """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   360
    case function_none :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   361
    ERROR;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   362
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   363
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   364
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   365
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   366
"""
115
017a65259f07 Change generate_cc to generate_c
lbessard
parents: 59
diff changeset
   367
Generate the part of generate_c_il_c::visit(il_function_call)
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   368
that is responsible to generate C code for std lib calls.
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   369
"""
58
39cd981ff242 Changing file headers
lbessard
parents: 43
diff changeset
   370
il_code_gen = matiec_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   371
switch(current_function_type){
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   372
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   373
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   374
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   375
    il_code_gen += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   376
/****
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   377
 *%s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   378
 */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   379
    case function_%s :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   380
    {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   381
        symbol_c *last_type_symbol = NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   382
"""    %(fname, fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   383
    indent =  "    "
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   384
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   385
    il_code_gen += recurse_and_indent(fdecls, indent, do_il=True).replace('\n','\n    ')
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   386
    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   387
    il_code_gen += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   388
    }/*function_%s*/
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   389
    break;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   390
"""    %(fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   391
il_code_gen +=  """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   392
    case function_none :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   393
    ERROR;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   394
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   395
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   396
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   397
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   398
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   399
Generate the part of search_expression_type_c::visit(function_invocation)
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   400
that is responsible of returning type symbol for function invocation.
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   401
"""
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
   402
search_type_code = matiec_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   403
406
af07b091bbee Modify code generated to fit latest modifications in matiec
laurent
parents: 404
diff changeset
   404
void *search_expression_type_c::compute_standard_function_default(function_invocation_c *st_symbol = NULL, il_formal_funct_call_c *il_symbol = NULL) {
284
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   405
  function_type_t current_function_type;
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   406
  function_call_param_iterator_c *tmp_function_call_param_iterator;
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   407
  if (st_symbol != NULL && il_symbol == NULL) {
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   408
    current_function_type = get_function_type((identifier_c *)st_symbol->function_name);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   409
    tmp_function_call_param_iterator = new function_call_param_iterator_c(st_symbol);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   410
  }
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   411
  else if (st_symbol == NULL && il_symbol != NULL) {
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   412
    current_function_type = get_function_type((identifier_c *)il_symbol->function_name);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   413
    tmp_function_call_param_iterator = new function_call_param_iterator_c(il_symbol);
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   414
  }
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   415
  else
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   416
    ERROR;
6cf858411d3a Adding support for EN/ENO in standard functions
lbessard
parents: 167
diff changeset
   417
  function_call_param_iterator_c function_call_param_iterator(*tmp_function_call_param_iterator);
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   418
  search_expression_type_c* search_expression_type = this;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   419
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   420
  switch(current_function_type){
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   421
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   422
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   423
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   424
    search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   425
/****
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   426
 *%s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   427
 */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   428
    case function_%s :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   429
    {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   430
        symbol_c *last_type_symbol = NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   431
"""    %(fname, fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   432
    indent =  "    "
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   433
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   434
    search_type_code += recurse_and_indent(fdecls, indent, True).replace('\n','\n    ')
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   435
    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   436
    search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   437
    }/*function_%s*/
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   438
    break;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   439
"""    %(fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   440
search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   441
    case function_none :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   442
    ERROR;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   443
  }
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   444
  return NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   445
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   446
406
af07b091bbee Modify code generated to fit latest modifications in matiec
laurent
parents: 404
diff changeset
   447
void *search_expression_type_c::compute_standard_function_il(il_function_call_c *symbol, symbol_c *param_data_type) {
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   448
  
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   449
  function_type_t current_function_type = get_function_type((identifier_c *)symbol->function_name);
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   450
  function_call_param_iterator_c function_call_param_iterator(symbol);  
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   451
  search_expression_type_c* search_expression_type = this;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   452
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   453
  switch(current_function_type){
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   454
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   455
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   456
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   457
    search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   458
/****
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   459
 *%s
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   460
 */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   461
    case function_%s :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   462
    {
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   463
        symbol_c *last_type_symbol = NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   464
"""    %(fname, fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   465
    indent =  "    "
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   466
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   467
    search_type_code += recurse_and_indent(fdecls, indent, True, True).replace('\n','\n    ')
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   468
    
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   469
    search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   470
    }/*function_%s*/
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   471
    break;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   472
"""    %(fname.lower())
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   473
search_type_code += """
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   474
    case function_none :
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   475
    ERROR;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   476
  }
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   477
  return NULL;
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   478
}
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   479
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   480
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   481
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   482
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   483
###################################################################
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   484
"""
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   485
Generate the standard_function_names[] for inclusion in bizon generated code
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   486
"""
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
   487
standard_function_names = matiec_header + """
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   488
const char *standard_function_names[] = {
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   489
"""
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   490
for fname, fdecls in [ (fname,std_fdecls[fname]) for fname in official_order ]:
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   491
    standard_function_names += "\""+fname+"\",\n"
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   492
standard_function_names += """
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   493
/* end of array marker! Do not remove! */
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   494
NULL
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   495
};
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   496
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   497
"""
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   498
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   499
###################################################################
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   500
###################################################################
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   501
###################################################################
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   502
"""
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   503
Generate the C implementation of the IEC standard function library.
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   504
"""
59
af079a11837b Adding header for files published under LGPL
lbessard
parents: 58
diff changeset
   505
iec_std_lib_generated = matiec_lesser_header + """
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   506
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   507
/* Macro that expand to subtypes */
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   508
"""
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   509
for typename, parenttypename in TypeHierarchy_list:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   510
    if (typename.startswith("ANY")):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   511
        iec_std_lib_generated += "#define " + typename + "(DO)"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   512
        for typename2, parenttypename2 in TypeHierarchy_list:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   513
            if(parenttypename2 == typename):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   514
                if(typename2.startswith("ANY")):
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   515
                    iec_std_lib_generated +=  " " + typename2 + "(DO)"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   516
                else:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   517
                    iec_std_lib_generated +=  " DO(" + typename2 + ")"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   518
        iec_std_lib_generated +=  "\n"
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   519
    else:
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   520
        break
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   521
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   522
# Now, print that out, or write to files from sys.argv
521
457578c31074 Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
Edouard Tisserant
parents: 488
diff changeset
   523
for path, name, ext in file_list :
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   524
    fd = open(os.path.join(sys.argv[1], path, name+'.'+ext),'w')
25
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   525
    fd.write(eval(name))
8dc68e669d99 Early implementation of STD library.
etisserant
parents:
diff changeset
   526
    fd.close()
36
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   527
    
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   528
#print "/* Code to eventually paste in iec_std_lib.h if type hierarchy changed */"
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   529
#print "/* you also have to change iec_std_lib.h according to new types        */\n\n"
e7d67b27877f Changes in the std library + std lib PLCOpen test (broken)
etisserant
parents: 26
diff changeset
   530
#print iec_std_lib_generated