misc/libfreetype/include/freetype/internal/ftserv.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
/*  ftserv.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
/*    The FreeType services (specification only).                          */
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 2003, 2004, 2005, 2006, 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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
  /*  Each module can export one or more `services'.  Each service is      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
  /*  identified by a constant string and modeled by a pointer; the latter */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
  /*  generally corresponds to a structure containing function pointers.   */
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
  /*  Note that a service's data cannot be a mere function pointer because */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  /*  in C it is possible that function pointers might be implemented      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /*  differently than data pointers (e.g. 48 bits instead of 32).         */
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
  /*************************************************************************/
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
#ifndef __FTSERV_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#define __FTSERV_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
FT_BEGIN_HEADER
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
#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /* we disable the warning `conditional expression is constant' here */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  /* in order to compile cleanly with the maximum level of warnings   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#pragma warning( disable : 4127 )
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
#endif /* _MSC_VER */
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
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
   * @macro:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
   *   FT_FACE_FIND_SERVICE
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
   * @description:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
   *   This macro is used to look up a service from a face's driver module.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
   * @input:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
   *   face ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
   *     The source face handle.
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
   *   id ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
   *     A string describing the service as defined in the service's
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
   *     `multi-masters').  It is automatically prefixed with
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
   *     `FT_SERVICE_ID_'.
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
   * @output:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
   *   ptr ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
   *     A variable that receives the service pointer.  Will be NULL
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
   *     if not found.
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
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
  FT_BEGIN_STMNT                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    FT_Pointer   _tmp_  = NULL;                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                              \
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
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    if ( module->clazz->get_interface )                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    *_pptr_ = _tmp_;                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
#else /* !C++ */
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
#define FT_FACE_FIND_SERVICE( face, ptr, id )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  FT_BEGIN_STMNT                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    FT_Pointer  _tmp_  = NULL;                                              \
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
    if ( module->clazz->get_interface )                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
      _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    ptr = _tmp_;                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
  FT_END_STMNT
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
#endif /* !C++ */
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
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
   * @macro:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
   *   FT_FACE_FIND_GLOBAL_SERVICE
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
   * @description:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
   *   This macro is used to look up a service from all modules.
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
   * @input:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
   *   face ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
   *     The source face handle.
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
   *   id ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
   *     A string describing the service as defined in the service's
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
   *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
   *     `multi-masters').  It is automatically prefixed with
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
   *     `FT_SERVICE_ID_'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
   * @output:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
   *   ptr ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
   *     A variable that receives the service pointer.  Will be NULL
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
   *     if not found.
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
#ifdef __cplusplus
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
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
  FT_BEGIN_STMNT                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    FT_Pointer   _tmp_;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                     \
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
                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
    *_pptr_ = _tmp_;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
#else /* !C++ */
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
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
  FT_BEGIN_STMNT                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    FT_Pointer  _tmp_;                                             \
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
                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    ptr   = _tmp_;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
  FT_END_STMNT
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
#endif /* !C++ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
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
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
  /*****         S E R V I C E   D E S C R I P T O R S                 *****/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
   *  The following structure is used to _describe_ a given service
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
   *  to the library.  This is useful to build simple static service lists.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
  typedef struct  FT_ServiceDescRec_
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
    const char*  serv_id;     /* service name         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    const void*  serv_data;   /* service pointer/data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
  } FT_ServiceDescRec;
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
  typedef const FT_ServiceDescRec*  FT_ServiceDesc;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
  /* <Macro>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
  /*    FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6             */
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
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
  /*    Used to initialize an array of FT_ServiceDescRec structs.          */
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
  /*    When FT_CONFIG_OPTION_PIC is defined a Create funtion will need    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
  /*    to called with a pointer where the allocated array is returned.    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
  /*    And when it is no longer needed a Destroy function needs           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  /*    to be called to release that allocation.                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  /*    These functions should be manyally called from the pic_init and    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
  /*    pic_free functions of your module (see FT_DEFINE_MODULE)           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
  /*    When FT_CONFIG_OPTION_PIC is not defined the array will be         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
  /*    allocated in the global scope (or the scope where the macro        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
  /*    is used).                                                          */
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
#ifndef FT_CONFIG_OPTION_PIC
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
#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
  static const FT_ServiceDescRec class_[] =                                  \
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
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
  {NULL, NULL}                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
        serv_id_2, serv_data_2)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
  static const FT_ServiceDescRec class_[] =                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
  {serv_id_2, serv_data_2},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
  {NULL, NULL}                                                               \
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_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  static const FT_ServiceDescRec class_[] =                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
  {serv_id_2, serv_data_2},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
  {serv_id_3, serv_data_3},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
  {NULL, NULL}                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
        serv_id_4, serv_data_4)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
  static const FT_ServiceDescRec class_[] =                                  \
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
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
  {serv_id_2, serv_data_2},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
  {serv_id_3, serv_data_3},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
  {serv_id_4, serv_data_4},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
  {NULL, NULL}                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
        serv_id_4, serv_data_4, serv_id_5, serv_data_5)                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
  static const FT_ServiceDescRec class_[] =                                  \
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
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
  {serv_id_2, serv_data_2},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  {serv_id_3, serv_data_3},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
  {serv_id_4, serv_data_4},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
  {serv_id_5, serv_data_5},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  {NULL, NULL}                                                               \
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
#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
        serv_id_6, serv_data_6)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  static const FT_ServiceDescRec class_[] =                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
  {serv_id_1, serv_data_1},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
  {serv_id_2, serv_data_2},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  {serv_id_3, serv_data_3},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
  {serv_id_4, serv_data_4},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
  {serv_id_5, serv_data_5},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
  {serv_id_6, serv_data_6},                                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  {NULL, NULL}                                                               \
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
#else /* FT_CONFIG_OPTION_PIC */ 
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
#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1)            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
                             FT_ServiceDescRec* clazz )                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
      FT_FREE( clazz );                                                      \
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
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
                            FT_ServiceDescRec** output_class)                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
    FT_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
    FT_Memory memory = library->memory;                                      \
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
    if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    clazz[1].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
    clazz[1].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
    return FT_Err_Ok;                                                        \
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
#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
        serv_id_2, serv_data_2)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
                             FT_ServiceDescRec* clazz )                      \
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
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
      FT_FREE( clazz );                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
  }                                                                          \
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
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
                            FT_ServiceDescRec** output_class)                \
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_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
    if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
    clazz[1].serv_id = serv_id_2;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
    clazz[1].serv_data = serv_data_2;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
    clazz[2].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    clazz[2].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
    return FT_Err_Ok;                                                        \
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
        serv_id_2, serv_data_2, serv_id_3, serv_data_3)                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
                             FT_ServiceDescRec* clazz )                      \
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
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
      FT_FREE( clazz );                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
  }                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
                            FT_ServiceDescRec** output_class)                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    FT_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
    if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
    clazz[1].serv_id = serv_id_2;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
    clazz[1].serv_data = serv_data_2;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
    clazz[2].serv_id = serv_id_3;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
    clazz[2].serv_data = serv_data_3;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
    clazz[3].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
    clazz[3].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
    return FT_Err_Ok;                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
  } 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
        serv_id_4, serv_data_4)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
                             FT_ServiceDescRec* clazz )                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
      FT_FREE( clazz );                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
  }                                                                          \
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
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
                            FT_ServiceDescRec** output_class)                \
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
    FT_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
    if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
    clazz[1].serv_id = serv_id_2;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
    clazz[1].serv_data = serv_data_2;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
    clazz[2].serv_id = serv_id_3;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
    clazz[2].serv_data = serv_data_3;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
    clazz[3].serv_id = serv_id_4;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
    clazz[3].serv_data = serv_data_4;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
    clazz[4].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
    clazz[4].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
    return FT_Err_Ok;                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
  } 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
        serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4,           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
        serv_data_4, serv_id_5, serv_data_5)                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
                             FT_ServiceDescRec* clazz )                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
  {                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
      FT_FREE( clazz );                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
  }                                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
                            FT_ServiceDescRec** output_class)                \
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
    FT_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
                                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
    if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
    clazz[1].serv_id = serv_id_2;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
    clazz[1].serv_data = serv_data_2;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
    clazz[2].serv_id = serv_id_3;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
    clazz[2].serv_data = serv_data_3;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
    clazz[3].serv_id = serv_id_4;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
    clazz[3].serv_data = serv_data_4;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
    clazz[4].serv_id = serv_id_5;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
    clazz[4].serv_data = serv_data_5;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
    clazz[5].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
    clazz[5].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
    return FT_Err_Ok;                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
  } 
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
#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1,            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
        serv_id_2, serv_data_2, serv_id_3, serv_data_3,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
        serv_id_4, serv_data_4, serv_id_5, serv_data_5,                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
        serv_id_6, serv_data_6)                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
  void                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
  FT_Destroy_Class_##class_( FT_Library library,                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
                             FT_ServiceDescRec* clazz )                      \
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
    FT_Memory memory = library->memory;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
    if ( clazz )                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
      FT_FREE( clazz );                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
  }                                                                          \
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
  FT_Error                                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
  FT_Create_Class_##class_( FT_Library library,                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
                            FT_ServiceDescRec** output_class)                \
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
    FT_ServiceDescRec*  clazz;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
    FT_Error          error;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
    FT_Memory memory = library->memory;                                      \
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
    if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) )                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
      return error;                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
    clazz[0].serv_id = serv_id_1;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
    clazz[0].serv_data = serv_data_1;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
    clazz[1].serv_id = serv_id_2;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
    clazz[1].serv_data = serv_data_2;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
    clazz[2].serv_id = serv_id_3;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
    clazz[2].serv_data = serv_data_3;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
    clazz[3].serv_id = serv_id_4;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
    clazz[3].serv_data = serv_data_4;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
    clazz[4].serv_id = serv_id_5;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
    clazz[4].serv_data = serv_data_5;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
    clazz[5].serv_id = serv_id_6;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
    clazz[5].serv_data = serv_data_6;                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
    clazz[6].serv_id = NULL;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
    clazz[6].serv_data = NULL;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
    *output_class = clazz;                                                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
    return FT_Err_Ok;                                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
  } 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
#endif /* FT_CONFIG_OPTION_PIC */ 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
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
   *  Parse a list of FT_ServiceDescRec descriptors and look for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
   *  a specific service by ID.  Note that the last element in the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
   *  array must be { NULL, NULL }, and that the function should
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
   *  return NULL if the service isn't available.
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
   *  This function can be used by modules to implement their
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
   *  `get_service' method.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
  ft_service_list_lookup( FT_ServiceDesc  service_descriptors,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
                          const char*     service_id );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
  /*****             S E R V I C E S   C A C H E                       *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   482
   *  This structure is used to store a cache for several frequently used
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   483
   *  services.  It is the type of `face->internal->services'.  You
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
   *  should only use FT_FACE_LOOKUP_SERVICE to access it.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
   *  All fields should have the type FT_Pointer to relax compilation
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
   *  dependencies.  We assume the developer isn't completely stupid.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
   *  Each field must be named `service_XXXX' where `XXX' corresponds to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
   *  the correct FT_SERVICE_ID_XXXX macro.  See the definition of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   491
   *  FT_FACE_LOOKUP_SERVICE below how this is implemented.
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
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
  typedef struct  FT_ServiceCacheRec_
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
    FT_Pointer  service_POSTSCRIPT_FONT_NAME;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   497
    FT_Pointer  service_MULTI_MASTERS;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   498
    FT_Pointer  service_GLYPH_DICT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
    FT_Pointer  service_PFR_METRICS;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
    FT_Pointer  service_WINFNT;
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
  } FT_ServiceCacheRec, *FT_ServiceCache;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   504
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   505
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
   *  A magic number used within the services cache.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
#define FT_SERVICE_UNAVAILABLE  ((FT_Pointer)-2)  /* magic number */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   509
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   510
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
   * @macro:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
   *   FT_FACE_LOOKUP_SERVICE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
   * @description:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
   *   This macro is used to lookup a service from a face's driver module
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
   *   using its cache.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
   * @input:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
   *   face::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
   *     The source face handle containing the cache.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
   *   field ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
   *     The field name in the cache.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
   *   id ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
   *     The service ID.
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
   * @output:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
   *   ptr ::
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   531
   *     A variable receiving the service data.  NULL if not available.
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
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   536
  FT_BEGIN_STMNT                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   537
    FT_Pointer   svc;                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   540
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   541
    svc = FT_FACE( face )->internal->services. service_ ## id; \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   542
    if ( svc == FT_SERVICE_UNAVAILABLE )                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   543
      svc = NULL;                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   544
    else if ( svc == NULL )                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   545
    {                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   546
      FT_FACE_FIND_SERVICE( face, svc, id );                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   547
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   548
      FT_FACE( face )->internal->services. service_ ## id =    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   549
        (FT_Pointer)( svc != NULL ? svc                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   550
                                  : FT_SERVICE_UNAVAILABLE );  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   551
    }                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   552
    *Pptr = svc;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   553
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   554
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   555
#else /* !C++ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   556
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   557
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   558
  FT_BEGIN_STMNT                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   559
    FT_Pointer  svc;                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   560
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   561
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   562
    svc = FT_FACE( face )->internal->services. service_ ## id; \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   563
    if ( svc == FT_SERVICE_UNAVAILABLE )                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   564
      svc = NULL;                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   565
    else if ( svc == NULL )                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   566
    {                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   567
      FT_FACE_FIND_SERVICE( face, svc, id );                   \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   568
                                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   569
      FT_FACE( face )->internal->services. service_ ## id =    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   570
        (FT_Pointer)( svc != NULL ? svc                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   571
                                  : FT_SERVICE_UNAVAILABLE );  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   572
    }                                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   573
    ptr = svc;                                                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   574
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   575
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   576
#endif /* !C++ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   577
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   578
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   579
   *  A macro used to define new service structure types.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   580
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   581
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   582
#define FT_DEFINE_SERVICE( name )            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   583
  typedef struct FT_Service_ ## name ## Rec_ \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   584
    FT_Service_ ## name ## Rec ;             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   585
  typedef struct FT_Service_ ## name ## Rec_ \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   586
    const * FT_Service_ ## name ;            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   587
  struct FT_Service_ ## name ## Rec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   588
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   589
  /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   590
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   591
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   592
   *  The header files containing the services.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   593
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   594
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   595
#define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   596
#define FT_SERVICE_CID_H                <freetype/internal/services/svcid.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   597
#define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   598
#define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   599
#define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   600
#define FT_SERVICE_MULTIPLE_MASTERS_H   <freetype/internal/services/svmm.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   601
#define FT_SERVICE_OPENTYPE_VALIDATE_H  <freetype/internal/services/svotval.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   602
#define FT_SERVICE_PFR_H                <freetype/internal/services/svpfr.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   603
#define FT_SERVICE_POSTSCRIPT_CMAPS_H   <freetype/internal/services/svpscmap.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   604
#define FT_SERVICE_POSTSCRIPT_INFO_H    <freetype/internal/services/svpsinfo.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   605
#define FT_SERVICE_POSTSCRIPT_NAME_H    <freetype/internal/services/svpostnm.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   606
#define FT_SERVICE_SFNT_H               <freetype/internal/services/svsfnt.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   607
#define FT_SERVICE_TRUETYPE_ENGINE_H    <freetype/internal/services/svtteng.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   608
#define FT_SERVICE_TT_CMAP_H            <freetype/internal/services/svttcmap.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   609
#define FT_SERVICE_WINFNT_H             <freetype/internal/services/svwinfnt.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   610
#define FT_SERVICE_XFREE86_NAME_H       <freetype/internal/services/svxf86nm.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   611
#define FT_SERVICE_TRUETYPE_GLYF_H      <freetype/internal/services/svttglyf.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   612
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   613
 /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   614
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   615
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   616
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   617
#endif /* __FTSERV_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   618
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   619
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   620
/* END */