/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. --
  15. class LIBERTY_INTERPRETER_FROM_EXTERNAL
  16. inherit
  17. LIBERTY_TYPE_VISITOR
  18. create {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  19. make
  20. feature {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  21. item (a_type: LIBERTY_KNOWN_TYPE; a_external: FOREIGN_OBJECT; a_position: like position): LIBERTY_INTERPRETER_OBJECT is
  22. require
  23. a_type /= Void
  24. do
  25. position := a_position
  26. external_object := a_external
  27. a_type.accept(Current)
  28. Result := liberty_object
  29. end
  30. feature {}
  31. position: LIBERTY_POSITION
  32. external_object: FOREIGN_OBJECT
  33. liberty_object: LIBERTY_INTERPRETER_OBJECT
  34. feature {LIBERTY_UNIVERSE}
  35. visit_type_any (a_type: LIBERTY_ACTUAL_TYPE) is
  36. do
  37. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  38. end
  39. visit_type_arguments (a_type: LIBERTY_ACTUAL_TYPE) is
  40. do
  41. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  42. end
  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 from a plugin", position)
  46. end
  47. visit_type_pointer (a_type: LIBERTY_ACTUAL_TYPE) is
  48. local
  49. p: FOREIGN_TYPED_OBJECT[POINTER]
  50. do
  51. p ::= external_object
  52. liberty_object := interpreter.new_pointer(p.item, position)
  53. end
  54. visit_type_integer_64 (a_type: LIBERTY_ACTUAL_TYPE) is
  55. local
  56. p: FOREIGN_TYPED_OBJECT[INTEGER_64]
  57. do
  58. p ::= external_object
  59. liberty_object := interpreter.new_integer_64(p.item, position)
  60. end
  61. visit_type_integer_32 (a_type: LIBERTY_ACTUAL_TYPE) is
  62. local
  63. p: FOREIGN_TYPED_OBJECT[INTEGER_32]
  64. do
  65. p ::= external_object
  66. liberty_object := interpreter.new_integer_32(p.item, position)
  67. end
  68. visit_type_integer_16 (a_type: LIBERTY_ACTUAL_TYPE) is
  69. local
  70. p: FOREIGN_TYPED_OBJECT[INTEGER_16]
  71. do
  72. p ::= external_object
  73. liberty_object := interpreter.new_integer_16(p.item, position)
  74. end
  75. visit_type_integer_8 (a_type: LIBERTY_ACTUAL_TYPE) is
  76. local
  77. p: FOREIGN_TYPED_OBJECT[INTEGER_8]
  78. do
  79. p ::= external_object
  80. liberty_object := interpreter.new_integer_8(p.item, position)
  81. end
  82. visit_type_real_64 (a_type: LIBERTY_ACTUAL_TYPE) is
  83. local
  84. p: FOREIGN_TYPED_OBJECT[REAL_64]
  85. do
  86. p ::= external_object
  87. liberty_object := interpreter.new_real_64(p.item, position)
  88. end
  89. visit_type_real_32 (a_type: LIBERTY_ACTUAL_TYPE) is
  90. local
  91. p: FOREIGN_TYPED_OBJECT[REAL_32]
  92. do
  93. p ::= external_object
  94. liberty_object := interpreter.new_real_32(p.item, position)
  95. end
  96. visit_type_real_80 (a_type: LIBERTY_ACTUAL_TYPE) is
  97. do
  98. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  99. end
  100. visit_type_real_128 (a_type: LIBERTY_ACTUAL_TYPE) is
  101. do
  102. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  103. end
  104. visit_type_character (a_type: LIBERTY_ACTUAL_TYPE) is
  105. local
  106. p: FOREIGN_TYPED_OBJECT[CHARACTER]
  107. do
  108. p ::= external_object
  109. liberty_object := interpreter.new_character(p.item, position)
  110. end
  111. visit_type_string (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. visit_type_boolean (a_type: LIBERTY_ACTUAL_TYPE) is
  116. local
  117. p: FOREIGN_TYPED_OBJECT[INTEGER]
  118. do
  119. p ::= external_object
  120. liberty_object := interpreter.new_boolean(p.item /= 0, position)
  121. end
  122. visit_type_native_array (a_type: LIBERTY_ACTUAL_TYPE) is
  123. do
  124. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  125. end
  126. visit_type_tuple (a_type: LIBERTY_ACTUAL_TYPE) is
  127. do
  128. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  129. end
  130. visit_type_routine (a_type: LIBERTY_ACTUAL_TYPE) is
  131. do
  132. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  133. end
  134. visit_type_procedure (a_type: LIBERTY_ACTUAL_TYPE) is
  135. do
  136. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  137. end
  138. visit_type_function (a_type: LIBERTY_ACTUAL_TYPE) is
  139. do
  140. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  141. end
  142. visit_type_predicate (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. visit_user_type (a_type: LIBERTY_ACTUAL_TYPE) is
  147. do
  148. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  149. end
  150. feature {LIBERTY_VOID_TYPE}
  151. visit_void (a_type: LIBERTY_VOID_TYPE) is
  152. do
  153. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted from a plugin", position)
  154. end
  155. feature {}
  156. make (a_interpreter: like interpreter) is
  157. require
  158. a_interpreter /= Void
  159. do
  160. interpreter := a_interpreter
  161. ensure
  162. interpreter = a_interpreter
  163. end
  164. interpreter: LIBERTY_INTERPRETER
  165. end -- LIBERTY_INTERPRETER_FROM_EXTERNAL