[692] | 1 | /***************************************************************************/
|
---|
| 2 | /* */
|
---|
| 3 | /* ftrfork.h */
|
---|
| 4 | /* */
|
---|
| 5 | /* Embedded resource forks accessor (specification). */
|
---|
| 6 | /* */
|
---|
| 7 | /* Copyright 2004 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 |
|
---|
| 32 | FT_BEGIN_HEADER
|
---|
| 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 8
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | /*************************************************************************/
|
---|
| 41 | /* */
|
---|
| 42 | /* <Function> */
|
---|
| 43 | /* FT_Raccess_Guess */
|
---|
| 44 | /* */
|
---|
| 45 | /* <Description> */
|
---|
| 46 | /* Guess a file name and offset where the actual resource fork is */
|
---|
| 47 | /* stored. The macro FT_RACCESS_N_RULES holds the number of */
|
---|
| 48 | /* guessing rules; the guessed result for the Nth rule is */
|
---|
| 49 | /* represented as a triplet: a new file name (new_names[N]), a file */
|
---|
| 50 | /* offset (offsets[N]), and an error code (errors[N]). */
|
---|
| 51 | /* */
|
---|
| 52 | /* <Input> */
|
---|
| 53 | /* library :: */
|
---|
| 54 | /* A FreeType library instance. */
|
---|
| 55 | /* */
|
---|
| 56 | /* stream :: */
|
---|
| 57 | /* A file stream containing the resource fork. */
|
---|
| 58 | /* */
|
---|
| 59 | /* base_name :: */
|
---|
| 60 | /* The (base) file name of the resource fork used for some */
|
---|
| 61 | /* guessing rules. */
|
---|
| 62 | /* */
|
---|
| 63 | /* <Output> */
|
---|
| 64 | /* new_names :: */
|
---|
| 65 | /* An array of guessed file names in which the resource forks may */
|
---|
| 66 | /* exist. If `new_names[N]' is NULL, the guessed file name is */
|
---|
| 67 | /* equal to `base_name'. */
|
---|
| 68 | /* */
|
---|
| 69 | /* offsets :: */
|
---|
| 70 | /* An array of guessed file offsets. `offsets[N]' holds the file */
|
---|
| 71 | /* offset of the possible start of the resource fork in file */
|
---|
| 72 | /* `new_names[N]'. */
|
---|
| 73 | /* */
|
---|
| 74 | /* errors :: */
|
---|
| 75 | /* An array of FreeType error codes. `errors[N]' is the error */
|
---|
| 76 | /* code of Nth guessing rule function. If `errors[N]' is not */
|
---|
| 77 | /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
|
---|
| 78 | /* */
|
---|
| 79 | FT_BASE( void )
|
---|
| 80 | FT_Raccess_Guess( FT_Library library,
|
---|
| 81 | FT_Stream stream,
|
---|
| 82 | char* base_name,
|
---|
| 83 | char** new_names,
|
---|
| 84 | FT_Long* offsets,
|
---|
| 85 | FT_Error* errors );
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | /*************************************************************************/
|
---|
| 89 | /* */
|
---|
| 90 | /* <Function> */
|
---|
| 91 | /* FT_Raccess_Get_HeaderInfo */
|
---|
| 92 | /* */
|
---|
| 93 | /* <Description> */
|
---|
| 94 | /* Get the information from the header of resource fork. The */
|
---|
| 95 | /* information includes the file offset where the resource map */
|
---|
| 96 | /* starts, and the file offset where the resource data starts. */
|
---|
| 97 | /* `FT_Raccess_Get_DataOffsets' requires these two data. */
|
---|
| 98 | /* */
|
---|
| 99 | /* <Input> */
|
---|
| 100 | /* library :: */
|
---|
| 101 | /* A FreeType library instance. */
|
---|
| 102 | /* */
|
---|
| 103 | /* stream :: */
|
---|
| 104 | /* A file stream containing the resource fork. */
|
---|
| 105 | /* */
|
---|
| 106 | /* rfork_offset :: */
|
---|
| 107 | /* The file offset where the resource fork starts. */
|
---|
| 108 | /* */
|
---|
| 109 | /* <Output> */
|
---|
| 110 | /* map_offset :: */
|
---|
| 111 | /* The file offset where the resource map starts. */
|
---|
| 112 | /* */
|
---|
| 113 | /* rdata_pos :: */
|
---|
| 114 | /* The file offset where the resource data starts. */
|
---|
| 115 | /* */
|
---|
| 116 | /* <Return> */
|
---|
| 117 | /* FreeType error code. FT_Err_Ok means success. */
|
---|
| 118 | /* */
|
---|
| 119 | FT_BASE( FT_Error )
|
---|
| 120 | FT_Raccess_Get_HeaderInfo( FT_Library library,
|
---|
| 121 | FT_Stream stream,
|
---|
| 122 | FT_Long rfork_offset,
|
---|
| 123 | FT_Long *map_offset,
|
---|
| 124 | FT_Long *rdata_pos );
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | /*************************************************************************/
|
---|
| 128 | /* */
|
---|
| 129 | /* <Function> */
|
---|
| 130 | /* FT_Raccess_Get_DataOffsets */
|
---|
| 131 | /* */
|
---|
| 132 | /* <Description> */
|
---|
| 133 | /* Get the data offsets for a tag in a resource fork. Offsets are */
|
---|
| 134 | /* stored in an array because, in some cases, resources in a resource */
|
---|
| 135 | /* fork have the same tag. */
|
---|
| 136 | /* */
|
---|
| 137 | /* <Input> */
|
---|
| 138 | /* library :: */
|
---|
| 139 | /* A FreeType library instance. */
|
---|
| 140 | /* */
|
---|
| 141 | /* stream :: */
|
---|
| 142 | /* A file stream containing the resource fork. */
|
---|
| 143 | /* */
|
---|
| 144 | /* map_offset :: */
|
---|
| 145 | /* The file offset where the resource map starts. */
|
---|
| 146 | /* */
|
---|
| 147 | /* rdata_pos :: */
|
---|
| 148 | /* The file offset where the resource data starts. */
|
---|
| 149 | /* */
|
---|
| 150 | /* tag :: */
|
---|
| 151 | /* The resource tag. */
|
---|
| 152 | /* */
|
---|
| 153 | /* <Output> */
|
---|
| 154 | /* offsets :: */
|
---|
| 155 | /* The stream offsets for the resource data specified by `tag'. */
|
---|
| 156 | /* This array is allocated by the function, so you have to call */
|
---|
| 157 | /* @FT_Free after use. */
|
---|
| 158 | /* */
|
---|
| 159 | /* count :: */
|
---|
| 160 | /* The length of offsets array. */
|
---|
| 161 | /* */
|
---|
| 162 | /* <Return> */
|
---|
| 163 | /* FreeType error code. FT_Err_Ok means success. */
|
---|
| 164 | /* */
|
---|
| 165 | /* <Note> */
|
---|
| 166 | /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
|
---|
| 167 | /* value for `map_offset' and `rdata_pos'. */
|
---|
| 168 | /* */
|
---|
| 169 | FT_BASE( FT_Error )
|
---|
| 170 | FT_Raccess_Get_DataOffsets( FT_Library library,
|
---|
| 171 | FT_Stream stream,
|
---|
| 172 | FT_Long map_offset,
|
---|
| 173 | FT_Long rdata_pos,
|
---|
| 174 | FT_Long tag,
|
---|
| 175 | FT_Long **offsets,
|
---|
| 176 | FT_Long *count );
|
---|
| 177 |
|
---|
| 178 |
|
---|
| 179 | FT_END_HEADER
|
---|
| 180 |
|
---|
| 181 | #endif /* __FTRFORK_H__ */
|
---|
| 182 |
|
---|
| 183 |
|
---|
| 184 | /* END */
|
---|