/src/tools/interpreter/liberty_interpreter_tuple.e

http://github.com/tybor/Liberty · Specman e · 182 lines · 139 code · 29 blank · 14 comment · 0 complexity · 820c66d0e4e375bd199b87ac5d87ee5f 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_TUPLE
  16. inherit
  17. LIBERTY_INTERPRETER_OBJECT
  18. TRAVERSABLE[LIBERTY_INTERPRETER_OBJECT]
  19. creation {LIBERTY_INTERPRETER_OBJECT_CREATOR}
  20. make
  21. feature {ANY}
  22. lower: INTEGER is
  23. do
  24. Result := tuple.lower
  25. end
  26. upper: INTEGER is
  27. do
  28. Result := tuple.upper
  29. end
  30. count: INTEGER is
  31. do
  32. Result := tuple.count
  33. end
  34. is_empty: BOOLEAN is
  35. do
  36. Result := tuple.is_empty
  37. end
  38. first: LIBERTY_INTERPRETER_OBJECT is
  39. do
  40. Result := tuple.first
  41. end
  42. last: LIBERTY_INTERPRETER_OBJECT is
  43. do
  44. Result := tuple.last
  45. end
  46. item (i: INTEGER): LIBERTY_INTERPRETER_OBJECT is
  47. do
  48. Result := tuple.item(i)
  49. end
  50. new_iterator: ITERATOR[LIBERTY_INTERPRETER_OBJECT] is
  51. do
  52. Result := tuple.new_iterator
  53. end
  54. feature {ANY}
  55. type: LIBERTY_ACTUAL_TYPE
  56. converted_to (target_type: LIBERTY_ACTUAL_TYPE): LIBERTY_INTERPRETER_OBJECT is
  57. do
  58. not_yet_implemented
  59. end
  60. hash_code: INTEGER is
  61. do
  62. Result := to_pointer.hash_code
  63. end
  64. feature {LIBERTY_INTERPRETER_EXTERNAL_TYPE_ANY_BUILTINS} -- Standard builtings
  65. builtin_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
  66. do
  67. not_yet_implemented
  68. end
  69. builtin_standard_is_equal (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION): BOOLEAN is
  70. do
  71. not_yet_implemented
  72. end
  73. builtin_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
  74. do
  75. not_yet_implemented
  76. end
  77. builtin_twin (a_position: LIBERTY_POSITION): like Current is
  78. do
  79. not_yet_implemented
  80. end
  81. builtin_standard_copy (other: LIBERTY_INTERPRETER_OBJECT; a_position: LIBERTY_POSITION) is
  82. do
  83. not_yet_implemented
  84. end
  85. builtin_standard_twin (a_position: LIBERTY_POSITION): like Current is
  86. do
  87. not_yet_implemented
  88. end
  89. feature {LIBERTY_INTERPRETER_OBJECT}
  90. do_deep_twin (deep_twin_memory: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): LIBERTY_INTERPRETER_OBJECT is
  91. do
  92. not_yet_implemented
  93. end
  94. do_deep_equal (object: LIBERTY_INTERPRETER_OBJECT; deep_equal_memory: SET[LIBERTY_INTERPRETER_OBJECT]; a_position: LIBERTY_POSITION): BOOLEAN is
  95. do
  96. not_yet_implemented
  97. end
  98. feature {LIBERTY_INTERPRETER_OBJECT_PRINTER, LIBERTY_INTERPRETER_FEATURE_CALL}
  99. show_stack (o: OUTPUT_STREAM; indent: INTEGER) is
  100. local
  101. i: INTEGER
  102. do
  103. o.put_character('{')
  104. o.put_string(type.full_name)
  105. o.put_line(once " [")
  106. from
  107. i := tuple.lower
  108. until
  109. i > tuple.upper
  110. loop
  111. interpreter.object_printer.put_indent(o, indent + 1)
  112. interpreter.object_printer.print_object(o, tuple.item(i), indent + 1)
  113. i := i + 1
  114. end
  115. interpreter.object_printer.put_indent(o, indent)
  116. o.put_line(once "] }")
  117. end
  118. feature {}
  119. expanded_twin: like Current is
  120. do
  121. check False end
  122. end
  123. feature {LIBERTY_INTERPRETER_EXPRESSIONS}
  124. ensure_capacity (capacity: INTEGER) is
  125. do
  126. tuple.with_capacity(capacity)
  127. ensure
  128. tuple.capacity >= capacity
  129. end
  130. add_last (a_object: LIBERTY_INTERPRETER_OBJECT) is
  131. do
  132. tuple.add_last(a_object)
  133. end
  134. feature {}
  135. make (a_interpreter: like interpreter; a_type: like type; a_position: like position) is
  136. require
  137. a_interpreter /= Void
  138. a_type /= Void
  139. a_position /= Void
  140. do
  141. interpreter := a_interpreter
  142. type := a_type
  143. position := a_position
  144. create tuple.with_capacity(0)
  145. ensure
  146. interpreter = a_interpreter
  147. type = a_type
  148. position = a_position
  149. end
  150. tuple: FAST_ARRAY[LIBERTY_INTERPRETER_OBJECT]
  151. invariant
  152. tuple /= Void
  153. end -- class LIBERTY_INTERPRETER_TUPLE