/src/wrappers/llvm/library/iterators/iterator_over_global_variables.e

http://github.com/tybor/Liberty · Specman e · 96 lines · 43 code · 16 blank · 37 comment · 0 complexity · c1c4e65dbc4201fa6072c1dcb1659c7a MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class ITERATOR_OVER_GLOBAL_VARIABLES
  5. inherit
  6. BIDIRECTIONAL_ITERATOR[LLVM_GLOBAL_VARIABLE]
  7. WRAPPER_FACTORY[LLVM_GLOBAL_VARIABLE]
  8. insert CORE_EXTERNALS
  9. create {LLVM_MODULE} from_module
  10. feature {LLVM_VALUE}
  11. from_module (a_module: like module)
  12. require a_module/=Void
  13. do
  14. module:=a_module
  15. end
  16. feature {ANY}
  17. module: LLVM_MODULE
  18. start
  19. do
  20. item := wrapper_or_void(llvmget_first_global(module.handle))
  21. end
  22. finish
  23. do
  24. item := wrapper_or_void(llvmget_last_global(module.handle))
  25. end
  26. next
  27. do
  28. item := wrapper_or_void(llvmget_next_global(item.handle))
  29. end
  30. previous
  31. do
  32. item := wrapper_or_void(llvmget_previous_global(item.handle))
  33. end
  34. is_off: BOOLEAN
  35. do
  36. Result:=(item=Void)
  37. end
  38. item: LLVM_GLOBAL_VARIABLE is attribute end
  39. generation, iterable_generation: INTEGER is 0
  40. feature {ANY}
  41. wrapper (p: POINTER): LLVM_GLOBAL_VARIABLE
  42. do
  43. create Result.from_external_pointer(p)
  44. end
  45. invariant module/=Void
  46. end -- class ITERATOR_OVER_GLOBAL_VARIABLES
  47. --
  48. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  49. --
  50. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  51. -- of this software and associated documentation files (the "Software"), to deal
  52. -- in the Software without restriction, including without limitation the rights
  53. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54. -- copies of the Software, and to permit persons to whom the Software is
  55. -- furnished to do so, subject to the following conditions:
  56. --
  57. -- The above copyright notice and this permission notice shall be included in
  58. -- all copies or substantial portions of the Software.
  59. --
  60. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  61. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  62. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  63. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  64. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  65. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  66. -- THE SOFTWARE.
  67. -- This file is part of LLVM wrappers for Liberty Eiffel.
  68. --
  69. -- This library is free software: you can redistribute it and/or modify
  70. -- it under the terms of the GNU Lesser General Public License as published by
  71. -- the Free Software Foundation, version 3 of the License.
  72. --
  73. -- Liberty Eiffel is distributed in the hope that it will be useful,
  74. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  75. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  76. -- GNU General Public License for more details.
  77. --
  78. -- You should have received a copy of the GNU General Public License
  79. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  80. --