| |
| /pliant/language/stream/filesystembase.pli |
| |
| 1 |
# Copyright Hubert Tonneau hubert.tonneau@pliant.cx | |
| 2 |
# | |
| 3 |
# This program is free software; you can redistribute it and/or | |
| 4 |
# modify it under the terms of the GNU General Public License version 2 | |
| 5 |
# as published by the Free Software Foundation. | |
| 6 |
# | |
| 7 |
# This program 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 |
# version 2 along with this program; if not, write to the Free Software | |
| 14 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 15 |
| |
| 16 |
module "ring.pli" | |
| 17 |
| |
| 18 |
| |
| 19 |
type FileSystem | |
| 20 |
void | |
| 21 |
| |
| 22 |
| |
| 23 |
method fs list path options flags files -> supported_flags | |
| 24 |
oarg_rw FileSystem fs ; arg Str path options ; arg Int flags supported_flags ; arg_rw List files | |
| 25 |
generic | |
| 26 |
| |
| 27 |
method fs query filename options flags info -> status | |
| 28 |
oarg_rw FileSystem fs ; arg Str filename options ; arg Int flags ; arg_rw FileInfo info ; arg ExtendedStatus status | |
| 29 |
generic | |
| 30 |
info size := undefined | |
| 31 |
info datetime := undefined | |
| 32 |
info status := failure | |
| 33 |
var Int i := filename search_last "/" -1 | |
| 34 |
if i<>(-1) | |
| 35 |
fs list (filename 0 i+1) options flags (var List files) | |
| 36 |
var Pointer:Arrow c :> files first | |
| 37 |
while c<>null | |
| 38 |
check (addressof entry_type:c)=addressof:FileInfo | |
| 39 |
var Pointer:FileInfo f :> c map FileInfo | |
| 40 |
if f:name=filename | |
| 41 |
info := f | |
| 42 |
return success | |
| 43 |
c :> files next c | |
| 44 |
status := failure | |
| 45 |
| |
| 46 |
method fs configure filename options command -> status | |
| 47 |
oarg_rw FileSystem fs ; arg Str filename options command ; arg ExtendedStatus status | |
| 48 |
generic | |
| 49 |
status := failure | |
| 50 |
| |
| 51 |
| |
| 52 |
public | |
| 53 |
gvar Link:FileSystem pliant_default_file_system | |
| 54 |
| |
| 55 |
| |
| 56 |
export FileSystem '. query' '. list' '. configure' | |
| 57 |
| |
| 58 |
| |
| |