1 /***************************************************************************/
5 /* Embedded resource forks accessor (specification). */
7 /* Copyright 2004, 2006, 2007 by */
8 /* Masatake YAMATO and Redhat K.K. */
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. */
16 /***************************************************************************/
18 /***************************************************************************/
19 /* Development of the code in this file is support of */
20 /* Information-technology Promotion Agency, Japan. */
21 /***************************************************************************/
29 #include FT_INTERNAL_OBJECTS_H
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
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. */
44 typedef struct FT_RFork_Ref_
52 /*************************************************************************/
55 /* FT_Raccess_Guess */
58 /* Guess a file name and offset where the actual resource fork is */
59 /* stored. The macro FT_RACCESS_N_RULES holds the number of */
60 /* guessing rules; the guessed result for the Nth rule is */
61 /* represented as a triplet: a new file name (new_names[N]), a file */
62 /* offset (offsets[N]), and an error code (errors[N]). */
66 /* A FreeType library instance. */
69 /* A file stream containing the resource fork. */
72 /* The (base) file name of the resource fork used for some */
77 /* An array of guessed file names in which the resource forks may */
78 /* exist. If `new_names[N]' is NULL, the guessed file name is */
79 /* equal to `base_name'. */
82 /* An array of guessed file offsets. `offsets[N]' holds the file */
83 /* offset of the possible start of the resource fork in file */
87 /* An array of FreeType error codes. `errors[N]' is the error */
88 /* code of Nth guessing rule function. If `errors[N]' is not */
89 /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
92 FT_Raccess_Guess( FT_Library library,
100 /*************************************************************************/
103 /* FT_Raccess_Get_HeaderInfo */
106 /* Get the information from the header of resource fork. The */
107 /* information includes the file offset where the resource map */
108 /* starts, and the file offset where the resource data starts. */
109 /* `FT_Raccess_Get_DataOffsets' requires these two data. */
113 /* A FreeType library instance. */
116 /* A file stream containing the resource fork. */
118 /* rfork_offset :: */
119 /* The file offset where the resource fork starts. */
123 /* The file offset where the resource map starts. */
126 /* The file offset where the resource data starts. */
129 /* FreeType error code. FT_Err_Ok means success. */
132 FT_Raccess_Get_HeaderInfo( FT_Library library,
134 FT_Long rfork_offset,
136 FT_Long *rdata_pos );
139 /*************************************************************************/
142 /* FT_Raccess_Get_DataOffsets */
145 /* Get the data offsets for a tag in a resource fork. Offsets are */
146 /* stored in an array because, in some cases, resources in a resource */
147 /* fork have the same tag. */
151 /* A FreeType library instance. */
154 /* A file stream containing the resource fork. */
157 /* The file offset where the resource map starts. */
160 /* The file offset where the resource data starts. */
163 /* The resource tag. */
167 /* The stream offsets for the resource data specified by `tag'. */
168 /* This array is allocated by the function, so you have to call */
169 /* @ft_mem_free after use. */
172 /* The length of offsets array. */
175 /* FreeType error code. FT_Err_Ok means success. */
178 /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
179 /* value for `map_offset' and `rdata_pos'. */
182 FT_Raccess_Get_DataOffsets( FT_Library library,
193 #endif /* __FTRFORK_H__ */