Debian Codegraph @

gcc/m2/gm2-libs/SFIO.def

raw
1 (* SFIO.def provides a String interface to the opening routines of FIO.
2
3 Copyright (C) 2001-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE SFIO ;
28
29 FROM DynamicStrings IMPORT String ;
30 FROM FIO IMPORT File ;
31
32
33 (*
34 Exists - returns TRUE if a file named, fname exists for reading.
35 *)
36
37 PROCEDURE Exists (fname: String) : BOOLEAN ;
38
39
40 (*
41 OpenToRead - attempts to open a file, fname, for reading and
42 it returns this file.
43 The success of this operation can be checked by
44 calling IsNoError.
45 *)
46
47 PROCEDURE OpenToRead (fname: String) : File ;
48
49
50 (*
51 OpenToWrite - attempts to open a file, fname, for write and
52 it returns this file.
53 The success of this operation can be checked by
54 calling IsNoError.
55 *)
56
57 PROCEDURE OpenToWrite (fname: String) : File ;
58
59
60 (*
61 OpenForRandom - attempts to open a file, fname, for random access
62 read or write and it returns this file.
63 The success of this operation can be checked by
64 calling IsNoError.
65 towrite, determines whether the file should be
66 opened for writing or reading.
67 if towrite is TRUE or whether the previous file should
68 be left alone, allowing this descriptor to seek
69 and modify an existing file.
70 *)
71
72 PROCEDURE OpenForRandom (fname: String; towrite, newfile: BOOLEAN) : File ;
73
74
75 (*
76 WriteS - writes a string, s, to, file. It returns the String, s.
77 *)
78
79 PROCEDURE WriteS (file: File; s: String) : String ;
80
81
82 (*
83 ReadS - reads a string, s, from, file. It returns the String, s.
84 It stops reading the string at the end of line or end of file.
85 It consumes the newline at the end of line but does not place
86 this into the returned string.
87 *)
88
89 PROCEDURE ReadS (file: File) : String ;
90
91
92 (*
93 GetFileName - return a new string containing the name of the file.
94 The string should be killed by the caller.
95 *)
96
97 PROCEDURE GetFileName (file: File) : String ;
98
99
100 END SFIO.