misc/libfreetype/src/otvalid/otvbase.c
author sheepluva
Thu, 03 May 2012 13:25:40 +0200
changeset 7015 08642c7da4a3
parent 5172 88f2e05288ba
permissions -rw-r--r--
add DLC button to net game room
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
/*  otvbase.c                                                              */
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
/*    OpenType BASE table validation (body).                               */
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 2004, 2007 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
#include "otvalid.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include "otvcommn.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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
#define FT_COMPONENT  trace_otvbase
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  otv_BaseCoord_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
                          OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
    FT_UInt   BaseCoordFormat;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
    OTV_NAME_ENTER( "BaseCoord" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
    OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
    BaseCoordFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    p += 2;     /* skip Coordinate */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
    OTV_TRACE(( " (format %d)\n", BaseCoordFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    switch ( BaseCoordFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    case 1:     /* BaseCoordFormat1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
    case 2:     /* BaseCoordFormat2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
      OTV_LIMIT_CHECK( 4 );   /* ReferenceGlyph, BaseCoordPoint */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    case 3:     /* BaseCoordFormat3 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
      OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
      /* DeviceTable */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
      otv_Device_validate( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    OTV_EXIT;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  otv_BaseTagList_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
                            OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    FT_UInt   BaseTagCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
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
    OTV_NAME_ENTER( "BaseTagList" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    BaseTagCount = FT_NEXT_USHORT( p );
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
    OTV_TRACE(( " (BaseTagCount = %d)\n", BaseTagCount ));
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
    OTV_LIMIT_CHECK( BaseTagCount * 4 );          /* BaselineTag */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    OTV_EXIT;
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
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  otv_BaseValues_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
    FT_UInt   BaseCoordCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
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
    OTV_NAME_ENTER( "BaseValues" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
    OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
    p             += 2;                     /* skip DefaultIndex */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    BaseCoordCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
    OTV_TRACE(( " (BaseCoordCount = %d)\n", BaseCoordCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    OTV_LIMIT_CHECK( BaseCoordCount * 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    /* BaseCoord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    for ( ; BaseCoordCount > 0; BaseCoordCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
      otv_BaseCoord_validate( table + FT_NEXT_USHORT( p ), valid );
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
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
  otv_MinMax_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
                       OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
    FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
    FT_UInt   FeatMinMaxCount;
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
    OTV_OPTIONAL_TABLE( MinCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
    OTV_OPTIONAL_TABLE( MaxCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
    OTV_NAME_ENTER( "MinMax" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    OTV_OPTIONAL_OFFSET( MinCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    OTV_OPTIONAL_OFFSET( MaxCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    FeatMinMaxCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    OTV_TRACE(( " (FeatMinMaxCount = %d)\n", FeatMinMaxCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
    table_size = FeatMinMaxCount * 8 + 6;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
    OTV_SIZE_CHECK( MinCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
    if ( MinCoord )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
      otv_BaseCoord_validate( table + MinCoord, valid );
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
    OTV_SIZE_CHECK( MaxCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    if ( MaxCoord )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
      otv_BaseCoord_validate( table + MaxCoord, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    OTV_LIMIT_CHECK( FeatMinMaxCount * 8 );
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
    /* FeatMinMaxRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    for ( ; FeatMinMaxCount > 0; FeatMinMaxCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
      p += 4;                           /* skip FeatureTableTag */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
      OTV_OPTIONAL_OFFSET( MinCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
      OTV_OPTIONAL_OFFSET( MaxCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
      OTV_SIZE_CHECK( MinCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
      if ( MinCoord )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
        otv_BaseCoord_validate( table + MinCoord, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
      OTV_SIZE_CHECK( MaxCoord );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
      if ( MaxCoord )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
        otv_BaseCoord_validate( table + MaxCoord, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
    OTV_EXIT;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  otv_BaseScript_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
    FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    FT_UInt   BaseLangSysCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    OTV_OPTIONAL_TABLE( BaseValues    );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
    OTV_OPTIONAL_TABLE( DefaultMinMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    OTV_NAME_ENTER( "BaseScript" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
    OTV_OPTIONAL_OFFSET( BaseValues    );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
    OTV_OPTIONAL_OFFSET( DefaultMinMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
    BaseLangSysCount = FT_NEXT_USHORT( p );
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
    OTV_TRACE(( " (BaseLangSysCount = %d)\n", BaseLangSysCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
    table_size = BaseLangSysCount * 6 + 6;
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
    OTV_SIZE_CHECK( BaseValues );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
    if ( BaseValues )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
      otv_BaseValues_validate( table + BaseValues, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
    OTV_SIZE_CHECK( DefaultMinMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
    if ( DefaultMinMax )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
      otv_MinMax_validate( table + DefaultMinMax, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
    OTV_LIMIT_CHECK( BaseLangSysCount * 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    /* BaseLangSysRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    for ( ; BaseLangSysCount > 0; BaseLangSysCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
      p += 4;       /* skip BaseLangSysTag */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
      otv_MinMax_validate( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
    OTV_EXIT;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
  otv_BaseScriptList_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
                               OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
    FT_UInt   BaseScriptCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    OTV_NAME_ENTER( "BaseScriptList" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
    BaseScriptCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
    OTV_TRACE(( " (BaseScriptCount = %d)\n", BaseScriptCount ));
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
    OTV_LIMIT_CHECK( BaseScriptCount * 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    /* BaseScriptRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    for ( ; BaseScriptCount > 0; BaseScriptCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
      p += 4;       /* skip BaseScriptTag */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
      /* BaseScript */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
      otv_BaseScript_validate( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
    OTV_EXIT;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
  otv_Axis_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
                     OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
    FT_UInt   table_size;
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
    OTV_OPTIONAL_TABLE( BaseTagList );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
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
    OTV_NAME_ENTER( "Axis" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
    OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
    OTV_OPTIONAL_OFFSET( BaseTagList );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
    table_size = 4;
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
    OTV_SIZE_CHECK( BaseTagList );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
    if ( BaseTagList )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
      otv_BaseTagList_validate( table + BaseTagList, valid );
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
    /* BaseScriptList */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    otv_BaseScriptList_validate( table + FT_NEXT_USHORT( p ), valid );
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
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
  otv_BASE_validate( FT_Bytes      table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
                     FT_Validator  ftvalid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
    OTV_ValidatorRec  validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
    OTV_Validator     valid = &validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
    FT_Bytes          p     = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
    FT_UInt           table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
    OTV_OPTIONAL_TABLE( HorizAxis );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
    OTV_OPTIONAL_TABLE( VertAxis  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
    valid->root = ftvalid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
    FT_TRACE3(( "validating BASE table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
    OTV_INIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
    table_size = 6;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
    OTV_OPTIONAL_OFFSET( HorizAxis );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    OTV_SIZE_CHECK( HorizAxis );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    if ( HorizAxis )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
      otv_Axis_validate( table + HorizAxis, valid );
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
    OTV_OPTIONAL_OFFSET( VertAxis );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
    OTV_SIZE_CHECK( VertAxis );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
    if ( VertAxis )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
      otv_Axis_validate( table + VertAxis, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
    FT_TRACE4(( "\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
/* END */