misc/libfreetype/include/freetype/internal/ftstream.h
author koda
Mon, 25 Apr 2011 01:46:54 +0200
changeset 5172 88f2e05288ba
permissions -rw-r--r--
aaand let's add freetype as well while we are at it other smaller changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ftstream.h                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    Stream handling (specification).                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 1996-2002, 2004-2006, 2011 by                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#ifndef __FTSTREAM_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#define __FTSTREAM_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include FT_SYSTEM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  /* format of an 8-bit frame_op value:           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  /*                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /* bit  76543210                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /*      xxxxxxes                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  /*                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  /* s is set to 1 if the value is signed.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  /* e is set to 1 if the value is little-endian. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  /* xxx is a command.                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
#define FT_FRAME_OP_SHIFT         2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#define FT_FRAME_OP_SIGNED        1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
#define FT_FRAME_OP_LITTLE        2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
#define FT_FRAME_OP_COMMAND( x )  ( x >> FT_FRAME_OP_SHIFT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
#define FT_MAKE_FRAME_OP( command, little, sign ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
          ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
#define FT_FRAME_OP_END    0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
#define FT_FRAME_OP_START  1  /* start a new frame     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
#define FT_FRAME_OP_BYTE   2  /* read 1-byte value     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
#define FT_FRAME_OP_SHORT  3  /* read 2-byte value     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
#define FT_FRAME_OP_LONG   4  /* read 4-byte value     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
#define FT_FRAME_OP_OFF3   5  /* read 3-byte value     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
#define FT_FRAME_OP_BYTES  6  /* read a bytes sequence */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  typedef enum  FT_Frame_Op_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    ft_frame_end       = 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    ft_frame_start     = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    ft_frame_byte      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    ft_frame_schar     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE,  0, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    ft_frame_short_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    ft_frame_short_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    ft_frame_ulong_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    ft_frame_long_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    ft_frame_ulong_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    ft_frame_long_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    ft_frame_uoff3_be  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    ft_frame_off3_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    ft_frame_uoff3_le  = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    ft_frame_off3_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    ft_frame_skip      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  } FT_Frame_Op;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  typedef struct  FT_Frame_Field_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    FT_Byte    value;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    FT_Byte    size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    FT_UShort  offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  } FT_Frame_Field;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  /* Construct an FT_Frame_Field out of a structure type and a field name. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  /* The structure type must be set in the FT_STRUCTURE macro before       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /* calling the FT_FRAME_START() macro.                                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
#define FT_FIELD_SIZE( f ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
#define FT_FIELD_SIZE_DELTA( f ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
          (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
#define FT_FIELD_OFFSET( f ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
          (FT_UShort)( offsetof( FT_STRUCTURE, f ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
#define FT_FRAME_FIELD( frame_op, field ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
          {                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
            frame_op,                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
            FT_FIELD_SIZE( field ),       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
            FT_FIELD_OFFSET( field )      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
#define FT_MAKE_EMPTY_FIELD( frame_op )  { frame_op, 0, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
#define FT_FRAME_START( size )   { ft_frame_start, 0, size }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
#define FT_FRAME_END             { ft_frame_end, 0, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
#define FT_FRAME_LONG( f )       FT_FRAME_FIELD( ft_frame_long_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
#define FT_FRAME_ULONG( f )      FT_FRAME_FIELD( ft_frame_ulong_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
#define FT_FRAME_SHORT( f )      FT_FRAME_FIELD( ft_frame_short_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
#define FT_FRAME_USHORT( f )     FT_FRAME_FIELD( ft_frame_ushort_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
#define FT_FRAME_OFF3( f )       FT_FRAME_FIELD( ft_frame_off3_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
#define FT_FRAME_UOFF3( f )      FT_FRAME_FIELD( ft_frame_uoff3_be, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
#define FT_FRAME_BYTE( f )       FT_FRAME_FIELD( ft_frame_byte, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
#define FT_FRAME_CHAR( f )       FT_FRAME_FIELD( ft_frame_schar, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
#define FT_FRAME_LONG_LE( f )    FT_FRAME_FIELD( ft_frame_long_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
#define FT_FRAME_ULONG_LE( f )   FT_FRAME_FIELD( ft_frame_ulong_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
#define FT_FRAME_SHORT_LE( f )   FT_FRAME_FIELD( ft_frame_short_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
#define FT_FRAME_USHORT_LE( f )  FT_FRAME_FIELD( ft_frame_ushort_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
#define FT_FRAME_OFF3_LE( f )    FT_FRAME_FIELD( ft_frame_off3_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
#define FT_FRAME_UOFF3_LE( f )   FT_FRAME_FIELD( ft_frame_uoff3_le, f )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
#define FT_FRAME_SKIP_LONG       { ft_frame_long_be, 0, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
#define FT_FRAME_SKIP_SHORT      { ft_frame_short_be, 0, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
#define FT_FRAME_SKIP_BYTE       { ft_frame_byte, 0, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
#define FT_FRAME_BYTES( field, count ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
          {                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
            ft_frame_bytes,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
            count,                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
            FT_FIELD_OFFSET( field )   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
#define FT_FRAME_SKIP_BYTES( count )  { ft_frame_skip, count, 0 }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
  /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
  /* type `char*' or equivalent (1-byte elements).                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
#define FT_BYTE_( p, i )  ( ((const FT_Byte*)(p))[(i)] )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
#define FT_INT8_( p, i )  ( ((const FT_Char*)(p))[(i)] )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
#define FT_INT16( x )   ( (FT_Int16)(x)  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
#define FT_UINT16( x )  ( (FT_UInt16)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
#define FT_INT32( x )   ( (FT_Int32)(x)  )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
#define FT_UINT32( x )  ( (FT_UInt32)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
#define FT_BYTE_I16( p, i, s )  ( FT_INT16(  FT_BYTE_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
#define FT_BYTE_U16( p, i, s )  ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
#define FT_BYTE_I32( p, i, s )  ( FT_INT32(  FT_BYTE_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
#define FT_BYTE_U32( p, i, s )  ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
#define FT_INT8_I16( p, i, s )  ( FT_INT16(  FT_INT8_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
#define FT_INT8_U16( p, i, s )  ( FT_UINT16( FT_INT8_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
#define FT_INT8_I32( p, i, s )  ( FT_INT32(  FT_INT8_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
#define FT_INT8_U32( p, i, s )  ( FT_UINT32( FT_INT8_( p, i ) ) << (s) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
#define FT_PEEK_SHORT( p )  FT_INT16( FT_INT8_I16( p, 0, 8) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
                                      FT_BYTE_I16( p, 1, 0) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
#define FT_PEEK_USHORT( p )  FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
                                        FT_BYTE_U16( p, 1, 0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
#define FT_PEEK_LONG( p )  FT_INT32( FT_INT8_I32( p, 0, 24 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
                                     FT_BYTE_I32( p, 1, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
                                     FT_BYTE_I32( p, 2,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
                                     FT_BYTE_I32( p, 3,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
#define FT_PEEK_ULONG( p )  FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
                                       FT_BYTE_U32( p, 1, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
                                       FT_BYTE_U32( p, 2,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
                                       FT_BYTE_U32( p, 3,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
#define FT_PEEK_OFF3( p )  FT_INT32( FT_INT8_I32( p, 0, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
                                     FT_BYTE_I32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
                                     FT_BYTE_I32( p, 2,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
#define FT_PEEK_UOFF3( p )  FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
                                       FT_BYTE_U32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
                                       FT_BYTE_U32( p, 2,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
#define FT_PEEK_SHORT_LE( p )  FT_INT16( FT_INT8_I16( p, 1, 8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
                                         FT_BYTE_I16( p, 0, 0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
#define FT_PEEK_USHORT_LE( p )  FT_UINT16( FT_BYTE_U16( p, 1, 8 ) |  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
                                           FT_BYTE_U16( p, 0, 0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
#define FT_PEEK_LONG_LE( p )  FT_INT32( FT_INT8_I32( p, 3, 24 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
                                        FT_BYTE_I32( p, 2, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
                                        FT_BYTE_I32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
                                        FT_BYTE_I32( p, 0,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
#define FT_PEEK_ULONG_LE( p )  FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
                                          FT_BYTE_U32( p, 2, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
                                          FT_BYTE_U32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
                                          FT_BYTE_U32( p, 0,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
#define FT_PEEK_OFF3_LE( p )  FT_INT32( FT_INT8_I32( p, 2, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
                                        FT_BYTE_I32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
                                        FT_BYTE_I32( p, 0,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
#define FT_PEEK_UOFF3_LE( p )  FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
                                          FT_BYTE_U32( p, 1,  8 ) | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
                                          FT_BYTE_U32( p, 0,  0 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
#define FT_NEXT_CHAR( buffer )       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
          ( (signed char)*buffer++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
#define FT_NEXT_BYTE( buffer )         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
          ( (unsigned char)*buffer++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
#define FT_NEXT_SHORT( buffer )                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
          ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
#define FT_NEXT_USHORT( buffer )                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
#define FT_NEXT_OFF3( buffer )                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
          ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
#define FT_NEXT_UOFF3( buffer )                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
#define FT_NEXT_LONG( buffer )                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
          ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
#define FT_NEXT_ULONG( buffer )                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
#define FT_NEXT_SHORT_LE( buffer )                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
          ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
#define FT_NEXT_USHORT_LE( buffer )                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
          ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
#define FT_NEXT_OFF3_LE( buffer )                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
          ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
#define FT_NEXT_UOFF3_LE( buffer )                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
          ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
#define FT_NEXT_LONG_LE( buffer )                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
          ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
#define FT_NEXT_ULONG_LE( buffer )                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
          ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  /* Each GET_xxxx() macro uses an implicit `stream' variable.             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
#if 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
#define FT_GET_MACRO( type )    FT_NEXT_ ## type ( stream->cursor )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
#define FT_GET_CHAR()       FT_GET_MACRO( CHAR )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
#define FT_GET_BYTE()       FT_GET_MACRO( BYTE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
#define FT_GET_SHORT()      FT_GET_MACRO( SHORT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
#define FT_GET_USHORT()     FT_GET_MACRO( USHORT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
#define FT_GET_OFF3()       FT_GET_MACRO( OFF3 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
#define FT_GET_UOFF3()      FT_GET_MACRO( UOFF3 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
#define FT_GET_LONG()       FT_GET_MACRO( LONG )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
#define FT_GET_ULONG()      FT_GET_MACRO( ULONG )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
#define FT_GET_TAG4()       FT_GET_MACRO( ULONG )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
#define FT_GET_SHORT_LE()   FT_GET_MACRO( SHORT_LE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
#define FT_GET_USHORT_LE()  FT_GET_MACRO( USHORT_LE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
#define FT_GET_LONG_LE()    FT_GET_MACRO( LONG_LE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
#define FT_GET_ULONG_LE()   FT_GET_MACRO( ULONG_LE )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
#define FT_GET_MACRO( func, type )        ( (type)func( stream ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
#define FT_GET_CHAR()       FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
#define FT_GET_BYTE()       FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
#define FT_GET_SHORT()      FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
#define FT_GET_USHORT()     FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
#define FT_GET_OFF3()       FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
#define FT_GET_UOFF3()      FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
#define FT_GET_LONG()       FT_GET_MACRO( FT_Stream_GetULong, FT_Long )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
#define FT_GET_ULONG()      FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
#define FT_GET_TAG4()       FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
#define FT_GET_USHORT_LE()  FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
#define FT_GET_LONG_LE()    FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
#define FT_GET_ULONG_LE()   FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
#define FT_READ_MACRO( func, type, var )        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
          ( var = (type)func( stream, &error ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
            error != FT_Err_Ok )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
#define FT_READ_BYTE( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
#define FT_READ_CHAR( var )       FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
#define FT_READ_SHORT( var )      FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
#define FT_READ_USHORT( var )     FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
#define FT_READ_OFF3( var )       FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
#define FT_READ_UOFF3( var )      FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
#define FT_READ_LONG( var )       FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
#define FT_READ_ULONG( var )      FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
#define FT_READ_SHORT_LE( var )   FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
#define FT_READ_USHORT_LE( var )  FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
#define FT_READ_LONG_LE( var )    FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
#define FT_READ_ULONG_LE( var )   FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
  /* initialize a stream for reading a regular system stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
  FT_Stream_Open( FT_Stream    stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
                  const char*  filepathname );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
  /* create a new (input) stream from an FT_Open_Args structure */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
  FT_Stream_New( FT_Library           library,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
                 const FT_Open_Args*  args,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
                 FT_Stream           *astream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
  /* free a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  FT_Stream_Free( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
                  FT_Int     external );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
  /* initialize a stream for reading in-memory data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
  FT_Stream_OpenMemory( FT_Stream       stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
                        const FT_Byte*  base,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
                        FT_ULong        size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
  /* close a stream (does not destroy the stream structure) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
  FT_Stream_Close( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
  /* seek within a stream. position is relative to start of stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
  FT_Stream_Seek( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
                  FT_ULong   pos );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
  /* skip bytes in a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
  FT_Stream_Skip( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
                  FT_Long    distance );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
  /* return current stream position */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
  FT_BASE( FT_Long )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
  FT_Stream_Pos( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
  /* read bytes from a stream into a user-allocated buffer, returns an */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
  /* error if not all bytes could be read.                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
  FT_Stream_Read( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
                  FT_Byte*   buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
                  FT_ULong   count );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
  /* read bytes from a stream at a given position */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
  FT_Stream_ReadAt( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
                    FT_ULong   pos,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
                    FT_Byte*   buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
                    FT_ULong   count );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
  /* try to read bytes at the end of a stream; return number of bytes */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
  /* really available                                                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
  FT_Stream_TryRead( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
                     FT_Byte*   buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
                     FT_ULong   count );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
  /* Enter a frame of `count' consecutive bytes in a stream.  Returns an */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
  /* error if the frame could not be read/accessed.  The caller can use  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
  /* the FT_Stream_Get_XXX functions to retrieve frame data without      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
  /* error checks.                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
  /*                                                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
  /* You must _always_ call FT_Stream_ExitFrame() once you have entered  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
  /* a stream frame!                                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
  /*                                                                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
  FT_Stream_EnterFrame( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
                        FT_ULong   count );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
  /* exit a stream frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
  FT_Stream_ExitFrame( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
  /* Extract a stream frame.  If the stream is disk-based, a heap block */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
  /* is allocated and the frame bytes are read into it.  If the stream  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
  /* is memory-based, this function simply set a pointer to the data.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
  /*                                                                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
  /* Useful to optimize access to memory-based streams transparently.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
  /*                                                                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
  /* All extracted frames must be `freed' with a call to the function   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
  /* FT_Stream_ReleaseFrame().                                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
  /*                                                                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
  FT_Stream_ExtractFrame( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
                          FT_ULong   count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
                          FT_Byte**  pbytes );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
  /* release an extract frame (see FT_Stream_ExtractFrame) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
  FT_Stream_ReleaseFrame( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
                          FT_Byte**  pbytes );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
  /* read a byte from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
  FT_BASE( FT_Char )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
  FT_Stream_GetChar( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
  /* read a 16-bit big-endian unsigned integer from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
  FT_BASE( FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
  FT_Stream_GetUShort( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
  /* read a 24-bit big-endian unsigned integer from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
  FT_Stream_GetUOffset( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
  /* read a 32-bit big-endian unsigned integer from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
  FT_Stream_GetULong( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
  /* read a 16-bit little-endian unsigned integer from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
  FT_BASE( FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
  FT_Stream_GetUShortLE( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
  /* read a 32-bit little-endian unsigned integer from an entered frame */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
  FT_Stream_GetULongLE( FT_Stream  stream );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
  /* read a byte from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
  FT_BASE( FT_Char )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
  FT_Stream_ReadChar( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
                      FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
  /* read a 16-bit big-endian unsigned integer from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
  FT_BASE( FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
  FT_Stream_ReadUShort( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
                        FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
  /* read a 24-bit big-endian unsigned integer from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
  FT_Stream_ReadUOffset( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
                         FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
  /* read a 32-bit big-endian integer from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
  FT_Stream_ReadULong( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
                       FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
  /* read a 16-bit little-endian unsigned integer from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
  FT_BASE( FT_UShort )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
  FT_Stream_ReadUShortLE( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
                          FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   479
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
  /* read a 32-bit little-endian unsigned integer from a stream */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
  FT_BASE( FT_ULong )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   482
  FT_Stream_ReadULongLE( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   483
                         FT_Error*  error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
  /* Read a structure from a stream.  The structure must be described */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
  /* by an array of FT_Frame_Field records.                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
  FT_Stream_ReadFields( FT_Stream              stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
                        const FT_Frame_Field*  fields,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
                        void*                  structure );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   491
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   492
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   493
#define FT_STREAM_POS()           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
          FT_Stream_Pos( stream )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   495
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   496
#define FT_STREAM_SEEK( position )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   497
          FT_SET_ERROR( FT_Stream_Seek( stream, position ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   498
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
#define FT_STREAM_SKIP( distance )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
          FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   501
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   502
#define FT_STREAM_READ( buffer, count )                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
          FT_SET_ERROR( FT_Stream_Read( stream,           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   504
                                        (FT_Byte*)buffer, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   505
                                        count ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
#define FT_STREAM_READ_AT( position, buffer, count )         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
          FT_SET_ERROR( FT_Stream_ReadAt( stream,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   509
                                           position,         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   510
                                           (FT_Byte*)buffer, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
                                           count ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
#define FT_STREAM_READ_FIELDS( fields, object )                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
          FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
#define FT_FRAME_ENTER( size )                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
          FT_SET_ERROR(                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
            FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
#define FT_FRAME_EXIT()                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
          FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
#define FT_FRAME_EXTRACT( size, bytes )                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
          FT_SET_ERROR(                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
            FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size,             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
                                                    (FT_Byte**)&(bytes) ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   528
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   529
#define FT_FRAME_RELEASE( bytes )                                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
          FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream,                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   531
                                                  (FT_Byte**)&(bytes) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   532
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   533
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   536
#endif /* __FTSTREAM_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   537
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
/* END */