Merge win32 branche (1.1.2.15) with main trunc !

This commit is contained in:
agibert 2001-11-26 10:17:44 +00:00
parent 14f8c8c0a1
commit 97703fce97

View File

@ -1,19 +1,42 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 1.2 $ */
/* $Name: $ */
/* $Date: 2001/11/26 10:17:44 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <dlfcn.h>
//#include <dlfcn.h>
#include <node.h>
#define HUGE_LONG 0xFFFFFFL
#ifndef min
#define min(A,B) ((A > B) ? B : A)
#ifdef __linux
# define NDD_PRINTF_PTR_PREFIX ""
#else
# define NDD_PRINTF_PTR_PREFIX "0x"
#endif
#ifndef max
#define max(A,B) ((A < B) ? B : A)
#endif
#define NDD_HUGE_LONG (long)0xFFFFFFL
/* Sortie standard des messages d'erreur */
@ -45,17 +68,17 @@ int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status Default_Manager (va_list Arguments);
NDT_Status Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Malloc (size_t Size, void ** ptr, void * User);
NDT_Status ND_Default_Allocator( size_t Size, void **ptr, void *User);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Free (void * ptr);
NDT_Status ND_Default_Desallocator( void *, void *);
/*------------------------------------------------------------------------------*/
/* Création d'un noeud */
@ -82,16 +105,14 @@ NDT_Status ND_Node_Free (NDT_Root * Root, NDT_Node * Node);
/* (I) Desallocater : pointeur vers la fonction de désallocation */
/* (I) Data : pointeur de données utiles à l'allocateur */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Root_Alloc (NDT_Root ** Root, NDT_DataStruct_Type Type, \
const char * Allocator, const char * Desallocator, \
void * Data);
NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], char *, NDT_Manager *, char *, NDT_Allocator *, char *, NDT_Desallocator *, short, void *);
/*------------------------------------------------------------------------------*/
/* Destruction d'une racine */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Root_Free (NDT_Root * Root);
NDT_Status ND_Node_Root_Free (NDT_Root * Root);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à une liste chaînée */
@ -99,7 +120,7 @@ NDT_Status ND_Root_Free (NDT_Root * Root);
/* (I) Root : pointeur sur la racine de la liste */
/* (I) New_Node : pointeur sur le noeud à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Node_Add (NDT_Root * Root, NDT_Node * New_Node);
NDT_Status ND_List_Node_Add (NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajout d'une nouvelle valeur à une liste */
@ -107,7 +128,7 @@ NDT_Status ND_List_Node_Add (NDT_Root * Root, NDT_Node * New_Node);
/* (I) Root : pointeur sur la racine de la liste */
/* (I) Value : pointeur sur la valeur à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Value_Add (NDT_Root * Root, void * Value);
NDT_Status ND_List_Value_Add (NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à un arbre binaire */
@ -115,31 +136,31 @@ NDT_Status ND_List_Value_Add (NDT_Root * Root, void * Value);
/* (I) Root : pointeur sur la racine de l'arbre */
/* (I) Value : pointeur sur la valeur à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Value_Add (NDT_Root * Root, void * Value);
NDT_Status ND_Tree_Value_Add (NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Supprime le noeud d'une liste */
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud à supprimer */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Node_Remove (NDT_Node * Node);
NDT_Status ND_List_Node_Remove (NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Conversion d'une structure en liste chaînée */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine du la structure à convertir */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Make (NDT_Root * Root);
NDT_Status ND_List_Make (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Recherche une valeur dans une liste et retourne le noeud correspondant */
/*------------------------------------------------------------------------------*/
NDT_Node * ND_List_Node_Find (NDT_Root * Root, void * Value, void * Data);
NDT_Node * ND_List_Node_Find (NDT_Root *, NDT_Index_Id, void *, va_list);
/*------------------------------------------------------------------------------*/
/* Recherche un noeud dans un arbre et retourne le pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
NDT_Node * ND_Tree_Node_Find (NDT_Root * Root, void * Value, void * Data);
NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
/*------------------------------------------------------------------------------*/
/* Conversion d'une structure en arbre binaire */
@ -147,14 +168,14 @@ NDT_Node * ND_Tree_Node_Find (NDT_Root * Root, void * Value, void * Data);
/* (I) Root : pointeur sur la racine du la structure à convertir */
/* (I) Type : type du futur arbre */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Make (NDT_Root * Root);
NDT_Status ND_Tree_Make (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Equilibrage d'un arbre */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de l'arbre */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Equalize (NDT_Root * Root);
NDT_Status ND_Tree_Equalize (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Retourne la profondeur de la plus grande branche à partir d'un noeud */
@ -176,7 +197,7 @@ long ND_Tree_MinDepth_Get (NDT_Node * Node);
/* (I) Root : pointeur sur la racine de l'arbre */
/* (I) Node : pointeur sur le noeud à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Node_Add (NDT_Root * Root, NDT_Node * Node);
NDT_Status ND_Tree_Node_Add (NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajoute tous les noeud d'une liste à un arbre */
@ -184,7 +205,7 @@ NDT_Status ND_Tree_Node_Add (NDT_Root * Root, NDT_Node * Node);
/* (I) Tree_Root : pointeur sur la racine de l'arbre */
/* (I) List_Root : pointeur sur la racine de la liste */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_List_Add (NDT_Root * Tree_Root, NDT_Root * List_Root);
NDT_Status ND_Tree_List_Add (NDT_Root *, NDT_Index_Id, NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Fonction de comparaison de noeuds (pour le quick sort) */
@ -196,7 +217,7 @@ int ND_Node_Compare (void ** Node1, void ** Node2);
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la liste à trier */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Sort (NDT_Root * Root);
NDT_Status ND_List_Sort (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
@ -204,27 +225,27 @@ NDT_Status ND_List_Sort (NDT_Root * Root);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
void ND_List_Check (NDT_Root *, int *, int *, FILE *);
void ND_List_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_List_Link_Check (NDT_Root *, int *, int *, FILE *);
void ND_List_Link_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Value_Check (NDT_Root *, int *, int *, FILE *);
void ND_Value_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Check (NDT_Root *, int *, int *, FILE *);
void ND_Tree_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Link_Check (NDT_Root *, int *, int *, FILE *);
void ND_Tree_Link_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
NDT_Status ND_List_Recursive_Make (NDT_Node *, NDT_Root *);
NDT_Status ND_List_Recursive_Make (NDT_Node *, NDT_Root *, NDT_Index_Id);
NDT_Node * ND_Tree_Recursive_Make (long, long, NDT_Node *);
void ND_Tree_Node_Recursive_Add (NDT_Root *, NDT_Node *, NDT_Node **, long , NDT_Node *);
void ND_Tree_Node_Recursive_Add( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Node **, long , NDT_Node *);
NDT_Node * ND_Tree_Node_First_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Last_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, void * Data);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, va_list);
NDT_Node * ND_Tree_Parent_Next_Recursive_Get (NDT_Node * Node);