aboutsummaryrefslogtreecommitdiff
path: root/include/bh/internal/file.h
blob: 20c6c315296ea9d3bda0d596eda2fba427043fa1 (plain)
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
#ifndef BH_INTERNAL_FILE_H
#define BH_INTERNAL_FILE_H

#include "bh.h"
#include "io.h"
#include <bh/file.h>

#if defined(BH_PLATFORM_POSIX)
#include "file_posix.h"
#elif defined(BH_PLATFORM_WIN)
#include "file_win.h"
#else
#include "file_null.h"
#endif

int bh_file_init(bh_file_t *file,
                 const char *path);

#define bh_file_destroy(file) \
    bh_io_destroy((bh_io_t *)(file))

void bh_file_destroy_base(bh_file_t *file);

int bh_file_open_base(bh_file_t *file,
                      int mode);

void bh_file_close_base(bh_file_t *file);

int bh_file_is_open_base(bh_file_t *file);

size_t bh_file_read_base(bh_file_t *file,
                         char *data,
                         size_t size);

size_t bh_file_write_base(bh_file_t *file,
                          const char *data,
                          size_t size);

void bh_file_flush_base(bh_file_t *file);

int bh_file_seek_base(bh_file_t *file,
                      bh_off_t pos,
                      int dir);

bh_off_t bh_file_size_base(bh_file_t *file);

bh_off_t bh_file_tell_base(bh_file_t *file);

bh_off_t bh_file_available_base(bh_file_t *file);

void bh_file_clear_base(bh_file_t *file);

#endif /* BH_INTERNAL_FILE_H */