source: trunk/Compiler/ModelicaCBackEnd/templates/ceval_external_template.c @ 13719

Last change on this file since 13719 was 13719, checked in by Christian Andersson, 2 months ago

Recommitted changeset:13700 to trunk with two bug fixes. Related to ticket:5837

File size: 2.0 KB
Line 
1/*
2    Copyright (C) 2015-2018 Modelon AB
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the Common Public License as published by
6    IBM, version 1.0 of the License.
7
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY. See the Common Public License for more details.
10
11    You should have received a copy of the Common Public License
12    along with this program. If not, see
13    <http://www.ibm.com/developerworks/library/os-cpl.html/>.
14*/
15
16#include "jmi_evaluator_util.h"
17
18/* Must be defined here in order to override the methods from jmi_global.c */
19void jmi_global_log(int warning, const char* name, const char* fmt, const char* value) {
20    _jmi_global_log(warning, name, fmt, value);
21}
22void jmi_throw() {
23    _jmi_throw();
24}
25void* jmi_global_calloc(size_t n, size_t s) {
26    return _jmi_global_calloc(n,s);
27}
28
29$ECE_external_includes$
30 
31/* Used record definitions */
32$ECE_record_definitions$
33
34/* Main */
35int main(int argc, const char* argv[])
36{
37    /* Size buffer for reading array dimensions */
38    int d[25];
39   
40    /* Indices for parsing/printing vars, dimensions */
41    size_t vi,di;
42   
43$ECE_decl$
44$ECE_setup_decl$
45
46    JMCEVAL_setup(); /* This needs to happen first */
47
48    JMCEVAL_check("START");
49    if (JMCEVAL_try()) {
50        JMI_DYNAMIC_INIT()
51        /* Init phase */
52$ECE_setup_init$
53        JMI_DYNAMIC_FREE()
54    } else {
55        JMCEVAL_failed();
56    }
57   
58    JMCEVAL_check("READY");
59    while (JMCEVAL_cont("EVAL\n")) {
60        JMI_DYNAMIC_INIT()
61$ECE_calc_decl$
62$ECE_calc_init$
63        JMCEVAL_check("CALC");
64        if (JMCEVAL_try()) {
65            /* Calc phase */
66$ECE_calc$
67        } else {
68            JMCEVAL_failed();
69        }
70$ECE_calc_free$
71        JMI_DYNAMIC_FREE()
72        JMCEVAL_check("READY");
73    }
74
75    if (JMCEVAL_try()) {
76        /* End phase */
77$ECE_free$
78$ECE_setup_free$
79    } else {
80        JMCEVAL_failed();
81    }
82    _jmi_dynamic_function_pool_destroy();
83    JMCEVAL_check("END");
84    return 0;
85}
86
Note: See TracBrowser for help on using the repository browser.