misc/libfreetype/src/base/ftinit.c
author unc0rr
Sat, 24 Aug 2013 01:37:20 +0400
branch0.9.19
changeset 9142 0dceffbaa4ee
parent 5172 88f2e05288ba
permissions -rw-r--r--
Fix script flaw in detection of best team when sending achievement info
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
/*  ftinit.c                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    FreeType initialization layer (body).                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 1996-2001, 2002, 2005, 2007, 2009 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
  /*  The purpose of this file is to implement the following two           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
  /*  functions:                                                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
  /*  FT_Add_Default_Modules():                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  /*     This function is used to add the set of default modules to a      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  /*     fresh new library object.  The set is taken from the header file  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /*     `freetype/config/ftmodule.h'.  See the document `FreeType 2.0     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /*     Build System' for more information.                               */
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
  /*  FT_Init_FreeType():                                                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  /*     This function creates a system object for the current platform,   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  /*     builds a library out of it, then calls FT_Default_Drivers().      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /*  Note that even if FT_Init_FreeType() uses the implementation of the  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /*  system object defined at build time, client applications are still   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  /*  able to provide their own `ftsystem.c'.                              */
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
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#include FT_CONFIG_CONFIG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
#include FT_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
#include FT_MODULE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
#include "basepic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
#define FT_COMPONENT  trace_init
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
#ifndef FT_CONFIG_OPTION_PIC
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
#define FT_USE_MODULE( type, x )  extern "C" const type  x;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
#define FT_USE_MODULE( type, x )  extern const type  x;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
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
#include FT_CONFIG_MODULES_H
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
#define FT_USE_MODULE( type, x )  (const FT_Module_Class*)&(x),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  static
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  const FT_Module_Class*  const ft_default_modules[] =
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
#include FT_CONFIG_MODULES_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
#else /* FT_CONFIG_OPTION_PIC */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
#define FT_EXTERNC  extern "C"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
#define FT_EXTERNC  extern
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
#endif
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
  /* declare the module's class creation/destruction functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
#define FT_USE_MODULE( type, x )  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
  FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  FT_EXTERNC void     FT_Destroy_Class_##x( FT_Library library, FT_Module_Class*  clazz );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
#include FT_CONFIG_MODULES_H
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /* count all module classes */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
#define FT_USE_MODULE( type, x )  MODULE_CLASS_##x,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  enum
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
#include FT_CONFIG_MODULES_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
    FT_NUM_MODULE_CLASSES
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  /* destroy all module classes */  
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
#define FT_USE_MODULE( type, x )  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
  i++;                                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
  FT_BASE_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
  ft_destroy_default_module_classes( FT_Library  library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
    FT_Module_Class** classes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
    FT_Memory         memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
    FT_UInt           i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
    BasePIC*          pic_container = (BasePIC*)library->pic_container.base;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    if ( !pic_container->default_module_classes )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
      return;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    classes = pic_container->default_module_classes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
    i = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
#include FT_CONFIG_MODULES_H
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
    FT_FREE( classes );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
    pic_container->default_module_classes = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
  /* initialize all module classes and the pointer table */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
#undef  FT_USE_MODULE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
#define FT_USE_MODULE( type, x )                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
  error = FT_Create_Class_##x(library, &clazz); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
  if (error) goto Exit;                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
  classes[i++] = clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
  FT_BASE_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
  ft_create_default_module_classes( FT_Library  library )
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
    FT_Error          error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
    FT_Memory         memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
    FT_Module_Class** classes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
    FT_Module_Class*  clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    FT_UInt           i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    BasePIC*          pic_container = (BasePIC*)library->pic_container.base;
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
    memory = library->memory;  
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    pic_container->default_module_classes = 0;
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
    if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    /* initialize all pointers to 0, especially the last one */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
    for (i = 0; i < FT_NUM_MODULE_CLASSES; i++)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
      classes[i] = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    classes[FT_NUM_MODULE_CLASSES] = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
    i = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
#include FT_CONFIG_MODULES_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
Exit:    
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    if (error) ft_destroy_default_module_classes( library );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
    else pic_container->default_module_classes = classes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    return error;    
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
#endif /* FT_CONFIG_OPTION_PIC */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
  /* documentation is in ftmodapi.h */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  FT_EXPORT_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  FT_Add_Default_Modules( FT_Library  library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    FT_Error                       error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
    const FT_Module_Class* const*  cur;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    /* test for valid `library' delayed to FT_Add_Module() */
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
    cur = FT_DEFAULT_MODULES_GET;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
    while ( *cur )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
      error = FT_Add_Module( library, *cur );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
      /* notify errors, but don't stop */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
        FT_TRACE0(( "FT_Add_Default_Module:"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
                    " Cannot install `%s', error = 0x%x\n",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
                    (*cur)->module_name, error ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
      cur++;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
  /* documentation is in freetype.h */
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
  FT_EXPORT_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
  FT_Init_FreeType( FT_Library  *alibrary )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
    FT_Error   error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
    FT_Memory  memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    /* First of all, allocate a new system object -- this function is part */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    /* of the system-specific component, i.e. `ftsystem.c'.                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
    memory = FT_New_Memory();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    if ( !memory )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
      FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
      return FT_Err_Unimplemented_Feature;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
    /* build a library out of it, then fill it with the set of */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    /* default drivers.                                        */
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
    error = FT_New_Library( memory, alibrary );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
      FT_Done_Memory( memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
      FT_Add_Default_Modules( *alibrary );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  /* documentation is in freetype.h */
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
  FT_EXPORT_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  FT_Done_FreeType( FT_Library  library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
    if ( library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
      FT_Memory  memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
      /* Discard the library object */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
      FT_Done_Library( library );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
      /* discard memory manager */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
      FT_Done_Memory( memory );
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
    return FT_Err_Ok;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
/* END */