1 /********************************************************************/ 2 /* */ 3 /* fil_rtl.h Primitive actions for the C library file type. */ 4 /* Copyright (C) 1989 - 2009 Thomas Mertes */ 5 /* */ 6 /* This file is part of the Seed7 Runtime Library. */ 7 /* */ 8 /* The Seed7 Runtime Library is free software; you can */ 9 /* redistribute it and/or modify it under the terms of the GNU */ 10 /* Lesser General Public License as published by the Free Software */ 11 /* Foundation; either version 2.1 of the License, or (at your */ 12 /* option) any later version. */ 13 /* */ 14 /* The Seed7 Runtime Library is distributed in the hope that it */ 15 /* will be useful, but WITHOUT ANY WARRANTY; without even the */ 16 /* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */ 17 /* PURPOSE. See the GNU Lesser General Public License for more */ 18 /* details. */ 19 /* */ 20 /* You should have received a copy of the GNU Lesser General */ 21 /* Public License along with this program; if not, write to the */ 22 /* Free Software Foundation, Inc., 51 Franklin Street, */ 23 /* Fifth Floor, Boston, MA 02110-1301, USA. */ 24 /* */ 25 /* Module: Seed7 Runtime Library */ 26 /* File: seed7/src/fil_rtl.h */ 27 /* Changes: 1992, 1993, 1994, 2009 Thomas Mertes */ 28 /* Content: Primitive actions for the C library file type. */ 29 /* */ 30 /********************************************************************/ 31 32 #ifdef DO_INIT 33 fileRecord nullFileRecord = {NULL, 0}; 34 fileRecord stdinFileRecord = {NULL, 0}; 35 fileRecord stdoutFileRecord = {NULL, 0}; 36 fileRecord stderrFileRecord = {NULL, 0}; 37 #else 38 EXTERN fileRecord nullFileRecord; 39 EXTERN fileRecord stdinFileRecord; 40 EXTERN fileRecord stdoutFileRecord; 41 EXTERN fileRecord stderrFileRecord; 42 #endif 43 44 #define initFileType(aFile, usage) (aFile)->usage_count = (usage); 45 46 47 int offsetSeek (cFileType aFile, const os_off_t anOffset, const int origin); 48 memSizeType remainingBytesInFile (cFileType aFile); 49 intType getFileLengthUsingSeek (cFileType aFile); 50 bigIntType getBigFileLengthUsingSeek (cFileType aFile); 51 bigIntType filBigLng (fileType aFile); 52 void filBigSeek (fileType aFile, const const_bigIntType big_position); 53 bigIntType filBigTell (fileType aFile); 54 void filClose (fileType aFile); 55 void filCpy (fileType *const dest, const fileType source); 56 fileType filCreate (const fileType source); 57 void filDestr (const fileType old_file); 58 boolType filEof (fileType inFile); 59 void filFlush (fileType outFile); 60 void filFree (fileType oldFile); 61 charType filGetcChkCtrlC (fileType inFile); 62 striType filGets (fileType inFile, intType length); 63 striType filGetsChkCtrlC (fileType inFile, intType length); 64 boolType filHasNext (fileType inFile); 65 boolType filHasNextChkCtrlC (fileType inFile); 66 striType filLineRead (fileType inFile, charType *terminationChar); 67 striType filLineReadChkCtrlC (fileType inFile, charType *terminationChar); 68 striType filLit (fileType aFile); 69 intType filLng (fileType aFile); 70 fileType filOpen (const const_striType path, const const_striType mode); 71 fileType filOpenNullDevice (void); 72 void filPclose (fileType aFile); 73 fileType filPopen (const const_striType command, 74 const const_striType parameters, const const_striType mode); 75 void filPrint (const const_striType stri); 76 void filSeek (fileType aFile, intType file_position); 77 boolType filSeekable (fileType aFile); 78 void filSetbuf (fileType aFile, intType mode, intType size); 79 intType filTell (fileType aFile); 80 void filTruncate (fileType aFile, intType length); 81 striType filWordRead (fileType inFile, charType *terminationChar); 82 striType filWordReadChkCtrlC (fileType inFile, charType *terminationChar); 83 void filWrite (fileType outFile, const const_striType stri); 84