Debian Codegraph @

texk/dvipdfm-x/mfileio.h

raw
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2
3 Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
4 the dvipdfmx project team.
5
6 Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]>
7
8 This program 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 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22
23 #ifndef _MFILEIO_H_
24 #define _MFILEIO_H_
25
26 #include <stdio.h>
27 #include "numbers.h"
28
29 #ifdef IODEBUG
30 FILE *mfopen (const char *name, const char *mode,
31 const char *function, int line);
32 int mfclose (FILE *file, const char *function, int line);
33 #define MFOPEN(name,mode) \
34 mfopen((name),(mode),__FUNCTION__,__LINE__)
35 #define MFCLOSE(file) \
36 mfclose((file),__FUNCTION__,__LINE__)
37 #else
38 #if defined(WIN32)
39 extern FILE *generic_fsyscp_fopen(const char *fname, const char *mode);
40 #define MFOPEN(name,mode) generic_fsyscp_fopen((name),(mode))
41 #else
42 #define MFOPEN(name,mode) fopen((name),(mode))
43 #endif
44 #define MFCLOSE(file) fclose(file)
45 #endif
46
47 extern void seek_absolute (FILE *file, int32_t pos);
48 extern void seek_relative (FILE *file, int32_t pos);
49
50 extern void seek_end (FILE *file);
51
52 extern int32_t tell_position (FILE *file);
53
54 extern int32_t file_size (FILE *file);
55
56 #define xseek_absolute(file, pos, name) xfseeko (file, (off_t)(pos), SEEK_SET, name)
57 #define xseek_relative(file, pos, name) xfseeko (file, (off_t)(pos), SEEK_CUR, name)
58 #define xseek_end(file, name) xfseeko (file, (off_t)0, SEEK_END, name)
59 #define xtell_position(file, name) xftello (file, name)
60
61 extern off_t xfile_size (FILE *file, const char *name);
62
63 extern char *mfgets (char *buffer, int length, FILE *file);
64 extern int mfreadln (char *buffer, int length, FILE *file);
65
66 extern char work_buffer[];
67
68 #define WORK_BUFFER_SIZE 1024
69
70 #endif /* _MFILEIO_H_ */