PageRenderTime 25ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

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