/*******************************************************************
 *
 *  ttengine.h                                                   1.0
 *
 *    Engine instance structure definition.
 *
 *  Copyright 1996, 1997 by
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
 *
 *  This file is part of the FreeType project, and may only be used
 *  modified and distributed under the terms of the FreeType project
 *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
 *  this file you indicate that you have read the license and
 *  understand and accept it fully.
 *
 ******************************************************************/

#ifndef TTENGINE_H
#define TTENGINE_H

#include "freetype.h"
#include "ttmutex.h"

#ifdef __cplusplus
  extern "C" {
#endif

  /********************************************************************/
  /*                                                                  */
  /*  The freetype engine instance structure.                         */
  /*                                                                  */
  /*  This structure holds all the data that is necessary to run      */
  /*  one instance of the freetype engine.  It is needed to get a     */
  /*  completely re-entrant version of the library.                   */
  /*                                                                  */
  /*  The goal is to move _all_ component-specific variables, either  */
  /*  static or global in the structure; the component initializers   */
  /*  and finalizers will all be called with the address of a valid   */
  /*  TEngine_Instance.                                               */
  /*                                                                  */
  /********************************************************************/

  struct  _TEngine_Instance 
  {
     TMutex  lock;               /* engine lock */

     void*   list_free_elements;

     void*   objs_face_class;       /* the face cache class     */
     void*   objs_instance_class;   /* the instance cache class */
     void*   objs_execution_class;  /* the context cache class  */
     void*   objs_glyph_class;      /* the glyph cache class    */

     void*   objs_face_cache;  /* these caches are used to track */

     void*   file_component;    /* ttfile implementation dependent   */

     void*   raster_component;  /* ttraster implementation depedent  */
     char    raster_palette[5]; /* gray-levels palette for anti-aliasing */

     void*   extension_component;  /* extensions dependent */

     TT_Glyph_Loader_Callback  glCallback; /* glyph loader callback, if any */
  };

  typedef struct _TEngine_Instance  TEngine_Instance;
  typedef TEngine_Instance*         PEngine_Instance;


#ifdef TT_CONFIG_REENTRANT  /* for re-entrant builds */

#define ENGINE_ARG    TEngine_Instance*  _engine
#define ENGINE_ARGS   TEngine_Instance*  _engine,

#define ENGINE_VAR   _engine
#define ENGINE_VARS  _engine,

#define ENGINE  _engine

#else                       /* for thread-safe builds */

#define ENGINE_ARG    /* void */
#define ENGINE_ARGS

#define ENGINE_VAR
#define ENGINE_VARS

#endif /* TT_CONFIG_REENTRANT */

#ifdef __cplusplus
  }
#endif

#endif /* TTENGINE_H */


/* END */
