misc/libfreetype/src/cache/ftcmru.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
/*  ftcmru.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
/*    Simple MRU list-cache (specification).                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2000-2001, 2003, 2004, 2005, 2006, 2010 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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
  /* An MRU is a list that cannot hold more than a certain number of       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
  /* elements (`max_elements').  All elements in the list are sorted in    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
  /* least-recently-used order, i.e., the `oldest' element is at the tail  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  /* of the list.                                                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'),   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /* the list is searched for an element with the corresponding key.  If   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  /* it is found, the element is moved to the head of the list and is      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
  /* returned.                                                             */
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
  /* If no corresponding element is found, the lookup routine will try to  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  /* obtain a new element with the relevant key.  If the list is already   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /* full, the oldest element from the list is discarded and replaced by a */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /* new one; a new element is added to the list otherwise.                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  /* Note that it is possible to pre-allocate the element list nodes.      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  /* This is handy if `max_elements' is sufficiently small, as it saves    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  /* allocations/releases during the lookup process.                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
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
#ifndef __FTCMRU_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
#define __FTCMRU_H__
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
#include FT_FREETYPE_H
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
#ifdef FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
#error "freetype.h of FreeType 1 has been loaded!"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
#error "Please fix the directory search order for header files"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
#error "so that freetype.h of FreeType 2 is found first."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
#endif
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
#define  xxFT_DEBUG_ERROR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
#define  FTC_INLINE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
  typedef struct FTC_MruNodeRec_*  FTC_MruNode;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
  typedef struct  FTC_MruNodeRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    FTC_MruNode  next;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    FTC_MruNode  prev;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
  } FTC_MruNodeRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  FTC_MruNode_Prepend( FTC_MruNode  *plist,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
                       FTC_MruNode   node );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
  FTC_MruNode_Up( FTC_MruNode  *plist,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
                  FTC_MruNode   node );
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
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
  FTC_MruNode_Remove( FTC_MruNode  *plist,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
                      FTC_MruNode   node );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  typedef struct FTC_MruListRec_*              FTC_MruList;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  typedef struct FTC_MruListClassRec_ const *  FTC_MruListClass;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  typedef FT_Bool
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
  (*FTC_MruNode_CompareFunc)( FTC_MruNode  node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
                              FT_Pointer   key );
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
  typedef FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
  (*FTC_MruNode_InitFunc)( FTC_MruNode  node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
                           FT_Pointer   key,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
                           FT_Pointer   data );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  typedef FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  (*FTC_MruNode_ResetFunc)( FTC_MruNode  node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
                            FT_Pointer   key,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
                            FT_Pointer   data );
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
  typedef void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
  (*FTC_MruNode_DoneFunc)( FTC_MruNode  node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
                           FT_Pointer   data );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  typedef struct  FTC_MruListClassRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
    FT_Offset                node_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    FTC_MruNode_CompareFunc  node_compare;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    FTC_MruNode_InitFunc     node_init;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    FTC_MruNode_ResetFunc    node_reset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    FTC_MruNode_DoneFunc     node_done;
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
  } FTC_MruListClassRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
  typedef struct  FTC_MruListRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    FT_UInt              num_nodes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    FT_UInt              max_nodes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    FTC_MruNode          nodes;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    FT_Pointer           data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    FTC_MruListClassRec  clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    FT_Memory            memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
  } FTC_MruListRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  FTC_MruList_Init( FTC_MruList       list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
                    FTC_MruListClass  clazz,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
                    FT_UInt           max_nodes,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
                    FT_Pointer        data,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
                    FT_Memory         memory );
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
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
  FTC_MruList_Reset( FTC_MruList  list );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
  FTC_MruList_Done( FTC_MruList  list );
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
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
  FTC_MruList_New( FTC_MruList   list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
                   FT_Pointer    key,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
                   FTC_MruNode  *anode );
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
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
  FTC_MruList_Remove( FTC_MruList  list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
                      FTC_MruNode  node );
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
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
  FTC_MruList_RemoveSelection( FTC_MruList              list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
                               FTC_MruNode_CompareFunc  selection,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
                               FT_Pointer               key );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
#ifdef FTC_INLINE
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
#define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error )           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
  FT_BEGIN_STMNT                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    FTC_MruNode*             _pfirst  = &(list)->nodes;                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
    FTC_MruNode_CompareFunc  _compare = (FTC_MruNode_CompareFunc)(compare); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    FTC_MruNode              _first, _node;                                 \
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
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    error  = FTC_Err_Ok;                                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    _first = *(_pfirst);                                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    _node  = NULL;                                                          \
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
    if ( _first )                                                           \
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
      _node = _first;                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
      do                                                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
      {                                                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
        if ( _compare( _node, (key) ) )                                     \
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
          if ( _node != _first )                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
            FTC_MruNode_Up( _pfirst, _node );                               \
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
          node = _node;                                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
          goto _MruOk;                                                      \
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
        _node = _node->next;                                                \
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
      } while ( _node != _first) ;                                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
    }                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
    error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
  _MruOk:                                                                   \
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
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )
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
#else  /* !FTC_INLINE */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
  FT_LOCAL( FTC_MruNode )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
  FTC_MruList_Find( FTC_MruList  list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
                    FT_Pointer   key );
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_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
  FTC_MruList_Lookup( FTC_MruList   list,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
                      FT_Pointer    key,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
                      FTC_MruNode  *pnode );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
  error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
#endif /* !FTC_INLINE */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
#define FTC_MRULIST_LOOP( list, node )        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
  FT_BEGIN_STMNT                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
    FTC_MruNode  _first = (list)->nodes;      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
    if ( _first )                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
    {                                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
      FTC_MruNode  _node = _first;            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
                                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
      do                                      \
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
        *(FTC_MruNode*)&(node) = _node;
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
#define FTC_MRULIST_LOOP_END()               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
        _node = _node->next;                 \
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
      } while ( _node != _first );           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
    }                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
 /* */
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
FT_END_HEADER
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
#endif /* __FTCMRU_H__ */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
/* END */