1 /* |
1 /* |
2 * matiec - a compiler for the programming languages defined in IEC 61131-3 |
2 * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD |
3 * |
3 * |
4 * Copyright (C) 2008 Edouard TISSERANT |
4 * See COPYING and COPYING.LESSER files for copyright details. |
5 * |
5 * |
6 * This program is free software: you can redistribute it and/or modify |
6 * This program is free software: you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License as published by |
7 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation, either version 3 of the License, or |
8 * the Free Software Foundation, either version 3 of the License, or |
9 * (at your option) any later version. |
9 * (at your option) any later version. |
10 * |
10 * |
11 * This program is distributed in the hope that it will be useful, |
11 * This program is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 * GNU General Public License for more details. |
14 * GNU General Public License for more details. |
15 * |
15 * |
16 * You should have received a copy of the GNU General Public License |
16 * You should have received a copy of the GNU General Public License |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 * |
|
19 * |
|
20 * This code is made available on the understanding that it will not be |
|
21 * used in safety-critical situations without a full and competent review. |
|
22 */ |
|
23 |
|
24 |
|
25 /* |
|
26 * An IEC 61131-3 IL and ST compiler. |
|
27 * |
|
28 * Based on the |
|
29 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
30 * |
18 * |
31 */ |
19 */ |
32 |
20 |
33 /**** |
21 /**** |
34 * IEC 61131-3 standard function library |
22 * IEC 61131-3 standard function library |
1197 return function_atan; |
1185 return function_atan; |
1198 |
1186 |
1199 if (!strcasecmp(function_name->value, "ADD")) |
1187 if (!strcasecmp(function_name->value, "ADD")) |
1200 return function_add; |
1188 return function_add; |
1201 |
1189 |
|
1190 if (!strcasecmp(function_name->value, "ADD_TIME")) |
|
1191 return function_add_time; |
|
1192 |
|
1193 if (!strcasecmp(function_name->value, "ADD_TOD_TIME")) |
|
1194 return function_add_tod_time; |
|
1195 |
|
1196 if (!strcasecmp(function_name->value, "ADD_DT_TIME")) |
|
1197 return function_add_dt_time; |
|
1198 |
1202 if (!strcasecmp(function_name->value, "MUL")) |
1199 if (!strcasecmp(function_name->value, "MUL")) |
1203 return function_mul; |
1200 return function_mul; |
1204 |
1201 |
|
1202 if (!strcasecmp(function_name->value, "MULTIME")) |
|
1203 return function_multime; |
|
1204 |
1205 if (!strcasecmp(function_name->value, "SUB")) |
1205 if (!strcasecmp(function_name->value, "SUB")) |
1206 return function_sub; |
1206 return function_sub; |
1207 |
1207 |
|
1208 if (!strcasecmp(function_name->value, "SUB_TIME")) |
|
1209 return function_sub_time; |
|
1210 |
|
1211 if (!strcasecmp(function_name->value, "SUB_DATE_DATE")) |
|
1212 return function_sub_date_date; |
|
1213 |
|
1214 if (!strcasecmp(function_name->value, "SUB_TOD_TIME")) |
|
1215 return function_sub_tod_time; |
|
1216 |
|
1217 if (!strcasecmp(function_name->value, "SUB_TOD_TOD")) |
|
1218 return function_sub_tod_tod; |
|
1219 |
|
1220 if (!strcasecmp(function_name->value, "SUB_DT_TIME")) |
|
1221 return function_sub_dt_time; |
|
1222 |
1208 if (!strcasecmp(function_name->value, "DIV")) |
1223 if (!strcasecmp(function_name->value, "DIV")) |
1209 return function_div; |
1224 return function_div; |
1210 |
1225 |
|
1226 if (!strcasecmp(function_name->value, "DIVTIME")) |
|
1227 return function_divtime; |
|
1228 |
1211 if (!strcasecmp(function_name->value, "MOD")) |
1229 if (!strcasecmp(function_name->value, "MOD")) |
1212 return function_mod; |
1230 return function_mod; |
1213 |
1231 |
1214 if (!strcasecmp(function_name->value, "EXPT")) |
1232 if (!strcasecmp(function_name->value, "EXPT")) |
1215 return function_expt; |
1233 return function_expt; |
1287 return function_mid; |
1305 return function_mid; |
1288 |
1306 |
1289 if (!strcasecmp(function_name->value, "CONCAT")) |
1307 if (!strcasecmp(function_name->value, "CONCAT")) |
1290 return function_concat; |
1308 return function_concat; |
1291 |
1309 |
|
1310 if (!strcasecmp(function_name->value, "CONCAT_DAT_TOD")) |
|
1311 return function_concat_dat_tod; |
|
1312 |
1292 if (!strcasecmp(function_name->value, "INSERT")) |
1313 if (!strcasecmp(function_name->value, "INSERT")) |
1293 return function_insert; |
1314 return function_insert; |
1294 |
1315 |
1295 if (!strcasecmp(function_name->value, "DELETE")) |
1316 if (!strcasecmp(function_name->value, "DELETE")) |
1296 return function_delete; |
1317 return function_delete; |