author | laurent |
Sat, 05 Dec 2009 18:53:01 +0100 | |
changeset 227 | 560c1231ad1f |
parent 202 | da1a8186f86f |
child 265 | 4d222f46f8cc |
permissions | -rw-r--r-- |
201
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
1 |
/* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
2 |
* (c) 2003 Mario de Sousa |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
3 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
4 |
* Offered to the public under the terms of the GNU General Public License |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
5 |
* as published by the Free Software Foundation; either version 2 of the |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
6 |
* License, or (at your option) any later version. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
7 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
8 |
* This program is distributed in the hope that it will be useful, but |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
9 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
11 |
* Public License for more details. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
12 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
13 |
* This code is made available on the understanding that it will not be |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
14 |
* used in safety-critical situations without a full and competent review. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
15 |
*/ |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
16 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
17 |
/* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
18 |
* An IEC 61131-3 IL and ST compiler. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
19 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
20 |
* Based on the |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
21 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
22 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
23 |
*/ |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
24 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
25 |
/* Returns the data type of an il_operand. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
26 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
27 |
* Note that the il_operand may be a variable, in which case |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
28 |
* we return the type of the variable instance. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
29 |
* The il_operand may also be a constant, in which case |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
30 |
* we return the data type of that constant. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
31 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
32 |
* The variable instance may be a member of a structured variable, |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
33 |
* or an element in an array, or any combination of the two. |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
34 |
* |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
35 |
* The class constructor must be given the search scope |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
36 |
* (function, function block or program within which |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
37 |
* the possible il_operand variable instance was declared). |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
38 |
*/ |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
39 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
40 |
class search_il_operand_type_c { |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
41 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
42 |
private: |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
201
diff
changeset
|
43 |
search_varfb_instance_type_c::search_varfb_instance_type_c search_varfb_instance_type; |
201
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
44 |
search_constant_type_c search_constant_type; |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
45 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
46 |
public: |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
47 |
search_il_operand_type_c(symbol_c *search_scope): search_varfb_instance_type(search_scope) {} |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
48 |
|
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
49 |
public: |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
50 |
symbol_c *get_type(symbol_c *il_operand); |
e657008f43d0
Introducing the search_il_operand_type files in the absyntax_utils folder.
Catarina Boucinha <ccb@fe.up.pt>
parents:
diff
changeset
|
51 |
}; |