1  /* do not edit automatically generated by mc from SFIO.  */
       2  /* SFIO.def provides a String interface to the opening routines of FIO.
       3  
       4  Copyright (C) 2001-2023 Free Software Foundation, Inc.
       5  Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6  
       7  This file is part of GNU Modula-2.
       8  
       9  GNU Modula-2 is free software; you can redistribute it and/or modify
      10  it under the terms of the GNU General Public License as published by
      11  the Free Software Foundation; either version 3, or (at your option)
      12  any later version.
      13  
      14  GNU Modula-2 is distributed in the hope that it will be useful, but
      15  WITHOUT ANY WARRANTY; without even the implied warranty of
      16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17  General Public License for more details.
      18  
      19  Under Section 7 of GPL version 3, you are granted additional
      20  permissions described in the GCC Runtime Library Exception, version
      21  3.1, as published by the Free Software Foundation.
      22  
      23  You should have received a copy of the GNU General Public License and
      24  a copy of the GCC Runtime Library Exception along with this program;
      25  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      26  <http://www.gnu.org/licenses/>.  */
      27  
      28  
      29  #if !defined (_SFIO_H)
      30  #   define _SFIO_H
      31  
      32  #include "config.h"
      33  #include "system.h"
      34  #   ifdef __cplusplus
      35  extern "C" {
      36  #   endif
      37  #include <stdbool.h>
      38  #   if !defined (PROC_D)
      39  #      define PROC_D
      40         typedef void (*PROC_t) (void);
      41         typedef struct { PROC_t proc; } PROC;
      42  #   endif
      43  
      44  #   include "GDynamicStrings.h"
      45  #   include "GFIO.h"
      46  
      47  #   if defined (_SFIO_C)
      48  #      define EXTERN
      49  #   else
      50  #      define EXTERN extern
      51  #   endif
      52  
      53  
      54  /*
      55     Exists - returns TRUE if a file named, fname exists for reading.
      56  */
      57  
      58  EXTERN bool SFIO_Exists (DynamicStrings_String fname);
      59  
      60  /*
      61     OpenToRead - attempts to open a file, fname, for reading and
      62                  it returns this file.
      63                  The success of this operation can be checked by
      64                  calling IsNoError.
      65  */
      66  
      67  EXTERN FIO_File SFIO_OpenToRead (DynamicStrings_String fname);
      68  
      69  /*
      70     OpenToWrite - attempts to open a file, fname, for write and
      71                   it returns this file.
      72                   The success of this operation can be checked by
      73                   calling IsNoError.
      74  */
      75  
      76  EXTERN FIO_File SFIO_OpenToWrite (DynamicStrings_String fname);
      77  
      78  /*
      79     OpenForRandom - attempts to open a file, fname, for random access
      80                     read or write and it returns this file.
      81                     The success of this operation can be checked by
      82                     calling IsNoError.
      83                     towrite, determines whether the file should be
      84                     opened for writing or reading.
      85                     if towrite is TRUE or whether the previous file should
      86                     be left alone, allowing this descriptor to seek
      87                     and modify an existing file.
      88  */
      89  
      90  EXTERN FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile);
      91  
      92  /*
      93     WriteS - writes a string, s, to, file. It returns the String, s.
      94  */
      95  
      96  EXTERN DynamicStrings_String SFIO_WriteS (FIO_File file, DynamicStrings_String s);
      97  
      98  /*
      99     ReadS - reads a string, s, from, file. It returns the String, s.
     100             It stops reading the string at the end of line or end of file.
     101             It consumes the newline at the end of line but does not place
     102             this into the returned string.
     103  */
     104  
     105  EXTERN DynamicStrings_String SFIO_ReadS (FIO_File file);
     106  #   ifdef __cplusplus
     107  }
     108  #   endif
     109  
     110  #   undef EXTERN
     111  #endif