author | Mario de Sousa <msousa@fe.up.pt> |
Mon, 18 Jun 2012 16:11:00 +0100 | |
changeset 600 | f5d4e9f91513 |
parent 596 | 4efb11e44065 |
permissions | -rw-r--r-- |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
1 |
/* |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
2 |
* 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:
267
diff
changeset
|
3 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
4 |
* |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
8 |
* (at your option) any later version. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
9 |
* |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
13 |
* GNU General Public License for more details. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
14 |
* |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
17 |
* |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
18 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
19 |
* This code is made available on the understanding that it will not be |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
20 |
* used in safety-critical situations without a full and competent review. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
21 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
22 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
23 |
/* |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
24 |
* An IEC 61131-3 compiler. |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
25 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
26 |
* Based on the |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
27 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
28 |
* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
29 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
30 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
31 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
32 |
/* |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
33 |
* This file contains the code that stores the output generated |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
34 |
* by each specific version of the 4th stage. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
35 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
36 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
37 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
38 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
39 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
40 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
41 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
42 |
// #include <stdio.h> /* required for NULL */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
43 |
#include <string> |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
44 |
#include <iostream> |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
45 |
#include <fstream> |
139
668a54686827
added missing includes on some platform (gentoo/gcc-4.3.1)
etisserant
parents:
55
diff
changeset
|
46 |
#include <stdlib.h> |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
47 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
48 |
#include "stage4.hh" |
596
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
49 |
#include "../main.hh" // required for ERROR() and ERROR_MSG() macros. |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
50 |
|
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
51 |
|
546
8cc4c51c4bfc
Fix generation of output for iec2iec.
mjsousa <msousa@fe.up.pt>
parents:
522
diff
changeset
|
52 |
|
8cc4c51c4bfc
Fix generation of output for iec2iec.
mjsousa <msousa@fe.up.pt>
parents:
522
diff
changeset
|
53 |
|
522
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
54 |
#define FIRST_(symbol1, symbol2) (((symbol1)->first_order < (symbol2)->first_order) ? (symbol1) : (symbol2)) |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
55 |
#define LAST_(symbol1, symbol2) (((symbol1)->last_order > (symbol2)->last_order) ? (symbol1) : (symbol2)) |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
56 |
#include <stdarg.h> |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
57 |
|
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
58 |
void stage4err(const char *stage4_generator_id, symbol_c *symbol1, symbol_c *symbol2, const char *errmsg, ...) { |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
59 |
va_list argptr; |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
60 |
va_start(argptr, errmsg); /* second argument is last fixed pamater of stage4err() */ |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
61 |
|
596
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
62 |
if ((symbol1 != NULL) && (symbol2 != NULL)) |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
63 |
fprintf(stderr, "%s:%d-%d..%d-%d: ", |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
64 |
FIRST_(symbol1,symbol2)->first_file, FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
65 |
LAST_(symbol1,symbol2) ->last_line, LAST_(symbol1,symbol2) ->last_column); |
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
66 |
|
4efb11e44065
Add ERROR_MSG macro && move extract_XXX() functions to constant_folding.cc
Mario de Sousa <msousa@fe.up.pt>
parents:
594
diff
changeset
|
67 |
fprintf(stderr, "error %s: ", stage4_generator_id); |
522
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
68 |
vfprintf(stderr, errmsg, argptr); |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
69 |
fprintf(stderr, "\n"); |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
70 |
// error_count++; |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
71 |
va_end(argptr); |
f9cff11ae622
Start having nicer stage 4 error messages.
Mario de Sousa <msousa@fe.up.pt>
parents:
397
diff
changeset
|
72 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
73 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
74 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
75 |
|
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
76 |
stage4out_c::stage4out_c(std::string indent_level): |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
77 |
m_file(NULL) { |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
78 |
out = &std::cout; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
79 |
this->indent_level = indent_level; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
80 |
this->indent_spaces = ""; |
546
8cc4c51c4bfc
Fix generation of output for iec2iec.
mjsousa <msousa@fe.up.pt>
parents:
522
diff
changeset
|
81 |
allow_output = true; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
82 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
83 |
|
46
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
84 |
stage4out_c::stage4out_c(const char *dir, const char *radix, const char *extension, std::string indent_level) { |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
85 |
std::string filename(radix); |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
86 |
filename += "."; |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
87 |
filename += extension; |
46
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
88 |
std::string filepath(""); |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
89 |
if (dir != NULL) { |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
90 |
filepath += dir; |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
91 |
filepath += "/"; |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
92 |
} |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
93 |
filepath += filename; |
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
94 |
std::fstream *file = new std::fstream(filepath.c_str(), std::fstream::out); |
41
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
95 |
if(file->fail()){ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
96 |
std::cerr << "Cannot open " << filename << " for write access \n"; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
97 |
exit(EXIT_FAILURE); |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
98 |
}else{ |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
99 |
std::cout << filename << "\n"; |
8998c8b24b60
First working IEC std lib test, actually test from string and to_string functions.
etisserant
parents:
28
diff
changeset
|
100 |
} |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
101 |
out = file; |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
102 |
m_file = file; |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
103 |
this->indent_level = indent_level; |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
104 |
this->indent_spaces = ""; |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
105 |
allow_output = true; |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
106 |
} |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
107 |
|
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
108 |
stage4out_c::~stage4out_c(void) { |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
109 |
if(m_file) |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
110 |
{ |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
111 |
m_file->close(); |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
112 |
delete m_file; |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
113 |
} |
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
114 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
115 |
|
296
9cf0d701d211
Adding fflush capabilities. It is sometimes usefull when debuging the compiler...
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
116 |
void stage4out_c::flush(void) { |
9cf0d701d211
Adding fflush capabilities. It is sometimes usefull when debuging the compiler...
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
117 |
out->flush(); |
9cf0d701d211
Adding fflush capabilities. It is sometimes usefull when debuging the compiler...
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
118 |
} |
9cf0d701d211
Adding fflush capabilities. It is sometimes usefull when debuging the compiler...
Mario de Sousa <msousa@fe.up.pt>
parents:
279
diff
changeset
|
119 |
|
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
120 |
void stage4out_c::enable_output(void) { |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
121 |
allow_output = true; |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
122 |
} |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
123 |
|
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
124 |
void stage4out_c::disable_output(void) { |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
125 |
allow_output = false; |
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
126 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
127 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
128 |
void stage4out_c::indent_right(void) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
129 |
indent_spaces+=indent_level; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
130 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
131 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
132 |
void stage4out_c::indent_left(void) { |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
133 |
if (indent_spaces.length() >= indent_level.length()) |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
134 |
indent_spaces.erase(indent_spaces.length() - indent_level.length(), indent_level.length()); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
135 |
else |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
136 |
indent_spaces.erase(); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
137 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
138 |
|
594
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
139 |
void *stage4out_c::print( std::string value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
140 |
void *stage4out_c::print( const char *value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
141 |
//void *stage4out_c::print( int64_t value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
142 |
//void *stage4out_c::print( uint64_t value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
143 |
void *stage4out_c::print( real64_t value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
144 |
void *stage4out_c::print( int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
145 |
void *stage4out_c::print( long int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
146 |
void *stage4out_c::print( long long int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
147 |
void *stage4out_c::print(unsigned int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
148 |
void *stage4out_c::print(unsigned long int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
149 |
void *stage4out_c::print(unsigned long long int value) {if (!allow_output) return NULL; *out << value; return NULL;} |
c8092e909886
Clean up code (remove parsing of integers in stage 4).
Mario de Sousa <msousa@fe.up.pt>
parents:
580
diff
changeset
|
150 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
151 |
|
397
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
152 |
void *stage4out_c::print_long_integer(unsigned long l_integer, bool suffix) { |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
153 |
if (!allow_output) return NULL; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
154 |
*out << l_integer; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
155 |
if (suffix) *out << "UL"; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
156 |
return NULL; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
157 |
} |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
158 |
|
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
159 |
void *stage4out_c::print_long_long_integer(unsigned long long ll_integer, bool suffix) { |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
160 |
if (!allow_output) return NULL; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
161 |
*out << ll_integer; |
85151b2f35ca
Adding Common_Ticktime to informations printed in VARIABLES.csv file
laurent
parents:
369
diff
changeset
|
162 |
if (suffix) *out << "ULL"; |
210
8387cac2aba6
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
202
diff
changeset
|
163 |
return NULL; |
8387cac2aba6
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
202
diff
changeset
|
164 |
} |
8387cac2aba6
Adding support for forcing tick count to return to zero as the same time than all tasks firing are synchronized
laurent
parents:
202
diff
changeset
|
165 |
|
580
b6350d9f204d
Code for debugging const_value annotations in abstract syntax tree.
Mario de Sousa <msousa@fe.up.pt>
parents:
546
diff
changeset
|
166 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
167 |
void *stage4out_c::printupper(const char *str) { |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
168 |
if (!allow_output) return NULL; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
169 |
for (int i = 0; str[i] != '\0'; i++) |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
170 |
*out << (unsigned char)toupper(str[i]); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
171 |
return NULL; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
172 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
173 |
|
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
174 |
void *stage4out_c::printlocation(const char *str) { |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
175 |
if (!allow_output) return NULL; |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
176 |
*out << "__"; |
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
177 |
for (int i = 0; str[i] != '\0'; i++) |
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
178 |
if(str[i] == '.') |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
179 |
*out << '_'; |
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
180 |
else |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
181 |
*out << (unsigned char)toupper(str[i]); |
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
182 |
return NULL; |
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
183 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
184 |
|
55
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
185 |
void *stage4out_c::printlocation_comasep(const char *str) { |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
186 |
if (!allow_output) return NULL; |
55
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
187 |
*out << (unsigned char)toupper(str[0]); |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
188 |
*out << ','; |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
189 |
*out << (unsigned char)toupper(str[1]); |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
190 |
*out << ','; |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
191 |
for (int i = 2; str[i] != '\0'; i++) |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
192 |
if(str[i] == '.') |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
193 |
*out << ','; |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
194 |
else |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
195 |
*out << (unsigned char)toupper(str[i]); |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
196 |
return NULL; |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
197 |
} |
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
198 |
|
8b7a21820737
Started support for long long (LL suffix) 64 bit literals on 32 bit platforms (unfinished)
etisserant
parents:
46
diff
changeset
|
199 |
|
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
200 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
201 |
void *stage4out_c::printupper(std::string str) { |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
202 |
if (!allow_output) return NULL; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
203 |
/* The string standard class does not have a converter member function to upper case. |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
204 |
* We have to do it ourselves, a character at a time... |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
205 |
*/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
206 |
#if 0 |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
207 |
/* The C++ way of doint things... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
208 |
for (string::const_iterator p = str.begin(); p != str.end(); ++p) |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
209 |
*out << (unsigned char)toupper(*p); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
210 |
#else |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
211 |
/* Or more simply... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
212 |
printupper(str.c_str()); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
213 |
#endif |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
214 |
return NULL; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
215 |
} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
139
diff
changeset
|
216 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
139
diff
changeset
|
217 |
|
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
218 |
void *stage4out_c::printlocation(std::string str) { |
267
0a1204bcc9af
starting to add proper header file with declaration of standard functions
Mario de Sousa <msousa@fe.up.pt>
parents:
210
diff
changeset
|
219 |
if (!allow_output) return NULL; |
27
667721cf52c5
Now, stage4out can address files. Generate_cc have been split into one visitor per C file : pous, ressource and config. Work in progress.
etisserant
parents:
26
diff
changeset
|
220 |
return printlocation(str.c_str()); |
26
fd67f54e64e1
Now, LOCATED variables do declare extern C variables the same way EXTERNAL variables do.
etisserant
parents:
0
diff
changeset
|
221 |
} |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
222 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
223 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
224 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
225 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
226 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
227 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
228 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
229 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
230 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
231 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
232 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
233 |
/***********************************************************************/ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
234 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
235 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
236 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
237 |
/* forward declarations... */ |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
238 |
/* These functions will be implemented in generate_XXX.cc */ |
46
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
239 |
visitor_c *new_code_generator(stage4out_c *s4o, const char *builddir); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
240 |
void delete_code_generator(visitor_c *code_generator); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
241 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
242 |
|
46
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
243 |
int stage4(symbol_c *tree_root, const char *builddir) { |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
244 |
stage4out_c s4o; |
46
fc1b78ea6d84
Adding support for generating files into an user-defined folder
lbessard
parents:
41
diff
changeset
|
245 |
visitor_c *generate_code = new_code_generator(&s4o, builddir); |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
246 |
|
546
8cc4c51c4bfc
Fix generation of output for iec2iec.
mjsousa <msousa@fe.up.pt>
parents:
522
diff
changeset
|
247 |
if (NULL == generate_code) ERROR; |
0
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
248 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
249 |
tree_root->accept(*generate_code); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
250 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
251 |
delete_code_generator(generate_code); |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
252 |
|
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
253 |
return 0; |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
254 |
} |
fb772792efd1
Initial commit. Last MatPLC CVS with some makefile inclusion removed in order to compile fine out of MatPLC.
etisserant
parents:
diff
changeset
|
255 |