Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
ftrfork.h
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ftrfork.h */
4 /* */
5 /* Embedded resource forks accessor (specification). */
6 /* */
7 /* Copyright 2004, 2006, 2007, 2012 by */
8 /* Masatake YAMATO and Redhat K.K. */
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 /***************************************************************************/
17 
18 /***************************************************************************/
19 /* Development of the code in this file is support of */
20 /* Information-technology Promotion Agency, Japan. */
21 /***************************************************************************/
22 
23 
24 #ifndef __FTRFORK_H__
25 #define __FTRFORK_H__
26 
27 
28 #include <ft2build.h>
29 #include FT_INTERNAL_OBJECTS_H
30 
31 
33 
34 
35  /* Number of guessing rules supported in `FT_Raccess_Guess'. */
36  /* Don't forget to increment the number if you add a new guessing rule. */
37 #define FT_RACCESS_N_RULES 9
38 
39 
40  /* A structure to describe a reference in a resource by its resource ID */
41  /* and internal offset. The `POST' resource expects to be concatenated */
42  /* by the order of resource IDs instead of its appearance in the file. */
43 
44  typedef struct FT_RFork_Ref_
45  {
48 
49  } FT_RFork_Ref;
50 
51 #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
52  typedef FT_Error
53  (*ft_raccess_guess_func)( FT_Library library,
55  char *base_file_name,
56  char **result_file_name,
57  FT_Long *result_offset );
58 
59  typedef enum FT_RFork_Rule_ {
60  FT_RFork_Rule_invalid = -2,
61  FT_RFork_Rule_uknown, /* -1 */
62  FT_RFork_Rule_apple_double,
63  FT_RFork_Rule_apple_single,
64  FT_RFork_Rule_darwin_ufs_export,
65  FT_RFork_Rule_darwin_newvfs,
66  FT_RFork_Rule_darwin_hfsplus,
67  FT_RFork_Rule_vfat,
68  FT_RFork_Rule_linux_cap,
69  FT_RFork_Rule_linux_double,
70  FT_RFork_Rule_linux_netatalk
71  } FT_RFork_Rule;
72 
73  /* For fast translation between rule index and rule type,
74  * the macros FT_RFORK_xxx should be kept consistent with
75  * the raccess_guess_funcs table
76  */
77  typedef struct ft_raccess_guess_rec_ {
78  ft_raccess_guess_func func;
79  FT_RFork_Rule type;
80  } ft_raccess_guess_rec;
81 
82 #ifndef FT_CONFIG_OPTION_PIC
83 
84  /* this array is a storage in non-PIC mode, so ; is needed in END */
85 #define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
86  const type name[] = {
87 #define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
88  { raccess_guess_ ## func_suffix, \
89  FT_RFork_Rule_ ## type_suffix },
90 #define CONST_FT_RFORK_RULE_ARRAY_END };
91 
92 #else /* FT_CONFIG_OPTION_PIC */
93 
94  /* this array is a function in PIC mode, so no ; is needed in END */
95 #define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
96  void \
97  FT_Init_ ## name( type* storage ) \
98  { \
99  type* local = storage; \
100  \
101  \
102  int i = 0;
103 #define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
104  local[i].func = raccess_guess_ ## func_suffix; \
105  local[i].type = FT_RFork_Rule_ ## type_suffix; \
106  i++;
107 #define CONST_FT_RFORK_RULE_ARRAY_END }
108 
109 #endif /* FT_CONFIG_OPTION_PIC */
110 
111 #endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
112 
113 
114  /*************************************************************************/
115  /* */
116  /* <Function> */
117  /* FT_Raccess_Guess */
118  /* */
119  /* <Description> */
120  /* Guess a file name and offset where the actual resource fork is */
121  /* stored. The macro FT_RACCESS_N_RULES holds the number of */
122  /* guessing rules; the guessed result for the Nth rule is */
123  /* represented as a triplet: a new file name (new_names[N]), a file */
124  /* offset (offsets[N]), and an error code (errors[N]). */
125  /* */
126  /* <Input> */
127  /* library :: */
128  /* A FreeType library instance. */
129  /* */
130  /* stream :: */
131  /* A file stream containing the resource fork. */
132  /* */
133  /* base_name :: */
134  /* The (base) file name of the resource fork used for some */
135  /* guessing rules. */
136  /* */
137  /* <Output> */
138  /* new_names :: */
139  /* An array of guessed file names in which the resource forks may */
140  /* exist. If `new_names[N]' is NULL, the guessed file name is */
141  /* equal to `base_name'. */
142  /* */
143  /* offsets :: */
144  /* An array of guessed file offsets. `offsets[N]' holds the file */
145  /* offset of the possible start of the resource fork in file */
146  /* `new_names[N]'. */
147  /* */
148  /* errors :: */
149  /* An array of FreeType error codes. `errors[N]' is the error */
150  /* code of Nth guessing rule function. If `errors[N]' is not */
151  /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
152  /* */
153  FT_BASE( void )
156  char* base_name,
157  char** new_names,
158  FT_Long* offsets,
159  FT_Error* errors );
160 
161 
162  /*************************************************************************/
163  /* */
164  /* <Function> */
165  /* FT_Raccess_Get_HeaderInfo */
166  /* */
167  /* <Description> */
168  /* Get the information from the header of resource fork. The */
169  /* information includes the file offset where the resource map */
170  /* starts, and the file offset where the resource data starts. */
171  /* `FT_Raccess_Get_DataOffsets' requires these two data. */
172  /* */
173  /* <Input> */
174  /* library :: */
175  /* A FreeType library instance. */
176  /* */
177  /* stream :: */
178  /* A file stream containing the resource fork. */
179  /* */
180  /* rfork_offset :: */
181  /* The file offset where the resource fork starts. */
182  /* */
183  /* <Output> */
184  /* map_offset :: */
185  /* The file offset where the resource map starts. */
186  /* */
187  /* rdata_pos :: */
188  /* The file offset where the resource data starts. */
189  /* */
190  /* <Return> */
191  /* FreeType error code. FT_Err_Ok means success. */
192  /* */
193  FT_BASE( FT_Error )
195  FT_Stream stream,
196  FT_Long rfork_offset,
197  FT_Long *map_offset,
198  FT_Long *rdata_pos );
199 
200 
201  /*************************************************************************/
202  /* */
203  /* <Function> */
204  /* FT_Raccess_Get_DataOffsets */
205  /* */
206  /* <Description> */
207  /* Get the data offsets for a tag in a resource fork. Offsets are */
208  /* stored in an array because, in some cases, resources in a resource */
209  /* fork have the same tag. */
210  /* */
211  /* <Input> */
212  /* library :: */
213  /* A FreeType library instance. */
214  /* */
215  /* stream :: */
216  /* A file stream containing the resource fork. */
217  /* */
218  /* map_offset :: */
219  /* The file offset where the resource map starts. */
220  /* */
221  /* rdata_pos :: */
222  /* The file offset where the resource data starts. */
223  /* */
224  /* tag :: */
225  /* The resource tag. */
226  /* */
227  /* <Output> */
228  /* offsets :: */
229  /* The stream offsets for the resource data specified by `tag'. */
230  /* This array is allocated by the function, so you have to call */
231  /* @ft_mem_free after use. */
232  /* */
233  /* count :: */
234  /* The length of offsets array. */
235  /* */
236  /* <Return> */
237  /* FreeType error code. FT_Err_Ok means success. */
238  /* */
239  /* <Note> */
240  /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
241  /* value for `map_offset' and `rdata_pos'. */
242  /* */
243  FT_BASE( FT_Error )
245  FT_Stream stream,
246  FT_Long map_offset,
247  FT_Long rdata_pos,
248  FT_Long tag,
249  FT_Long **offsets,
250  FT_Long *count );
251 
252 
254 
255 #endif /* __FTRFORK_H__ */
256 
257 
258 /* END */
int FT_Error
Definition: fttypes.h:296
GLuint GLuint stream
FT_Raccess_Get_DataOffsets(FT_Library library, FT_Stream stream, FT_Long map_offset, FT_Long rdata_pos, FT_Long tag, FT_Long **offsets, FT_Long *count)
Definition: ftrfork.c:149
signed long FT_Long
Definition: fttypes.h:238
unsigned long FT_ULong
Definition: fttypes.h:249
#define FT_END_HEADER
Definition: ftheader.h:54
FT_Library library
Definition: cffdrivr.c:414
#define FT_BEGIN_HEADER
Definition: ftheader.h:36
FT_ULong offset
Definition: ftrfork.h:47
#define FT_BASE(x)
Definition: ftconfig.h:247
struct FT_RFork_Ref_ FT_RFork_Ref
GLenum type
GLenum func
GLuint GLuint GLsizei count
unsigned short FT_UShort
Definition: fttypes.h:205
FT_UShort res_id
Definition: ftrfork.h:46
FT_Raccess_Guess(FT_Library library, FT_Stream stream, char *base_name, char **new_names, FT_Long *offsets, FT_Error *errors)
Definition: ftrfork.c:823
FT_Raccess_Get_HeaderInfo(FT_Library library, FT_Stream stream, FT_Long rfork_offset, FT_Long *map_offset, FT_Long *rdata_pos)
Definition: ftrfork.c:50