- Complete libnode.c LibLog support,
- Complete ndbench.c LibLog support, - Add test-10M.ndb & test-10M-s.ndb test files.
This commit is contained in:
106
lib/libnode.c
106
lib/libnode.c
@@ -370,13 +370,13 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
|
||||
|
||||
default:
|
||||
{
|
||||
printf( "ND_Default_Manager() called with an undefined command %d\n", Command);
|
||||
return(NDS_ERRAPI);
|
||||
LG_LOG_ERROR_1( "Manager called with an undefined command: (%d)", Command);
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
}
|
||||
|
||||
printf( "ND_Default_Manager() called with command %d (%s)\n", Command, Command_Name);
|
||||
return(NDS_OK);
|
||||
LG_LOG_ERROR_2( "Manager internal error with command: (%d) name: [%s]", Command, Command_Name);
|
||||
return( NDS_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,7 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
|
||||
|
||||
default:
|
||||
{
|
||||
printf( "Unknown COMP idx (%d) !\n", Index_Id);
|
||||
LG_LOG_ERROR_1( "Unknown COMP idx: (%d)", Index_Id);
|
||||
return( NDS_KO);
|
||||
}
|
||||
}
|
||||
@@ -636,12 +636,12 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
|
||||
|
||||
default:
|
||||
{
|
||||
printf( "OpenStruct_Manager() called with an undefined command %d\n", Command);
|
||||
LG_LOG_ERROR_1( "Manager called with an undefined command: (%d)", Command);
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
}
|
||||
|
||||
printf( "OpenStruct_Manager() called with command %d (%s)\n", Command, Command_Name);
|
||||
LG_LOG_ERROR_2( "Manager internal error with command: (%d) name: [%s]", Command, Command_Name);
|
||||
return( NDS_OK);
|
||||
}
|
||||
|
||||
@@ -1367,11 +1367,11 @@ NDT_Status ND_Index_Check_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int
|
||||
|
||||
if( *Detected_Nb_Ptr == 0)
|
||||
{
|
||||
fprintf( Out, "No error detected in the node structure (%p:%d)\n", Root_Ptr, Index_Id);
|
||||
LG_LOG_INFO_2( "No error detected in the node structure (%p:%d)", Root_Ptr, Index_Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( Out, "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Corrected_Nb_Ptr, *Detected_Nb_Ptr, Root_Ptr, Index_Id);
|
||||
LG_LOG_INFO_4( "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Corrected_Nb_Ptr, *Detected_Nb_Ptr, Root_Ptr, Index_Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2616,8 +2616,8 @@ NDT_Status ND_Index_Node_Add_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, ND
|
||||
else if( ND_INDEX_TYPE_TREE_IS( Root_Ptr, Index_Id)) return ND_Tree_Node_Add( Root_Ptr, Index_Id, Node_Ptr);
|
||||
else
|
||||
{
|
||||
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Add_I: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
ND_Error_Print ();
|
||||
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
|
||||
@@ -2741,8 +2741,8 @@ NDT_Status ND_Index_Node_Remove_I( NDT_Node *Node_Ptr)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Remove_I: unknown structure type (%d)", root_ptr->Index_Tab[index_id].Type);
|
||||
ND_Error_Print ();
|
||||
LG_LOG_ERROR_1( "Unknown structure type (%d)", root_ptr->Index_Tab[index_id].Type);
|
||||
|
||||
return(NDS_ERRAPI);
|
||||
}
|
||||
|
||||
@@ -2986,8 +2986,7 @@ NDT_Status ND_Index_Node_Find_VI( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Find_VI: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
ND_Error_Print ();
|
||||
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
|
||||
return( NDS_KO);
|
||||
}
|
||||
@@ -3040,7 +3039,8 @@ NDT_Status ND_Index_Node_Find_VC( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr
|
||||
|
||||
NDT_Status ND_Index_Node_Find_I( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, void *Value_Ptr, ...)
|
||||
{
|
||||
va_list user_args;
|
||||
va_list user_args;
|
||||
NDT_Status status;
|
||||
|
||||
|
||||
va_start( user_args, Value_Ptr);
|
||||
@@ -3048,20 +3048,22 @@ NDT_Status ND_Index_Node_Find_I( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr,
|
||||
if( ND_INDEX_TYPE_LIST_IS( Root_Ptr, Index_Id))
|
||||
{
|
||||
*Node_Ptr_Ptr = ND_List_Node_Find( Root_Ptr, Index_Id, Value_Ptr, &user_args);
|
||||
status = NDS_OK;
|
||||
}
|
||||
else if ( ND_INDEX_TYPE_TREE_IS( Root_Ptr, Index_Id))
|
||||
{
|
||||
*Node_Ptr_Ptr = ND_Tree_Node_Find( Root_Ptr, Index_Id, Value_Ptr, &user_args);
|
||||
status = NDS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Find_I: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
ND_Error_Print ();
|
||||
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
status = NDS_KO;
|
||||
}
|
||||
|
||||
va_end( user_args);
|
||||
|
||||
return( NDS_OK);
|
||||
return( status);
|
||||
}
|
||||
|
||||
|
||||
@@ -4039,7 +4041,8 @@ NDT_Status ND_List_Node_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_N
|
||||
}
|
||||
}
|
||||
|
||||
printf( "ND_List_Node_Add: unknown list type (%d)\n", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
LG_LOG_ERROR_1( "Unknown list type: (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
|
||||
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
|
||||
@@ -4911,7 +4914,9 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
if( left2right_node_number == right2left_node_number)
|
||||
{
|
||||
Root_Ptr->Index_Tab[Index_Id].Node_Number = left2right_node_number;
|
||||
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
|
||||
|
||||
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
return;
|
||||
@@ -4927,7 +4932,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
{
|
||||
if( node_ptr->Right && ( node_ptr->Right->Left != node_ptr))
|
||||
{
|
||||
fprintf( Out, "\t- link 'Left' has been corrected on node %p of structure %p:%d\n", node_ptr->Right, Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_3( "\t- link 'Left' has been corrected on node: (%p) of structure: (%p:%d)", node_ptr->Right, Root_Ptr, Index_Id);
|
||||
|
||||
node_ptr->Right->Left = node_ptr;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -4935,7 +4941,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
|
||||
if( !node_ptr->Right && ( node_ptr != Root_Ptr->Index_Tab[Index_Id].Tail))
|
||||
{
|
||||
fprintf( Out, "\t- link 'Tail' has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_2( "\t- link 'Tail' has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
|
||||
|
||||
Root_Ptr->Index_Tab[Index_Id].Tail = node_ptr;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -4946,7 +4953,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
|
||||
if( Root_Ptr->Index_Tab[Index_Id].Node_Number != left2right_node_number)
|
||||
{
|
||||
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
|
||||
|
||||
Root_Ptr->Index_Tab[Index_Id].Node_Number = left2right_node_number;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -4965,7 +4973,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
{
|
||||
if( node_ptr->Left && ( node_ptr->Left->Right != node_ptr))
|
||||
{
|
||||
fprintf( Out, "\t- link 'Right' has been corrected on node %p of list %p:%d\n", node_ptr->Left, Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_3( "\t- link 'Right' has been corrected on node: (%p) of list: (%p:%d)", node_ptr->Left, Root_Ptr, Index_Id);
|
||||
|
||||
node_ptr->Left->Right = node_ptr;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -4973,7 +4982,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
|
||||
if( !node_ptr->Left && ( node_ptr != Root_Ptr->Index_Tab[Index_Id].Head))
|
||||
{
|
||||
fprintf( Out, "\t- link 'Head' has been corrected on the structure root %p:%d\n", Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_2( "\t- link 'Head' has been corrected on the structure root: (%p:%d)", Root_Ptr, Index_Id);
|
||||
|
||||
Root_Ptr->Index_Tab[Index_Id].Head = node_ptr;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -4984,7 +4994,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
|
||||
|
||||
if( Root_Ptr->Index_Tab[Index_Id].Node_Number != right2left_node_number)
|
||||
{
|
||||
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
|
||||
|
||||
Root_Ptr->Index_Tab[Index_Id].Node_Number = right2left_node_number;
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
@@ -5015,7 +5026,7 @@ void ND_Value_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_Dete
|
||||
|
||||
if( !node_ptr->Value)
|
||||
{
|
||||
fprintf( Out, "\t- node %p has been removed from structure %p:%d because no value is attached to it\n", node_ptr, Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_3( "\t- node: (%p) has been removed from structure (%p:%d) because no value is attached to it", node_ptr, Root_Ptr, Index_Id);
|
||||
|
||||
ND_Index_Node_Remove_I( node_ptr);
|
||||
|
||||
@@ -5026,7 +5037,7 @@ void ND_Value_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_Dete
|
||||
}
|
||||
else if( ND_Address_Check( node_ptr->Value) != NDS_OK)
|
||||
{
|
||||
fprintf (Out, "\t- node %p has been removed from structure %p:%d because its value cannot be accessed\n", node_ptr, Root_Ptr, Index_Id);
|
||||
LG_LOG_WARNING_3( "\t- node %p has been removed from structure %p:%d because its value cannot be accessed", node_ptr, Root_Ptr, Index_Id);
|
||||
|
||||
ND_Index_Node_Remove_I( node_ptr);
|
||||
|
||||
@@ -5080,7 +5091,9 @@ void ND_Tree_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_
|
||||
if( Root_Ptr->Index_Tab[Index_Id].Head->Root != Root_Ptr)
|
||||
{
|
||||
Root_Ptr->Index_Tab[Index_Id].Head->Root = Root_Ptr;
|
||||
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Root_Ptr->Index_Tab[Index_Id].Head, Root_Ptr, Index_Id);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Root_Ptr->Index_Tab[Index_Id].Head, Root_Ptr, Index_Id);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5103,7 +5116,9 @@ void ND_Tree_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_
|
||||
if( ND_Index_Node_Find_I( &node_ptr, Root_Ptr, Index_Id, Root_Ptr->Index_Tab[Index_Id].Save->Value, NULL) != NDS_OK)
|
||||
{
|
||||
ND_Index_Node_Add_I( Root_Ptr, Index_Id, Root_Ptr->Index_Tab[Index_Id].Save);
|
||||
fprintf( Out, "\t- saved node %p has been restored to structure %p:%d\n", Root_Ptr->Index_Tab[Index_Id].Save, Root_Ptr, Index_Id);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- saved node: (%p) has been restored to structure: (%p:%d)", Root_Ptr->Index_Tab[Index_Id].Save, Root_Ptr, Index_Id);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5123,7 +5138,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
|
||||
if( Node_Ptr->Left->Root != Node_Ptr->Root)
|
||||
{
|
||||
Node_Ptr->Left->Root = Node_Ptr->Root;
|
||||
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5131,7 +5148,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
|
||||
if( Node_Ptr->Left->Parent != Node_Ptr)
|
||||
{
|
||||
Node_Ptr->Left->Parent = Node_Ptr;
|
||||
fprintf( Out, "\t- link 'Parent' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- link 'Parent' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5146,7 +5165,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
|
||||
if( Node_Ptr->Right->Root != Node_Ptr->Root)
|
||||
{
|
||||
Node_Ptr->Right->Root = Node_Ptr->Root;
|
||||
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5154,7 +5175,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
|
||||
if( Node_Ptr->Right->Parent != Node_Ptr)
|
||||
{
|
||||
Node_Ptr->Right->Parent = Node_Ptr;
|
||||
fprintf( Out, "\t- link 'Parent' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
LG_LOG_WARNING_3( "\t- link 'Parent' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
|
||||
|
||||
(*Nb_Detected_Ptr)++;
|
||||
(*Nb_Corrected_Ptr)++;
|
||||
}
|
||||
@@ -5304,16 +5327,3 @@ void ND_Signal_Trap( int Sig_Num)
|
||||
longjmp( NDG_Base.SigLongJmp_Env, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/* Routine d'affichage d'un message d'erreur */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
void ND_Error_Print( void)
|
||||
{
|
||||
if( NDG_Base.Err_Stream) fprintf( ( NDG_Base.Err_Stream == (FILE *)-1 ) ? stderr : NDG_Base.Err_Stream, "%s\n", NDG_Base.Err_String);
|
||||
}
|
||||
|
||||
@@ -353,8 +353,6 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *, int *, int *, FILE *);
|
||||
|
||||
NDT_Status ND_Symbol_Find( void **, const char *);
|
||||
|
||||
void ND_Error_Print( void);
|
||||
|
||||
void ND_Signal_Trap( int);
|
||||
|
||||
NDT_Status ND_Address_Check( void *);
|
||||
|
||||
Reference in New Issue
Block a user