1 module ft.system;
2 
3 import core.stdc.config : c_long, c_ulong;
4 
5 extern(C) nothrow
6 {
7     alias FT_Alloc_Func = void* function (FT_Memory memory, c_long size);
8 
9     alias FT_Free_Func = void function (FT_Memory memory, void* block);
10 
11     alias FT_Realloc_Func = void* function (FT_Memory memory,
12                                             c_long cur_size,
13                                             c_long new_size,
14                                             void* block);
15 }
16 
17 struct FT_MemoryRec
18 {
19     void*            user;
20     FT_Alloc_Func    alloc;
21     FT_Free_Func     free;
22     FT_Realloc_Func  realloc;
23 }
24 
25 alias FT_Memory = FT_MemoryRec*;
26 
27 
28 union FT_StreamDesc
29 {
30     c_long value;
31     void* pointer;
32 }
33 
34 extern(C) nothrow
35 {
36     alias FT_Stream_IoFunc = c_ulong function (FT_Stream stream,
37                                                c_ulong   offset,
38                                                ubyte*  buffer,
39                                                c_ulong   count );
40 
41     alias FT_Stream_CloseFunc = void function (FT_Stream stream);
42 }
43 
44 struct FT_StreamRec
45 {
46     ubyte*               base;
47     c_ulong              size;
48     c_long               pos;
49 
50     FT_StreamDesc        descriptor;
51     FT_StreamDesc        pathname;
52     FT_Stream_IoFunc     read;
53     FT_Stream_CloseFunc  close;
54 
55     FT_Memory            memory;
56     ubyte*               cursor;
57     ubyte*               limit;
58 }
59 
60 alias FT_Stream = FT_StreamRec*;