/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. --
  15. class LIBERTY_INTERPRETER_FOREIGN_TYPES
  16. inherit
  17. LIBERTY_TYPE_VISITOR
  18. create {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  19. make
  20. feature {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  21. type (a_type: LIBERTY_KNOWN_TYPE): FOREIGN_TYPE is
  22. require
  23. a_type /= Void
  24. do
  25. a_type.accept(Current)
  26. Result := foreign_type
  27. end
  28. feature {LIBERTY_UNIVERSE}
  29. visit_type_any (a_type: LIBERTY_ACTUAL_TYPE) is
  30. do
  31. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  32. end
  33. visit_type_arguments (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. visit_type_platform (a_type: LIBERTY_ACTUAL_TYPE) is
  38. do
  39. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  40. end
  41. visit_type_pointer (a_type: LIBERTY_ACTUAL_TYPE) is
  42. do
  43. foreign_type := types.pointer
  44. end
  45. visit_type_integer_64 (a_type: LIBERTY_ACTUAL_TYPE) is
  46. do
  47. foreign_type := types.sint64
  48. end
  49. visit_type_integer_32 (a_type: LIBERTY_ACTUAL_TYPE) is
  50. do
  51. foreign_type := types.sint32
  52. end
  53. visit_type_integer_16 (a_type: LIBERTY_ACTUAL_TYPE) is
  54. do
  55. foreign_type := types.sint16
  56. end
  57. visit_type_integer_8 (a_type: LIBERTY_ACTUAL_TYPE) is
  58. do
  59. foreign_type := types.sint8
  60. end
  61. visit_type_real_64 (a_type: LIBERTY_ACTUAL_TYPE) is
  62. do
  63. foreign_type := types.double
  64. end
  65. visit_type_real_32 (a_type: LIBERTY_ACTUAL_TYPE) is
  66. do
  67. foreign_type := types.float
  68. end
  69. visit_type_real_80 (a_type: LIBERTY_ACTUAL_TYPE) is
  70. do
  71. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  72. end
  73. visit_type_real_128 (a_type: LIBERTY_ACTUAL_TYPE) is
  74. do
  75. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  76. end
  77. visit_type_character (a_type: LIBERTY_ACTUAL_TYPE) is
  78. do
  79. foreign_type := types.schar
  80. end
  81. visit_type_string (a_type: LIBERTY_ACTUAL_TYPE) is
  82. do
  83. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  84. end
  85. visit_type_boolean (a_type: LIBERTY_ACTUAL_TYPE) is
  86. do
  87. foreign_type := types.sint32
  88. end
  89. visit_type_native_array (a_type: LIBERTY_ACTUAL_TYPE) is
  90. do
  91. foreign_type := types.pointer
  92. end
  93. visit_type_tuple (a_type: LIBERTY_ACTUAL_TYPE) is
  94. do
  95. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  96. end
  97. visit_type_routine (a_type: LIBERTY_ACTUAL_TYPE) is
  98. do
  99. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  100. end
  101. visit_type_procedure (a_type: LIBERTY_ACTUAL_TYPE) is
  102. do
  103. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  104. end
  105. visit_type_function (a_type: LIBERTY_ACTUAL_TYPE) is
  106. do
  107. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  108. end
  109. visit_type_predicate (a_type: LIBERTY_ACTUAL_TYPE) is
  110. do
  111. interpreter.fatal_error("The type " + a_type.full_name + " cannot be transmitted to a plugin", errors.unknown_position)
  112. end
  113. visit_user_type (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. feature {LIBERTY_VOID_TYPE}
  118. visit_void (a_type: LIBERTY_VOID_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. feature {}
  123. make (a_interpreter: like interpreter) is
  124. require
  125. a_interpreter /= Void
  126. do
  127. interpreter := a_interpreter
  128. ensure
  129. interpreter = a_interpreter
  130. end
  131. foreign_type: FOREIGN_TYPE
  132. types: FOREIGN_TYPES
  133. interpreter: LIBERTY_INTERPRETER
  134. errors: LIBERTY_ERRORS
  135. end -- LIBERTY_INTERPRETER_FOREIGN_TYPES