PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/src/tools/interpreter/liberty_interpreter_foreign_types.e

http://github.com/tybor/Liberty
Specman e | 165 lines | 121 code | 30 blank | 14 comment | 0 complexity | a2572d209e7100506c73f5685342b807 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_FOREIGN_TYPES
 16
 17inherit
 18   LIBERTY_TYPE_VISITOR
 19
 20create {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
 21   make
 22
 23feature {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
 24   type (a_type: LIBERTY_KNOWN_TYPE): FOREIGN_TYPE is
 25      require
 26         a_type /= Void
 27      do
 28         a_type.accept(Current)
 29         Result := foreign_type
 30      end
 31
 32feature {LIBERTY_UNIVERSE}
 33   visit_type_any (a_type: LIBERTY_ACTUAL_TYPE) is
 34      do
 35         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
 36      end
 37
 38   visit_type_arguments (a_type: LIBERTY_ACTUAL_TYPE) is
 39      do
 40         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
 41      end
 42
 43   visit_type_platform (a_type: LIBERTY_ACTUAL_TYPE) is
 44      do
 45         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
 46      end
 47
 48   visit_type_pointer (a_type: LIBERTY_ACTUAL_TYPE) is
 49      do
 50         foreign_type := types.pointer
 51      end
 52
 53   visit_type_integer_64 (a_type: LIBERTY_ACTUAL_TYPE) is
 54      do
 55         foreign_type := types.sint64
 56      end
 57
 58   visit_type_integer_32 (a_type: LIBERTY_ACTUAL_TYPE) is
 59      do
 60         foreign_type := types.sint32
 61      end
 62
 63   visit_type_integer_16 (a_type: LIBERTY_ACTUAL_TYPE) is
 64      do
 65         foreign_type := types.sint16
 66      end
 67
 68   visit_type_integer_8 (a_type: LIBERTY_ACTUAL_TYPE) is
 69      do
 70         foreign_type := types.sint8
 71      end
 72
 73   visit_type_real_64 (a_type: LIBERTY_ACTUAL_TYPE) is
 74      do
 75         foreign_type := types.double
 76      end
 77
 78   visit_type_real_32 (a_type: LIBERTY_ACTUAL_TYPE) is
 79      do
 80         foreign_type := types.float
 81      end
 82
 83   visit_type_real_80 (a_type: LIBERTY_ACTUAL_TYPE) is
 84      do
 85         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
 86      end
 87
 88   visit_type_real_128 (a_type: LIBERTY_ACTUAL_TYPE) is
 89      do
 90         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
 91      end
 92
 93   visit_type_character (a_type: LIBERTY_ACTUAL_TYPE) is
 94      do
 95         foreign_type := types.schar
 96      end
 97
 98   visit_type_string (a_type: LIBERTY_ACTUAL_TYPE) is
 99      do
100         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
101      end
102
103   visit_type_boolean (a_type: LIBERTY_ACTUAL_TYPE) is
104      do
105         foreign_type := types.sint32
106      end
107
108   visit_type_native_array (a_type: LIBERTY_ACTUAL_TYPE) is
109      do
110         foreign_type := types.pointer
111      end
112
113   visit_type_tuple (a_type: LIBERTY_ACTUAL_TYPE) is
114      do
115         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
116      end
117
118   visit_type_routine (a_type: LIBERTY_ACTUAL_TYPE) is
119      do
120         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
121      end
122
123   visit_type_procedure (a_type: LIBERTY_ACTUAL_TYPE) is
124      do
125         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
126      end
127
128   visit_type_function (a_type: LIBERTY_ACTUAL_TYPE) is
129      do
130         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
131      end
132
133   visit_type_predicate (a_type: LIBERTY_ACTUAL_TYPE) is
134      do
135         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
136      end
137
138   visit_user_type (a_type: LIBERTY_ACTUAL_TYPE) is
139      do
140         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
141      end
142
143feature {LIBERTY_VOID_TYPE}
144   visit_void (a_type: LIBERTY_VOID_TYPE) is
145      do
146         interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
147      end
148
149feature {}
150   make (a_interpreter: like interpreter) is
151      require
152         a_interpreter /= Void
153      do
154         interpreter := a_interpreter
155      ensure
156         interpreter = a_interpreter
157      end
158
159   foreign_type: FOREIGN_TYPE
160   types: FOREIGN_TYPES
161
162   interpreter: LIBERTY_INTERPRETER
163   errors: LIBERTY_ERRORS
164
165end -- LIBERTY_INTERPRETER_FOREIGN_TYPES