Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenftstream.h
Go to the documentation of this file.
00001 /***************************************************************************/ 00002 /* */ 00003 /* ftstream.h */ 00004 /* */ 00005 /* Stream handling (specification). */ 00006 /* */ 00007 /* Copyright 1996-2001, 2002, 2004, 2005, 2006 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __FTSTREAM_H__ 00020 #define __FTSTREAM_H__ 00021 00022 00023 #include <ft2build.h> 00024 #include FT_SYSTEM_H 00025 #include FT_INTERNAL_OBJECTS_H 00026 00027 00028 FT_BEGIN_HEADER 00029 00030 00031 /* format of an 8-bit frame_op value: */ 00032 /* */ 00033 /* bit 76543210 */ 00034 /* xxxxxxes */ 00035 /* */ 00036 /* s is set to 1 if the value is signed. */ 00037 /* e is set to 1 if the value is little-endian. */ 00038 /* xxx is a command. */ 00039 00040 #define FT_FRAME_OP_SHIFT 2 00041 #define FT_FRAME_OP_SIGNED 1 00042 #define FT_FRAME_OP_LITTLE 2 00043 #define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT ) 00044 00045 #define FT_MAKE_FRAME_OP( command, little, sign ) \ 00046 ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign ) 00047 00048 #define FT_FRAME_OP_END 0 00049 #define FT_FRAME_OP_START 1 /* start a new frame */ 00050 #define FT_FRAME_OP_BYTE 2 /* read 1-byte value */ 00051 #define FT_FRAME_OP_SHORT 3 /* read 2-byte value */ 00052 #define FT_FRAME_OP_LONG 4 /* read 4-byte value */ 00053 #define FT_FRAME_OP_OFF3 5 /* read 3-byte value */ 00054 #define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */ 00055 00056 00057 typedef enum FT_Frame_Op_ 00058 { 00059 ft_frame_end = 0, 00060 ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ), 00061 00062 ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ), 00063 ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ), 00064 00065 ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ), 00066 ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ), 00067 ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ), 00068 ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ), 00069 00070 ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ), 00071 ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ), 00072 ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ), 00073 ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ), 00074 00075 ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ), 00076 ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ), 00077 ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ), 00078 ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ), 00079 00080 ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ), 00081 ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 ) 00082 00083 } FT_Frame_Op; 00084 00085 00086 typedef struct FT_Frame_Field_ 00087 { 00088 FT_Byte value; 00089 FT_Byte size; 00090 FT_UShort offset; 00091 00092 } FT_Frame_Field; 00093 00094 00095 /* Construct an FT_Frame_Field out of a structure type and a field name. */ 00096 /* The structure type must be set in the FT_STRUCTURE macro before */ 00097 /* calling the FT_FRAME_START() macro. */ 00098 /* */ 00099 #define FT_FIELD_SIZE( f ) \ 00100 (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f ) 00101 00102 #define FT_FIELD_SIZE_DELTA( f ) \ 00103 (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] ) 00104 00105 #define FT_FIELD_OFFSET( f ) \ 00106 (FT_UShort)( offsetof( FT_STRUCTURE, f ) ) 00107 00108 #define FT_FRAME_FIELD( frame_op, field ) \ 00109 { \ 00110 frame_op, \ 00111 FT_FIELD_SIZE( field ), \ 00112 FT_FIELD_OFFSET( field ) \ 00113 } 00114 00115 #define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 } 00116 00117 #define FT_FRAME_START( size ) { ft_frame_start, 0, size } 00118 #define FT_FRAME_END { ft_frame_end, 0, 0 } 00119 00120 #define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f ) 00121 #define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f ) 00122 #define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f ) 00123 #define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f ) 00124 #define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f ) 00125 #define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f ) 00126 #define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f ) 00127 #define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f ) 00128 00129 #define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f ) 00130 #define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f ) 00131 #define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f ) 00132 #define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f ) 00133 #define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f ) 00134 #define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f ) 00135 00136 #define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 } 00137 #define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 } 00138 #define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 } 00139 00140 #define FT_FRAME_BYTES( field, count ) \ 00141 { \ 00142 ft_frame_bytes, \ 00143 count, \ 00144 FT_FIELD_OFFSET( field ) \ 00145 } 00146 00147 #define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 } 00148 00149 00150 /*************************************************************************/ 00151 /* */ 00152 /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */ 00153 /* type `char*' or equivalent (1-byte elements). */ 00154 /* */ 00155 00156 #define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] ) 00157 #define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] ) 00158 00159 #define FT_INT16( x ) ( (FT_Int16)(x) ) 00160 #define FT_UINT16( x ) ( (FT_UInt16)(x) ) 00161 #define FT_INT32( x ) ( (FT_Int32)(x) ) 00162 #define FT_UINT32( x ) ( (FT_UInt32)(x) ) 00163 00164 #define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) ) 00165 #define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) ) 00166 #define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) ) 00167 #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) 00168 00169 #define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) ) 00170 #define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) ) 00171 #define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) ) 00172 #define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) ) 00173 00174 00175 #define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \ 00176 FT_BYTE_I16( p, 1, 0) ) 00177 00178 #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ 00179 FT_BYTE_U16( p, 1, 0 ) ) 00180 00181 #define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \ 00182 FT_BYTE_I32( p, 1, 16 ) | \ 00183 FT_BYTE_I32( p, 2, 8 ) | \ 00184 FT_BYTE_I32( p, 3, 0 ) ) 00185 00186 #define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \ 00187 FT_BYTE_U32( p, 1, 16 ) | \ 00188 FT_BYTE_U32( p, 2, 8 ) | \ 00189 FT_BYTE_U32( p, 3, 0 ) ) 00190 00191 #define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \ 00192 FT_BYTE_I32( p, 1, 8 ) | \ 00193 FT_BYTE_I32( p, 2, 0 ) ) 00194 00195 #define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \ 00196 FT_BYTE_U32( p, 1, 8 ) | \ 00197 FT_BYTE_U32( p, 2, 0 ) ) 00198 00199 #define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \ 00200 FT_BYTE_I16( p, 0, 0 ) ) 00201 00202 #define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \ 00203 FT_BYTE_U16( p, 0, 0 ) ) 00204 00205 #define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \ 00206 FT_BYTE_I32( p, 2, 16 ) | \ 00207 FT_BYTE_I32( p, 1, 8 ) | \ 00208 FT_BYTE_I32( p, 0, 0 ) ) 00209 00210 #define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \ 00211 FT_BYTE_U32( p, 2, 16 ) | \ 00212 FT_BYTE_U32( p, 1, 8 ) | \ 00213 FT_BYTE_U32( p, 0, 0 ) ) 00214 00215 #define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \ 00216 FT_BYTE_I32( p, 1, 8 ) | \ 00217 FT_BYTE_I32( p, 0, 0 ) ) 00218 00219 #define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \ 00220 FT_BYTE_U32( p, 1, 8 ) | \ 00221 FT_BYTE_U32( p, 0, 0 ) ) 00222 00223 00224 #define FT_NEXT_CHAR( buffer ) \ 00225 ( (signed char)*buffer++ ) 00226 00227 #define FT_NEXT_BYTE( buffer ) \ 00228 ( (unsigned char)*buffer++ ) 00229 00230 #define FT_NEXT_SHORT( buffer ) \ 00231 ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) 00232 00233 #define FT_NEXT_USHORT( buffer ) \ 00234 ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) 00235 00236 #define FT_NEXT_OFF3( buffer ) \ 00237 ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) 00238 00239 #define FT_NEXT_UOFF3( buffer ) \ 00240 ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) 00241 00242 #define FT_NEXT_LONG( buffer ) \ 00243 ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) 00244 00245 #define FT_NEXT_ULONG( buffer ) \ 00246 ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) 00247 00248 00249 #define FT_NEXT_SHORT_LE( buffer ) \ 00250 ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) 00251 00252 #define FT_NEXT_USHORT_LE( buffer ) \ 00253 ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) 00254 00255 #define FT_NEXT_OFF3_LE( buffer ) \ 00256 ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) 00257 00258 #define FT_NEXT_UOFF3_LE( buffer ) \ 00259 ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) 00260 00261 #define FT_NEXT_LONG_LE( buffer ) \ 00262 ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) 00263 00264 #define FT_NEXT_ULONG_LE( buffer ) \ 00265 ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) 00266 00267 00268 /*************************************************************************/ 00269 /* */ 00270 /* Each GET_xxxx() macro uses an implicit `stream' variable. */ 00271 /* */ 00272 #if 0 00273 #define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor ) 00274 00275 #define FT_GET_CHAR() FT_GET_MACRO( CHAR ) 00276 #define FT_GET_BYTE() FT_GET_MACRO( BYTE ) 00277 #define FT_GET_SHORT() FT_GET_MACRO( SHORT ) 00278 #define FT_GET_USHORT() FT_GET_MACRO( USHORT ) 00279 #define FT_GET_OFF3() FT_GET_MACRO( OFF3 ) 00280 #define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 ) 00281 #define FT_GET_LONG() FT_GET_MACRO( LONG ) 00282 #define FT_GET_ULONG() FT_GET_MACRO( ULONG ) 00283 #define FT_GET_TAG4() FT_GET_MACRO( ULONG ) 00284 00285 #define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE ) 00286 #define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE ) 00287 #define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE ) 00288 #define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE ) 00289 00290 #else 00291 #define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) 00292 00293 #define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) 00294 #define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) 00295 #define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) 00296 #define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) 00297 #define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) 00298 #define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) 00299 #define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) 00300 #define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) 00301 #define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) 00302 00303 #define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) 00304 #define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) 00305 #define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) 00306 #define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) 00307 #endif 00308 00309 #define FT_READ_MACRO( func, type, var ) \ 00310 ( var = (type)func( stream, &error ), \ 00311 error != FT_Err_Ok ) 00312 00313 #define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) 00314 #define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) 00315 #define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) 00316 #define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) 00317 #define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) 00318 #define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) 00319 #define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) 00320 #define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) 00321 00322 #define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) 00323 #define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) 00324 #define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) 00325 #define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) 00326 00327 00328 #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM 00329 00330 /* initialize a stream for reading a regular system stream */ 00331 FT_BASE( FT_Error ) 00332 FT_Stream_Open( FT_Stream stream, 00333 const char* filepathname ); 00334 00335 #endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ 00336 00337 00338 /* create a new (input) stream from an FT_Open_Args structure */ 00339 FT_BASE( FT_Error ) 00340 FT_Stream_New( FT_Library library, 00341 const FT_Open_Args* args, 00342 FT_Stream *astream ); 00343 00344 /* free a stream */ 00345 FT_BASE( void ) 00346 FT_Stream_Free( FT_Stream stream, 00347 FT_Int external ); 00348 00349 /* initialize a stream for reading in-memory data */ 00350 FT_BASE( void ) 00351 FT_Stream_OpenMemory( FT_Stream stream, 00352 const FT_Byte* base, 00353 FT_ULong size ); 00354 00355 /* close a stream (does not destroy the stream structure) */ 00356 FT_BASE( void ) 00357 FT_Stream_Close( FT_Stream stream ); 00358 00359 00360 /* seek within a stream. position is relative to start of stream */ 00361 FT_BASE( FT_Error ) 00362 FT_Stream_Seek( FT_Stream stream, 00363 FT_ULong pos ); 00364 00365 /* skip bytes in a stream */ 00366 FT_BASE( FT_Error ) 00367 FT_Stream_Skip( FT_Stream stream, 00368 FT_Long distance ); 00369 00370 /* return current stream position */ 00371 FT_BASE( FT_Long ) 00372 FT_Stream_Pos( FT_Stream stream ); 00373 00374 /* read bytes from a stream into a user-allocated buffer, returns an */ 00375 /* error if not all bytes could be read. */ 00376 FT_BASE( FT_Error ) 00377 FT_Stream_Read( FT_Stream stream, 00378 FT_Byte* buffer, 00379 FT_ULong count ); 00380 00381 /* read bytes from a stream at a given position */ 00382 FT_BASE( FT_Error ) 00383 FT_Stream_ReadAt( FT_Stream stream, 00384 FT_ULong pos, 00385 FT_Byte* buffer, 00386 FT_ULong count ); 00387 00388 /* try to read bytes at the end of a stream; return number of bytes */ 00389 /* really available */ 00390 FT_BASE( FT_ULong ) 00391 FT_Stream_TryRead( FT_Stream stream, 00392 FT_Byte* buffer, 00393 FT_ULong count ); 00394 00395 /* Enter a frame of `count' consecutive bytes in a stream. Returns an */ 00396 /* error if the frame could not be read/accessed. The caller can use */ 00397 /* the FT_Stream_Get_XXX functions to retrieve frame data without */ 00398 /* error checks. */ 00399 /* */ 00400 /* You must _always_ call FT_Stream_ExitFrame() once you have entered */ 00401 /* a stream frame! */ 00402 /* */ 00403 FT_BASE( FT_Error ) 00404 FT_Stream_EnterFrame( FT_Stream stream, 00405 FT_ULong count ); 00406 00407 /* exit a stream frame */ 00408 FT_BASE( void ) 00409 FT_Stream_ExitFrame( FT_Stream stream ); 00410 00411 /* Extract a stream frame. If the stream is disk-based, a heap block */ 00412 /* is allocated and the frame bytes are read into it. If the stream */ 00413 /* is memory-based, this function simply set a pointer to the data. */ 00414 /* */ 00415 /* Useful to optimize access to memory-based streams transparently. */ 00416 /* */ 00417 /* All extracted frames must be `freed' with a call to the function */ 00418 /* FT_Stream_ReleaseFrame(). */ 00419 /* */ 00420 FT_BASE( FT_Error ) 00421 FT_Stream_ExtractFrame( FT_Stream stream, 00422 FT_ULong count, 00423 FT_Byte** pbytes ); 00424 00425 /* release an extract frame (see FT_Stream_ExtractFrame) */ 00426 FT_BASE( void ) 00427 FT_Stream_ReleaseFrame( FT_Stream stream, 00428 FT_Byte** pbytes ); 00429 00430 /* read a byte from an entered frame */ 00431 FT_BASE( FT_Char ) 00432 FT_Stream_GetChar( FT_Stream stream ); 00433 00434 /* read a 16-bit big-endian integer from an entered frame */ 00435 FT_BASE( FT_Short ) 00436 FT_Stream_GetShort( FT_Stream stream ); 00437 00438 /* read a 24-bit big-endian integer from an entered frame */ 00439 FT_BASE( FT_Long ) 00440 FT_Stream_GetOffset( FT_Stream stream ); 00441 00442 /* read a 32-bit big-endian integer from an entered frame */ 00443 FT_BASE( FT_Long ) 00444 FT_Stream_GetLong( FT_Stream stream ); 00445 00446 /* read a 16-bit little-endian integer from an entered frame */ 00447 FT_BASE( FT_Short ) 00448 FT_Stream_GetShortLE( FT_Stream stream ); 00449 00450 /* read a 32-bit little-endian integer from an entered frame */ 00451 FT_BASE( FT_Long ) 00452 FT_Stream_GetLongLE( FT_Stream stream ); 00453 00454 00455 /* read a byte from a stream */ 00456 FT_BASE( FT_Char ) 00457 FT_Stream_ReadChar( FT_Stream stream, 00458 FT_Error* error ); 00459 00460 /* read a 16-bit big-endian integer from a stream */ 00461 FT_BASE( FT_Short ) 00462 FT_Stream_ReadShort( FT_Stream stream, 00463 FT_Error* error ); 00464 00465 /* read a 24-bit big-endian integer from a stream */ 00466 FT_BASE( FT_Long ) 00467 FT_Stream_ReadOffset( FT_Stream stream, 00468 FT_Error* error ); 00469 00470 /* read a 32-bit big-endian integer from a stream */ 00471 FT_BASE( FT_Long ) 00472 FT_Stream_ReadLong( FT_Stream stream, 00473 FT_Error* error ); 00474 00475 /* read a 16-bit little-endian integer from a stream */ 00476 FT_BASE( FT_Short ) 00477 FT_Stream_ReadShortLE( FT_Stream stream, 00478 FT_Error* error ); 00479 00480 /* read a 32-bit little-endian integer from a stream */ 00481 FT_BASE( FT_Long ) 00482 FT_Stream_ReadLongLE( FT_Stream stream, 00483 FT_Error* error ); 00484 00485 /* Read a structure from a stream. The structure must be described */ 00486 /* by an array of FT_Frame_Field records. */ 00487 FT_BASE( FT_Error ) 00488 FT_Stream_ReadFields( FT_Stream stream, 00489 const FT_Frame_Field* fields, 00490 void* structure ); 00491 00492 00493 #define FT_STREAM_POS() \ 00494 FT_Stream_Pos( stream ) 00495 00496 #define FT_STREAM_SEEK( position ) \ 00497 FT_SET_ERROR( FT_Stream_Seek( stream, position ) ) 00498 00499 #define FT_STREAM_SKIP( distance ) \ 00500 FT_SET_ERROR( FT_Stream_Skip( stream, distance ) ) 00501 00502 #define FT_STREAM_READ( buffer, count ) \ 00503 FT_SET_ERROR( FT_Stream_Read( stream, \ 00504 (FT_Byte*)buffer, \ 00505 count ) ) 00506 00507 #define FT_STREAM_READ_AT( position, buffer, count ) \ 00508 FT_SET_ERROR( FT_Stream_ReadAt( stream, \ 00509 position, \ 00510 (FT_Byte*)buffer, \ 00511 count ) ) 00512 00513 #define FT_STREAM_READ_FIELDS( fields, object ) \ 00514 FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) 00515 00516 00517 #define FT_FRAME_ENTER( size ) \ 00518 FT_SET_ERROR( \ 00519 FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) ) 00520 00521 #define FT_FRAME_EXIT() \ 00522 FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) ) 00523 00524 #define FT_FRAME_EXTRACT( size, bytes ) \ 00525 FT_SET_ERROR( \ 00526 FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \ 00527 (FT_Byte**)&(bytes) ) ) ) 00528 00529 #define FT_FRAME_RELEASE( bytes ) \ 00530 FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \ 00531 (FT_Byte**)&(bytes) ) ) 00532 00533 00534 FT_END_HEADER 00535 00536 #endif /* __FTSTREAM_H__ */ 00537 00538 00539 /* END */ Generated on Sun May 27 2012 04:33:32 for ReactOS by
1.7.6.1
|