ftlist.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:16k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftlist.h                                                               */
  4. /*                                                                         */
  5. /*    Generic list support for FreeType (specification).                   */
  6. /*                                                                         */
  7. /*  Copyright 1996-2001, 2003, 2007 by                                     */
  8. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  9. /*                                                                         */
  10. /*  This file is part of the FreeType project, and may only be used,       */
  11. /*  modified, and distributed under the terms of the FreeType project      */
  12. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  13. /*  this file you indicate that you have read the license and              */
  14. /*  understand and accept it fully.                                        */
  15. /*                                                                         */
  16. /***************************************************************************/
  17.   /*************************************************************************/
  18.   /*                                                                       */
  19.   /*  This file implements functions relative to list processing.  Its     */
  20.   /*  data structures are defined in `freetype.h'.                         */
  21.   /*                                                                       */
  22.   /*************************************************************************/
  23. #ifndef __FTLIST_H__
  24. #define __FTLIST_H__
  25. #include <ft2build.h>
  26. #include FT_FREETYPE_H
  27. #ifdef FREETYPE_H
  28. #error "freetype.h of FreeType 1 has been loaded!"
  29. #error "Please fix the directory search order for header files"
  30. #error "so that freetype.h of FreeType 2 is found first."
  31. #endif
  32. FT_BEGIN_HEADER
  33.   /*************************************************************************/
  34.   /*                                                                       */
  35.   /* <Section>                                                             */
  36.   /*    list_processing                                                    */
  37.   /*                                                                       */
  38.   /* <Title>                                                               */
  39.   /*    List Processing                                                    */
  40.   /*                                                                       */
  41.   /* <Abstract>                                                            */
  42.   /*    Simple management of lists.                                        */
  43.   /*                                                                       */
  44.   /* <Description>                                                         */
  45.   /*    This section contains various definitions related to list          */
  46.   /*    processing using doubly-linked nodes.                              */
  47.   /*                                                                       */
  48.   /* <Order>                                                               */
  49.   /*    FT_List                                                            */
  50.   /*    FT_ListNode                                                        */
  51.   /*    FT_ListRec                                                         */
  52.   /*    FT_ListNodeRec                                                     */
  53.   /*                                                                       */
  54.   /*    FT_List_Add                                                        */
  55.   /*    FT_List_Insert                                                     */
  56.   /*    FT_List_Find                                                       */
  57.   /*    FT_List_Remove                                                     */
  58.   /*    FT_List_Up                                                         */
  59.   /*    FT_List_Iterate                                                    */
  60.   /*    FT_List_Iterator                                                   */
  61.   /*    FT_List_Finalize                                                   */
  62.   /*    FT_List_Destructor                                                 */
  63.   /*                                                                       */
  64.   /*************************************************************************/
  65.   /*************************************************************************/
  66.   /*                                                                       */
  67.   /* <Function>                                                            */
  68.   /*    FT_List_Find                                                       */
  69.   /*                                                                       */
  70.   /* <Description>                                                         */
  71.   /*    Finds the list node for a given listed object.                     */
  72.   /*                                                                       */
  73.   /* <Input>                                                               */
  74.   /*    list :: A pointer to the parent list.                              */
  75.   /*    data :: The address of the listed object.                          */
  76.   /*                                                                       */
  77.   /* <Return>                                                              */
  78.   /*    List node.  NULL if it wasn't found.                               */
  79.   /*                                                                       */
  80.   FT_EXPORT( FT_ListNode )
  81.   FT_List_Find( FT_List  list,
  82.                 void*    data );
  83.   /*************************************************************************/
  84.   /*                                                                       */
  85.   /* <Function>                                                            */
  86.   /*    FT_List_Add                                                        */
  87.   /*                                                                       */
  88.   /* <Description>                                                         */
  89.   /*    Appends an element to the end of a list.                           */
  90.   /*                                                                       */
  91.   /* <InOut>                                                               */
  92.   /*    list :: A pointer to the parent list.                              */
  93.   /*    node :: The node to append.                                        */
  94.   /*                                                                       */
  95.   FT_EXPORT( void )
  96.   FT_List_Add( FT_List      list,
  97.                FT_ListNode  node );
  98.   /*************************************************************************/
  99.   /*                                                                       */
  100.   /* <Function>                                                            */
  101.   /*    FT_List_Insert                                                     */
  102.   /*                                                                       */
  103.   /* <Description>                                                         */
  104.   /*    Inserts an element at the head of a list.                          */
  105.   /*                                                                       */
  106.   /* <InOut>                                                               */
  107.   /*    list :: A pointer to parent list.                                  */
  108.   /*    node :: The node to insert.                                        */
  109.   /*                                                                       */
  110.   FT_EXPORT( void )
  111.   FT_List_Insert( FT_List      list,
  112.                   FT_ListNode  node );
  113.   /*************************************************************************/
  114.   /*                                                                       */
  115.   /* <Function>                                                            */
  116.   /*    FT_List_Remove                                                     */
  117.   /*                                                                       */
  118.   /* <Description>                                                         */
  119.   /*    Removes a node from a list.  This function doesn't check whether   */
  120.   /*    the node is in the list!                                           */
  121.   /*                                                                       */
  122.   /* <Input>                                                               */
  123.   /*    node :: The node to remove.                                        */
  124.   /*                                                                       */
  125.   /* <InOut>                                                               */
  126.   /*    list :: A pointer to the parent list.                              */
  127.   /*                                                                       */
  128.   FT_EXPORT( void )
  129.   FT_List_Remove( FT_List      list,
  130.                   FT_ListNode  node );
  131.   /*************************************************************************/
  132.   /*                                                                       */
  133.   /* <Function>                                                            */
  134.   /*    FT_List_Up                                                         */
  135.   /*                                                                       */
  136.   /* <Description>                                                         */
  137.   /*    Moves a node to the head/top of a list.  Used to maintain LRU      */
  138.   /*    lists.                                                             */
  139.   /*                                                                       */
  140.   /* <InOut>                                                               */
  141.   /*    list :: A pointer to the parent list.                              */
  142.   /*    node :: The node to move.                                          */
  143.   /*                                                                       */
  144.   FT_EXPORT( void )
  145.   FT_List_Up( FT_List      list,
  146.               FT_ListNode  node );
  147.   /*************************************************************************/
  148.   /*                                                                       */
  149.   /* <FuncType>                                                            */
  150.   /*    FT_List_Iterator                                                   */
  151.   /*                                                                       */
  152.   /* <Description>                                                         */
  153.   /*    An FT_List iterator function which is called during a list parse   */
  154.   /*    by @FT_List_Iterate.                                               */
  155.   /*                                                                       */
  156.   /* <Input>                                                               */
  157.   /*    node :: The current iteration list node.                           */
  158.   /*                                                                       */
  159.   /*    user :: A typeless pointer passed to @FT_List_Iterate.             */
  160.   /*            Can be used to point to the iteration's state.             */
  161.   /*                                                                       */
  162.   typedef FT_Error
  163.   (*FT_List_Iterator)( FT_ListNode  node,
  164.                        void*        user );
  165.   /*************************************************************************/
  166.   /*                                                                       */
  167.   /* <Function>                                                            */
  168.   /*    FT_List_Iterate                                                    */
  169.   /*                                                                       */
  170.   /* <Description>                                                         */
  171.   /*    Parses a list and calls a given iterator function on each element. */
  172.   /*    Note that parsing is stopped as soon as one of the iterator calls  */
  173.   /*    returns a non-zero value.                                          */
  174.   /*                                                                       */
  175.   /* <Input>                                                               */
  176.   /*    list     :: A handle to the list.                                  */
  177.   /*    iterator :: An iterator function, called on each node of the list. */
  178.   /*    user     :: A user-supplied field which is passed as the second    */
  179.   /*                argument to the iterator.                              */
  180.   /*                                                                       */
  181.   /* <Return>                                                              */
  182.   /*    The result (a FreeType error code) of the last iterator call.      */
  183.   /*                                                                       */
  184.   FT_EXPORT( FT_Error )
  185.   FT_List_Iterate( FT_List           list,
  186.                    FT_List_Iterator  iterator,
  187.                    void*             user );
  188.   /*************************************************************************/
  189.   /*                                                                       */
  190.   /* <FuncType>                                                            */
  191.   /*    FT_List_Destructor                                                 */
  192.   /*                                                                       */
  193.   /* <Description>                                                         */
  194.   /*    An @FT_List iterator function which is called during a list        */
  195.   /*    finalization by @FT_List_Finalize to destroy all elements in a     */
  196.   /*    given list.                                                        */
  197.   /*                                                                       */
  198.   /* <Input>                                                               */
  199.   /*    system :: The current system object.                               */
  200.   /*                                                                       */
  201.   /*    data   :: The current object to destroy.                           */
  202.   /*                                                                       */
  203.   /*    user   :: A typeless pointer passed to @FT_List_Iterate.  It can   */
  204.   /*              be used to point to the iteration's state.               */
  205.   /*                                                                       */
  206.   typedef void
  207.   (*FT_List_Destructor)( FT_Memory  memory,
  208.                          void*      data,
  209.                          void*      user );
  210.   /*************************************************************************/
  211.   /*                                                                       */
  212.   /* <Function>                                                            */
  213.   /*    FT_List_Finalize                                                   */
  214.   /*                                                                       */
  215.   /* <Description>                                                         */
  216.   /*    Destroys all elements in the list as well as the list itself.      */
  217.   /*                                                                       */
  218.   /* <Input>                                                               */
  219.   /*    list    :: A handle to the list.                                   */
  220.   /*                                                                       */
  221.   /*    destroy :: A list destructor that will be applied to each element  */
  222.   /*               of the list.                                            */
  223.   /*                                                                       */
  224.   /*    memory  :: The current memory object which handles deallocation.   */
  225.   /*                                                                       */
  226.   /*    user    :: A user-supplied field which is passed as the last       */
  227.   /*               argument to the destructor.                             */
  228.   /*                                                                       */
  229.   FT_EXPORT( void )
  230.   FT_List_Finalize( FT_List             list,
  231.                     FT_List_Destructor  destroy,
  232.                     FT_Memory           memory,
  233.                     void*               user );
  234.   /* */
  235. FT_END_HEADER
  236. #endif /* __FTLIST_H__ */
  237. /* END */