1 /******************************************************************************
3 * Copyright (C) 2006-2009 by Tor Andersson. *
5 * This file is part of Gargoyle. *
7 * Gargoyle is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * Gargoyle is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with Gargoyle; if not, write to the Free Software *
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
21 *****************************************************************************/
23 /* glkio.h -- make stdio calls use glk i/o instead */
26 typedef struct glk_stream_struct FILE;
35 #define fclose(f) (glk_stream_close(f, NULL), 0)
37 #define ferror(f) (0) /* No ferror() equivalent */
39 #define fgetc(f) (glk_get_char_stream(f))
41 #define fgets(a, n, f) (glk_get_line_stream(f, a, n))
43 #define fread(a,s,n,f) (glk_get_buffer_stream(f, (char *)a, s*n))
45 #define fwrite(a,s,n,f) (glk_put_buffer_stream(f, (char *)a, s*n), 0)
47 #define fprintf(f,s,a) (glk_put_string_stream(f, a), 0)
49 #define fputc(c, f) (glk_put_char_stream(f, (unsigned char)(c)), 0)
51 #define fputs(s, f) (glk_put_buffer_stream(f, s, strlen(s)), 0)
53 #define ftell(f) (glk_stream_get_position(f))
55 #define fseek(f, p, m) (glk_stream_set_position(f, p, m), 0)
58 #define SEEK_SET seekmode_Start
60 #define SEEK_CUR seekmode_Current
62 #define SEEK_END seekmode_End
64 FILE *frotzopenprompt(int flag);
65 FILE *frotzopen(char *filename, int flag);