/src/lib/io/filesystem/path_name/openvms_directory_notation.e

http://github.com/tybor/Liberty · Specman e · 203 lines · 146 code · 20 blank · 37 comment · 10 complexity · 657e58a615a73043963731294b9be799 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class OPENVMS_DIRECTORY_NOTATION
  5. -- The VMS file path notation looks like:
  6. -- DISK:[LibertyEiffel.sys]system.se
  7. -- The current working directory notation is:
  8. -- DISK:[]
  9. -- The equivalent of Unix .. is :
  10. -- [-]
  11. -- The equivalent of Unix ../.. is :
  12. -- [-.-]
  13. --
  14. inherit
  15. DIRECTORY_NOTATION
  16. feature {ANY}
  17. is_current_directory (path: STRING): BOOLEAN
  18. do
  19. not_yet_implemented
  20. end
  21. is_parent_directory (path: STRING): BOOLEAN
  22. do
  23. not_yet_implemented
  24. end
  25. to_parent_directory (some_path: STRING)
  26. local
  27. old_count: INTEGER
  28. do
  29. --|*** "-" is not handled correctly <FM-24/03/2005>
  30. old_count := some_path.count
  31. if some_path.last = ']' then
  32. from
  33. some_path.remove_last
  34. until
  35. some_path.is_empty or else some_path.last = '.' or else some_path.last = '['
  36. loop
  37. some_path.remove_last
  38. end
  39. if some_path.count > 0 then
  40. inspect
  41. some_path.last
  42. when '.' then
  43. some_path.remove_last
  44. some_path.extend(']')
  45. when '[' then
  46. if some_path.count = old_count - 1 then
  47. some_path.remove_last
  48. else
  49. some_path.extend(']')
  50. end
  51. end
  52. end
  53. elseif some_path.last = ':' then
  54. some_path.clear_count
  55. else
  56. from
  57. some_path.remove_last
  58. until
  59. some_path.is_empty or else some_path.last = ']'
  60. loop
  61. some_path.remove_last
  62. end
  63. if some_path.is_empty then
  64. some_path.clear_count
  65. end
  66. end
  67. end
  68. to_subdirectory_with (parent_path, entry_name: STRING)
  69. do
  70. if parent_path.count = 1 then
  71. parent_path.clear_count
  72. elseif parent_path.last = ']' then
  73. parent_path.remove_last
  74. if parent_path.last = '[' then
  75. parent_path.append(entry_name)
  76. parent_path.extend(']')
  77. else
  78. parent_path.extend('.')
  79. parent_path.append(entry_name)
  80. parent_path.extend(']')
  81. end
  82. elseif parent_path.last = ':' then
  83. parent_path.extend('[')
  84. parent_path.append(entry_name)
  85. parent_path.extend(']')
  86. else
  87. parent_path.clear_count
  88. end
  89. end
  90. to_file_path_with (parent_path, file_name: STRING)
  91. do
  92. inspect
  93. parent_path.last
  94. when ']' then
  95. when '.' then
  96. parent_path.remove_last
  97. parent_path.extend(']')
  98. else
  99. parent_path.extend(']')
  100. end
  101. if file_name.first = ']' then
  102. parent_path.remove_last
  103. end
  104. parent_path.append(file_name)
  105. end
  106. to_subpath_with (parent_path, subpath: STRING)
  107. do
  108. not_yet_implemented
  109. end
  110. to_directory_path (path: STRING)
  111. do
  112. not_yet_implemented
  113. end
  114. to_short_name_in (buffer, path: STRING)
  115. do
  116. not_yet_implemented
  117. end
  118. feature {ANY}
  119. can_map_drive (source_notation: DIRECTORY_NOTATION; drive: STRING): BOOLEAN
  120. do
  121. --|*** We (c/sh)ould do better than nothing... <24/03/2005>
  122. end
  123. to_root (source_notation: DIRECTORY_NOTATION; drive: STRING)
  124. do
  125. check
  126. False
  127. end
  128. end
  129. to_default_root (directory: STRING)
  130. do
  131. not_yet_implemented
  132. end
  133. to_current_directory (directory: STRING)
  134. do
  135. not_yet_implemented
  136. end
  137. feature {ANY}
  138. is_case_sensitive: BOOLEAN False
  139. is_valid_path (path: STRING): BOOLEAN
  140. do
  141. --|*** Not nearly strict enough <FM-24/03/2003>
  142. Result := not path.is_empty
  143. end
  144. is_valid_directory_path (path: STRING): BOOLEAN
  145. do
  146. --|*** Not nearly strict enough <FM-24/03/2003>
  147. Result := not path.is_empty
  148. end
  149. is_valid_file_name (name: STRING): BOOLEAN
  150. do
  151. --|*** Not nearly strict enough <FM-24/03/2003>
  152. Result := not name.is_empty
  153. end
  154. is_absolute_path (path: STRING): BOOLEAN
  155. do
  156. not_yet_implemented
  157. end
  158. feature {DIRECTORY_NOTATION}
  159. to_notation (path: STRING; destination_notation: DIRECTORY_NOTATION): STRING
  160. do
  161. not_yet_implemented
  162. end
  163. end -- class OPENVMS_DIRECTORY_NOTATION
  164. --
  165. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  166. --
  167. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  168. -- of this software and associated documentation files (the "Software"), to deal
  169. -- in the Software without restriction, including without limitation the rights
  170. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  171. -- copies of the Software, and to permit persons to whom the Software is
  172. -- furnished to do so, subject to the following conditions:
  173. --
  174. -- The above copyright notice and this permission notice shall be included in
  175. -- all copies or substantial portions of the Software.
  176. --
  177. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  178. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  179. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  180. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  181. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  182. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  183. -- THE SOFTWARE.