1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/* ****************************************************************************
* file/sdk.c -- File related functions.
*
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of the 'casiowin/fxlib' module in libcarrot, an
* experimental modular libc project.
*
* This file is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Lesser Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this file. If not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
#include <fxlib/file.h>
/**
* Bfile_OpenFile:
* Open a file handle.
*
* @arg filename the filename.
* @arg mode the mode.
* @return the error.
*/
int Bfile_OpenFile(const FONTCHARACTER *filename, int mode)
{
return (Bfile_OpenFile_OS(filename, mode, 0));
}
/**
* Bfile_CloseFile:
* Close a file handle.
*
* @arg HANDLE the handle.
* @return the error.
*/
int Bfile_CloseFile(int HANDLE)
{
return (Bfile_CloseFile_OS(HANDLE));
}
/**
* Bfile_ReadFile:
* Read from a file handle.
*
* @arg HANDLE the handle.
* @arg buf the buffer to read to.
* @arg size the size to read to.
* @arg readpos the read position.
* @return the error that occurred.
*/
int Bfile_ReadFile(int HANDLE, void *buf, int size, int readpos)
{
return (Bfile_ReadFile_OS(HANDLE, buf, size, readpos));
}
/**
* Bfile_WriteFile:
* Write to a file handle.
*
* @arg HANDLE the handle.
* @arg buf the buffer to write.
* @arg size the buffer size.
* @return the error that occurred.
*/
int Bfile_WriteFile(int HANDLE, const void *buf, int size)
{
return (Bfile_WriteFile_OS(HANDLE, buf, size));
}
/**
* Bfile_SeekFile:
* Seek using a file handle.
*
* @arg HANDLE the handle.
* @arg pos the position.
* @return the error that occurred.
*/
int Bfile_SeekFile(int HANDLE, int pos)
{
return (Bfile_SeekFile_OS(HANDLE, pos));
}
|