⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftstream.h

📁 一个Xpdf应用的例子
💻 H
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************//*                                                                         *//*  ftstream.h                                                             *//*                                                                         *//*    Stream handling(specification).                                      *//*                                                                         *//*  Copyright 1996-2001 by                                                 *//*  David Turner, Robert Wilhelm, and Werner Lemberg.                      *//*                                                                         *//*  This file is part of the FreeType project, and may only be used,       *//*  modified, and distributed under the terms of the FreeType project      *//*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     *//*  this file you indicate that you have read the license and              *//*  understand and accept it fully.                                        *//*                                                                         *//***************************************************************************/#ifndef __FTSTREAM_H__#define __FTSTREAM_H__#include <ft2build.h>#include FT_INTERNAL_OBJECTS_HFT_BEGIN_HEADER  /* format of an 8-bit frame_op value = [ xxxxx | e | s ] */  /* s is set to 1 if the value is signed,                 */  /* e is set to 1 if the value is little-endian           */  /* xxxxx is a command                                    */#define FT_FRAME_OP_SHIFT         2#define FT_FRAME_OP_SIGNED        1#define FT_FRAME_OP_LITTLE        2#define FT_FRAME_OP_COMMAND( x )  ( x >> FT_FRAME_OP_SHIFT )#define FT_MAKE_FRAME_OP( command, little, sign ) \          ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )#define FT_FRAME_OP_END   0#define FT_FRAME_OP_START 1  /* start a new frame     */#define FT_FRAME_OP_BYTE  2  /* read 1-byte value     */#define FT_FRAME_OP_SHORT 3  /* read 2-byte value     */#define FT_FRAME_OP_LONG  4  /* read 4-byte value     */#define FT_FRAME_OP_OFF3  5  /* read 3-byte value     */#define FT_FRAME_OP_BYTES 6  /* read a bytes sequence */  typedef enum  FT_Frame_Op_  {    ft_frame_end       = 0,    ft_frame_start     = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),    ft_frame_byte      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 0 ),    ft_frame_schar     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 1 ),    ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),    ft_frame_short_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),    ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),    ft_frame_short_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),    ft_frame_ulong_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),    ft_frame_long_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),    ft_frame_ulong_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),    ft_frame_long_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),    ft_frame_uoff3_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),    ft_frame_off3_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),    ft_frame_uoff3_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),    ft_frame_off3_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),    ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),    ft_frame_skip      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )  } FT_Frame_Op;  typedef struct  FT_Frame_Field_  {    FT_Byte      value;    FT_Byte      size;    FT_UShort    offset;  } FT_Frame_Field;  /* Construct an FT_Frame_Field out of a structure type and a field name. */  /* The structure type must be set in the FT_STRUCTURE macro before       */  /* calling the FT_FRAME_START() macro.                                   */#define FT_FIELD_SIZE( f ) \          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )#define FT_FIELD_SIZE_DELTA( f ) \          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )#define FT_FIELD_OFFSET( f ) \          (FT_UShort)( offsetof( FT_STRUCTURE, f ) )#define FT_FRAME_FIELD( frame_op, field ) \          {                               \            frame_op,                     \            FT_FIELD_SIZE( field ),       \            FT_FIELD_OFFSET( field )      \          }#define FT_MAKE_EMPTY_FIELD( frame_op )  { frame_op, 0, 0 }#define FT_FRAME_START( size )   { ft_frame_start, 0, size }#define FT_FRAME_END             { ft_frame_end, 0, 0 }#define FT_FRAME_LONG( f )       FT_FRAME_FIELD( ft_frame_long_be, f )#define FT_FRAME_ULONG( f )      FT_FRAME_FIELD( ft_frame_ulong_be, f )#define FT_FRAME_SHORT( f )      FT_FRAME_FIELD( ft_frame_short_be, f )#define FT_FRAME_USHORT( f )     FT_FRAME_FIELD( ft_frame_ushort_be, f )#define FT_FRAME_BYTE( f )       FT_FRAME_FIELD( ft_frame_byte, f )#define FT_FRAME_CHAR( f )       FT_FRAME_FIELD( ft_frame_schar, f )#define FT_FRAME_LONG_LE( f )    FT_FRAME_FIELD( ft_frame_long_le, f )#define FT_FRAME_ULONG_LE( f )   FT_FRAME_FIELD( ft_frame_ulong_le, f )#define FT_FRAME_SHORT_LE( f )   FT_FRAME_FIELD( ft_frame_short_le, f )#define FT_FRAME_USHORT_LE( f )  FT_FRAME_FIELD( ft_frame_ushort_le, f )#define FT_FRAME_SKIP_LONG       { ft_frame_long_be, 0, 0 }#define FT_FRAME_SKIP_SHORT      { ft_frame_short_be, 0, 0 }#define FT_FRAME_SKIP_BYTE       { ft_frame_byte, 0, 0 }#define FT_FRAME_BYTES( field, count ) \          {                            \            ft_frame_bytes,            \            count,                     \            FT_FIELD_OFFSET( field )   \          }#define FT_FRAME_SKIP_BYTES( count )  { ft_frame_skip, count, 0 }  /*************************************************************************/  /*                                                                       */  /* integer extraction macros -- the `buffer' parameter must ALWAYS be of */  /* type `char*' or equivalent (1-byte elements).                         */  /*                                                                       */#define FT_GET_SHORT_BE( p )                                   \          ((FT_Int16)( ( (FT_Int16)(FT_Char)(p)[0] <<  8 ) |   \                         (FT_Int16)(FT_Byte)(p)[1]         ) )#define FT_GET_USHORT_BE( p )                                   \          ((FT_Int16)( ( (FT_UInt16)(FT_Byte)(p)[0] <<  8 ) |   \                         (FT_UInt16)(FT_Byte)(p)[1]         ) )#define FT_GET_OFF3_BE( p )                                      \          ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[0] << 16 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_Int32)(FT_Byte)(p)[2]         ) )#define FT_GET_UOFF3_BE( p )                                      \          ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[0] << 16 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_UInt32)(FT_Byte)(p)[2]         ) )#define FT_GET_LONG_BE( p )                                      \          ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[0] << 24 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[1] << 16 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[2] <<  8 ) |   \                           (FT_Int32)(FT_Byte)(p)[3]         ) )#define FT_GET_ULONG_BE( p )                                      \          ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[0] << 24 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[1] << 16 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[2] <<  8 ) |   \                           (FT_UInt32)(FT_Byte)(p)[3]         ) )#define FT_GET_SHORT_LE( p )                                   \          ((FT_Int16)( ( (FT_Int16)(FT_Char)(p)[1] <<  8 ) |   \                         (FT_Int16)(FT_Byte)(p)[0]         ) )#define FT_GET_USHORT_LE( p )                                   \          ((FT_Int16)( ( (FT_UInt16)(FT_Byte)(p)[1] <<  8 ) |   \                         (FT_UInt16)(FT_Byte)(p)[0]         ) )#define FT_GET_OFF3_LE( p )                                      \          ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[2] << 16 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_Int32)(FT_Byte)(p)[0]         ) )#define FT_GET_UOFF3_LE( p )                                      \          ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[2] << 16 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_UInt32)(FT_Byte)(p)[0]         ) )#define FT_GET_LONG_LE( p )                                      \          ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[3] << 24 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[2] << 16 ) |   \                         ( (FT_Int32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_Int32)(FT_Byte)(p)[0]         ) )#define FT_GET_ULONG_LE( p )                                      \          ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[3] << 24 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[2] << 16 ) |   \                         ( (FT_UInt32)(FT_Byte)(p)[1] <<  8 ) |   \                           (FT_UInt32)(FT_Byte)(p)[0]         ) )#define NEXT_Char( buffer )          \          ( (signed char)*buffer++ )#define NEXT_Byte( buffer )            \          ( (unsigned char)*buffer++ )#define NEXT_Short( buffer )                                        \          ( (short)( buffer += 2, FT_GET_SHORT_BE( buffer - 2 ) ) )#define NEXT_UShort( buffer )                                                 \          ( (unsigned short)( buffer += 2, FT_GET_USHORT_BE( buffer - 2 ) ) )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -