/src/tools/interpreter/builtins/liberty_interpreter_external_type_arguments_builtins.e

http://github.com/tybor/Liberty · Specman e · 65 lines · 45 code · 6 blank · 14 comment · 1 complexity · c38dbcf656c299e5299cbd58d4e575be 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_ARGUMENTS_BUILTINS
  16. insert
  17. LIBERTY_INTERPRETER_EXTERNAL_BUILTINS_CALLER
  18. COMMAND_LINE_ARGUMENT_FACTORY
  19. creation {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
  20. make
  21. feature {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
  22. call (builtin_call: LIBERTY_INTERPRETER_FEATURE_CALL): LIBERTY_INTERPRETER_OBJECT is
  23. local
  24. index: INTEGER; argv: STRING
  25. do
  26. last_call_failed := False
  27. builtin_call.evaluate_parameters
  28. inspect
  29. builtin_call.name
  30. when "se_argc" then
  31. Result := interpreter.new_integer(remaining_parameters.item.count + 1, builtin_call.position)
  32. when "se_argv" then
  33. index := integer(builtin_call)
  34. if index = 0 then
  35. argv := root_class_and_feature
  36. else
  37. argv := remaining_parameters.item.item(index-1).out
  38. end
  39. Result := interpreter.new_string(argv, builtin_call.position)
  40. else
  41. last_call_failed := True
  42. end
  43. end
  44. feature {}
  45. integer (builtin_call: LIBERTY_INTERPRETER_FEATURE_CALL): INTEGER is
  46. local
  47. obj: LIBERTY_INTERPRETER_OBJECT_NATIVE[INTEGER_64]
  48. do
  49. builtin_call.evaluate_parameters
  50. obj ::= builtin_call.parameters.first
  51. Result := obj.item.to_integer_32
  52. end
  53. root_class_and_feature: STRING is
  54. once
  55. Result := interpreter.root_type.full_name.out
  56. Result.extend('.')
  57. Result.append(interpreter.root_feature_name.full_name)
  58. end
  59. end -- class LIBERTY_INTERPRETER_EXTERNAL_TYPE_ARGUMENTS_BUILTINS