/src/tools/interpreter/builtins/liberty_interpreter_external_type_any_builtins.e

http://github.com/tybor/Liberty · Specman e · 89 lines · 66 code · 5 blank · 18 comment · 0 complexity · 3d548f371c517fbad927d7f25acb3f8b 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_EXTERNAL_TYPE_ANY_BUILTINS
  16. insert
  17. LIBERTY_INTERPRETER_EXTERNAL_BUILTINS_CALLER
  18. creation {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
  19. make
  20. feature {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
  21. call (builtin_call: LIBERTY_INTERPRETER_FEATURE_CALL): LIBERTY_INTERPRETER_OBJECT is
  22. do
  23. last_call_failed := False
  24. builtin_call.evaluate_parameters
  25. inspect
  26. builtin_call.name
  27. when "generating_type" then
  28. Result := interpreter.new_string(builtin_call.target.type.full_name.out, builtin_call.position)
  29. when "generator" then
  30. Result := interpreter.new_string(builtin_call.target.type.name.out, builtin_call.position)
  31. when "same_dynamic_type" then
  32. Result := interpreter.new_boolean(builtin_call.target.type = builtin_call.parameters.first.type, builtin_call.position)
  33. when "is_equal" then
  34. Result := interpreter.new_boolean(builtin_call.target.builtin_is_equal(builtin_call.parameters.first, builtin_call.position), builtin_call.position)
  35. when "standard_is_equal" then
  36. Result := interpreter.new_boolean(builtin_call.target.builtin_standard_is_equal(builtin_call.parameters.first, builtin_call.position), builtin_call.position)
  37. when "is_deep_equal" then
  38. Result := interpreter.new_boolean(builtin_call.target.builtin_is_deep_equal(builtin_call.parameters.first, builtin_call.position), builtin_call.position)
  39. when "twin" then
  40. Result := builtin_call.target.builtin_twin(builtin_call.position)
  41. when "copy" then
  42. builtin_call.target.builtin_copy(builtin_call.parameters.first, builtin_call.position)
  43. when "standard_twin" then
  44. Result := builtin_call.target.builtin_standard_twin(builtin_call.position)
  45. when "standard_copy" then
  46. builtin_call.target.builtin_standard_copy(builtin_call.parameters.first, builtin_call.position)
  47. when "deep_twin" then
  48. Result := builtin_call.target.builtin_deep_twin(builtin_call.position)
  49. when "trace_switch" then
  50. -- se specific, does nothing
  51. when "sedb_breakpoint" then
  52. -- se specific, should do nothing
  53. interpreter.break
  54. when "die_with_code" then
  55. do_die_with_code(builtin_call.parameters.first)
  56. when "to_pointer" then
  57. Result := interpreter.new_pointer(builtin_call.target.to_pointer, builtin_call.position)
  58. when "is_basic_expanded_type" then
  59. not_yet_implemented
  60. when "object_size" then
  61. Result := interpreter.new_integer(builtin_call.target.object_size, builtin_call.position)
  62. when "c_inline_h" then
  63. -- se specific
  64. not_yet_implemented
  65. when "c_inline_c" then
  66. -- se specific
  67. not_yet_implemented
  68. when "print_run_time_stack" then
  69. interpreter.show_stack(std_output)
  70. when "to_internals" then
  71. not_yet_implemented
  72. else
  73. last_call_failed := True
  74. end
  75. end
  76. feature {}
  77. do_die_with_code (status: LIBERTY_INTERPRETER_OBJECT) is
  78. local
  79. sts: LIBERTY_INTERPRETER_OBJECT_NATIVE[INTEGER_64]
  80. do
  81. sts ::= status
  82. die_with_code(sts.item.to_integer_32)
  83. end
  84. end -- class LIBERTY_INTERPRETER_EXTERNAL_TYPE_ANY_BUILTINS