/src/tools/interpreter/liberty_interpreter_native_array.e

http://github.com/tybor/Liberty · Specman e · 121 lines · 86 code · 21 blank · 14 comment · 2 complexity · fca835eac975967a303c0df0d6eef34f 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. deferred class LIBERTY_INTERPRETER_NATIVE_ARRAY
  16. inherit
  17. LIBERTY_INTERPRETER_OBJECT
  18. export {LIBERTY_INTERPRETER_NATIVE_ARRAY}
  19. interpreter
  20. undefine
  21. out_in_tagged_out_memory, copy
  22. end
  23. feature {ANY}
  24. type: LIBERTY_ACTUAL_TYPE
  25. item_type: LIBERTY_ACTUAL_TYPE
  26. put (o: LIBERTY_INTERPRETER_OBJECT; index: INTEGER) is
  27. require
  28. valid_index(index)
  29. deferred
  30. end
  31. valid_index (index: INTEGER): BOOLEAN is
  32. do
  33. Result := index.in_range(lower, upper)
  34. end
  35. item (index: INTEGER): LIBERTY_INTERPRETER_OBJECT is
  36. require
  37. valid_index(index)
  38. deferred
  39. end
  40. first: LIBERTY_INTERPRETER_OBJECT is
  41. deferred
  42. end
  43. last: LIBERTY_INTERPRETER_OBJECT is
  44. deferred
  45. end
  46. lower: INTEGER is
  47. deferred
  48. end
  49. upper: INTEGER is
  50. deferred
  51. end
  52. count: INTEGER is
  53. deferred
  54. end
  55. is_empty: BOOLEAN is
  56. deferred
  57. end
  58. converted_to (target_type: LIBERTY_ACTUAL_TYPE): LIBERTY_INTERPRETER_OBJECT is
  59. do
  60. not_yet_implemented
  61. end
  62. feature {LIBERTY_INTERPRETER_TO_EXTERNAL}
  63. to_external: POINTER is
  64. deferred
  65. end
  66. feature {LIBERTY_INTERPRETER_NATIVE_ARRAY_CREATOR}
  67. from_external (a_external: POINTER; a_capacity: INTEGER) is
  68. deferred
  69. end
  70. feature {LIBERTY_INTERPRETER_EXTERNAL_TYPE_NATIVE_ARRAY_BUILTINS}
  71. builtin_element_sizeof: INTEGER is
  72. deferred
  73. end
  74. builtin_calloc (capacity: INTEGER; a_position: LIBERTY_POSITION): like Current is
  75. deferred
  76. end
  77. builtin_item (index: INTEGER; a_position: LIBERTY_POSITION): LIBERTY_INTERPRETER_OBJECT is
  78. do
  79. if not valid_index(index) then
  80. interpreter.fatal_error("Invalid index: " + index.out, a_position)
  81. else
  82. Result := item(index)
  83. end
  84. end
  85. builtin_put (element: LIBERTY_INTERPRETER_OBJECT; index: INTEGER; a_position: LIBERTY_POSITION) is
  86. do
  87. if not valid_index(index) then
  88. interpreter.fatal_error("Invalid index: " + index.out, a_position)
  89. else
  90. put(element, index)
  91. end
  92. end
  93. builtin_slice_copy (at: INTEGER; src: like Current; src_min, src_max: INTEGER) is
  94. deferred
  95. end
  96. feature {LIBERTY_INTERPRETER_OBJECT_PRINTER, LIBERTY_INTERPRETER_FEATURE_CALL}
  97. show_stack (o: OUTPUT_STREAM; indent: INTEGER) is
  98. deferred
  99. end
  100. end -- class LIBERTY_INTERPRETER_NATIVE_ARRAY