| 1 |
/* This is xdvipsk, an eXtended version of dvips(k) by Tomas Rokicki. |
| 2 |
|
| 3 |
Copyright (C) 2016 by VTeX Ltd (www.vtex.lt), |
| 4 |
the xdvipsk project team - Sigitas Tolusis and Arunas Povilaitis. |
| 5 |
|
| 6 |
Program original code copyright (C) 2007-2014 by Jin-Hwan Cho and |
| 7 |
Shunsaku Hirata, the dvipdfmx project team. |
| 8 |
|
| 9 |
This program 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 2 of the License, or |
| 12 |
(at your option) any later version. |
| 13 |
|
| 14 |
This program is distributed in the hope that it will be useful, |
| 15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
GNU General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with this program; if not, write to the Free Software |
| 21 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef _MFILEIO_H_ |
| 25 |
#define _MFILEIO_H_ |
| 26 |
|
| 27 |
#include <stdio.h> |
| 28 |
#include "numbers.h" |
| 29 |
|
| 30 |
#ifdef IODEBUG |
| 31 |
FILE *mfopen (const char *name, const char *mode, |
| 32 |
const char *function, int line); |
| 33 |
int mfclose (FILE *file, const char *function, int line); |
| 34 |
#define MFOPEN(name,mode) \ |
| 35 |
mfopen((name),(mode),__FUNCTION__,__LINE__) |
| 36 |
#define MFCLOSE(file) \ |
| 37 |
mfclose((file),__FUNCTION__,__LINE__) |
| 38 |
#else |
| 39 |
#if defined(WIN32) |
| 40 |
#define MFOPEN(name,mode) 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, long pos); |
| 48 |
extern void seek_relative (FILE *file, long pos); |
| 49 |
|
| 50 |
extern void seek_end (FILE *file); |
| 51 |
|
| 52 |
extern long tell_position (FILE *file); |
| 53 |
|
| 54 |
extern long 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 |
|
| 65 |
extern char work_buffer[]; |
| 66 |
|
| 67 |
#define WORK_BUFFER_SIZE 1024 |
| 68 |
|
| 69 |
#endif /* _MFILEIO_H_ */ |