2018-06-03 22:00:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftlist.h
|
|
|
|
*
|
|
|
|
* Generic list support for FreeType (specification).
|
|
|
|
*
|
2020-01-19 17:05:19 +01:00
|
|
|
* Copyright (C) 1996-2020 by
|
2018-06-03 22:00:42 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-08-24 18:52:30 +02:00
|
|
|
* This file implements functions relative to list processing. Its data
|
|
|
|
* structures are defined in `freetype.h`.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
*/
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef FTLIST_H_
|
|
|
|
#define FTLIST_H_
|
2000-08-30 23:40:45 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/freetype.h>
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2003-11-04 08:44:19 +01:00
|
|
|
#ifdef FREETYPE_H
|
|
|
|
#error "freetype.h of FreeType 1 has been loaded!"
|
|
|
|
#error "Please fix the directory search order for header files"
|
|
|
|
#error "so that freetype.h of FreeType 2 is found first."
|
|
|
|
#endif
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
2000-08-30 23:40:45 +02:00
|
|
|
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @section:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list_processing
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @title:
|
2018-06-03 22:00:42 +02:00
|
|
|
* List Processing
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @abstract:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Simple management of lists.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* This section contains various definitions related to list processing
|
|
|
|
* using doubly-linked nodes.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @order:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List
|
|
|
|
* FT_ListNode
|
|
|
|
* FT_ListRec
|
|
|
|
* FT_ListNodeRec
|
|
|
|
*
|
|
|
|
* FT_List_Add
|
|
|
|
* FT_List_Insert
|
|
|
|
* FT_List_Find
|
|
|
|
* FT_List_Remove
|
|
|
|
* FT_List_Up
|
|
|
|
* FT_List_Iterate
|
|
|
|
* FT_List_Iterator
|
|
|
|
* FT_List_Finalize
|
|
|
|
* FT_List_Destructor
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Find
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Find the list node for a given listed object.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A pointer to the parent list.
|
|
|
|
* data ::
|
|
|
|
* The address of the listed object.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @return:
|
2019-02-20 16:18:40 +01:00
|
|
|
* List node. `NULL` if it wasn't found.
|
2018-06-03 22:00:42 +02:00
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_ListNode )
|
|
|
|
FT_List_Find( FT_List list,
|
|
|
|
void* data );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Add
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Append an element to the end of a list.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @inout:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A pointer to the parent list.
|
|
|
|
* node ::
|
|
|
|
* The node to append.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_List_Add( FT_List list,
|
|
|
|
FT_ListNode node );
|
2000-11-08 00:56:02 +01:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Insert
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Insert an element at the head of a list.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @inout:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A pointer to parent list.
|
|
|
|
* node ::
|
|
|
|
* The node to insert.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_List_Insert( FT_List list,
|
|
|
|
FT_ListNode node );
|
2000-11-08 00:56:02 +01:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Remove
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* Remove a node from a list. This function doesn't check whether the
|
|
|
|
* node is in the list!
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* node ::
|
|
|
|
* The node to remove.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @inout:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A pointer to the parent list.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_List_Remove( FT_List list,
|
|
|
|
FT_ListNode node );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Up
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* Move a node to the head/top of a list. Used to maintain LRU lists.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @inout:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A pointer to the parent list.
|
|
|
|
* node ::
|
|
|
|
* The node to move.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_List_Up( FT_List list,
|
|
|
|
FT_ListNode node );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @functype:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Iterator
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-08-24 18:52:30 +02:00
|
|
|
* An FT_List iterator function that is called during a list parse by
|
|
|
|
* @FT_List_Iterate.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* node ::
|
|
|
|
* The current iteration list node.
|
|
|
|
*
|
|
|
|
* user ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* A typeless pointer passed to @FT_List_Iterate. Can be used to point
|
|
|
|
* to the iteration's state.
|
2018-06-03 22:00:42 +02:00
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef FT_Error
|
|
|
|
(*FT_List_Iterator)( FT_ListNode node,
|
|
|
|
void* user );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Iterate
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Parse a list and calls a given iterator function on each element.
|
|
|
|
* Note that parsing is stopped as soon as one of the iterator calls
|
|
|
|
* returns a non-zero value.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A handle to the list.
|
|
|
|
* iterator ::
|
|
|
|
* An iterator function, called on each node of the list.
|
|
|
|
* user ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* A user-supplied field that is passed as the second argument to the
|
|
|
|
* iterator.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @return:
|
2018-06-03 22:00:42 +02:00
|
|
|
* The result (a FreeType error code) of the last iterator call.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FT_List_Iterate( FT_List list,
|
|
|
|
FT_List_Iterator iterator,
|
|
|
|
void* user );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @functype:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Destructor
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* An @FT_List iterator function that is called during a list
|
2018-08-24 18:52:30 +02:00
|
|
|
* finalization by @FT_List_Finalize to destroy all elements in a given
|
|
|
|
* list.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* system ::
|
|
|
|
* The current system object.
|
|
|
|
*
|
|
|
|
* data ::
|
|
|
|
* The current object to destroy.
|
|
|
|
*
|
|
|
|
* user ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* A typeless pointer passed to @FT_List_Iterate. It can be used to
|
|
|
|
* point to the iteration's state.
|
2018-06-03 22:00:42 +02:00
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef void
|
|
|
|
(*FT_List_Destructor)( FT_Memory memory,
|
|
|
|
void* data,
|
|
|
|
void* user );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
|
|
|
|
2018-06-03 22:00:42 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @function:
|
2018-06-03 22:00:42 +02:00
|
|
|
* FT_List_Finalize
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @description:
|
2018-06-03 22:00:42 +02:00
|
|
|
* Destroy all elements in the list as well as the list itself.
|
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @input:
|
2018-06-03 22:00:42 +02:00
|
|
|
* list ::
|
|
|
|
* A handle to the list.
|
|
|
|
*
|
|
|
|
* destroy ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* A list destructor that will be applied to each element of the list.
|
2019-02-20 16:18:40 +01:00
|
|
|
* Set this to `NULL` if not needed.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
|
|
|
* memory ::
|
|
|
|
* The current memory object that handles deallocation.
|
|
|
|
*
|
|
|
|
* user ::
|
2018-08-24 18:52:30 +02:00
|
|
|
* A user-supplied field that is passed as the last argument to the
|
|
|
|
* destructor.
|
2018-06-03 22:00:42 +02:00
|
|
|
*
|
2018-06-17 21:08:36 +02:00
|
|
|
* @note:
|
2018-06-03 22:00:42 +02:00
|
|
|
* This function expects that all nodes added by @FT_List_Add or
|
|
|
|
* @FT_List_Insert have been dynamically allocated.
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FT_List_Finalize( FT_List list,
|
|
|
|
FT_List_Destructor destroy,
|
|
|
|
FT_Memory memory,
|
|
|
|
void* user );
|
2000-08-30 23:40:45 +02:00
|
|
|
|
2001-01-10 07:53:49 +01:00
|
|
|
/* */
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-08-30 23:40:45 +02:00
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* FTLIST_H_ */
|
2000-08-30 23:40:45 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2000-08-30 23:40:45 +02:00
|
|
|
/* END */
|