Makefile: don't link all objs to all programs
[rofl0r-agsutils.git] / File.h
blob5a09be1f51117bde9c3ba9aab151bf70cec30025
1 #ifndef FILE_H
2 #define FILE_H
3 #include <stddef.h>
4 #include <stdio.h>
5 #include "ByteArray.h"
7 typedef struct AgsFile {
8 struct ByteArray b_b;
9 struct ByteArray *b;
10 } AF;
12 /* 0: error, 1: success */
13 int AF_open(AF *f, const char* fn);
14 void AF_close(AF* f);
16 off_t AF_get_pos(AF* f);
17 int AF_set_pos(AF* f, off_t x);
19 ssize_t AF_read(AF* f, void* buf, size_t len);
20 long long AF_read_longlong(AF* f);
21 int AF_read_int(AF* f);
22 unsigned AF_read_uint(AF* f);
23 short AF_read_short(AF* f);
24 unsigned short AF_read_ushort(AF* f);
25 int AF_read_string(AF* a, char* buf, size_t max);
27 /* dumps file contents between start and start+len into fn */
28 int AF_dump_chunk(AF* a, size_t start, size_t len, char* fn);
29 int AF_dump_chunk_stream(AF* a, size_t start, size_t len, FILE* out);
30 /* "swallows" or skips l bytes, i.e. advances the offset */
31 int AF_read_junk(AF* a, size_t l);
33 #pragma RcB2 DEP "File.c"
35 #endif