PageRenderTime 29ms CodeModel.GetById 20ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/interpreter/liberty_interpreter_from_external.e

http://github.com/tybor/Liberty
Specman e | 195 lines | 151 code | 30 blank | 14 comment | 0 complexity | d51c114af6ac46c51d11aee4832320d8 MD5 | raw file
  1-- This file is part of Liberty Eiffel.
  2--
  3-- Liberty Eiffel is free software: you can redistribute it and/or modify
  4-- it under the terms of the GNU General Public License as published by
  5-- the Free Software Foundation, version 3 of the License.
  6--
  7-- Liberty Eiffel is distributed in the hope that it will be useful,
  8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10-- GNU General Public License for more details.
 11--
 12-- You should have received a copy of the GNU General Public License
 13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
 14--
 15class LIBERTY_INTERPRETER_FROM_EXTERNAL
 16
 17inherit
 18   LIBERTY_TYPE_VISITOR
 19
 20create {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
 21   make
 22
 23feature {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
 24   item (a_type: LIBERTY_KNOWN_TYPE; a_external: FOREIGN_OBJECT; a_position: like position): LIBERTY_INTERPRETER_OBJECT is
 25      require
 26         a_type /= Void
 27      do
 28         position := a_position
 29         external_object := a_external
 30         a_type.accept(Current)
 31         Result := liberty_object
 32      end
 33
 34feature {}
 35   position: LIBERTY_POSITION
 36   external_object: FOREIGN_OBJECT
 37   liberty_object: LIBERTY_INTERPRETER_OBJECT
 38
 39feature {LIBERTY_UNIVERSE}
 40   visit_type_any (a_type: LIBERTY_ACTUAL_TYPE) is
 41      do
 42         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
 43      end
 44
 45   visit_type_arguments (a_type: LIBERTY_ACTUAL_TYPE) is
 46      do
 47         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
 48      end
 49
 50   visit_type_platform (a_type: LIBERTY_ACTUAL_TYPE) is
 51      do
 52         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
 53      end
 54
 55   visit_type_pointer (a_type: LIBERTY_ACTUAL_TYPE) is
 56      local
 57         p: FOREIGN_TYPED_OBJECT[POINTER]
 58      do
 59         p ::= external_object
 60         liberty_object := interpreter.new_pointer(p.item, position)
 61      end
 62
 63   visit_type_integer_64 (a_type: LIBERTY_ACTUAL_TYPE) is
 64      local
 65         p: FOREIGN_TYPED_OBJECT[INTEGER_64]
 66      do
 67         p ::= external_object
 68         liberty_object := interpreter.new_integer_64(p.item, position)
 69      end
 70
 71   visit_type_integer_32 (a_type: LIBERTY_ACTUAL_TYPE) is
 72      local
 73         p: FOREIGN_TYPED_OBJECT[INTEGER_32]
 74      do
 75         p ::= external_object
 76         liberty_object := interpreter.new_integer_32(p.item, position)
 77      end
 78
 79   visit_type_integer_16 (a_type: LIBERTY_ACTUAL_TYPE) is
 80      local
 81         p: FOREIGN_TYPED_OBJECT[INTEGER_16]
 82      do
 83         p ::= external_object
 84         liberty_object := interpreter.new_integer_16(p.item, position)
 85      end
 86
 87   visit_type_integer_8 (a_type: LIBERTY_ACTUAL_TYPE) is
 88      local
 89         p: FOREIGN_TYPED_OBJECT[INTEGER_8]
 90      do
 91         p ::= external_object
 92         liberty_object := interpreter.new_integer_8(p.item, position)
 93      end
 94
 95   visit_type_real_64 (a_type: LIBERTY_ACTUAL_TYPE) is
 96      local
 97         p: FOREIGN_TYPED_OBJECT[REAL_64]
 98      do
 99         p ::= external_object
100         liberty_object := interpreter.new_real_64(p.item, position)
101      end
102
103   visit_type_real_32 (a_type: LIBERTY_ACTUAL_TYPE) is
104      local
105         p: FOREIGN_TYPED_OBJECT[REAL_32]
106      do
107         p ::= external_object
108         liberty_object := interpreter.new_real_32(p.item, position)
109      end
110
111   visit_type_real_80 (a_type: LIBERTY_ACTUAL_TYPE) is
112      do
113         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
114      end
115
116   visit_type_real_128 (a_type: LIBERTY_ACTUAL_TYPE) is
117      do
118         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
119      end
120
121   visit_type_character (a_type: LIBERTY_ACTUAL_TYPE) is
122      local
123         p: FOREIGN_TYPED_OBJECT[CHARACTER]
124      do
125         p ::= external_object
126         liberty_object := interpreter.new_character(p.item, position)
127      end
128
129   visit_type_string (a_type: LIBERTY_ACTUAL_TYPE) is
130      do
131         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
132      end
133
134   visit_type_boolean (a_type: LIBERTY_ACTUAL_TYPE) is
135      local
136         p: FOREIGN_TYPED_OBJECT[INTEGER]
137      do
138         p ::= external_object
139         liberty_object := interpreter.new_boolean(p.item /= 0, position)
140      end
141
142   visit_type_native_array (a_type: LIBERTY_ACTUAL_TYPE) is
143      do
144         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
145      end
146
147   visit_type_tuple (a_type: LIBERTY_ACTUAL_TYPE) is
148      do
149         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
150      end
151
152   visit_type_routine (a_type: LIBERTY_ACTUAL_TYPE) is
153      do
154         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
155      end
156
157   visit_type_procedure (a_type: LIBERTY_ACTUAL_TYPE) is
158      do
159         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
160      end
161
162   visit_type_function (a_type: LIBERTY_ACTUAL_TYPE) is
163      do
164         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
165      end
166
167   visit_type_predicate (a_type: LIBERTY_ACTUAL_TYPE) is
168      do
169         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
170      end
171
172   visit_user_type (a_type: LIBERTY_ACTUAL_TYPE) is
173      do
174         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
175      end
176
177feature {LIBERTY_VOID_TYPE}
178   visit_void (a_type: LIBERTY_VOID_TYPE) is
179      do
180         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
181      end
182
183feature {}
184   make (a_interpreter: like interpreter) is
185      require
186         a_interpreter /= Void
187      do
188         interpreter := a_interpreter
189      ensure
190         interpreter = a_interpreter
191      end
192
193   interpreter: LIBERTY_INTERPRETER
194
195end -- LIBERTY_INTERPRETER_FROM_EXTERNAL