Compare commits

...

11 Commits

Author SHA1 Message Date
da05b521f6 - Add LibLog 1.1.x support. 2024-08-09 15:10:58 +02:00
cc97394120 - Implement and use init handler. 2024-06-13 20:15:20 +02:00
fa777a9b89 - First try for the second libnode V3 implementation:
- ND_Handler_Open_Default() implemented.
2024-06-12 23:26:26 +02:00
6339c66000 - First implementation test:
- Init + Open handlers called in DatatStruict_Open_I() API.
  - Works but too complicated...
- Second implementation should now be tested.
2024-06-12 12:38:48 +02:00
b84ae12dfa - Remove ND_Node_Root_Alloc(),
- Update init handler API.
2024-05-31 12:11:56 +02:00
4756903ac3 - Add open mode to ND_DataStruct_Open() API,
- ADD data struct name and open mode to init handler.
2024-05-28 17:41:24 +02:00
6d13e890a9 - Fix init handler call: call it after default handlers setup. 2024-05-28 13:59:18 +02:00
c45466c893 - Implement Open, Close, Info, Lock & Unlock default handlers,
- Implement Open, Close, Info, Lock & Unlock exec function handlers,
- Add Init & Open handler calls in ND_DataStruct_Open(),
- Add Info handler call in ND_DataStruct_Info_Print_I(),
- Update ND_Node_Root_Alloc().
2024-05-27 22:47:24 +02:00
e569611b1c - New Handler tab implementation. 2024-05-26 16:27:29 +02:00
2d259e4f2f - Add DataStruct Handlers,
- Update Open_DataStruct() API.
2024-05-24 17:16:12 +02:00
9708977753 - Update RelaseNote with new version 3! 2024-05-21 00:11:51 +02:00
6 changed files with 1453 additions and 400 deletions

View File

@ -1,3 +1,17 @@
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 3.0.0-1 - A. GIBERT - 2024/05/xx
------------------------------------------------------------------------------------------------------------------------------------
- All:
- Working on new API...
- Add DataStruct Handlers,
- Update Open_DataStruct() API,
- Add LibLog 1.1 support.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.3.0-1 - A. GIBERT - 2024/05/20 LibNode V 2.3.0-1 - A. GIBERT - 2024/05/20
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@ -625,7 +625,7 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
index_type_ptr = index_type_final_tab; index_type_ptr = index_type_final_tab;
} }
if( ( status = ND_DataStruct_Open( &demo_ds_ptr, INDEX_NB, index_type_ptr, "Demo_DS_Manager", Demo_DS_Manager, NULL, NULL, NULL, NULL,0, NULL)) != NDS_OK) if( ( status = ND_DataStruct_Open( &demo_ds_ptr, "NDDemo0", ND_OPEN_FLAG_CREATE, INDEX_NB, index_type_ptr, "Demo_DS_Manager", Demo_DS_Manager, NULL, 0, NULL)) != NDS_OK)
{ {
printf( "ND_DataStruct_Open() failed (%d) !\n", status); printf( "ND_DataStruct_Open() failed (%d) !\n", status);
} }

View File

@ -37,6 +37,7 @@
# include <stdio.h> # include <stdio.h>
# include <string.h> # include <string.h>
# include <stdarg.h> # include <stdarg.h>
# include <stdbool.h>
# ifdef _LIBVER_SUPPORT # ifdef _LIBVER_SUPPORT
# include <ver.h> # include <ver.h>
@ -46,6 +47,19 @@
# if defined( _WIN32) && !defined( LIBNODE_STATIC)
# ifndef _LIBNODE_C_
# define NDD_DLL_API __declspec( dllimport)
# else
# define NDD_DLL_API __declspec( dllexport)
# endif
# else
# ifdef _LIBNODE_C_
# define NDD_DLL_API
# else
# define NDD_DLL_API extern
# endif
# endif
@ -54,16 +68,97 @@
# define NDD_TRUE 1 # define NDD_TRUE 1
# define NDD_FALSE 0 # define NDD_FALSE 0
/* Helper Macro */
# define NDD_MIN(A,B) ( ( A > B) ? B : A) # define NDD_MIN(A,B) ( ( A > B) ? B : A)
# define NDD_MAX(A,B) ( ( A < B) ? B : A) # define NDD_MAX(A,B) ( ( A < B) ? B : A)
# define ND_STR_CPY( dest, src, size) strncpy( (dest), (src), (size)); \
(dest)[ (size) - 1] = '\0'
/*----------------------------------------------------------------------------*/
/* Predefinition */
/*----------------------------------------------------------------------------*/
typedef struct NDT_Node NDT_Node;
typedef struct NDT_Handler NDT_Handler;
typedef struct NDT_Index NDT_Index;
typedef struct NDT_Root NDT_Root;
/*----------------------------------------------------------------------------*/
/* 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 */
/*----------------------------------------------------------------------------*/
/* Print out definitions */
/*----------------------------------------------------------------------------*/
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
/*----------------------------------------------------------------------------*/
/* Indexes definitions */
/*----------------------------------------------------------------------------*/
/* /*
Default allowed maximum depth between tree branches before rebalancing Default allowed maximum depth between tree branches before rebalancing
*/ */
# define DEF_MAX_DIF 100 # define DEF_MAX_DIF 100
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
/* Types de structure */ /* Types de structure */
typedef short NDT_Root_Type; typedef short NDT_Root_Type;
typedef int NDT_Index_Type; typedef int NDT_Index_Type;
@ -143,6 +238,64 @@ typedef int NDT_Index_Type;
/*----------------------------------------------------------------------------*/
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;
/*----------------------------------------------------------------------------*/
/* Mangers definitions */
/*----------------------------------------------------------------------------*/
/* 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 Template */ /* 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_Status ND_Example_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list *Args_Ptr)
@ -478,75 +631,6 @@ typedef int NDT_Index_Type;
/* 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
/* Predefinition */
typedef struct NDT_Node NDT_Node;
typedef struct NDT_Index NDT_Index;
typedef struct NDT_Root NDT_Root;
/* Manager function pointer */ /* Manager function pointer */
# define NDD_MANAGER_NAME_LEN_MAX 64 # define NDD_MANAGER_NAME_LEN_MAX 64
@ -578,34 +662,136 @@ typedef NDT_Status NDT_Deallocator( void *, NDT_Root *, void *);
/*----------------------------------------------------------------------------*/
typedef struct NDT_Index typedef short NDT_Open_Flag;
# define ND_OPEN_FLAG_OPEN 0x0001
# define ND_OPEN_FLAG_CREATE 0x0002
# define ND_OPEN_FLAG_NEW ~(ND_OPEN_FLAG_OPEN | ND_OPEN_FLAG_CREATE)
typedef short NDT_Close_Flag;
# define ND_CLOSE_FLAG_CLOSE 0x0001
# define ND_CLOSE_FLAG_DESTROY 0x0002
typedef short NDT_Lock_Flag;
# define ND_LOCK_FLAG_READ 0x0001
# define ND_LOCK_FLAG_WRITE 0x0002
/*----------------------------------------------------------------------------*/
/* Handler definitions */
/*----------------------------------------------------------------------------*/
typedef short NDT_Handler_Id;
typedef short NDT_Handler_Nb;
# define NDD_HANDLER_ID_UNKNOWN ( NDT_Handler_Id)-1
# define NDD_HANDLER_ID_MANAGER ( NDT_Handler_Id)0
# define NDD_HANDLER_ID_INIT ( NDT_Handler_Id)1
# define NDD_HANDLER_ID_ALLOC ( NDT_Handler_Id)2
# define NDD_HANDLER_ID_FREE ( NDT_Handler_Id)3
# define NDD_HANDLER_ID_OPEN ( NDT_Handler_Id)4
# define NDD_HANDLER_ID_CLOSE ( NDT_Handler_Id)5
# define NDD_HANDLER_ID_INFO ( NDT_Handler_Id)6
# define NDD_HANDLER_ID_LOCK ( NDT_Handler_Id)7
# define NDD_HANDLER_ID_UNLOCK ( NDT_Handler_Id)8
# define NDD_HANDLER_ID_NB ( NDT_Handler_Nb)9
# define NDD_HANDLER_NB NDD_HANDLER_ID_NB
# define NDD_HANDLER_NAME_LEN 64
# define NDD_HANDLER_NAME_SIZE ( NDD_HANDLER_NAME_LEN + 1)
typedef char NDT_Handler_Name[ NDD_HANDLER_NAME_SIZE];
typedef NDT_Status ( NDT_Handler_Function)( void);
/*----------------------------------------------------------------------------*/
typedef struct NDT_Handler
{ {
NDT_Index_Type Type; /* Structure Type (Queue, Stack, Tree, ... ) */ NDT_Handler_Name Name;
NDT_Handler_Function *Ptr;
} NDT_Handler;
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;
# define NDD_HANDLER_TAB_SIZE ( sizeof( NDT_Handler) * NDD_HANDLER_NB)
# define NDD_HANDLER_SET( Handler_Ptr, Function_Name, Function_Ptr) ND_STR_CPY( ( Handler_Ptr).Name, (Function_Name), NDD_HANDLER_NAME_SIZE); \
( Handler_Ptr).Ptr = (NDT_Handler_Function *)(Function_Ptr);
# ifndef _LIBNODE_C_
extern NDT_Handler NDG_Handler_Tab_Default[ NDD_HANDLER_ID_NB];
# endif
/*----------------------------------------------------------------------------*/
/* Root definitions */
/*----------------------------------------------------------------------------*/
# define NDD_DATASTRUCT_NAME_LEN 64
# define NDD_DATASTRUCT_NAME_SIZE ( NDD_DATASTRUCT_NAME_LEN + 1)
typedef char *NDT_DataStruct_Name;
typedef short NDT_DataStruct_Status;
#define NDD_DATASTRUCT_STATUS_UNKNOWN 0x0000
#define NDD_DATASTRUCT_STATUS_TEMPORARY 0x0001
#define NDD_DATASTRUCT_STATUS_VALID 0x0002
#define NDD_DATASTRUCT_STATUS_INVALID 0x0003
#define NDD_DATASTRUCT_STATUS_MSK ( NDD_DATASTRUCT_STATUS_UNKNOWN | NDD_DATASTRUCT_STATUS_TEMPORARY | NDD_DATASTRUCT_STATUS_VALID | NDD_DATASTRUCT_STATUS_INVALID)
#define NDD_DATASTRUCT_STATUS_RMSK ( NDD_DATASTRUCT_STATUS_MSK ^ 0xffff)
#define ND_DATASTRUCT_STATUS_VALUE_UNKNOWN_IS( V) ( ( V) == NDD_DATASTRUCT_STATUS_UNKNOWN)
#define ND_DATASTRUCT_STATUS_VALUE_TEMPORARY_IS( V) ( ( V) == NDD_DATASTRUCT_STATUS_TEMPORARY)
#define ND_DATASTRUCT_STATUS_VALUE_VALID_IS( V) ( ( V) == NDD_DATASTRUCT_STATUS_VALID)
#define ND_DATASTRUCT_STATUS_VALUE_INVALID_IS( V) ( ( V) == NDD_DATASTRUCT_STATUS_INVALID)
#define ND_DATASTRUCT_STATUS_UNKNOWN_IS( R) ( ND_DATASTRUCT_STATUS_VALUE_UNKNOWN_IS( ( R)->Status))
#define ND_DATASTRUCT_STATUS_TEMPORARY_IS( R) ( ND_DATASTRUCT_STATUS_VALUE_TEMPORARY_IS( ( R)->Status))
#define ND_DATASTRUCT_STATUS_VALID_IS( R) ( ND_DATASTRUCT_STATUS_VALUE_VALID_IS( ( R)->Status))
#define ND_DATASTRUCT_STATUS_INVALID_IS( R) ( ND_DATASTRUCT_STATUS_VALUE_INVALID_IS( ( R)->Status))
#define NDD_DATASTRUCT_STATUS_VALUE_ASCII_GET( V) ( ND_DATASTRUCT_STATUS_VALUE_UNKNOWN_IS( V) ? "UNKNOWN" : ( ND_DATASTRUCT_STATUS_VALUE_TEMPORARY_IS( V) ? "TEMPORARY" : ( ND_DATASTRUCT_STATUS_VALUE_VALID_IS( V) ? "VALID" : ( ND_DATASTRUCT_STATUS_VALUE_INVALID_IS( V) ? "INVALID" : "???"))))
#define NDD_DATASTRUCT_STATUS_ASCII_GET( R) ( NDD_DATASTRUCT_STATUS_VALUE_ASCII_GET( ( R)->Status))
typedef struct NDT_Root typedef struct NDT_Root
{ {
char Name[ NDD_DATASTRUCT_NAME_SIZE];
size_t Root_Size; /* Root node total size */
NDT_DataStruct_Status Status;
NDT_Handler Handler_Tab[ NDD_HANDLER_ID_NB];
/* Deprecated Start */
NDT_Manager *Manager_Ptr; /* Manager function pointer */ NDT_Manager *Manager_Ptr; /* Manager function pointer */
char Manager_Name[ NDD_MANAGER_NAME_SIZE_MAX]; /* Manager function name */ char Manager_Name[ NDD_MANAGER_NAME_SIZE_MAX]; /* Manager function name */
NDT_Allocator *Allocator_Ptr; /* Value allocator function pointer */ NDT_Allocator *Allocator_Ptr; /* Value allocator function pointer */
char Allocator_Name[ NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Value allocator function name */ char Allocator_Name[ NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Value allocator function name */
NDT_Deallocator *Deallocator_Ptr; /* Value deallocator function pointer */ NDT_Deallocator *Deallocator_Ptr; /* Value deallocator function pointer */
char Deallocator_Name[ NDD_DEALLOCATOR_NAME_SIZE_MAX]; /* Value deallocator function name */ char Deallocator_Name[ NDD_DEALLOCATOR_NAME_SIZE_MAX]; /* Value deallocator function name */
/* Deprecated End */
short Own_Value; /* Flag indicating if the structure is the node owner */ short Own_Value; /* Flag indicating if the structure is the node owner */
void *User_Ptr; /* User pointer */ void *User_Ptr; /* User pointer */
NDT_Index_Nb Index_Nb; NDT_Index_Nb Index_Nb;
@ -618,7 +804,6 @@ typedef struct NDT_Root
typedef struct NDT_DataStruct typedef struct NDT_DataStruct
{ {
NDT_Root *Root_Ptr; NDT_Root *Root_Ptr;
NDT_Manager *Manager_Ptr; /* Manager function pointer */ NDT_Manager *Manager_Ptr; /* Manager function pointer */
@ -643,19 +828,19 @@ typedef struct NDT_Node
typedef int NDT_Recursive_Mode; /*----------------------------------------------------------------------------*/
typedef int NDT_Recursive_Depth; /* Handler protypes */
typedef int NDT_Recursive_Offset; /*----------------------------------------------------------------------------*/
# define NDD_RECURSIVE_MODE_UNKNOWN ( NDT_Recursive_Mode)0x00 typedef NDT_Status NDT_Handler_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Cmd, va_list *);
# define NDD_RECURSIVE_MODE_PARENT ( NDT_Recursive_Mode)0x01 typedef NDT_Status NDT_Handler_Init( NDT_Root **root_tmp_ptr_ptr, NDT_DataStruct_Name Name, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Handler *Handler_Tab, short Own_Value, void *User_Ptr);
# define NDD_RECURSIVE_MODE_CHILD ( NDT_Recursive_Mode)0x02 typedef NDT_Status NDT_Handler_Alloc( void **Memory_Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, void *User_Ptr);
# define NDD_RECURSIVE_MODE_PARENT_CHILD ( NDT_Recursive_Mode)0x03 typedef NDT_Status NDT_Handler_Free( void *Memory_Ptr, NDT_Root *Root_Ptr, void *User_Ptr);
typedef NDT_Status NDT_Handler_Open( NDT_Root **Root_Ptr_Ptr, NDT_Root *Root_Tmp_Ptr, NDT_Open_Flag Open_Mode);
# define ND_RECURSIVE_PARENT_IS(m) ( m & NDD_RECURSIVE_MODE_PARENT) typedef NDT_Status NDT_Handler_Close( NDT_Root *Root_Ptr, NDT_Close_Flag Close_Mode, void *User_Ptr);
# define ND_RECURSIVE_CHILD_IS(m) ( m & NDD_RECURSIVE_MODE_CHILD) typedef NDT_Status NDT_Handler_Info( NDT_Root *Root_Ptr, NDT_Recursive_Offset Recursive_Offset);
typedef NDT_Status NDT_Handler_Lock( NDT_Root *Root_Ptr, NDT_Lock_Flag Lock_Mode, bool *Locked_Ptr, void *User_Ptr);
# define ND_RECURSIVE_PRINT_OFFSET 8 typedef NDT_Status NDT_Handler_Unlock( NDT_Root *Root_Ptr, void *User_Ptr);
@ -714,6 +899,15 @@ typedef int NDT_Recursive_Offset;
# define ND_Manager_Exec ND_Manager_Exec_I # define ND_Manager_Exec ND_Manager_Exec_I
# define ND_Alloc ND_Alloc_I # define ND_Alloc ND_Alloc_I
# define ND_Free ND_Free_I # define ND_Free ND_Free_I
# define ND_Handler_Init_Exec ND_Handler_Init_Exec_I
# define ND_Handler_Alloc_Exec ND_Handler_Alloc_Exec_I
# define ND_Handler_Free_Exec ND_Handler_Free_Exec_I
# define ND_Handler_Open_Exec ND_Handler_Open_Exec_I
# define ND_Handler_Close_Exec ND_Handler_Close_Exec_I
# define ND_Handler_Info_Exec ND_Handler_Info_Exec_I
# define ND_Handler_Lock_Exec ND_Handler_Lock_Exec_I
# define ND_Handler_Unlock_Exec ND_Handler_Unlock_Exec_I
# define ND_Allocator_Exec ND_Allocator_Exec_I # define ND_Allocator_Exec ND_Allocator_Exec_I
# define ND_Deallocator_Exec ND_Deallocator_Exec_I # define ND_Deallocator_Exec ND_Deallocator_Exec_I
@ -770,6 +964,15 @@ typedef int NDT_Recursive_Offset;
# define ND_Manager_Exec ND_Manager_Exec_C # define ND_Manager_Exec ND_Manager_Exec_C
# define ND_Alloc ND_Alloc_C # define ND_Alloc ND_Alloc_C
# define ND_Free ND_Free_C # define ND_Free ND_Free_C
# define ND_Handler_Init_Exec ND_Handler_Init_Exec_C
# define ND_Handler_Alloc_Exec ND_Handler_Alloc_Exec_C
# define ND_Handler_Free_Exec ND_Handler_Free_Exec_C
# define ND_Handler_Open_Exec ND_Handler_Open_Exec_C
# define ND_Handler_Close_Exec ND_Handler_Close_Exec_C
# define ND_Handler_Info_Exec ND_Handler_Info_Exec_C
# define ND_Handler_Lock_Exec ND_Handler_Lock_Exec_C
# define ND_Handler_Unlock_Exec ND_Handler_Unlock_Exec_C
# define ND_Allocator_Exec ND_Allocator_Exec_C # define ND_Allocator_Exec ND_Allocator_Exec_C
# define ND_Deallocator_Exec ND_Deallocator_Exec_C # define ND_Deallocator_Exec ND_Deallocator_Exec_C
@ -777,24 +980,6 @@ typedef int NDT_Recursive_Offset;
/*----------------------------------------------------------------------------*/
# if defined( _WIN32) && !defined( LIBNODE_STATIC)
# ifndef _LIBNODE_C_
# define NDD_DLL_API __declspec( dllimport)
# else
# define NDD_DLL_API __declspec( dllexport)
# endif
# else
# ifndef _LIBNODE_C_
# define NDD_DLL_API
# else
# define NDD_DLL_API extern
# endif
# endif
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Library initialisation */ /* Library initialisation */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -830,20 +1015,19 @@ NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *);
/* Create a new data structure */ /* Create a new data structure */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* (O) Root_Ptr_Ptr: Pointer adress of the new data structure */ /* (O) Root_Ptr_Ptr: Pointer adress of the new data structure */
/* (I) DataStruct_Name: Name of the data structure */
/* (I) Open_Mode: Open mode */
/* (I) Index_Nb: Number of index */ /* (I) Index_Nb: Number of index */
/* (I) Index_Type_Ptr: Array of Index type (List, tree, ...) */ /* (I) Index_Type_Ptr: Array of Index type (List, tree, ...) */
/* (I) Manager_Name: Manager function name */ /* (I) Manager_Name: Manager function name */
/* (I) Manager_Ptr: Manager function pointer */ /* (I) Manager_Ptr: Manager function pointer */
/* (I) Allocator_Name: Value allocator function name */ /* (I) Handlers_Ptr: Pointer to the data structure handlers */
/* (I) Allocator_Ptr: Value allocator function pointer */
/* (I) Deallocator_Name: Value deallocator function name */
/* (I) Deallocator_Ptr: Value deallocator function pointer */
/* (I) Own_Value: Flag indicating if the structure is the node owner */ /* (I) Own_Value: Flag indicating if the structure is the node owner */
/* (I) Data_Ptr: User pointer */ /* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
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 *); NDT_Status ND_DataStruct_Open_I( NDT_Root **Root_Ptr_Ptr, NDT_DataStruct_Name Name, NDT_Open_Flag Open_Mode, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Manager_Name Manager_Name, NDT_Manager *Manager_Ptr, NDT_Handler *Handler_Ptr, short Own_Value, void *User_Ptr);
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 *); NDT_Status ND_DataStruct_Open_C( NDT_Root **Root_Ptr_Ptr, NDT_DataStruct_Name Name, NDT_Open_Flag Open_Mode, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Manager_Name Manager_Name, NDT_Manager *Manager_Ptr, NDT_Handler *Handler_Ptr, short Own_Value, void *User_Ptr);
@ -1282,6 +1466,16 @@ NDD_DLL_API NDT_Status ND_Value_Free_C( NDT_Root *, void *);
/*----------------------------------------------------------------------------*/
/* Allocate a temporary root node */
/*----------------------------------------------------------------------------*/
/* (O) Root_Tmp_Ptr_Ptr: Data structure pointer address */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Root_Tmp_Alloc( NDT_Root **Root_Tmp_Ptr_Ptr, size_t Root_Extra_Size, NDT_DataStruct_Name Name, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Handler *Handler_Tab, short Own_Value, void *User_Ptr);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Execute a manager command */ /* Execute a manager command */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -1326,6 +1520,128 @@ NDD_DLL_API NDT_Status ND_Free_C( void *, NDT_Root *, void *);
/*----------------------------------------------------------------------------*/
/* Execute an init handler function */
/*----------------------------------------------------------------------------*/
/* (O) Root_Extra_Size_Ptr: Pointer on the extra root size */
/* (I) Handler_Init_Name: Init handler function name */
/* (I) Handler_Init_Ptr: Init handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Init_Exec_I( NDT_Root **root_tmp_ptr_ptr, NDT_DataStruct_Name Name, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Handler *Handler_Tab, short Own_Value, void *User_Ptr, NDT_Handler_Name Handler_Init_Name, NDT_Handler_Init *Handler_Init_Ptr);
NDT_Status ND_Handler_Init_Exec_C( NDT_Root **root_tmp_ptr_ptr, NDT_DataStruct_Name Name, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Handler *Handler_Tab, short Own_Value, void *User_Ptr, NDT_Handler_Name Handler_Init_Name, NDT_Handler_Init *Handler_Init_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute an alloc handler function */
/*----------------------------------------------------------------------------*/
/* (O) Memory_Ptr_Ptr: Memory pointer address */
/* (I) Root_Ptr: Data structure pointer */
/* (I) Size: Allocation size */
/* (I) Handler_Alloc_Name: Alloc handler function name */
/* (I) Handler_Alloc_Ptr: Alloc handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Alloc_Exec_I( void **Memory_Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, NDT_Handler_Name Handler_Alloc_Name, NDT_Handler_Alloc *Handler_Alloc_Ptr, void *User_Ptr);
NDT_Status ND_Handler_Alloc_Exec_C( void **Memory_Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, NDT_Handler_Name Handler_Alloc_Name, NDT_Handler_Alloc *Handler_Alloc_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute a free handler function */
/*----------------------------------------------------------------------------*/
/* (I) Memory_Ptr: Memory pointer */
/* (I) Root_Ptr: Data structure pointer */
/* (I) Handler_Free_Name: Free handler function name */
/* (I) Handler_Free_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Free_Exec_I( void *Memory_Ptr, NDT_Root *Root_Ptr, NDT_Handler_Name Handler_Free_Name, NDT_Handler_Free *Handler_Free_Ptr, void *User_Ptr);
NDT_Status ND_Handler_Free_Exec_C( void *Memory_Ptr, NDT_Root *Root_Ptr, NDT_Handler_Name Handler_Free_Name, NDT_Handler_Free *Handler_Free_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute an open handler function */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Open_Mode: Open mode */
/* (I) Handler_Open_Name: Free handler function name */
/* (I) Handler_Open_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Open_Exec_I( NDT_Root **Root_Ptr_Ptr, NDT_Root *Root_Tmp_Ptr, NDT_Open_Flag Open_Mode, NDT_Handler_Name Handler_Open_Name, NDT_Handler_Open *Handler_Open_Ptr);
NDT_Status ND_Handler_Open_Exec_C( NDT_Root **Root_Ptr_Ptr, NDT_Root *Root_Tmp_Ptr, NDT_Open_Flag Open_Mode, NDT_Handler_Name Handler_Open_Name, NDT_Handler_Open *Handler_Open_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute a close handler function */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Close_Mode: Close mode */
/* (I) Handler_Close_Name: Free handler function name */
/* (I) Handler_Close_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Close_Exec_I( NDT_Root *Root_Ptr, NDT_Close_Flag Close_Mode, NDT_Handler_Name Handler_Close_Name, NDT_Handler_Close *Handler_Close_Ptr, void *User_Ptr);
NDT_Status ND_Handler_Close_Exec_C( NDT_Root *Root_Ptr, NDT_Close_Flag Close_Mode, NDT_Handler_Name Handler_Close_Name, NDT_Handler_Close *Handler_Close_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute an Info handler function */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Recursive_Offset: Print line offset */
/* (I) Handler_Info_Name: Free handler function name */
/* (I) Handler_Info_Ptr: Free handler function pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Info_Exec_I( NDT_Root *Root_Ptr, NDT_Recursive_Offset Recursive_Offset, NDT_Handler_Name Handler_Info_Name, NDT_Handler_Info *Handler_Info_Ptr);
NDT_Status ND_Handler_Info_Exec_C( NDT_Root *Root_Ptr, NDT_Recursive_Offset Recursive_Offset, NDT_Handler_Name Handler_Info_Name, NDT_Handler_Info *Handler_Info_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute a lock handler function */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Open_Mode: Lock mode */
/* (O) Locked_Ptr: Locked flag */
/* (I) Handler_Lock_Name: Free handler function name */
/* (I) Handler_Lock_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Lock_Exec_I( NDT_Root *Root_Ptr, NDT_Lock_Flag Lock_Mode, bool *Locked_Ptr, NDT_Handler_Name Handler_Lock_Name, NDT_Handler_Lock *Handler_Lock_Ptr, void *User_Ptr);
NDT_Status ND_Handler_Lock_Exec_C( NDT_Root *Root_Ptr, NDT_Lock_Flag Lock_Mode, bool *Locked_Ptr, NDT_Handler_Name Handler_Lock_Name, NDT_Handler_Lock *Handler_Lock_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Execute an unlock handler function */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Handler_Unlock_Name: Free handler function name */
/* (I) Handler_Unlock_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Unlock_Exec_I( NDT_Root *Root_Ptr, NDT_Handler_Name Handler_Unlock_Name, NDT_Handler_Unlock *Handler_Unlock_Ptr, void *User_Ptr);
NDT_Status ND_Handler_Unlock_Exec_C( NDT_Root *Root_Ptr, NDT_Handler_Name Handler_Unlock_Name, NDT_Handler_Unlock *Handler_Unlock_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Execute an allocator function */ /* Execute an allocator function */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -1336,7 +1652,7 @@ NDD_DLL_API NDT_Status ND_Free_C( void *, NDT_Root *, void *);
/* (I) Allocator_Ptr: Value allocator function pointer */ /* (I) Allocator_Ptr: Value allocator function pointer */
/* (I) Data_Ptr: User pointer */ /* (I) Data_Ptr: User pointer */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* to be deleted */
NDD_DLL_API NDT_Status ND_Allocator_Exec_I( void **, NDT_Root *, size_t, NDT_Allocator_Name, NDT_Allocator *, void *); NDD_DLL_API NDT_Status ND_Allocator_Exec_I( void **, NDT_Root *, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
NDD_DLL_API NDT_Status ND_Allocator_Exec_C( void **, NDT_Root *, size_t, NDT_Allocator_Name, NDT_Allocator *, void *); NDD_DLL_API NDT_Status ND_Allocator_Exec_C( void **, NDT_Root *, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
@ -1351,7 +1667,7 @@ NDD_DLL_API NDT_Status ND_Allocator_Exec_C( void **, NDT_Root *, size_t, NDT_
/* (I) Allocator_Ptr: Value deallocator function pointer */ /* (I) Allocator_Ptr: Value deallocator function pointer */
/* (I) Data_Ptr: User pointer */ /* (I) Data_Ptr: User pointer */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* to be deleted */
NDD_DLL_API NDT_Status ND_Deallocator_Exec_I( void *, NDT_Root *, NDT_Deallocator_Name, NDT_Deallocator *, void *); NDD_DLL_API NDT_Status ND_Deallocator_Exec_I( void *, NDT_Root *, NDT_Deallocator_Name, NDT_Deallocator *, void *);
NDD_DLL_API NDT_Status ND_Deallocator_Exec_C( void *, NDT_Root *, NDT_Deallocator_Name, NDT_Deallocator *, void *); NDD_DLL_API NDT_Status ND_Deallocator_Exec_C( void *, NDT_Root *, NDT_Deallocator_Name, NDT_Deallocator *, void *);

File diff suppressed because it is too large Load Diff

View File

@ -118,12 +118,19 @@ NDT_Base NDG_Base =
}; };
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
/* */ /* */
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
#define ND_LIBNODE_OPEN_CHECK() if( NDG_Base.Open_Status != NDD_TRUE) { LG_LOG_ERROR_0( "LibNode library is not opened"); return( NDS_ERRAPI); } #define ND_LIBNODE_OPEN_CHECK() if( NDG_Base.Open_Status != NDD_TRUE) { LG_LOG_ERROR( "LibNode library is not opened"); return( NDS_ERRAPI); }
#define ND_NOT_NULL_CHECK( ptr, msg) if( !(ptr)) { LG_LOG_ERROR_1( "%s is null", (msg)); return( NDS_ERRAPI); } #define ND_NOT_NULL_CHECK( Ptr, Msg) if( !( Ptr)) { LG_LOG_ERROR( "%s is null", ( Msg)); return( NDS_ERRAPI); }
#define ND_HANDLER_NOT_NULL_CHECK( Function_Name, Function_Ptr) if( ( !( Function_Name)) && ( !( Function_Ptr))) { LG_LOG_ERROR( "Undefined function name"); return( NDS_ERRAPI); }
#define ND_HANDLER_SYMBOL_FIND( Function_Ptr, Handler_Name, Handler_Ptr) if( ( Handler_Ptr)) { ( Function_Ptr) = ( Handler_Ptr);} \
else { if( ND_Symbol_Find( (void **)&( Function_Ptr), ( Handler_Name)) != NDS_OK) { LG_LOG_ERROR( "Cant't find free handler function"); return( NDS_KO);}}
@ -187,17 +194,6 @@ NDT_Status ND_Node_Free( NDT_Root *, NDT_Node *);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
NDT_Status ND_Index_Clear( NDT_Root *, NDT_Index_Id); NDT_Status ND_Index_Clear( NDT_Root *, NDT_Index_Id);
/*----------------------------------------------------------------------------*/
/* Création de la racine d'une structure de données quelconque */
/*----------------------------------------------------------------------------*/
/* (O) New_Root : adresse du pointeur sur la nouvelle racine */
/* (I) Type : type de la structure de données */
/* (I) Allocater : pointeur vers la fonction d'allocation */
/* (I) Deallocater : pointeur vers la fonction de désallocation */
/* (I) Data : pointeur de données utiles à l'allocateur */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], char *, NDT_Manager *, char *, NDT_Allocator *, char *, NDT_Deallocator *, short, void *);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Destruction d'une racine */ /* Destruction d'une racine */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
@ -314,11 +310,120 @@ NDT_Status ND_List_Sort( NDT_Root *, NDT_Index_Id);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* PRIVATE FUNCTIONS */ /* PRIVATE FUNCTIONS */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* Init handler: */
/* - Return extra root size */
/* - Update handler tab */
/*----------------------------------------------------------------------------*/
/* (O) Root_Extra_Size_Ptr: Pointer on the extra root size */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Init_Default( NDT_Root **root_tmp_ptr_ptr, NDT_DataStruct_Name Name, NDT_Index_Nb Index_Nb, NDT_Index_Type *Type_Ptr, NDT_Handler *Handler_Tab, short Own_Value, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Default alloc handler: */
/* malloc() function wrapper with NDT_Status return status */
/*----------------------------------------------------------------------------*/
/* (O) Memory_Ptr_Ptr: Memory pointer address */
/* (I) Root_Ptr: Data structure pointer */
/* (I) Size: Allocation size */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Alloc_Default( void **Memory_Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Default free handler: */
/* free() function wrapper with NDT_Status return status */
/*----------------------------------------------------------------------------*/
/* (I) Memory_Ptr: Memory pointer */
/* (I) Root_Ptr: Data structure pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Free_Default( void *Memory_Ptr, NDT_Root *Root_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Default open handler */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Open_Mode: Open mode */
/* (I) Handler_Open_Name: Free handler function name */
/* (I) Handler_Open_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Open_Default( NDT_Root **Root_Ptr_Ptr, NDT_Root *Root_Tmp_Ptr, NDT_Open_Flag Open_Mode);
/*----------------------------------------------------------------------------*/
/* Default close handler */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Close_Mode: Close mode */
/* (I) Handler_Close_Name: Free handler function name */
/* (I) Handler_Close_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Close_Default( NDT_Root *Root_Ptr, NDT_Close_Flag Close_Mode, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Default info handler */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Recursive_Offset: Print line offset */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Info_Default( NDT_Root *Root_Ptr, NDT_Recursive_Offset Recursive_Offset);
/*----------------------------------------------------------------------------*/
/* Default lock handler */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Open_Mode: Lock mode */
/* (O) Locked_Ptr: Locked flag */
/* (I) Handler_Lock_Name: Free handler function name */
/* (I) Handler_Lock_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Lock_Default( NDT_Root *Root_Ptr, NDT_Lock_Flag Lock_Mode, bool *Locked_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/
/* Defalt unlock handler */
/*----------------------------------------------------------------------------*/
/* (I) Root_Ptr: Data structure pointer */
/* (I) Handler_Unlock_Name: Free handler function name */
/* (I) Handler_Unlock_Ptr: Free handler function pointer */
/* (I) User_Ptr: User pointer */
/*----------------------------------------------------------------------------*/
NDT_Status ND_Handler_Unlock_Default( NDT_Root *Root_Ptr, void *User_Ptr);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void ND_List_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *); void ND_List_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
@ -356,3 +461,35 @@ NDT_Status ND_Symbol_Find( void **, const char *);
void ND_Signal_Trap( int); void ND_Signal_Trap( int);
NDT_Status ND_Address_Check( void *); NDT_Status ND_Address_Check( void *);
/*----------------------------------------------------------------------------*/
/* Post prototype global variable definitions */
/*----------------------------------------------------------------------------*/
NDT_Handler NDG_Handler_Tab_Default[ NDD_HANDLER_NB] =
{
{ "", /* Default Manager function name */
NULL}, /* Default Manager function pointer */
{ "ND_Handler_Init_Default", /* Default Init function name */
( NDT_Handler_Function *)ND_Handler_Init_Default}, /* Default Init function pointer */
{ "ND_Handler_Alloc_Default", /* Default Alloc function name */
( NDT_Handler_Function *)ND_Handler_Alloc_Default}, /* Default Alloc function pointer */
{ "ND_Handler_Free_Default", /* Default Free function name */
( NDT_Handler_Function *)ND_Handler_Free_Default}, /* Default Free function pointer */
{ "NDT_Handler_Open_Default", /* Default Open function name */
( NDT_Handler_Function *)ND_Handler_Open_Default}, /* Default Open function pointer */
{ "NDT_Handler_Close_Default", /* Default Close function name */
( NDT_Handler_Function *)ND_Handler_Close_Default}, /* Default Close function pointer */
{ "NDT_Handler_Info_Default", /* Default Info function name */
( NDT_Handler_Function *)ND_Handler_Info_Default}, /* Default Info function pointer */
{ "NDT_Handler_Lock_Default", /* Default Lock function name */
( NDT_Handler_Function *)ND_Handler_Lock_Default}, /* Default Lock function pointer */
{ "NDT_Handler_Unlock_Default", /* Default Unlock function name */
( NDT_Handler_Function *)ND_Handler_Unlock_Default} /* Default Unlock function pointer */
};

View File

@ -687,7 +687,7 @@ void Command_Get( int *choice, char **arg1, char **arg2, FILE *File_Output,
void Command_Exec_Begin_Print( FILE *File_Output, int Choice) void Command_Exec_Begin_Print( FILE *File_Output, int Choice)
{ {
// fprintf( File_Output, "%s: %s...\n", Command_Tab[Choice].Name, Command_Tab[Choice].FullName); // fprintf( File_Output, "%s: %s...\n", Command_Tab[Choice].Name, Command_Tab[Choice].FullName);
LG_LOG_INFO_2( "%s: %s...", Command_Tab[Choice].Name, Command_Tab[Choice].FullName); LG_LOG_INFO( "%s: %s...", Command_Tab[Choice].Name, Command_Tab[Choice].FullName);
// fflush( File_Output); // fflush( File_Output);
} }
@ -704,12 +704,12 @@ void Command_Exec_End_Print( FILE *File_Output, int Choice, cpt T_Exec, int
if( nb == 1) if( nb == 1)
{ {
// fprintf( File_Output, "%s: Completed in (%.4f) second !\n", Command_Tab[Choice].Name, T_Exec.sec); // fprintf( File_Output, "%s: Completed in (%.4f) second !\n", Command_Tab[Choice].Name, T_Exec.sec);
LG_LOG_INFO_2( "%s: Completed in (%.4f) second !", Command_Tab[Choice].Name, T_Exec.sec); LG_LOG_INFO( "%s: Completed in (%.4f) second !", Command_Tab[Choice].Name, T_Exec.sec);
} }
else else
{ {
// fprintf( File_Output, "%s: Completed in (%.4f) second, (%.2f) per second !\n", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec); // fprintf( File_Output, "%s: Completed in (%.4f) second, (%.2f) per second !\n", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec);
LG_LOG_INFO_3( "%s: Completed in (%.4f) second, (%.2f) per second !", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec); LG_LOG_INFO( "%s: Completed in (%.4f) second, (%.2f) per second !", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec);
} }
} }
@ -838,11 +838,13 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
t_start( t_exec); t_start( t_exec);
if( sub_choice == 0) if( sub_choice == 0)
{ {
ND_DataStruct_Open( DS_Ptr_Ptr, INDEX_NB, idx_type_tab, "Module_Manager", Module_Manager, NULL, NULL, NULL, NULL, NDD_TRUE, NULL); // ND_DataStruct_Open( DS_Ptr_Ptr, INDEX_NB, idx_type_tab, "Module_Manager", Module_Manager, NULL, NULL, NULL, NULL, NDD_TRUE, NULL);
ND_DataStruct_Open( DS_Ptr_Ptr, "NDBench", ND_OPEN_FLAG_CREATE, INDEX_NB, idx_type_tab, "Module_Manager", Module_Manager, NULL, NDD_TRUE, NULL);
} }
else else
{ {
ND_DataStruct_Open( DS_Ptr_Ptr, INDEX_NB, idx_type_tab, "Module_Manager", NULL, NULL, NULL, NULL, NULL, NDD_TRUE, NULL); // ND_DataStruct_Open( DS_Ptr_Ptr, INDEX_NB, idx_type_tab, "Module_Manager", NULL, NULL, NULL, NULL, NULL, NDD_TRUE, NULL);
ND_DataStruct_Open( DS_Ptr_Ptr, "NDBench", ND_OPEN_FLAG_CREATE, INDEX_NB, idx_type_tab, "Module_Manager", NULL, NULL, NDD_TRUE, NULL);
} }
t_stop( t_exec); t_stop( t_exec);
@ -933,7 +935,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...\n", low, high, order); // fprintf( File_Output, "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...\n", low, high, order);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_3( "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...", low, high, order); LG_LOG_INFO( "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...", low, high, order);
t_start( t_exec); t_start( t_exec);
@ -953,7 +955,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
{ {
// fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n"); // fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
LG_LOG_ERROR_0( "DS_Value_Add: Allocation Failled !"); LG_LOG_ERROR( "DS_Value_Add: Allocation Failled !");
break; break;
} }
@ -974,7 +976,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
else else
{ {
// fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n"); // fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
LG_LOG_ERROR_0( "DS_Value_Add: Allocation Failled !"); LG_LOG_ERROR( "DS_Value_Add: Allocation Failled !");
break; break;
} }
@ -1081,7 +1083,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "DS_Value_Find: from: (%d) to: (%d)...\n", low, high); // fprintf( File_Output, "DS_Value_Find: from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_2( "DS_Value_Find: from: (%d) to: (%d)...", low, high); LG_LOG_INFO( "DS_Value_Find: from: (%d) to: (%d)...", low, high);
i = low; i = low;
@ -1113,7 +1115,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...\n", low, high); // fprintf( File_Output, "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_2( "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...", low, high); LG_LOG_INFO( "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...", low, high);
t_start( t_exec); t_start( t_exec);
@ -1139,7 +1141,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...\n", low, high); // fprintf( File_Output, "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_2( "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...", low, high); LG_LOG_INFO( "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...", low, high);
t_start( t_exec); t_start( t_exec);
@ -1165,7 +1167,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Close: Closing index from: (%d) to: (%d)...\n", low, high); // fprintf( File_Output, "Index_Close: Closing index from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_2( "Index_Close: Closing index from: (%d) to: (%d)...", low, high); LG_LOG_INFO( "Index_Close: Closing index from: (%d) to: (%d)...", low, high);
t_start( t_exec); t_start( t_exec);
@ -1232,7 +1234,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( index_subtype != NDD_INDEX_SUBTYPE_UNKNOWN) if( index_subtype != NDD_INDEX_SUBTYPE_UNKNOWN)
{ {
// fprintf( File_Output, "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !\n", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype)); // fprintf( File_Output, "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !\n", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
LG_LOG_INFO_2( "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype)); LG_LOG_INFO( "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
t_start( t_exec); t_start( t_exec);
@ -1337,7 +1339,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Reorg: Reorganizing index (%d)...\n", i); // fprintf( File_Output, "Index_Reorg: Reorganizing index (%d)...\n", i);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_1( "Index_Reorg: Reorganizing index (%d)...", i); LG_LOG_INFO( "Index_Reorg: Reorganizing index (%d)...", i);
ND_Index_Reorg( *DS_Ptr_Ptr, (NDT_Index_Id)i); ND_Index_Reorg( *DS_Ptr_Ptr, (NDT_Index_Id)i);
} }
@ -1363,7 +1365,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Tree_To_List: Converting Index (%d)...\n", i); // fprintf( File_Output, "Index_Tree_To_List: Converting Index (%d)...\n", i);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_1( "Index_Tree_To_List: Converting Index (%d)...", i); LG_LOG_INFO( "Index_Tree_To_List: Converting Index (%d)...", i);
ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_sorted_list); ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_sorted_list);
} }
@ -1389,7 +1391,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_List_To_Tree: Converting Index (%d)...\n", i); // fprintf( File_Output, "Index_List_To_Tree: Converting Index (%d)...\n", i);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_1( "Index_List_To_Tree: Converting Index (%d)...", i); LG_LOG_INFO( "Index_List_To_Tree: Converting Index (%d)...", i);
ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_balanced_tree); ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_balanced_tree);
} }
@ -1411,7 +1413,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Info_Print: Printing index from: (%d) to: (%d)...\n", low, high); // fprintf( File_Output, "Index_Info_Print: Printing index from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_2( "Index_Info_Print: Printing index from: (%d) to: (%d)...", low, high); LG_LOG_INFO( "Index_Info_Print: Printing index from: (%d) to: (%d)...", low, high);
for( i = low; i <= high; i++) for( i = low; i <= high; i++)
{ {
@ -1427,7 +1429,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "DS_Value_Print:\n"); // fprintf( File_Output, "DS_Value_Print:\n");
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_0( "DS_Value_Print:"); LG_LOG_INFO( "DS_Value_Print:");
ND_DataStruct_Value_Print( File_Output, *DS_Ptr_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0); ND_DataStruct_Value_Print( File_Output, *DS_Ptr_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
break; break;
@ -1458,7 +1460,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// low, high); // low, high);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_3( "Index_Value_Break: Breaking: (%s) values from index: (%d) to: (%d)...", LG_LOG_INFO( "Index_Value_Break: Breaking: (%s) values from index: (%d) to: (%d)...",
( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"), ( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
low, high); low, high);
@ -1499,7 +1501,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "0x(%x)", node_ptr); // fprintf( File_Output, "0x(%x)", node_ptr);
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_1( "Index_Value_Break: Breaking value of node: 0x(%x)", node_ptr); LG_LOG_INFO( "Index_Value_Break: Breaking value of node: 0x(%x)", node_ptr);
node_ptr->Value = (void *)-1; node_ptr->Value = (void *)-1;
} }
@ -1535,8 +1537,8 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
// fprintf( File_Output, "Index_Check: "); // fprintf( File_Output, "Index_Check: ");
// fflush( File_Output); // fflush( File_Output);
LG_LOG_INFO_1( "Index_Check: Checking Index (%d)...", i); LG_LOG_INFO( "Index_Check: Checking Index (%d)...", i);
LG_LOG_INFO_0( "Index_Check: "); LG_LOG_INFO( "Index_Check: ");
Nb_Corrected = Nb_Detected = 0; Nb_Corrected = Nb_Detected = 0;
ND_Index_Check( *DS_Ptr_Ptr, (NDT_Index_Id)i, &Nb_Detected, &Nb_Corrected, File_Output); ND_Index_Check( *DS_Ptr_Ptr, (NDT_Index_Id)i, &Nb_Detected, &Nb_Corrected, File_Output);
@ -1569,20 +1571,20 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( file_input == NULL) if( file_input == NULL)
{ {
// fprintf( File_Output, "Batch_Run: Can't open file (%s)!\n", Arg1); // fprintf( File_Output, "Batch_Run: Can't open file (%s)!\n", Arg1);
LG_LOG_ERROR_1( "Batch_Run: Can't open file (%s)!", Arg1); LG_LOG_ERROR( "Batch_Run: Can't open file (%s)!", Arg1);
} }
else else
{ {
// fprintf( File_Output, "\n\n--------------------------------------------------------------------------------\n"); // fprintf( File_Output, "\n\n--------------------------------------------------------------------------------\n");
// fprintf( File_Output, "Batch_Run: Starting execution (%s)...\n", Arg1); // fprintf( File_Output, "Batch_Run: Starting execution (%s)...\n", Arg1);
LG_LOG_INFO_0( "--------------------------------------------------------------------------------"); LG_LOG_INFO( "--------------------------------------------------------------------------------");
LG_LOG_INFO_1( "Batch_Run: Starting execution (%s)...", Arg1); LG_LOG_INFO( "Batch_Run: Starting execution (%s)...", Arg1);
Batch_Run( DS_Ptr_Ptr, File_Output, file_input, 0); Batch_Run( DS_Ptr_Ptr, File_Output, file_input, 0);
// fprintf( File_Output, "\n"); // fprintf( File_Output, "\n");
// fprintf( File_Output, "Batch_Run: Ending execution (%s)...\n", Arg1); // fprintf( File_Output, "Batch_Run: Ending execution (%s)...\n", Arg1);
LG_LOG_INFO_1( "Batch_Run: Ending execution (%s)...", Arg1); LG_LOG_INFO( "Batch_Run: Ending execution (%s)...", Arg1);
fclose( file_input); fclose( file_input);
} }
@ -1652,7 +1654,7 @@ int main( int argc, char **argv)
return( -1); return( -1);
} }
LG_LOG_INFO_0( "Start NDBench"); LG_LOG_INFO( "Start NDBench");
/* Init Random numbers... */ /* Init Random numbers... */
@ -1706,7 +1708,7 @@ int main( int argc, char **argv)
} }
LG_LOG_INFO_0( "End NDBench"); LG_LOG_INFO( "End NDBench");
if( ( lg_status = LG_Library_Close( true)) != LGS_OK) if( ( lg_status = LG_Library_Close( true)) != LGS_OK)
{ {