Add OpenStruct tracing support in ND_Library_Open(), ND_Library_Close(), ND_DataStruct_Open() and ND_DataStruct_Close(),

Create NDG_Base global structure variable and move all the sparced global variables into it,
ND_Library_Open() call is now mandatory,
Add library open test in *_C() functions,
Code cleaning,
Fix code indentation.
This commit is contained in:
agibert 2004-08-01 23:18:37 +00:00
parent 2274de2cf2
commit 8541d83655
3 changed files with 1643 additions and 877 deletions

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: node.h,v $ */
/* $RCSfile: node.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.6 $ */
/* $Revision: 2.7 $ */
/* $Name: $ */
/* $Date: 2003/07/16 00:20:53 $ */
/* $Date: 2004/08/01 23:18:37 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -21,7 +21,7 @@
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with Foobar; if not, write to the Free Software */
/* along with LibNode; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*---------------------------------------------------------------------------------*/
@ -64,9 +64,9 @@ extern "C" {
/*
Différence de profondeur entre la branche la plus courte et
la plus longue d'un arbre.
Le dépassement de ce seuil provoque le rééquilibrage de l'arbre
Différence de profondeur entre la branche la plus courte et
la plus longue d'un arbre.
Le dépassement de ce seuil provoque le rééquilibrage de l'arbre
*/
#define DEF_MAX_DIF 100
@ -131,9 +131,9 @@ typedef int NDT_Index_Type;
#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_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)
@ -244,16 +244,16 @@ typedef NDT_Status NDT_Desallocator(void *, void *);
typedef struct NDT_Index
{
NDT_Index_Type Type; /* Type de la structure (liste, arbre ... ) */
NDT_Index_Type Type; /* Type de la structure (liste, arbre ... ) */
long Node_Number; /* Nombre de noeuds dans la structure */
long Min_Depth; /* Profondeur minimale de l'arbre */
long Max_Depth; /* Profondeur maximale de l'arbre */
long Max_Dif; /* Différence maximale autorisée entre la branche la plus courte et la plus longue */
long Nb_Equ; /* Nombre de réquilibrages réalisés sur l'arbre */
struct NDT_Node * Head; /* Noeud de tête */
struct NDT_Node * Tail; /* Noeud de queue */
struct NDT_Node * Save; /* Pointeur de sauvegarde (utile pour la fonction de restauration) */
long Node_Number; /* Nombre de noeuds dans la structure */
long Min_Depth; /* Profondeur minimale de l'arbre */
long Max_Depth; /* Profondeur maximale de l'arbre */
long Max_Dif; /* Différence maximale autorisée entre la branche la plus courte et la plus longue */
long Nb_Equ; /* Nombre de réquilibrages réalisés sur l'arbre */
struct NDT_Node *Head; /* Noeud de tête */
struct NDT_Node *Tail; /* Noeud de queue */
struct NDT_Node *Save; /* Pointeur de sauvegarde (utile pour la fonction de restauration) */
} NDT_Index;
@ -264,19 +264,19 @@ typedef struct NDT_Root
// NDT_Root_Type Type; /* Root Structure Type */
// NDT_DataStruct_Type DS_Type; /* Type de la structure (liste, arbre ... ) */
NDT_Manager *Manager_Ptr; /* Pointeur sur la fonction manager */
char Manager_Name[NDD_MANAGER_NAME_SIZE_MAX]; /* Nom de la fonction manager */
NDT_Allocator *Allocator_Ptr; /* Pointeur sur la fonction d'allocation */
char Allocator_Name[NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction d'allocation */
NDT_Desallocator *Desallocator_Ptr; /* Pointeur sur la fonction de désallocation */
char Desallocator_Name[NDD_DESALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction de désallocation */
NDT_Manager *Manager_Ptr; /* Pointeur sur la fonction manager */
char Manager_Name[NDD_MANAGER_NAME_SIZE_MAX]; /* Nom de la fonction manager */
NDT_Allocator *Allocator_Ptr; /* Pointeur sur la fonction d'allocation */
char Allocator_Name[NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction d'allocation */
NDT_Desallocator *Desallocator_Ptr; /* Pointeur sur la fonction de désallocation */
char Desallocator_Name[NDD_DESALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction de désallocation */
short Own_Value; /* Indique si la structure est propriétaire de ses valeurs */
void *User; /* Pointeur utilisable librement par l'utilisateur */
short Own_Value; /* Indique si la structure est propriétaire de ses valeurs */
void *User; /* Pointeur utilisable librement par l'utilisateur */
NDT_Index_Nb Index_Nb;
NDT_Index_Nb Index_Open_Count;
NDT_Index Index_Tab[0];
NDT_Index_Nb Index_Nb;
NDT_Index_Nb Index_Open_Count;
NDT_Index Index_Tab[0];
} NDT_Root;
@ -285,11 +285,11 @@ typedef struct NDT_Root
typedef struct NDT_DataStruct
{
NDT_Root *Root_Ptr;
NDT_Root *Root_Ptr;
NDT_Manager *Manager_Ptr; /* Manager function pointer */
NDT_Allocator *Allocator_Ptr; /* Allocator function pointer */
NDT_Desallocator *Desallocator_Ptr; /* Desallocator function pointer */
NDT_Manager *Manager_Ptr; /* Manager function pointer */
NDT_Allocator *Allocator_Ptr; /* Allocator function pointer */
NDT_Desallocator *Desallocator_Ptr; /* Desallocator function pointer */
} NDT_DataStruct;
@ -304,28 +304,24 @@ typedef struct NDT_Node
struct NDT_Node *Parent;
struct NDT_Node *Left;
struct NDT_Node *Right;
void *Value;
void *Value;
} NDT_Node;
char ND_Error_Msg [512];
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 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_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
#define ND_RECURSIVE_PRINT_OFFSET 8
@ -339,7 +335,7 @@ typedef int NDT_Recursive_Offset;
#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_Library_StdErr_Set ND_Library_Stderr_Set_I
#define ND_DataStruct_Open ND_DataStruct_Open_I
#define ND_DataStruct_Close ND_DataStruct_Close_I
@ -355,25 +351,25 @@ typedef int NDT_Recursive_Offset;
#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_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
@ -389,7 +385,7 @@ typedef int NDT_Recursive_Offset;
#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_Library_StdErr_Set ND_Library_Stderr_Set_C
#define ND_DataStruct_Open ND_DataStruct_Open_C
#define ND_DataStruct_Close ND_DataStruct_Close_C
@ -405,25 +401,25 @@ typedef int NDT_Recursive_Offset;
#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_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
@ -472,8 +468,8 @@ NDD_DLL_API NDT_Status ND_Library_Close_C( void);
/*------------------------------------------------------------------------------*/
/* Définition de la sortie standard des messages d'erreur de la librairie */
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_Library_Stderr_Set_I( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_Stderr_Set_C( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_I( FILE *Out);
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *Out);
@ -560,8 +556,8 @@ NDD_DLL_API NDT_Status ND_DataStruct_Convert_C( NDT_Root *, NDT_Index_Type *)
/*------------------------------------------------------------------------------*/
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VI( NDT_Root *, NDT_Command Command, va_list);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VC( NDT_Root *, NDT_Command Command, va_list);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_I( NDT_Root *, NDT_Command Command, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_C( NDT_Root *, NDT_Command Command, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_I( NDT_Root *, NDT_Command Command, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_C( NDT_Root *, NDT_Command Command, ...);
@ -606,8 +602,8 @@ NDD_DLL_API NDT_Status ND_DataStruct_Value_Remove_C( NDT_Root *Root, void *Va
/* (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, ...);
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, ...);
@ -622,8 +618,8 @@ NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_C( FILE *, NDT_Root *, NDT_R
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VI( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, va_list);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VC( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, va_list);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_I( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_C( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_I( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, ...);
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_C( void **Value_Ptr_Ptr, NDT_Root *Root_Ptr, void *Ref_Value_Ptr, ...);
@ -710,8 +706,8 @@ NDD_DLL_API NDT_Status ND_Index_Reorg_C( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
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, ...);
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, ...);
@ -758,8 +754,8 @@ NDD_DLL_API NDT_Status ND_Index_Value_Remove_C( NDT_Root *Root, NDT_Index_Id,
/* (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, ...);
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, ...);
@ -838,8 +834,8 @@ NDD_DLL_API NDT_Status ND_Index_Node_Previous_Get_C( NDT_Node **, NDT_Node *)
/*------------------------------------------------------------------------------*/
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 *, ...);
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 *, ...);
@ -884,8 +880,8 @@ NDD_DLL_API NDT_Status ND_Value_Free_C( NDT_Root *, void *);
/*------------------------------------------------------------------------------*/
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, ...);
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, ...);

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.h,v $ */
/* $RCSfile: libnode.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.4 $ */
/* $Name: $ */
/* $Date: 2002/07/29 14:53:51 $ */
/* $Author: agibert $ */
/* $Revision: 2.5 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:18:38 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------*/
@ -21,7 +21,7 @@
/* GNU Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with Foobar; if not, write to the Free Software */
/* along with LibNode; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*---------------------------------------------------------------------------------*/
@ -43,13 +43,9 @@
#ifdef __linux
# define NDD_PRINTF_PTR_PREFIX ""
#else
# define NDD_PRINTF_PTR_PREFIX "0x"
#endif
@ -58,24 +54,52 @@
#define NDD_HUGE_LONG (long)0xFFFFFFL
/* Sortie standard des messages d'erreur */
FILE * ND_stderr;
/* Table des symboles locale */
struct Symbol {
void * Ptr;
char * Name;
struct Symbol * Next;
} * Symbol_Table = NULL;
struct NDT_Symbol;
typedef struct NDT_Symbol
{
void *Ptr;
char *Name;
struct NDT_Symbol *Next;
} NDT_Symbol;
/* LibNode Global Base Structure */
typedef struct NDT_Base
{
int Open_Status;
int Debug_Mode;
char Err_String[512];
FILE *Err_Stream;
int Sig_Trapped;
NDT_Symbol *Symbol_First_Ptr;
NDT_Index_Type OpenStruct_Index_Type[1];
NDT_Root *OpenStruct_Ptr;
} NDT_Base;
NDT_Base NDG_Base =
{
NDD_FALSE,
NDD_TRUE,
"",
(FILE *)-1,
0,
(NDT_Symbol *)NULL,
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
(NDT_Root *)NULL
};
NDT_Root * Tmp_Root;
//extern char * strdup (const char *);
//extern int sigrelse (int sig);
int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
@ -88,7 +112,14 @@ int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
NDT_Status ND_Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* OpenStruct Manager */
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status ND_OpenStruct_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
@ -106,7 +137,7 @@ NDT_Status ND_Default_Desallocator( void *, void *);
/* (I) Root : adresse de la racine pour laquelle on crée un noeud */
/* (O) New_Node : adresse du pointeur sur le nouveau noeud */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Node_Alloc (NDT_Root * Root, NDT_Node ** New_Node);
NDT_Status ND_Node_Alloc( NDT_Root * Root, NDT_Node ** New_Node);
/*------------------------------------------------------------------------------*/
/* Destruction d'un noeud */
@ -114,7 +145,7 @@ NDT_Status ND_Node_Alloc (NDT_Root * Root, NDT_Node ** New_Node);
/* (I) Root : adresse de la racine dans laquelle on détruit un noeud */
/* (I) Node : pointeur sur le noeud à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Node_Free (NDT_Root * Root, NDT_Node * Node);
NDT_Status ND_Node_Free( NDT_Root *, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Création d'une nouvelle structure de données */
@ -144,7 +175,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], ch
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Node_Root_Free (NDT_Root * Root);
NDT_Status ND_Node_Root_Free( NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à une liste chaînée */
@ -152,7 +183,7 @@ NDT_Status ND_Node_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 *, NDT_Index_Id, NDT_Node *);
NDT_Status ND_List_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajout d'une nouvelle valeur à une liste */
@ -160,7 +191,7 @@ NDT_Status ND_List_Node_Add (NDT_Root *, NDT_Index_Id, NDT_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 *, NDT_Index_Id, void *);
NDT_Status ND_List_Value_Add( NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à un arbre binaire */
@ -168,31 +199,31 @@ NDT_Status ND_List_Value_Add (NDT_Root *, NDT_Index_Id, void *);
/* (I) Root : pointeur sur la racine de l'arbre */
/* (I) Value : pointeur sur la valeur à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Value_Add (NDT_Root *, NDT_Index_Id, void *);
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 *);
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 *, NDT_Index_Id);
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 *, NDT_Index_Id, void *, va_list);
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 *, NDT_Index_Id, void *, va_list);
NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
/*------------------------------------------------------------------------------*/
/* Conversion d'une structure en arbre binaire */
@ -200,28 +231,28 @@ NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
/* (I) Root : pointeur sur la racine du la structure à convertir */
/* (I) Type : type du futur arbre */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Make (NDT_Root *, NDT_Index_Id);
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 *, NDT_Index_Id);
NDT_Status ND_Tree_Equalize( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Retourne la profondeur de la plus grande branche à partir d'un noeud */
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
long ND_Tree_MaxDepth_Get (NDT_Node *Node);
long ND_Tree_MaxDepth_Get( NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Retourne la profondeur de la plus petite branche à partir d'un noeud */
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
long ND_Tree_MinDepth_Get (NDT_Node *Node);
long ND_Tree_MinDepth_Get( NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à un arbre binaire */
@ -229,7 +260,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 *, NDT_Index_Id, NDT_Node *);
NDT_Status ND_Tree_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajoute tous les noeud d'une liste à un arbre */
@ -237,19 +268,19 @@ NDT_Status ND_Tree_Node_Add (NDT_Root *, NDT_Index_Id, NDT_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 *, NDT_Index_Id, NDT_Root *, NDT_Index_Id);
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) */
/*------------------------------------------------------------------------------*/
int ND_Node_Compare (void ** Node1, void ** Node2);
int ND_Node_Compare( void **, void **);
/*------------------------------------------------------------------------------*/
/* Ordonne une liste chaînée selon l'algorithme du tri à bulle */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la liste à trier */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Sort (NDT_Root *, NDT_Index_Id);
NDT_Status ND_List_Sort( NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
@ -257,40 +288,40 @@ NDT_Status ND_List_Sort (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
void ND_List_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_List_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_List_Link_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_List_Link_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Value_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Value_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Link_Check (NDT_Root *, NDT_Index_Id, 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_Index_Id);
NDT_Status ND_List_Recursive_Make( NDT_Node *, NDT_Root *, NDT_Index_Id);
NDT_Node * ND_Tree_Recursive_Make (long, long, NDT_Node *);
NDT_Node * ND_Tree_Recursive_Make( long, long, NDT_Node *);
void ND_Tree_Node_Recursive_Add( NDT_Root *, NDT_Index_Id, 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_First_Recursive_Get( NDT_Node *);
NDT_Node * ND_Tree_Node_Last_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Last_Recursive_Get( NDT_Node *);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, va_list);
NDT_Node * ND_Tree_Node_Recursive_Find( NDT_Node *, void *, va_list);
NDT_Node * ND_Tree_Parent_Next_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Parent_Next_Recursive_Get( NDT_Node * Node);
NDT_Node * ND_Tree_Parent_Previous_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Parent_Previous_Recursive_Get( NDT_Node *);
void ND_Tree_Recursive_Print (NDT_Node * Node, long Depth, FILE *);
void ND_Tree_Recursive_Print( NDT_Node *, long, FILE *);
void ND_Tree_Link_Recursive_Check (NDT_Node * Node, int *, int *, FILE *);
void ND_Tree_Link_Recursive_Check( NDT_Node *Node, int *, int *, FILE *);
void * ND_Symbol_Find (const char *);
void * ND_Symbol_Find( const char *);
void ND_Error_Print (void);
void ND_Error_Print( void);
void ND_Signal_Trap (int);
void ND_Signal_Trap( int);
NDT_Status ND_Address_Check (void * Address);
NDT_Status ND_Address_Check(void *);