clarify the gui
[open-ps2-loader.git] / thirdparty / freetype-2.3.12 / include / freetype / ftsystem.h
bloba95b2c76b61cece2ba9124fb34911e35761618ae
1 /***************************************************************************/
2 /* */
3 /* ftsystem.h */
4 /* */
5 /* FreeType low-level system interface definition (specification). */
6 /* */
7 /* Copyright 1996-2001, 2002, 2005 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
19 #ifndef __FTSYSTEM_H__
20 #define __FTSYSTEM_H__
23 #include <ft2build.h>
26 FT_BEGIN_HEADER
29 /*************************************************************************/
30 /* */
31 /* <Section> */
32 /* system_interface */
33 /* */
34 /* <Title> */
35 /* System Interface */
36 /* */
37 /* <Abstract> */
38 /* How FreeType manages memory and i/o. */
39 /* */
40 /* <Description> */
41 /* This section contains various definitions related to memory */
42 /* management and i/o access. You need to understand this */
43 /* information if you want to use a custom memory manager or you own */
44 /* i/o streams. */
45 /* */
46 /*************************************************************************/
49 /*************************************************************************/
50 /* */
51 /* M E M O R Y M A N A G E M E N T */
52 /* */
53 /*************************************************************************/
56 /*************************************************************************
58 * @type:
59 * FT_Memory
61 * @description:
62 * A handle to a given memory manager object, defined with an
63 * @FT_MemoryRec structure.
66 typedef struct FT_MemoryRec_* FT_Memory;
69 /*************************************************************************
71 * @functype:
72 * FT_Alloc_Func
74 * @description:
75 * A function used to allocate `size' bytes from `memory'.
77 * @input:
78 * memory ::
79 * A handle to the source memory manager.
81 * size ::
82 * The size in bytes to allocate.
84 * @return:
85 * Address of new memory block. 0~in case of failure.
88 typedef void*
89 (*FT_Alloc_Func)( FT_Memory memory,
90 long size );
93 /*************************************************************************
95 * @functype:
96 * FT_Free_Func
98 * @description:
99 * A function used to release a given block of memory.
101 * @input:
102 * memory ::
103 * A handle to the source memory manager.
105 * block ::
106 * The address of the target memory block.
109 typedef void
110 (*FT_Free_Func)( FT_Memory memory,
111 void* block );
114 /*************************************************************************
116 * @functype:
117 * FT_Realloc_Func
119 * @description:
120 * A function used to re-allocate a given block of memory.
122 * @input:
123 * memory ::
124 * A handle to the source memory manager.
126 * cur_size ::
127 * The block's current size in bytes.
129 * new_size ::
130 * The block's requested new size.
132 * block ::
133 * The block's current address.
135 * @return:
136 * New block address. 0~in case of memory shortage.
138 * @note:
139 * In case of error, the old block must still be available.
142 typedef void*
143 (*FT_Realloc_Func)( FT_Memory memory,
144 long cur_size,
145 long new_size,
146 void* block );
149 /*************************************************************************
151 * @struct:
152 * FT_MemoryRec
154 * @description:
155 * A structure used to describe a given memory manager to FreeType~2.
157 * @fields:
158 * user ::
159 * A generic typeless pointer for user data.
161 * alloc ::
162 * A pointer type to an allocation function.
164 * free ::
165 * A pointer type to an memory freeing function.
167 * realloc ::
168 * A pointer type to a reallocation function.
171 struct FT_MemoryRec_
173 void* user;
174 FT_Alloc_Func alloc;
175 FT_Free_Func free;
176 FT_Realloc_Func realloc;
180 /*************************************************************************/
181 /* */
182 /* I / O M A N A G E M E N T */
183 /* */
184 /*************************************************************************/
187 /*************************************************************************
189 * @type:
190 * FT_Stream
192 * @description:
193 * A handle to an input stream.
196 typedef struct FT_StreamRec_* FT_Stream;
199 /*************************************************************************
201 * @struct:
202 * FT_StreamDesc
204 * @description:
205 * A union type used to store either a long or a pointer. This is used
206 * to store a file descriptor or a `FILE*' in an input stream.
209 typedef union FT_StreamDesc_
211 long value;
212 void* pointer;
214 } FT_StreamDesc;
217 /*************************************************************************
219 * @functype:
220 * FT_Stream_IoFunc
222 * @description:
223 * A function used to seek and read data from a given input stream.
225 * @input:
226 * stream ::
227 * A handle to the source stream.
229 * offset ::
230 * The offset of read in stream (always from start).
232 * buffer ::
233 * The address of the read buffer.
235 * count ::
236 * The number of bytes to read from the stream.
238 * @return:
239 * The number of bytes effectively read by the stream.
241 * @note:
242 * This function might be called to perform a seek or skip operation
243 * with a `count' of~0.
246 typedef unsigned long
247 (*FT_Stream_IoFunc)( FT_Stream stream,
248 unsigned long offset,
249 unsigned char* buffer,
250 unsigned long count );
253 /*************************************************************************
255 * @functype:
256 * FT_Stream_CloseFunc
258 * @description:
259 * A function used to close a given input stream.
261 * @input:
262 * stream ::
263 * A handle to the target stream.
266 typedef void
267 (*FT_Stream_CloseFunc)( FT_Stream stream );
270 /*************************************************************************
272 * @struct:
273 * FT_StreamRec
275 * @description:
276 * A structure used to describe an input stream.
278 * @input:
279 * base ::
280 * For memory-based streams, this is the address of the first stream
281 * byte in memory. This field should always be set to NULL for
282 * disk-based streams.
284 * size ::
285 * The stream size in bytes.
287 * pos ::
288 * The current position within the stream.
290 * descriptor ::
291 * This field is a union that can hold an integer or a pointer. It is
292 * used by stream implementations to store file descriptors or `FILE*'
293 * pointers.
295 * pathname ::
296 * This field is completely ignored by FreeType. However, it is often
297 * useful during debugging to use it to store the stream's filename
298 * (where available).
300 * read ::
301 * The stream's input function.
303 * close ::
304 * The stream;s close function.
306 * memory ::
307 * The memory manager to use to preload frames. This is set
308 * internally by FreeType and shouldn't be touched by stream
309 * implementations.
311 * cursor ::
312 * This field is set and used internally by FreeType when parsing
313 * frames.
315 * limit ::
316 * This field is set and used internally by FreeType when parsing
317 * frames.
320 typedef struct FT_StreamRec_
322 unsigned char* base;
323 unsigned long size;
324 unsigned long pos;
326 FT_StreamDesc descriptor;
327 FT_StreamDesc pathname;
328 FT_Stream_IoFunc read;
329 FT_Stream_CloseFunc close;
331 FT_Memory memory;
332 unsigned char* cursor;
333 unsigned char* limit;
335 } FT_StreamRec;
338 /* */
341 FT_END_HEADER
343 #endif /* __FTSYSTEM_H__ */
346 /* END */