libnode/include/node.h

1257 lines
57 KiB
C
Raw Normal View History

/*---------------------------------------------------------------------------------*/
/* $RCSfile: node.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.13 $ */
/* $Name: libnode-2_2_0-1 $ */
/* $Date: 2010/06/06 21:26:31 $ */
2003-07-16 02:20:53 +02:00
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
2002-02-28 20:02:32 +01:00
/*---------------------------------------------------------------------------------*/
/* This file is part of LibNode */
/* */
/* LibNode is free software; you can redistribute it and/or modify */
2002-02-28 22:53:47 +01:00
/* it under the terms of the GNU Lesser General Public Licence as published by */
2002-02-28 20:02:32 +01:00
/* the Free Software Foundation; either version 2.1 of the License, or */
/* (at your option) any later version. */
/* */
/* LibNode is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
2002-02-28 22:53:47 +01:00
/* You should have received a copy of the GNU Lesser General Public License */
/* along with LibNode; if not, write to the Free Software */
2002-02-28 20:02:32 +01:00
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*---------------------------------------------------------------------------------*/
#ifndef _LIBNODE_H_
# define _LIBNODE_H_
# ifdef __cplusplus
extern "C" {
# endif
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
# include <stdarg.h>
# ifdef _LIBVER_SUPPORT
# include <ver.h>
# endif
#define NDD_TRUE 1
#define NDD_FALSE 0
#define NDD_MIN(A,B) ((A > B) ? B : A)
#define NDD_MAX(A,B) ((A < B) ? B : A)
/*
Default allowed maximum depth between tree branches before rebalancing
*/
#define DEF_MAX_DIF 100
/* Types de structure */
typedef short NDT_Root_Type;
typedef int NDT_Index_Type;
#define NDD_INDEX_MSK 0xffff
#define NDD_INDEX_RMSK 0x0000
#define NDD_INDEX_STATUS_UNKNOWN 0x0000
#define NDD_INDEX_STATUS_OPENED 0x0001
#define NDD_INDEX_STATUS_CLOSED 0x0002
#define NDD_INDEX_STATUS_MSK (NDD_INDEX_STATUS_UNKNOWN | NDD_INDEX_STATUS_OPENED | NDD_INDEX_STATUS_CLOSED)
#define NDD_INDEX_STATUS_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_STATUS_MSK)
#define ND_INDEX_STATUS_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_UNKNOWN)
#define ND_INDEX_STATUS_VALUE_OPENED_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_OPENED)
#define ND_INDEX_STATUS_VALUE_CLOSED_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_CLOSED)
#define ND_INDEX_STATUS_UNKNOWN_IS( r, i) ND_INDEX_STATUS_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_STATUS_OPENED_IS( r, i) ND_INDEX_STATUS_VALUE_OPENED_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_STATUS_CLOSED_IS( r, i) ND_INDEX_STATUS_VALUE_CLOSED_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_STATUS_VALUE_ASCII_GET( v) ( ND_INDEX_STATUS_VALUE_UNKNOWN_IS( (v)) ? "UNKNOWN" : ( ND_INDEX_STATUS_VALUE_OPENED_IS( (v)) ? "OPENED" : ( ND_INDEX_STATUS_VALUE_CLOSED_IS( (v)) ? "CLOSED" : "???")))
#define ND_INDEX_STATUS_ASCII_GET( r, i) ND_INDEX_STATUS_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
#define NDD_INDEX_TYPE_UNKNOWN 0x0000
#define NDD_INDEX_TYPE_LIST 0x0010
#define NDD_INDEX_TYPE_TREE 0x0020
#define NDD_INDEX_TYPE_MSK (NDD_INDEX_TYPE_UNKNOWN | NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)
#define NDD_INDEX_TYPE_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_TYPE_MSK)
#define ND_INDEX_TYPE_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_UNKNOWN)
#define ND_INDEX_TYPE_VALUE_LIST_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_LIST)
#define ND_INDEX_TYPE_VALUE_TREE_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_TREE)
#define ND_INDEX_TYPE_UNKNOWN_IS( r, i) ND_INDEX_TYPE_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_TYPE_LIST_IS( r, i) ND_INDEX_TYPE_VALUE_LIST_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_TYPE_TREE_IS( r, i) ND_INDEX_TYPE_VALUE_TREE_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_TYPE_VALUE_ASCII_GET( v) ( ND_INDEX_TYPE_VALUE_UNKNOWN_IS( (v)) ? "UNKNOWN" : ( ND_INDEX_TYPE_VALUE_LIST_IS( (v)) ? "LIST" : ( ND_INDEX_TYPE_VALUE_TREE_IS( (v)) ? "TREE" : "???")))
#define ND_INDEX_TYPE_ASCII_GET( r, i) ND_INDEX_TYPE_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
#define NDD_INDEX_SUBTYPE_UNKNOWN 0x0000
#define NDD_INDEX_SUBTYPE_FIFO 0x0100 /* First In First Out list (queue) */
#define NDD_INDEX_SUBTYPE_LILO NDD_INDEX_SUBTYPE_FIFO
#define NDD_INDEX_SUBTYPE_LIFO 0x0200 /* First In Last Out list (stack) */
#define NDD_INDEX_SUBTYPE_FILO NDD_INDEX_SUBTYPE_LIFO
#define NDD_INDEX_SUBTYPE_SORTED 0x0300 /* Sorted list */
#define NDD_INDEX_SUBTYPE_UNBALANCED 0x0400
#define NDD_INDEX_SUBTYPE_BALANCED 0x0500 /* Auto balanced tree */
#define NDD_INDEX_SUBTYPE_MSK ( NDD_INDEX_SUBTYPE_UNKNOWN | NDD_INDEX_SUBTYPE_FIFO | NDD_INDEX_SUBTYPE_FILO | NDD_INDEX_SUBTYPE_SORTED | NDD_INDEX_SUBTYPE_UNBALANCED | NDD_INDEX_SUBTYPE_BALANCED)
#define NDD_INDEX_SUBTYPE_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_SUBTYPE_MSK)
#define ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_UNKNOWN)
#define ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_FIFO)
#define ND_INDEX_SUBTYPE_VALUE_LILO_IS( v) ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v)
#define ND_INDEX_SUBTYPE_VALUE_LIFO_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_LIFO)
#define ND_INDEX_SUBTYPE_VALUE_FILO_IS( v) ND_INDEX_SUBTYPE_LIFO_IS( r, i)
#define ND_INDEX_SUBTYPE_VALUE_SORTED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_SORTED)
#define ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_UNBALANCED)
#define ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_BALANCED)
#define ND_INDEX_SUBTYPE_UNKNOWN_IS( r, i) ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_FIFO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_FIFO_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_LILO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_LILO_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_LIFO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_LIFO_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_FILO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_FILO_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_SORTED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_SORTED_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_UNBALANCED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_BALANCED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( (r)->Index_Tab[(i)].Type)
#define ND_INDEX_SUBTYPE_VALUE_ASCII_GET( v) ( ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( v) ? "UNKNOWN" : ( ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v) ? "FIFO" : ( ND_INDEX_SUBTYPE_VALUE_LIFO_IS( v) ? "LIFO" : ( ND_INDEX_SUBTYPE_VALUE_SORTED_IS( v) ? "SORTED" : ( ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( v) ? "UNBALANCED" : ( ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( v) ? "BALANCED" : "???"))))))
#define ND_INDEX_SUBTYPE_ASCII_GET( r, i) ND_INDEX_SUBTYPE_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
/* Manager Template */
// NDT_Status ND_Example_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list *Args_Ptr)
// {
// NDT_Command_Name Command_Name;
//
//
// switch( Command)
// {
// case NDD_CMD_MANAGER_VERSION:
// {
// ND_VA_ARG_GET( Version_Name_Ptr, *Args_Ptr, NDT_Version_Name *);
//
//
// Command_Name = "NDD_CMD_MANAGER_VERSION";
//
// *Version_Name_Ptr = "$Revision: 2.13 $ $Name: libnode-2_2_0-1 $ $Date: 2010/06/06 21:26:31 $ $Author: agibert $";
//
// return( NDS_OK);
// }
//
// case NDD_CMD_INDEX_GET:
// {
// /*
// ND_VA_ARG_GET( Reply_Index_Id_Ptr, *Args_Ptr, NDT_Index_Id *);
// ND_VA_ARG_GET( Reply_Command_Ptr, *Args_Ptr, NDT_Command *);
// ND_VA_ARG_GET( Cmd, *Args_Ptr, NDT_Command);
// ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
// */
// ND_VA_ARG_GET( Reply_Index_Id_Ptr, *Args_Ptr, NDT_Index_Id *);
// ND_VA_ARG_GET( Reply_Command_Ptr, *Args_Ptr, NDT_Command *);
// ND_VA_ARG_GET( Cmd, *Args_Ptr, NDT_Command);
// ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
//
//
// Command_Name = "NDD_CMD_INDEX_GET";
//
// switch(Cmd)
// {
// /*
// case NDT_CMD_SOME_USER_CMD:
// {
// *Reply_Index_Id_Ptr = 0;
// *Reply_Command_Ptr = NDD_CMD_SOME_OTHER_CMD;
// break;
// }
//
// ...
// */
//
// default:
// {
// *Reply_Index_Id_Ptr = Index_Id;
// *Reply_Command_Ptr = Cmd;
// break;
// }
// }
//
// return( NDS_OK);
// }
//
// case NDD_CMD_VALUE_ALLOC:
// {
// /*
// ND_VA_ARG_GET( Value_Ptr_Ptr, *Args_Ptr, void **);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// */
//
//
// Command_Name = "NDD_CMD_VALUE_ALLOC";
//
// /*
// if( ( *Value_Ptr_Ptr = (void *)malloc( sizeof(void))) == NULL)
// {
// return(NDS_ERRMEM);
// }
// else
// {
// ...
//
// return( NDS_OK);
// }
// */
// }
//
// case NDD_CMD_VALUE_FREE:
// {
// /*
// ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// */
//
//
// Command_Name = "NDD_CMD_VALUE_FREE";
//
// /*
// free( Value_Ptr);
//
// return( NDS_OK);
// */
// }
//
// case NDD_CMD_VALUE_COMP:
// {
// /*
// ND_VA_ARG_GET( Value1_Ptr, *Args_Ptr, void *);
// ND_VA_ARG_GET( Value2_Ptr, *Args_Ptr, void *);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// */
//
//
// Command_Name = "NDD_CMD_VALUE_COMP";
//
// switch( Index_Id)
// {
// case 0:
// {
// int rc;
//
//
// rc = strcmp( Value1_Ptr->..., Value2_Ptr->...);
//
// if( rc < 0)
// {
// return(NDS_LOWER);
// }
// else
// {
// if( rc > 0)
// {
// return(NDS_GREATER);
// }
// else
// {
// return(NDS_EQUAL);
// }
// }
// }
//
// case 1:
// {
// int val1 = atoi(Value1_Ptr->...);
// int val2 = atoi(Value2_Ptr->...);
//
//
// if( val1 < val2)
// {
// return(NDS_LOWER);
// }
// else
// {
// if( val1 > val2)
// {
// return(NDS_GREATER);
// }
// else
// {
// return(NDS_EQUAL);
// }
// }
// }
//
// case 2:
// {
// ...
// }
//
// default:
// {
// printf( "Unknown COMP idx (%d) !\n", Index_Id);
// return( NDS_KO);
// }
// }
//
// return( NDS_OK);
// }
//
// case NDD_CMD_VALUE_ADD:
// {
// /*
// ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// */
//
//
// Command_Name = "NDD_CMD_VALUE_ADD";
//
// /*
// return( NDS_OK);
// */
// }
//
// case NDD_CMD_VALUE_REMOVE:
// {
// /*
// ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// */
//
//
// Command_Name = "NDD_CMD_VALUE_REMOVE";
// /*
// return( NDS_OK);
// */
// }
//
// case NDD_CMD_VALUE_PRINT:
// {
// /*
// ND_VA_ARG_GET( Next_Node_Ptr, *Args_Ptr, NDT_Node *);
//
// ND_VA_LIST_OPEN( lib_args, *Args_Ptr);
//
// ND_VA_ARG_GET( Out, lib_args, FILE *);
// ND_VA_ARG_GET( Recursive_Mode, lib_args, NDT_Recursive_Mode);
// ND_VA_ARG_GET( Recursive_Depth, lib_args, NDT_Recursive_Depth);
// ND_VA_ARG_GET( Recursive_Offset, lib_args, NDT_Recursive_Offset);
//
// ND_VA_LIST_OPEN( user_args, lib_args);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// ND_VA_LIST_CLOSE( lib_args);
//
// void *Value_Ptr = Node_Ptr->Value;
// */
//
//
// Command_Name = "NDD_CMD_VALUE_PRINT";
//
// /*
// fprintf( Out, "...\n", Value_Ptr->..., ...);
//
// return( NDS_OK);
// */
// }
//
// case NDD_CMD_INFO_PRINT:
// {
// /*
// ND_VA_ARG_GET( Next_Node_Ptr, *Args_Ptr, NDT_Node *);
//
// ND_VA_LIST_OPEN( lib_args, *Args_Ptr);
//
// ND_VA_ARG_GET( Out, lib_args, FILE *);
// ND_VA_ARG_GET( Recursive_Mode, lib_args, NDT_Recursive_Mode);
// ND_VA_ARG_GET( Recursive_Depth, lib_args, NDT_Recursive_Depth);
// ND_VA_ARG_GET( Recursive_Offset, lib_args, NDT_Recursive_Offset);
//
// ND_VA_LIST_OPEN( user_args, lib_args);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
// ND_VA_LIST_CLOSE( lib_args);
// */
//
//
// Command_Name = "NDD_CMD_INFO_PRINT";
//
// /*
// return( NDS_OK);
// */
// }
//
// case NDD_CMD_USER_TRAVERSE:
// {
// /*
// ND_VA_ARG_GET( Next_Node_Ptr, *Args_Ptr, NDT_Node *);
//
// ND_VA_LIST_OPEN( user_args, *Args_Ptr);
//
// ND_VA_ARG_GET( user_data, user_args, user_type);
// ND_VA_ARG_GET( ..., user_args, ...);
//
// ND_VA_LIST_CLOSE( user_args);
//
//
// void *Value_Ptr = Node_Ptr->Value;
// */
//
//
// Command_Name = "NDD_CMD_USER_TRAVERSE";
//
// /*
// return( NDS_OK);
// */
// }
//
// default:
// {
// printf( "ND_Default_Manager() called with an undefined command %d\n", Command);
// return(NDS_ERRAPI);
// }
// }
//
// printf( "ND_Default_Manager() called with command %d (%s)\n", Command, Command_Name);
// return(NDS_OK);
// }
/* Var Args Manager Macros */
#define ND_VA_LIST_OPEN( VA_List_Target, VA_List_Source) va_list VA_List_Target; va_copy( VA_List_Target, *va_arg( VA_List_Source, va_list *))
#define ND_VA_LIST_CLOSE( VA_List) va_end( VA_List)
#define ND_VA_ARG_GET( Arg, VA_List, Type) Type Arg = va_arg( VA_List, Type)
/* Manager Commands */
typedef int NDT_Command;
#define NDD_CMD_UNKNOWN (NDT_Command)0
#define NDD_CMD_MANAGER_VERSION (NDT_Command)1
#define NDD_CMD_INDEX_GET (NDT_Command)2
#define NDD_CMD_VALUE_ALLOC (NDT_Command)3
#define NDD_CMD_VALUE_FREE (NDT_Command)4
#define NDD_CMD_VALUE_COMP (NDT_Command)5
#define NDD_CMD_VALUE_ADD (NDT_Command)6
#define NDD_CMD_VALUE_REMOVE (NDT_Command)7
#define NDD_CMD_VALUE_PRINT (NDT_Command)8
#define NDD_CMD_VALUE_FIND (NDT_Command)9
#define NDD_CMD_INFO_PRINT (NDT_Command)10
#define NDD_CMD_USER_TRAVERSE (NDT_Command)17
typedef char *NDT_Command_Name;
typedef char *NDT_Version_Name;
/* Manager or Functions Return Codes */
typedef int NDT_Status;
#define ND_ERROR(s) ((s) <= 0) /* All negative or 0 status are errors */
#define NDS_OK 1
#define NDS_KO 0
#define NDS_YES 1
#define NDS_NO 0
#define NDS_EQUAL 1
#define NDS_GREATER 2
#define NDS_LOWER 3
#define NDS_ERRMEM -1 /* Memory allocation problem */
#define NDS_ERRAPI -2 /* Bad API usage */
typedef short NDT_Index_Id;
typedef short NDT_Index_Nb;
#define NDD_INDEX_UNKNOWN (NDT_Index_Id)-1
#define NDD_INDEX_PRIMARY (NDT_Index_Id)0
struct NDT_Root;
struct NDT_Node;
/* Manager function pointer */
#define NDD_MANAGER_NAME_LEN_MAX 64
#define NDD_MANAGER_NAME_SIZE_MAX (NDD_MANAGER_NAME_LEN_MAX + 1)
typedef char *NDT_Manager_Name;
typedef NDT_Status NDT_Manager( struct NDT_Root *, NDT_Index_Id, struct NDT_Node *, NDT_Command, va_list *);
/* Memory allocator function pointer */
#define NDD_ALLOCATOR_NAME_LEN_MAX 64
#define NDD_ALLOCATOR_NAME_SIZE_MAX (NDD_ALLOCATOR_NAME_LEN_MAX + 1)
typedef char *NDT_Allocator_Name;
typedef NDT_Status NDT_Allocator( void **, size_t, void *);
/* Memory deallocator function pointer */
#define NDD_DEALLOCATOR_NAME_LEN_MAX 64
#define NDD_DEALLOCATOR_NAME_SIZE_MAX (NDD_DEALLOCATOR_NAME_LEN_MAX + 1)
typedef char *NDT_Deallocator_Name;
typedef NDT_Status NDT_Deallocator( void *, void *);
typedef struct NDT_Index
{
NDT_Index_Type Type; /* Structure Type (Queue, Stack, Tree, ... ) */
long Node_Number; /* Number of node in the structure */
long Min_Depth; /* Minimum tree depth */
long Max_Depth; /* Maximum tree depth */
long Max_Dif; /* Maximum allowed depth between tree branches before rebalancing */
long Nb_Equ; /* Rebalancing count */
struct NDT_Node *Head; /* Head node */
struct NDT_Node *Tail; /* Tail node */
struct NDT_Node *Save; /* Save pointer (Used by restore function) */
} NDT_Index;
typedef struct NDT_Root
{
NDT_Manager *Manager_Ptr; /* Manager function pointer */
char Manager_Name[NDD_MANAGER_NAME_SIZE_MAX]; /* Manager function name */
NDT_Allocator *Allocator_Ptr; /* Value allocator function pointer */
char Allocator_Name[NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Value allocator function name */
NDT_Deallocator *Deallocator_Ptr; /* Value deallocator function pointer */
char Deallocator_Name[NDD_DEALLOCATOR_NAME_SIZE_MAX]; /* Value deallocator function name */
short Own_Value; /* Flag indicating if the structure is the node owner */
void *User_Ptr; /* User pointer */
NDT_Index_Nb Index_Nb;
NDT_Index_Nb Index_Open_Count;
NDT_Index Index_Tab[1];
} NDT_Root;
typedef struct NDT_DataStruct
{
NDT_Root *Root_Ptr;
NDT_Manager *Manager_Ptr; /* Manager function pointer */
NDT_Allocator *Allocator_Ptr; /* Value allocator function pointer */
NDT_Deallocator *Deallocator_Ptr; /* Value deallocator function pointer */
} NDT_DataStruct;
/* Node structure */
typedef struct NDT_Node
{
NDT_Root *Root;
NDT_Index_Id Index;
struct NDT_Node *Parent;
struct NDT_Node *Left;
struct NDT_Node *Right;
void *Value;
} NDT_Node;
typedef int NDT_Recursive_Mode;
typedef int NDT_Recursive_Depth;
typedef int NDT_Recursive_Offset;
#define NDD_RECURSIVE_MODE_UNKNOWN (NDT_Recursive_Mode)0x00
#define NDD_RECURSIVE_MODE_PARENT (NDT_Recursive_Mode)0x01
#define NDD_RECURSIVE_MODE_CHILD (NDT_Recursive_Mode)0x02
#define NDD_RECURSIVE_MODE_PARENT_CHILD (NDT_Recursive_Mode)0x03
#define ND_RECURSIVE_PARENT_IS(m) (m & NDD_RECURSIVE_MODE_PARENT)
#define ND_RECURSIVE_CHILD_IS(m) (m & NDD_RECURSIVE_MODE_CHILD)
#define ND_RECURSIVE_PRINT_OFFSET 8
/* Alias API definition */
#ifndef ND_MODE
#define ND_MODE 0
#endif
#if ND_MODE == 1 /* No arg checking API */
#define ND_Library_Open ND_Library_Open_I
#define ND_Library_Close ND_Library_Close_I
#define ND_Library_StdErr_Set ND_Library_StdErr_Set_I
#define ND_DataStruct_Open ND_DataStruct_Open_I
#define ND_DataStruct_Close ND_DataStruct_Close_I
#define ND_DataStruct_Flush ND_DataStruct_Flush_I
#define ND_DataStruct_Check ND_DataStruct_Check_I
#define ND_DataStruct_Convert ND_DataStruct_Convert_I
#define ND_DataStruct_Reorg ND_DataStruct_Reorg_I
#define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VI
#define ND_DataStruct_Traverse ND_DataStruct_Traverse_I
#define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_I
#define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_I
#define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_I
#define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_I
#define ND_DataStruct_Value_Find ND_DataStruct_Value_Find_I
#define ND_Index_Open ND_Index_Open_I
#define ND_Index_Close ND_Index_Close_I
#define ND_Index_Flush ND_Index_Flush_I
#define ND_Index_Check ND_Index_Check_I
#define ND_Index_Convert ND_Index_Convert_I
#define ND_Index_Reorg ND_Index_Reorg_I
#define ND_Index_Traverse_V ND_Index_Traverse_VI
#define ND_Index_Traverse ND_Index_Traverse_I
#define ND_Index_Info_Print ND_Index_Info_Print_I
#define ND_Index_Value_Add ND_Index_Value_Add_I
#define ND_Index_Value_Remove ND_Index_Value_Remove_I
#define ND_Index_Value_Print ND_Index_Value_Print_I
#define ND_Index_Node_Add ND_Index_Node_Add_I
#define ND_Index_Node_Remove ND_Index_Node_Remove_I
#define ND_Index_Node_First_Get ND_Index_Node_First_Get_I
#define ND_Index_Node_Last_Get ND_Index_Node_Last_Get_I
#define ND_Index_Node_Next_Get ND_Index_Node_Next_Get_I
#define ND_Index_Node_Previous_Get ND_Index_Node_Previous_Get_I
#define ND_Index_Node_Find ND_Index_Node_Find_I
#define ND_Node_Root_Get ND_Node_Root_Get_I
#define ND_Value_Alloc ND_Value_Alloc_I
#define ND_Value_Free ND_Value_Free_I
#define ND_Manager_Exec_V ND_Manager_Exec_VI
#define ND_Manager_Exec ND_Manager_Exec_I
#define ND_Allocator_Exec ND_Allocator_Exec_I
#define ND_Deallocator_Exec ND_Deallocator_Exec_I
#else /* Arg checking API */
#define ND_Library_Open ND_Library_Open_C
#define ND_Library_Close ND_Library_Close_C
#define ND_Library_StdErr_Set ND_Library_StdErr_Set_C
#define ND_DataStruct_Open ND_DataStruct_Open_C
#define ND_DataStruct_Close ND_DataStruct_Close_C
#define ND_DataStruct_Flush ND_DataStruct_Flush_C
#define ND_DataStruct_Check ND_DataStruct_Check_C
#define ND_DataStruct_Convert ND_DataStruct_Convert_C
#define ND_DataStruct_Reorg ND_DataStruct_Reorg_C
#define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VC
#define ND_DataStruct_Traverse ND_DataStruct_Traverse_C
#define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_C
#define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_C
#define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_C
#define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_C
#define ND_DataStruct_Value_Find ND_DataStruct_Value_Find_C
#define ND_Index_Open ND_Index_Open_C
#define ND_Index_Close ND_Index_Close_C
#define ND_Index_Flush ND_Index_Flush_C
#define ND_Index_Check ND_Index_Check_C
#define ND_Index_Convert ND_Index_Convert_C
#define ND_Index_Reorg ND_Index_Reorg_C
#define ND_Index_Traverse_V ND_Index_Traverse_VC
#define ND_Index_Traverse ND_Index_Traverse_C
#define ND_Index_Info_Print ND_Index_Info_Print_C
#define ND_Index_Value_Add ND_Index_Value_Add_C
#define ND_Index_Value_Remove ND_Index_Value_Remove_C
#define ND_Index_Value_Print ND_Index_Value_Print_C
#define ND_Index_Node_Add ND_Index_Node_Add_C
#define ND_Index_Node_Remove ND_Index_Node_Remove_C
#define ND_Index_Node_First_Get ND_Index_Node_First_Get_C
#define ND_Index_Node_Last_Get ND_Index_Node_Last_Get_C
#define ND_Index_Node_Next_Get ND_Index_Node_Next_Get_C
#define ND_Index_Node_Previous_Get ND_Index_Node_Previous_Get_C
#define ND_Index_Node_Find ND_Index_Node_Find_C
#define ND_Node_Root_Get ND_Node_Root_Get_C
#define ND_Value_Alloc ND_Value_Alloc_C
#define ND_Value_Free ND_Value_Free_C
#define ND_Manager_Exec_V ND_Manager_Exec_VC
#define ND_Manager_Exec ND_Manager_Exec_C
#define ND_Allocator_Exec ND_Allocator_Exec_C
#define ND_Deallocator_Exec ND_Deallocator_Exec_C
#endif
/*------------------------------------------------------------------------------*/
# if defined(_WIN32) && !defined(LIBNODE_STATIC)
# ifndef _LIBNODE_C_
# define NDD_DLL_API __declspec(dllimport)
# else
# define NDD_DLL_API __declspec(dllexport)
# endif
# else
# define NDD_DLL_API
# endif
/*------------------------------------------------------------------------------*/
/* Library initialisation */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Library_Open_I ( int Debug_Mode );
NDD_DLL_API NDT_Status ND_Library_Open_C ( int Debug_Mode );
/*------------------------------------------------------------------------------*/
/* Library deinitialisation */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Library_Close_I( void);
NDD_DLL_API NDT_Status ND_Library_Close_C( void);
/*------------------------------------------------------------------------------*/
/* Library Standard Error output setup */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_I( FILE *);
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *);
/*------------------------------------------------------------------------------*/
/* Create a new data structure */
/*------------------------------------------------------------------------------*/
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
/* (I) Type: type de la structure.de donn<6E>es (liste ou arbre binaire) */
/* (I) Allocator: pointeur vers la fonction d'allocation */
/* (I) Deallocator: pointeur vers la fonction de d<>sallocation */
/* (I) Data : pointeur de donn<6E>es utiles <20> l'allocateur */
/* (I) Own_Value : indique si la structure est propri<72>taire de ses valeurs */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Open_I( NDT_Root **, NDT_Index_Nb, NDT_Index_Type *, NDT_Manager_Name, NDT_Manager *, NDT_Allocator_Name, NDT_Allocator *, NDT_Deallocator_Name, NDT_Deallocator *, short, void *);
NDD_DLL_API NDT_Status ND_DataStruct_Open_C( NDT_Root **, NDT_Index_Nb, NDT_Index_Type *, NDT_Manager_Name, NDT_Manager *, NDT_Allocator_Name, NDT_Allocator *, NDT_Deallocator_Name, NDT_Deallocator *, short, void *);
/*------------------------------------------------------------------------------*/
/* Destroy a data structure */
/*------------------------------------------------------------------------------*/
/* (O) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Close_I( NDT_Root *);
NDD_DLL_API NDT_Status ND_DataStruct_Close_C( NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Destroy all data of a data structure */
/*------------------------------------------------------------------------------*/
/* (O) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Flush_I( NDT_Root *);
NDD_DLL_API NDT_Status ND_DataStruct_Flush_C( NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Check & repare a datat structure: */
/* - Check & fix node links */
/* - Update data structure statistics */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la structure */
/* (O) Nb_Detected : pointeur sur le nombre d'erreurs */
/* (O) Nb_Corrected : pointeur sur le nombre d'erreurs */
/* (I) Out : flux de sortie du rapport */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Check_I( NDT_Root *, int *, int *, FILE *);
NDD_DLL_API NDT_Status ND_DataStruct_Check_C( NDT_Root *, int *, int *, FILE *);
/*------------------------------------------------------------------------------*/
/* Convert a data structure to another type */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Target_Type: type de structure cible */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Convert_I( NDT_Root *, NDT_Index_Type *);
NDD_DLL_API NDT_Status ND_DataStruct_Convert_C( NDT_Root *, NDT_Index_Type *);
/*------------------------------------------------------------------------------*/
/* Reorganise a data structure: */
/* - sort a non-sorted list */
/* - rebalance a non auto-balanced tree */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Reorg_I( NDT_Root *);
NDD_DLL_API NDT_Status ND_DataStruct_Reorg_C( NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Traverse a data structure & execute a command on each node */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Command: Commande <20> ex<65>cuter sur chaque noeud travers<72> */
/* (I) Data: pointeur de donn<6E>es utilisateur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VI( NDT_Root *, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VC( NDT_Root *, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_I( NDT_Root *, NDT_Command, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_C( NDT_Root *, NDT_Command, ...);
/*------------------------------------------------------------------------------*/
/* Print data structure information */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Out : flux de sortie */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Info_Print_I( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
NDD_DLL_API NDT_Status ND_DataStruct_Info_Print_C( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
/*------------------------------------------------------------------------------*/
/* Add a new value to a data structure */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Value: pointeur sur la valeur <20> ajouter */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Value_Add_I( NDT_Root *, void *);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Add_C( NDT_Root *, void *);
/*------------------------------------------------------------------------------*/
/* Remove the first matching value from a data structure */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la structure de donn<6E>es */
/* (I) Reference_Value : pointeur sur la valeur de r<>f<EFBFBD>rence */
/* (I) Removed_Value : adresse d'un pointeur sur la valeur supprim<69>e */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Value_Remove_I( NDT_Root *, void *);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Remove_C( NDT_Root *, void *);
/*------------------------------------------------------------------------------*/
/* Print all the data structure values */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Out : flux de sortie */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_VI( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, va_list *);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_I( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_C( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
/*------------------------------------------------------------------------------*/
/* Find a node from a value in a datat structure */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de l'abre */
/* (O) Node : pointeur sur le noeud <20> r<>cuperer */
/* (I) Value : pointeur sur la valeur <20> rechercher */
/* (I) Data : pointeur de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VI( void **, NDT_Root *, void *, va_list *);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VC( void **, NDT_Root *, void *, va_list *);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_I( void **, NDT_Root *, void *, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_C( void **, NDT_Root *, void *, ...);
/*------------------------------------------------------------------------------*/
/* Create a new index (not yet implemented !) */
/*------------------------------------------------------------------------------*/
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
/* (I) Type: type de la structure.de donn<6E>es (liste ou arbre binaire) */
/* (I) Allocator: pointeur vers la fonction d'allocation */
/* (I) Deallocator: pointeur vers la fonction de d<>sallocation */
/* (I) Data : pointeur de donn<6E>es utiles <20> l'allocateur */
/* (I) Own_Value : indique si la structure est propri<72>taire de ses valeurs */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Open_I( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
NDD_DLL_API NDT_Status ND_Index_Open_C( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
/*------------------------------------------------------------------------------*/
/* Remove an Index (not yet implemented !) */
/*------------------------------------------------------------------------------*/
/* (O) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Close_I( NDT_Root *, NDT_Index_Id);
NDD_DLL_API NDT_Status ND_Index_Close_C( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Remove an Index (not yet implemented !) */
/*------------------------------------------------------------------------------*/
/* (O) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Flush_I( NDT_Root *, NDT_Index_Id);
NDD_DLL_API NDT_Status ND_Index_Flush_C( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Check & repare a data structure index: */
/* - Check & fix node links */
/* - Update data structure statistics */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la structure */
/* (O) Nb_Detected : pointeur sur le nombre d'erreurs */
/* (O) Nb_Corrected : pointeur sur le nombre d'erreurs */
/* (I) Out : flux de sortie du rapport */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Check_I( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
NDD_DLL_API NDT_Status ND_Index_Check_C( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
/*------------------------------------------------------------------------------*/
/* Convert a data structure index to another type */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Target_Type: type de structure cible */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Convert_I ( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
NDD_DLL_API NDT_Status ND_Index_Convert_C ( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
/*------------------------------------------------------------------------------*/
/* Reorganise a data structure index: */
/* - sort a non-sorted list */
/* - rebalance a non auto-balanced tree */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Reorg_I( NDT_Root *, NDT_Index_Id);
NDD_DLL_API NDT_Status ND_Index_Reorg_C( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Traverse a data structure index & execute a command on each node */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Command: Commande <20> ex<65>cuter sur chaque noeud travers<72> */
/* (I) Data: pointeur de donn<6E>es utilisateur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Traverse_VI( NDT_Root *, NDT_Index_Id, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_Index_Traverse_VC( NDT_Root *, NDT_Index_Id, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_Index_Traverse_I( NDT_Root *, NDT_Index_Id, NDT_Command, ...);
NDD_DLL_API NDT_Status ND_Index_Traverse_C( NDT_Root *, NDT_Index_Id, NDT_Command, ...);
/*------------------------------------------------------------------------------*/
/* Print data structure index information */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Command: Commande <20> ex<65>cuter sur chaque noeud travers<72> */
/* (I) Data: pointeur de donn<6E>es utilisateur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Info_Print_I( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
NDD_DLL_API NDT_Status ND_Index_Info_Print_C( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
/*------------------------------------------------------------------------------*/
/* Add a new value to a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Value: pointeur sur la valeur <20> ajouter */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Value_Add_I( NDT_Root *, NDT_Index_Id, void *);
NDD_DLL_API NDT_Status ND_Index_Value_Add_C( NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Remove the first matching value from a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la structure de donn<6E>es */
/* (I) Reference_Value : pointeur sur la valeur de r<>f<EFBFBD>rence */
/* (I) Removed_Value : adresse d'un pointeur sur la valeur supprim<69>e */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Value_Remove_I( NDT_Root *, NDT_Index_Id, void *);
NDD_DLL_API NDT_Status ND_Index_Value_Remove_C( NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Print all the data structure index values */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Out : flux de sortie */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Value_Print_VI( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, va_list *);
NDD_DLL_API NDT_Status ND_Index_Value_Print_I( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
NDD_DLL_API NDT_Status ND_Index_Value_Print_C( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
/*------------------------------------------------------------------------------*/
/* Add a new node to a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Node: pointeur sur le noeud <20> ajouter */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Add_I( NDT_Root *, NDT_Index_Id, NDT_Node *);
NDD_DLL_API NDT_Status ND_Index_Node_Add_C( NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Remove a node from a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Node: pointeur sur le noeud <20> supprimer de la structure de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Remove_I( NDT_Node *);
NDD_DLL_API NDT_Status ND_Index_Node_Remove_C( NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Get the first node of a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine dont on cherche le premier noeud */
/* (O) Node : pointeur sur le noeud <20> r<>cup<75>rer */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_First_Get_I( NDT_Node **, NDT_Root *, NDT_Index_Id);
NDD_DLL_API NDT_Status ND_Index_Node_First_Get_C( NDT_Node **, NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Get the last node of a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine dont on cherche le dernier noeud */
/* (O) Node : pointeur sur le noeud <20> r<>cup<75>rer */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Last_Get_I( NDT_Node **, NDT_Root *, NDT_Index_Id);
NDD_DLL_API NDT_Status ND_Index_Node_Last_Get_C( NDT_Node **, NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Get the next node of a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Node: pointeur sur le noeud dont on cherche le suivant */
/* (O) Next_Node : pointeur sur le noeud suivant */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Next_Get_I( NDT_Node **, NDT_Node *);
NDD_DLL_API NDT_Status ND_Index_Node_Next_Get_C( NDT_Node **, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Get the previous node of a data structure index */
/*------------------------------------------------------------------------------*/
/* (I) Node: pointeur sur le noeud dont on cherche le pr<70>c<EFBFBD>dant */
/* (O) Prev_Node : pointeur sur le noeud pr<70>c<EFBFBD>dant */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Previous_Get_I( NDT_Node **, NDT_Node *);
NDD_DLL_API NDT_Status ND_Index_Node_Previous_Get_C( NDT_Node **, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Find a node from a value in a datat structure index */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de l'abre */
/* (O) Node : pointeur sur le noeud <20> r<>cuperer */
/* (I) Value : pointeur sur la valeur <20> rechercher */
/* (I) Data : pointeur de donn<6E>es */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Index_Node_Find_VI( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, va_list *);
NDD_DLL_API NDT_Status ND_Index_Node_Find_VC( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, va_list *);
NDD_DLL_API NDT_Status ND_Index_Node_Find_I( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, ...);
NDD_DLL_API NDT_Status ND_Index_Node_Find_C( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, ...);
/*------------------------------------------------------------------------------*/
/* Get the root node of a data structure */
/*------------------------------------------------------------------------------*/
/* (O) Root: Adresse du pointeur sur la racine <20> r<>cup<75>rer */
/* (I) Node: pointeur sur le noeud dont on cherche la racine */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Node_Root_Get_I( NDT_Root **, NDT_Node *);
NDD_DLL_API NDT_Status ND_Node_Root_Get_C( NDT_Root **, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Allocate a new value */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la structure de donn<6E>es */
/* (O) Value : adresse d'un pointeur sur la valeur <20> allouer */
/* (I) ... : arguments relatifs <20> l'allocation de la valeur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Value_Alloc_I( NDT_Root *, void **, ...);
NDD_DLL_API NDT_Status ND_Value_Alloc_C( NDT_Root *, void **, ...);
/*------------------------------------------------------------------------------*/
/* Deallocate a value */
/*------------------------------------------------------------------------------*/
/* (I) Root: pointeur sur la racine de la structure de donn<6E>es */
/* (I) Value: pointeur sur la valeur <20> d<>sallouer */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Value_Free_I( NDT_Root *, void *);
NDD_DLL_API NDT_Status ND_Value_Free_C( NDT_Root *, void *);
/*------------------------------------------------------------------------------*/
/* Execute a manager function */
/*------------------------------------------------------------------------------*/
/* (I) Function : nom de la fonction manager <20> ex<65>cuter */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Manager_Exec_VI( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_Manager_Exec_VC( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
NDD_DLL_API NDT_Status ND_Manager_Exec_I( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, ...);
NDD_DLL_API NDT_Status ND_Manager_Exec_C( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, ...);
/*------------------------------------------------------------------------------*/
/* Execute an allocator function */
/*------------------------------------------------------------------------------*/
/* (I) Function : nom de la fonction <20> ex<65>cuter */
/* (O) Ptr : adresse d'un pointeur sur la zone <20> allouer */
/* (I) Size : taille de la zone <20> allouer */
/* (I) Data : pointeur de donn<6E>es utiles <20> l'allocateur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Allocator_Exec_I( void **, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
NDD_DLL_API NDT_Status ND_Allocator_Exec_C( void **, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
/*------------------------------------------------------------------------------*/
/* Execute a deallocator function */
/*------------------------------------------------------------------------------*/
/* (I) Function : nom de la fonction <20> ex<65>cuter */
/* (I) Function : nom de la fonction <20> ex<65>cuter */
/* (I) Ptr : adresse de la zone <20> d<>sallouer */
/* (I) Data : pointeur de donn<6E>es utiles au d<>sallocateur */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Deallocator_Exec_I( void *, NDT_Deallocator_Name, NDT_Deallocator *, void *);
NDD_DLL_API NDT_Status ND_Deallocator_Exec_C( void *, NDT_Deallocator_Name, NDT_Deallocator *, void *);
# ifdef __cplusplus
}
# endif
#endif