1 /*$
2  Copyright (C) 2013-2020 Azel.
3 
4  This file is part of AzPainter.
5 
6  AzPainter is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  AzPainter is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 $*/
19 
20 #ifndef MLIB_UTIL_STDIO_H
21 #define MLIB_UTIL_STDIO_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 FILE *mFILEopenUTF8(const char *filename,const char *mode);
28 
29 mBool mFILEreadByte(FILE *fp,void *buf);
30 mBool mFILEread16LE(FILE *fp,void *buf);
31 mBool mFILEread32LE(FILE *fp,void *buf);
32 mBool mFILEread16BE(FILE *fp,void *buf);
33 mBool mFILEread32BE(FILE *fp,void *buf);
34 uint16_t mFILEget16LE(FILE *fp);
35 uint32_t mFILEget32LE(FILE *fp);
36 mBool mFILEreadCompareStr(FILE *fp,const char *text);
37 int mFILEreadStr_variableLen(FILE *fp,char **ppbuf);
38 int mFILEreadStr_len16BE(FILE *fp,char **ppbuf);
39 int mFILEreadArray16BE(FILE *fp,void *buf,int num);
40 int mFILEreadArray32BE(FILE *fp,void *buf,int num);
41 mBool mFILEreadArgsLE(FILE *fp,const char *format,...);
42 mBool mFILEreadArgsBE(FILE *fp,const char *format,...);
43 
44 void mFILEwriteByte(FILE *fp,uint8_t val);
45 void mFILEwrite16LE(FILE *fp,uint16_t val);
46 void mFILEwrite32LE(FILE *fp,uint32_t val);
47 void mFILEwrite16BE(FILE *fp,uint16_t val);
48 void mFILEwrite32BE(FILE *fp,uint32_t val);
49 void mFILEwriteZero(FILE *fp,int size);
50 int mFILEwriteStr_variableLen(FILE *fp,const char *text,int len);
51 int mFILEwriteStr_len16BE(FILE *fp,const char *text,int len);
52 void mFILEwriteArray16BE(FILE *fp,void *buf,int num);
53 void mFILEwriteArray32BE(FILE *fp,void *buf,int num);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif
60