PageRenderTime 45ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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