Jo Engine  9
Jo Sega Saturn Engine
fs.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2017, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35 #ifndef __JO_FS_H__
36 # define __JO_FS_H__
37 
38 #ifdef JO_COMPILE_WITH_FS_SUPPORT
39 
40 /*
41 ** MACROS
42 */
44 # define JO_ROOT_DIR ((const char *)0)
45 
46 # define JO_CURRENT_DIR ((const char *)0)
47 
48 # define JO_PARENT_DIR ("..")
49 
50 /*
51 ** TYPEDEFS
52 */
54 typedef void (*jo_fs_async_read_callback)(char *contents, int length, int optional_token);
55 
59 void jo_fs_cd(const char *const sub_dir);
60 
67 char* jo_fs_read_file_in_dir(const char *const filename, const char *const sub_dir, int *len);
68 
74 char* jo_fs_read_file(const char *const filename, int *len);
75 
82 bool jo_fs_read_file_async(const char *const filename, jo_fs_async_read_callback callback, int optional_token);
83 
89 bool jo_fs_open(jo_file * const file, const char *const filename);
90 
94 void jo_fs_close(jo_file * const file);
95 
102 int jo_fs_read_next_bytes(jo_file * const file, char *buffer, unsigned int nbytes);
103 
109 bool jo_fs_seek_forward(jo_file * const file, unsigned int nbytes);
110 
111 #endif /* !JO_COMPILE_WITH_FS_SUPPORT */
112 
113 #endif /* !__JO_FS_H__ */
114 
115 /*
116 ** END OF FILE
117 */
File definition.
Definition: types.h:170