File: ALLEGRO_FILE_INTERFACE.3

package info (click to toggle)
allegro5 2%3A5.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,856 kB
  • ctags: 15,948
  • sloc: ansic: 87,540; cpp: 9,693; objc: 3,491; python: 2,057; sh: 829; makefile: 93; perl: 37; pascal: 24
file content (51 lines) | stat: -rw-r--r-- 1,771 bytes parent folder | download
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
.TH ALLEGRO_FILE_INTERFACE 3 "" "Allegro reference manual"
.SH NAME
.PP
ALLEGRO_FILE_INTERFACE \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

typedef\ struct\ ALLEGRO_FILE_INTERFACE
\f[]
.fi
.SH DESCRIPTION
.PP
A structure containing function pointers to handle a type of "file",
real or virtual.
See the full discussion in al_set_new_file_interface(3).
.PP
The fields are:
.IP
.nf
\f[C]
void*\ \ \ \ \ \ \ \ \ (*fi_fopen)(const\ char\ *path,\ const\ char\ *mode);
void\ \ \ \ \ \ \ \ \ \ (*fi_fclose)(ALLEGRO_FILE\ *f);
size_t\ \ \ \ \ \ \ \ (*fi_fread)(ALLEGRO_FILE\ *f,\ void\ *ptr,\ size_t\ size);
size_t\ \ \ \ \ \ \ \ (*fi_fwrite)(ALLEGRO_FILE\ *f,\ const\ void\ *ptr,\ size_t\ size);
bool\ \ \ \ \ \ \ \ \ \ (*fi_fflush)(ALLEGRO_FILE\ *f);
int64_t\ \ \ \ \ \ \ (*fi_ftell)(ALLEGRO_FILE\ *f);
bool\ \ \ \ \ \ \ \ \ \ (*fi_fseek)(ALLEGRO_FILE\ *f,\ int64_t\ offset,\ int\ whence);
bool\ \ \ \ \ \ \ \ \ \ (*fi_feof)(ALLEGRO_FILE\ *f);
bool\ \ \ \ \ \ \ \ \ \ (*fi_ferror)(ALLEGRO_FILE\ *f);
void\ \ \ \ \ \ \ \ \ \ (*fi_fclearerr)(ALLEGRO_FILE\ *f);
int\ \ \ \ \ \ \ \ \ \ \ (*fi_fungetc)(ALLEGRO_FILE\ *f,\ int\ c);
off_t\ \ \ \ \ \ \ \ \ (*fi_fsize)(ALLEGRO_FILE\ *f);
\f[]
.fi
.PP
The fi_open function must allocate memory for whatever userdata
structure it needs.
The pointer to that memory must be returned; it will then be associated
with the file.
The other functions can access that data by calling
al_get_file_userdata(3) on the file handle.
If fi_open returns NULL then al_fopen(3) will also return NULL.
.PP
The fi_fclose function must clean up and free the userdata, but Allegro
will free the ALLEGRO_FILE(3) handle.
.PP
If fi_fungetc is NULL, then Allegro\[aq]s default implementation of a 16
char long buffer will be used.