10 Commits

Author SHA1 Message Date
agibert
3d91078a5c Add Index_Value_Break andDS_Check commands. 2004-08-24 20:32:47 +00:00
agibert
51482fb475 Add Index_Value_Break and Index_Node_Break commands,
Improve random number generation.
2004-08-24 20:31:28 +00:00
agibert
75cfc21e01 Add ndbech random number improvement in 2.0.6-1 entry. 2004-08-24 20:30:23 +00:00
agibert
5aea056299 Update to 2.0.6 release. 2004-08-23 22:53:02 +00:00
agibert
3f6d118ae2 Code cleanup. 2004-08-23 22:48:37 +00:00
agibert
7c96ad706b Implement signal support for Windows target,
Fix NDT_Root header for HP compilation: Index default number goes from 0 to 1.
2004-08-23 22:47:22 +00:00
agibert
c70c4e5aba Add final updates in libnode (ND_Check for Windows target) and *Break cmd for ndbench. 2004-08-23 22:45:17 +00:00
agibert
7f142acda3 Add re-implementation of address checking in 2.0.6-1 entry.
Fix Micot project spelling.
2004-08-02 21:33:53 +00:00
agibert
64baaa1bc5 Re-implement for unix target, address checking in ND_Address_Check: now use sigaction() and siglingjmp() instead of signal().
Minor code clean-up.
2004-08-02 21:26:03 +00:00
agibert
77330558f0 Add 2.0.6-1 entry,
Add TIMA project reference in 2.0.0-alpha1 entry,
extend -*- separators from 80 to 132 cols.
2004-08-02 00:25:43 +00:00
8 changed files with 419 additions and 191 deletions

View File

@@ -1,16 +1,32 @@
# $RCSfile: ReleaseNotes.txt,v $
# $Revision: 2.12 $
# $Revision: 2.16 $
# $Name: $
# $Date: 2004/08/01 23:49:13 $
# $Date: 2004/08/24 20:30:23 $
# $Author: agibert $
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.6-1 - A. Gibert - 24/08/04
------------------------------------------------------------------------------------------------------------------------------------
All: Generate *-c executables with checking mode enabled (ND_MODE=1),
Code clean up and more cleanly indented,
This new release is developped for the MICOT/Target project (Banque de France - Paris),
LibNode: Add OpenStruct tracing support (Enabled by ND_MODE=1 and Debug=1),
Re-implement for Unix and Windows target, full address checking in ND_Address_Check(),
NDDemo0: Add LibNode 2.0.6 support: Add ND_Library_Open/Close() calls,
NDBench: Add Lib_Open, Lib_Close, Index_Value_Break and Index_Node_Break command,
Improve random number generation,
Add test-10.ndb and test-errror.ndb batch files.
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.5-1 - A. Gibert / M. Regimbeau - 28/07/03
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: Add a new Makefile system (Makefile.rule and Makefile.var),
Add 'make distrib' support,
@@ -19,9 +35,9 @@ All: Add a new Makefile system (Makefile.rule and Makefile.var),
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.4-1 - A. Gibert - 29/07/02
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: This release of libnode pass with sucess valgrind test on linux.
LibNode: Add and use ND_Index_Clear() private API,
@@ -29,9 +45,9 @@ NbBench: Add fclose() call at the end of batch_run.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.3-1 - A. Gibert - 09/04/02
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: Fix Microsoft Visual Project to generate Debug and Release config correctly,
LibNode: Change index type numeric print value from decimal to hexa in ND_Index_Info_Print() API,
@@ -43,9 +59,9 @@ NbBench: Generate in Debug mode ndbenchd.exe and in Release mode ndbenchd.exe.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.2-2 - A. Gibert - 01/03/02
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: Add GNU-GPL.txt, GNU-LGPL.txt and GNU-FDL.txt license files,
All: Add license stuff in ReandMe.
@@ -56,9 +72,9 @@ NbBench: Add GPL header in ndbench.c.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.2-1 - A. Gibert - 27/02/02
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: Makefiles now generate static and dynamic objects,
All: Add no libver support in Makefiles,
@@ -70,26 +86,26 @@ NbBench: Implement Index_Close and Index_Info_Print functions.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.1-1 - A. Gibert - 28/11/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode: Fix the error level of TIMAS_KO: it's now an error status.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-1 - A. Gibert - 26/11/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
All: Merge the main CVS trunc with the win32 branche (2.0.0-alpha5),
Switch file release to 2.0.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-alpha5 - A. Gibert - 25/10/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode: Add Open/Close Index support,
LibNode: Fix return code next to empty struct manipulations,
@@ -97,9 +113,9 @@ NdBench: Add full multi index support.
--------------------------------------------------------------------------------
LibNode V 2.0.0-alpha4 - A. Gibert - 28/9/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-alpha4 - A. Gibert - 28/09/01
------------------------------------------------------------------------------------------------------------------------------------
All: Add optional libver support,
LibNode: Fix missing recursive offset args,
@@ -108,18 +124,18 @@ NdBench: Fix local stack pointer big bug.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-alpha3 - A. Gibert - 18/9/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
New manager args interface (again !),
ndbench support batch mode.
--------------------------------------------------------------------------------
LibNode V 2.0.0-alpha2 - A. Gibert - 8/9/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-alpha2 - A. Gibert - 08/09/01
------------------------------------------------------------------------------------------------------------------------------------
Re-enable libver support for unix,
Bug fixes,
@@ -127,53 +143,54 @@ Code cleanup.
--------------------------------------------------------------------------------
LibNode V 2.0.0-alpha1 - A. Gibert - 7/9/01
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 2.0.0-alpha1 - A. Gibert - 07/09/01
------------------------------------------------------------------------------------------------------------------------------------
Add Full win32 support,
Remove libver support,
Multi index support,
New manager args format,
Major Code cleanup et standardisation.
This new version (2.0.x) is developped for the TIMA project (Misys IBS - France).
--------------------------------------------------------------------------------
LibNode V 1.0.0 - S. Mas / A. Gibert - 18/7/00
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 1.0.0 - S. Mas / A. Gibert - 18/07/00
------------------------------------------------------------------------------------------------------------------------------------
Unix (Linux and Solaris) version only, for BDM project (Société Générale - Paris)
Major code rewrite.
--------------------------------------------------------------------------------
LibNode V 0.2.2 - A. Gibert - 1/6/93
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 0.2.2 - A. Gibert - 01/06/93
------------------------------------------------------------------------------------------------------------------------------------
Embeded version on OS/2 2.1 (Companie Générale des Eaux - Paris)
--------------------------------------------------------------------------------
LibNode V 0.2.1 - A. Gibert - 1/4/92
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 0.2.1 - A. Gibert - 01/04/92
------------------------------------------------------------------------------------------------------------------------------------
Amiga and PC support (Bareau de Draguignan - Ste Maxime).
--------------------------------------------------------------------------------
LibNode V 0.2.0 - A. Gibert - 1/3/91
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 0.2.0 - A. Gibert - 01/03/91
------------------------------------------------------------------------------------------------------------------------------------
C version aided by p2c tools on Pyramid (Swansee University - Wales).
--------------------------------------------------------------------------------
LibNode V 0.1.0 - A. Gibert - 1/12/90
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
LibNode V 0.1.0 - A. Gibert - 01/12/90
------------------------------------------------------------------------------------------------------------------------------------
Inital version in Pascal on Pyramid (Swansee University - Wales).

View File

@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: nddemo0.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.7 $ */
/* $Revision: 2.8 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:35:39 $ */
/* $Date: 2004/08/23 22:48:37 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@@ -37,25 +37,25 @@
#define DEMO_FILE_NAME "nddemo0.dat"
#define STRING_LEN (short)1024
#define STRING_SIZE (short)(STRING_LEN + 1)
#define VAL_LEN (short)64
#define VAL_SIZE (short)(VAL_LEN + 1)
#define INDEX_NB (short)4
#define STRING_LEN ( short) 1024
#define STRING_SIZE ( short) ( STRING_LEN + 1)
#define VAL_LEN ( short) 64
#define VAL_SIZE ( short) ( VAL_LEN + 1)
#define INDEX_NB ( short) 4
#define NDT_CMD_INDEX0_PRINT (NDT_Command)64
#define NDT_CMD_INDEX1_PRINT (NDT_Command)65
#define NDT_CMD_INDEX2_PRINT (NDT_Command)66
#define NDT_CMD_INDEX3_PRINT (NDT_Command)67
#define NDD_CMD_INDEX0_PRINT ( NDT_Command) 64
#define NDD_CMD_INDEX1_PRINT ( NDT_Command) 65
#define NDD_CMD_INDEX2_PRINT ( NDT_Command) 66
#define NDD_CMD_INDEX3_PRINT ( NDT_Command) 67
typedef struct Demo_Value
{
char Val0[VAL_SIZE];
char Val1[VAL_SIZE];
char Val2[VAL_SIZE];
char Val3[VAL_SIZE];
char Val0[ VAL_SIZE];
char Val1[ VAL_SIZE];
char Val2[ VAL_SIZE];
char Val3[ VAL_SIZE];
} Demo_Value;
@@ -64,7 +64,7 @@ typedef struct Demo_Value
/* Prototypes */
/*---------------------------------------------------------------------------------*/
NDT_Status Manager_Demo_DS( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
NDT_Status Demo_DS_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
void DataStruct_Load( NDT_Root *, FILE *);
void DataStruct_Load( NDT_Root *, FILE *);
void Demo( char *, short);
@@ -80,7 +80,7 @@ int main( int, char **);
/* */
/*---------------------------------------------------------------------------------*/
NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list Args)
NDT_Status Demo_DS_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list Args)
{
NDT_Command_Name Command_Name;
@@ -94,7 +94,7 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.7 $ $Name: $ $Date: 2004/08/01 23:35:39 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.8 $ $Name: $ $Date: 2004/08/23 22:48:37 $ $Author: agibert $";
return( NDS_OK);
}
@@ -117,28 +117,28 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
switch(Cmd)
{
case NDT_CMD_INDEX0_PRINT:
case NDD_CMD_INDEX0_PRINT:
{
*Reply_Index_Id_Ptr = 0;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX1_PRINT:
case NDD_CMD_INDEX1_PRINT:
{
*Reply_Index_Id_Ptr = 1;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX2_PRINT:
case NDD_CMD_INDEX2_PRINT:
{
*Reply_Index_Id_Ptr = 2;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX3_PRINT:
case NDD_CMD_INDEX3_PRINT:
{
*Reply_Index_Id_Ptr = 3;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
@@ -228,63 +228,63 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
if( rc < 0)
{
return(NDS_LOWER);
return( NDS_LOWER);
}
else
{
if( rc > 0)
{
return(NDS_GREATER);
return( NDS_GREATER);
}
else
{
return(NDS_EQUAL);
return( NDS_EQUAL);
}
}
}
case 1:
{
int val1 = atoi(Value1_Ptr->Val1);
int val2 = atoi(Value2_Ptr->Val1);
int val1 = atoi( Value1_Ptr->Val1);
int val2 = atoi( Value2_Ptr->Val1);
if( val1 < val2)
{
return(NDS_LOWER);
return( NDS_LOWER);
}
else
{
if( val1 > val2)
{
return(NDS_GREATER);
return( NDS_GREATER);
}
else
{
return(NDS_EQUAL);
return( NDS_EQUAL);
}
}
}
case 2:
{
int val1 = strlen(Value1_Ptr->Val2);
int val2 = strlen(Value2_Ptr->Val2);
int val1 = strlen( Value1_Ptr->Val2);
int val2 = strlen( Value2_Ptr->Val2);
if( val1 < val2)
{
return(NDS_LOWER);
return( NDS_LOWER);
}
else
{
if( val1 > val2)
{
return(NDS_GREATER);
return( NDS_GREATER);
}
else
{
return(NDS_EQUAL);
return( NDS_EQUAL);
}
}
}
@@ -323,6 +323,7 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
*/
Command_Name = "NDD_CMD_VALUE_REMOVE";
return( NDS_OK);
}
@@ -380,12 +381,12 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
default:
{
printf( "Demo_DS_Manager() called with an undefined command %d\n", Command);
return NDS_ERRAPI;
return( NDS_ERRAPI);
}
}
printf( "Demo_DS_Manager() called with command %d (%s)\n", Command, Command_Name);
return NDS_OK;
return( NDS_OK);
}
@@ -492,7 +493,7 @@ void DataStruct_Dump( NDT_Root *ds_ptr)
printf( "Traverse DataStructure Index 0:\n");
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDT_CMD_INDEX0_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX0_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
@@ -503,7 +504,7 @@ void DataStruct_Dump( NDT_Root *ds_ptr)
printf( "Traverse DataStructure Index 1:\n");
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDT_CMD_INDEX1_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX1_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
@@ -514,7 +515,7 @@ void DataStruct_Dump( NDT_Root *ds_ptr)
printf( "Traverse DataStructure Index 2:\n");
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDT_CMD_INDEX2_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX2_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
@@ -525,7 +526,7 @@ void DataStruct_Dump( NDT_Root *ds_ptr)
printf( "Traverse DataStructure Index 3:\n");
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDT_CMD_INDEX3_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX3_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
@@ -584,7 +585,7 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
index_type_ptr = index_type_final_tab;
}
if( ( status = ND_DataStruct_Open( &demo_ds_ptr, INDEX_NB, index_type_ptr, "Manager_Demo_DS", Manager_Demo_DS, NULL, NULL, NULL, NULL,0, NULL)) != NDS_OK)
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)
{
printf( "ND_DataStruct_Open() failed (%d) !\n", status);
}
@@ -606,16 +607,11 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
printf( "\n\n\nLaod Data File:\n\n");
DataStruct_Load( demo_ds_ptr, demo_file);
if( Optimized_Mode)
{
printf( "\n\n\nInitial Structure Dump:\n\n");
DataStruct_Dump( demo_ds_ptr);
printf( "Convert data structure: ");
@@ -634,8 +630,6 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
printf( "\n\n\nFinal Structure Dump:\n\n");
DataStruct_Dump( demo_ds_ptr);
printf( "Close demo datafile: ");
if( fclose( demo_file) != 0)

View File

@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: node.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.7 $ */
/* $Revision: 2.9 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:18:37 $ */
/* $Date: 2004/08/23 22:47:22 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@@ -31,21 +31,20 @@
#ifndef _LIBNODE_H_
#define _LIBNODE_H_
# define _LIBNODE_H_
#ifdef __cplusplus
# ifdef __cplusplus
extern "C" {
#endif
# endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
# include <stdarg.h>
#ifdef _LIBVER_SUPPORT
# include <ver.h>
#endif
# ifdef _LIBVER_SUPPORT
# include <ver.h>
# endif
@@ -276,7 +275,7 @@ typedef struct NDT_Root
NDT_Index_Nb Index_Nb;
NDT_Index_Nb Index_Open_Count;
NDT_Index Index_Tab[0];
NDT_Index Index_Tab[1];
} NDT_Root;
@@ -299,7 +298,7 @@ typedef struct NDT_DataStruct
typedef struct NDT_Node
{
NDT_Root *Root;
NDT_Root *Root;
NDT_Index_Id Index;
struct NDT_Node *Parent;
struct NDT_Node *Left;
@@ -910,8 +909,8 @@ NDD_DLL_API NDT_Status ND_Desallocator_Exec_C( NDT_Desallocator *, void *, vo
#ifdef __cplusplus
# ifdef __cplusplus
}
#endif
# endif
#endif

View File

@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.10 $ */
/* $Revision: 2.12 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:18:38 $ */
/* $Date: 2004/08/23 22:47:22 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@@ -34,7 +34,7 @@
#include <libnode.h>
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT( libnode, "$Revision: 2.10 $", "$Name: $", __FILE__, "$Author: agibert $")
VER_INFO_EXPORT( libnode, "$Revision: 2.12 $", "$Name: $", __FILE__, "$Author: agibert $")
#endif
@@ -63,7 +63,7 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.10 $ $Name: $ $Date: 2004/08/01 23:18:38 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.12 $ $Name: $ $Date: 2004/08/23 22:47:22 $ $Author: agibert $";
return( NDS_OK);
}
@@ -369,7 +369,7 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.10 $ $Name: $ $Date: 2004/08/01 23:18:38 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.12 $ $Name: $ $Date: 2004/08/23 22:47:22 $ $Author: agibert $";
return( NDS_OK);
}
@@ -661,11 +661,11 @@ NDT_Status ND_Library_Close_I( void)
Symbol = NDG_Base.Symbol_First_Ptr;
while (Symbol)
while( Symbol)
{
Next_Symbol = Symbol->Next;
free (Symbol->Name);
free (Symbol);
free( Symbol->Name);
free( Symbol);
Symbol = Next_Symbol;
}
@@ -702,12 +702,12 @@ NDT_Status ND_Library_Close_C( void)
{
if( NDG_Base.OpenStruct_Ptr->Index_Tab[NDD_INDEX_PRIMARY].Node_Number > 0)
{
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: Unclosed DataStruct:");
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: Unclosed DataStruct:");
ND_Error_Print();
if( ( status = ND_DataStruct_Info_Print_I( NDG_Base.Err_Stream, NDG_Base.OpenStruct_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 0, 0)) != NDS_OK)
{
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: can't print OpenStruct info");
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: can't print OpenStruct info");
ND_Error_Print();
return( NDS_KO);
@@ -716,7 +716,7 @@ NDT_Status ND_Library_Close_C( void)
if( ( status = ND_DataStruct_Close_I( NDG_Base.OpenStruct_Ptr)) != NDS_OK)
{
sprintf( NDG_Base.Err_String, "Error ND_Library_Open_C: can't close OpenStruct");
sprintf( NDG_Base.Err_String, "Error ND_Library_Close_C: can't close OpenStruct");
ND_Error_Print();
return( NDS_KO);
@@ -4128,7 +4128,7 @@ NDT_Status ND_Node_Alloc( NDT_Root *Root_Ptr, NDT_Node **Node_Ptr_Ptr )
rc = ND_Allocator_Exec_I( Root_Ptr->Allocator_Ptr, (void **)Node_Ptr_Ptr, sizeof(NDT_Node), Root_Ptr->User);
if( ND_ERROR(rc)) return(rc);
if( ND_ERROR(rc)) return( rc);
(*Node_Ptr_Ptr)->Root = NULL;
(*Node_Ptr_Ptr)->Index = NDD_INDEX_UNKNOWN;
@@ -4208,7 +4208,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
NDT_Index_Id index_id;
status = ND_Allocator_Exec_I( Allocator_Ptr, (void **)Root_Ptr_Ptr, ( sizeof (NDT_Root) + sizeof(NDT_Index) * (Index_Nb + 1)), Data_Ptr);
status = ND_Allocator_Exec_I( Allocator_Ptr, (void **)Root_Ptr_Ptr, ( sizeof( NDT_Root) + sizeof(NDT_Index) * (Index_Nb - 1)), Data_Ptr);
if( ND_ERROR(status)) return( status);
if( strlen(Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI);
@@ -4245,7 +4245,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
return( NDS_KO);
}
(*Root_Ptr_Ptr)->Index_Tab[index_id].Type = NDD_INDEX_STATUS_CLOSED;
( *Root_Ptr_Ptr)->Index_Tab[index_id].Type = NDD_INDEX_STATUS_CLOSED;
}
}
@@ -4329,7 +4329,7 @@ NDT_Status ND_List_Node_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_N
if(!New_Node_Ptr->Left && !New_Node_Ptr->Right)
{
if (!Root_Ptr->Index_Tab[Index_Id].Tail) Root_Ptr->Index_Tab[Index_Id].Head = Root_Ptr->Index_Tab[Index_Id].Tail = New_Node_Ptr;
if( !Root_Ptr->Index_Tab[Index_Id].Tail) Root_Ptr->Index_Tab[Index_Id].Head = Root_Ptr->Index_Tab[Index_Id].Tail = New_Node_Ptr;
else
{
Root_Ptr->Index_Tab[Index_Id].Tail->Right = New_Node_Ptr;
@@ -4449,7 +4449,7 @@ NDT_Status ND_List_Value_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, void
node_ptr->Value = Value_Ptr;
// return ND_List_Node_Add (Root, Node);
// return ND_List_Node_Add( Root, Node);
rc = ND_List_Node_Add( Root_Ptr, Index_Id, node_ptr);
if( ND_ERROR(rc))
@@ -4484,7 +4484,7 @@ NDT_Status ND_Tree_Value_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, void
node_ptr->Value = Value_Ptr;
// return ND_Tree_Node_Add (Root, Node);
// return ND_Tree_Node_Add( Root, Node);
rc = ND_Tree_Node_Add( Root_Ptr, Index_Id, node_ptr);
if( ND_ERROR(rc))
@@ -4525,7 +4525,7 @@ NDT_Node *ND_List_Node_Find( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, void
{
rc = ND_Manager_Exec_I( Root_Ptr, Index_Id, node_ptr, NDD_CMD_VALUE_COMP, Value_Ptr, node_ptr->Value, User_Args);
switch (rc)
switch( rc)
{
case NDS_EQUAL:
{
@@ -4739,7 +4739,7 @@ NDT_Node *ND_Tree_Recursive_Make( long Depth, long Node_Number, NDT_Node *No
NDT_Node *left_node_ptr, *middle_node_ptr, *right_node_ptr;
if( !Node_Ptr) return (NULL);
if( !Node_Ptr) return( NULL);
/* On calcule le milieu de la liste */
@@ -4900,7 +4900,7 @@ long ND_Tree_MaxDepth_Get( NDT_Node *Node_Ptr)
long Max_Left, Max_Right;
if( !Node_Ptr) return ( 0);
if( !Node_Ptr) return( 0);
Max_Left = ND_Tree_MaxDepth_Get( Node_Ptr->Left);
@@ -4975,7 +4975,7 @@ void ND_Tree_Node_Recursive_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, N
if( Max_Depth + Depth - 1 > Root_Ptr->Index_Tab[Index_Id].Max_Depth) Root_Ptr->Index_Tab[Index_Id].Max_Depth = Max_Depth + Depth - 1;
if (Min_Depth + Depth - 1 < Root_Ptr->Index_Tab[Index_Id].Min_Depth) Root_Ptr->Index_Tab[Index_Id].Min_Depth = Min_Depth + Depth - 1 ;
if( Min_Depth + Depth - 1 < Root_Ptr->Index_Tab[Index_Id].Min_Depth) Root_Ptr->Index_Tab[Index_Id].Min_Depth = Min_Depth + Depth - 1 ;
}
}
@@ -5051,14 +5051,14 @@ void ND_Tree_Recursive_Print( NDT_Node *Node_Ptr, long Depth, FILE *Out)
/* Affichage des toutes les informations (noeud et valeur) :
if (Node->Root) fprintf (Out, "Root=%p ", Node->Root);
if (Node->Parent) fprintf (Out, "Parent=%p ", Node->Parent);
if (Node->Left) fprintf (Out, "Left=%p ", Node->Left);
if (Node->Right) fprintf (Out, "Right=%p ", Node->Right);
if( Node->Root) fprintf( Out, "Root=%p ", Node->Root);
if( Node->Parent) fprintf( Out, "Parent=%p ", Node->Parent);
if( Node->Left) fprintf( Out, "Left=%p ", Node->Left);
if( Node->Right) fprintf( Out, "Right=%p ", Node->Right);
fprintf (Out, "Value=[");
ND_Manager_Exec (Node->Root->Manager, NDD_CMD_PRINT_VALUE, Node->Value, Out);
fprintf (Out, "]\n");
fprintf( Out, "Value=[");
ND_Manager_Exec( Node->Root->Manager, NDD_CMD_PRINT_VALUE, Node->Value, Out);
fprintf( Out, "]\n");
*/
/* Affichage de la valeur seule : */
@@ -5087,7 +5087,7 @@ int ND_Node_Compare( void **Node1_Ptr_Ptr, void **Node2_Ptr_Ptr)
// rc = ND_Manager_Exec_I( Tmp_Root->Manager, NDD_CMD_COMP_VALUE_COMP, ((NDT_Node *)(*Node1))->Value, ((NDT_Node *)(*Node2))->Value);
rc = ND_Manager_Exec_I( ((NDT_Node *)(*Node1_Ptr_Ptr))->Root, ((NDT_Node *)(*Node1_Ptr_Ptr))->Index, *Node1_Ptr_Ptr, NDD_CMD_VALUE_COMP, ((NDT_Node *)(*Node1_Ptr_Ptr))->Value, ((NDT_Node *)(*Node2_Ptr_Ptr))->Value, NULL);
rc = ND_Manager_Exec_I( ( ( NDT_Node *)( *Node1_Ptr_Ptr))->Root, ( ( NDT_Node *)(*Node1_Ptr_Ptr))->Index, *Node1_Ptr_Ptr, NDD_CMD_VALUE_COMP, ( (NDT_Node *) (*Node1_Ptr_Ptr))->Value, ( ( NDT_Node *)( *Node2_Ptr_Ptr))->Value, NULL);
switch( (int)rc)
{
@@ -5097,7 +5097,7 @@ int ND_Node_Compare( void **Node1_Ptr_Ptr, void **Node2_Ptr_Ptr)
default:
sprintf( NDG_Base.Err_String, "Error ND_Node_Compare : incorrect return code from the manager: %d", rc);
ND_Error_Print ();
ND_Error_Print();
return 0;
}
}
@@ -5141,12 +5141,12 @@ NDT_Status ND_List_Sort( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id)
// Tmp_Root = Root;
// qsort( (void *)tab, (size_t)(Root_Ptr->Index_Tab[Index_Id].Node_Number), sizeof(NDT_Node *), (int (__cdecl *)(const void *, const void *))&ND_Node_Compare);
qsort( (void *)tab, (size_t)(Root_Ptr->Index_Tab[Index_Id].Node_Number), sizeof(NDT_Node *), (int (*)(const void *, const void *))&ND_Node_Compare);
// qsort( (void *)tab, (size_t)(Root_Ptr->Index_Tab[Index_Id].Node_Number), sizeof(NDT_Node *), ( int (__cdecl *)(const void *, const void *))&ND_Node_Compare);
qsort( (void *)tab, (size_t)( Root_Ptr->Index_Tab[Index_Id].Node_Number), sizeof( NDT_Node *), ( int (*)( const void *, const void *))&ND_Node_Compare);
/* On met à jour les liens entre les noeuds */
for (i = 0; i < Root_Ptr->Index_Tab[Index_Id].Node_Number; i++)
for( i = 0; i < Root_Ptr->Index_Tab[Index_Id].Node_Number; i++)
{
node_ptr = (NDT_Node *)tab[i];
@@ -5207,7 +5207,7 @@ NDT_Node *ND_Tree_Node_Last_Recursive_Get( NDT_Node *Node_Ptr)
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction malloc () avec retour de type NDT_Status */
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Default_Allocator( size_t Size, void **Ptr_Ptr, void *Data_Ptr)
@@ -5225,7 +5225,7 @@ NDT_Status ND_Default_Allocator( size_t Size, void **Ptr_Ptr, void *Data_Ptr
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction free () avec retour de type NDT_Status */
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Default_Desallocator( void *Ptr, void *Data_Ptr)
@@ -5560,31 +5560,126 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
/*------------------------------------------------------------------------------*/
/* Vérifie qu'une adresse est valide */
/* Target address access try */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Address_Check( void *Address)
{
int test;
#if !defined(_MSC_VER)
NDT_Status status;
int rc;
int test;
struct sigaction act = {0}, oact_bus, oact_segv;
act.sa_handler = ND_Signal_Trap;
NDG_Base.Sig_Trapped = 0;
/* Trap SIGBUS and SIGSEGV */
if( ( rc = sigaction( SIGBUS, &act, &oact_bus)) != 0)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: sigaction (Add SIGBUS Hdl) rc: %d errno: %d", rc, errno);
ND_Error_Print();
return( NDS_KO);
}
if( ( rc = sigaction( SIGSEGV, &act, &oact_segv)) != 0)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: sigaction (Add SIGSEGV Hdl) rc: %d errno: %d", rc, errno);
ND_Error_Print();
return( NDS_KO);
}
/* Target address access try */
if( sigsetjmp( NDG_Base.SigLongJmp_Env, 1) == 0 )
{
test = *( (int *)Address);
status = NDS_OK;
}
else
{
status = NDS_KO;
}
/* Untrap SIGBUS and SIGSEGV */
if( ( rc = sigaction( SIGBUS, &oact_bus, &act)) != 0)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: sigaction (Remove SIGBUS Hdl) rc: %d errno: %d", rc, errno);
ND_Error_Print();
return( NDS_KO);
}
if( ( rc = sigaction( SIGSEGV, &oact_segv, &act)) != 0)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: sigaction (Remove SIGSEGV Hdl) rc: %d errno: %d", rc, errno);
ND_Error_Print();
return( NDS_KO);
}
return( status);
#else
NDT_Status status;
int test;
void (__cdecl *old_sigsegv_sighandler)(int);
NDG_Base.Sig_Trapped = 0;
/* On trappe les signaux SIGBUS et SIGSEGV */
// signal( SIGBUS, NDG_Base.Signal_Trap); Win32
// signal( SIGSEGV, NDG_Base.Signal_Trap); Win32
/* On tente d'accéder à l'adresse fournie */
/* Trap SIGSEGV */
test = *( (int *)Address);
if( ( old_sigsegv_sighandler = signal( SIGSEGV, ND_Signal_Trap)) == SIG_ERR)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: signal (Add SIGSEGV Hdl) errno: %d", errno);
ND_Error_Print();
// sigrelse( SIGBUS); Win32
// sigrelse( SIGSEGV); Win32
return( NDS_KO);
}
if( NDG_Base.Sig_Trapped != 0) return( NDS_KO);
return( NDS_OK);
/* Target address access try */
if( setjmp( NDG_Base.SigLongJmp_Env) == 0 )
{
test = *( (int *)Address);
status = NDS_OK;
}
else
{
status = NDS_KO;
}
/* Untrap SIGSEGV */
if( ( old_sigsegv_sighandler = signal( SIGSEGV, old_sigsegv_sighandler)) == SIG_ERR)
{
sprintf( NDG_Base.Err_String, "Error ND_Address_Check: signal (Remove SIGSEGV Hdl) errno: %d", errno);
ND_Error_Print();
return( NDS_KO);
}
return( status);
#endif
}
@@ -5598,6 +5693,12 @@ NDT_Status ND_Address_Check( void *Address)
void ND_Signal_Trap( int Sig_Num)
{
NDG_Base.Sig_Trapped = Sig_Num;
#if !defined(_MSC_VER)
siglongjmp( NDG_Base.SigLongJmp_Env, 1);
#else
longjmp( NDG_Base.SigLongJmp_Env, 1);
#endif
}

View File

@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.5 $ */
/* $Revision: 2.7 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:18:38 $ */
/* $Date: 2004/08/23 22:47:22 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@@ -29,11 +29,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
# include <errno.h>
# include <signal.h>
# include <setjmp.h>
//#include <dlfcn.h>
#include <node.h>
@@ -52,7 +56,7 @@
#define NDD_HUGE_LONG (long)0xFFFFFFL
#define NDD_HUGE_LONG ( long) 0xFFFFFFL
@@ -78,6 +82,11 @@ typedef struct NDT_Base
char Err_String[512];
FILE *Err_Stream;
int Sig_Trapped;
#if !defined(_MSC_VER)
sigjmp_buf SigLongJmp_Env;
#else
jmp_buf SigLongJmp_Env;
#endif
NDT_Symbol *Symbol_First_Ptr;
NDT_Index_Type OpenStruct_Index_Type[1];
NDT_Root *OpenStruct_Ptr;
@@ -88,17 +97,16 @@ NDT_Base NDG_Base =
NDD_FALSE,
NDD_TRUE,
"",
(FILE *)-1,
(FILE *) -1,
0,
(NDT_Symbol *)NULL,
{0},
(NDT_Symbol *) NULL,
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
(NDT_Root *)NULL
(NDT_Root *) NULL
};
//extern int sigrelse (int sig);
/*------------------------------------------------------------------------------*/

View File

@@ -1,5 +1,5 @@
Name: libnode
Version: 2.0.5
Version: 2.0.6
Release: 1
%define libnode_name %{name}-%{version}-%{release}
@@ -10,7 +10,7 @@ Copyright: GPL
Group: Application/Utilitaires
Distribution: Rx3 OpenSource
Vendor: Rx3
Packager: arnaud.gibert@rx3.net
Packager: Arnaud G. Gibert <arnaud@rx3.net>
Source: ftp://ftp.rx3.org/pub/%{source}
Url: http://www.rx3.org/dvp/libnode/download/
@@ -18,7 +18,7 @@ BuildRoot: %{_tmppath}/%{libnode_name}-buildroot
AutoReqProv: no
%description
Manages generic list and/or tree node structures
Manages generic list and/or tree node structures.
@@ -49,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Aug 24 2004 Arnaud G. Gibert <arnaud@rx3.net> 2.0.6-1
- Update to 2.0.6 release.
* Tue Jul 15 2003 Arnaud G. Gibert <arnaud@rx3.net> - 2.0.5-1
- Add release in libnode dir name support.

View File

@@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: ndbench.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.7 $ */
/* $Revision: 2.8 $ */
/* $Name: $ */
/* $Date: 2004/08/01 23:38:52 $ */
/* $Date: 2004/08/24 20:31:28 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@@ -59,7 +59,7 @@
/*---------------------------------------------------------------------------------*/
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT( ndbench, "$Revision: 2.7 $", "$Name: $", __FILE__, "$Author: agibert $");
VER_INFO_EXPORT( ndbench, "$Revision: 2.8 $", "$Name: $", __FILE__, "$Author: agibert $");
# define USAGE "Usage : %s [ --help | --version [-v] | --batch_run <batch_file_name>]\n"
#else
# define USAGE "Usage : %s [ --help | --batch_run <batch_file_name>]\n"
@@ -94,9 +94,11 @@ VER_INFO_EXPORT( ndbench, "$Revision: 2.7 $", "$Name: $", __FILE__, "$Author: a
#define INDEX_REORG 22
#define INDEX_INFO_PRINT 23
#define INDEX_VALUE_PRINT 24
#define BATCH_RUN 25
#define INDEX_VALUE_BREAK 25
#define INDEX_NODE_BREAK 26
#define BATCH_RUN 27
#define COMMAND_NB 26
#define COMMAND_NB 28
#define INDEX_NB 32
@@ -149,8 +151,9 @@ typedef struct
struct _timeb stop;
} cpt;
# define t_start(x) { _ftime( &(x.start));}
# define t_stop(x) { _ftime( &(x.stop)); x.sec = (double)(x.stop.time) - (double)(x.start.time) + ((double)(x.stop.millitm) - (double)(x.start.millitm)) / 1000;}
# define t_start(x) { _ftime( &(x.start));}
# define t_stop(x) { _ftime( &(x.stop)); x.sec = (double)(x.stop.time) - (double)(x.start.time) + ((double)(x.stop.millitm) - (double)(x.start.millitm)) / 1000;}
# define seed_get(x) (int)( (x).start.time)
#else
@@ -161,8 +164,9 @@ typedef struct
struct timeval stop;
} cpt;
# define t_start(x) { gettimeofday( &(x.start), NULL);}
# define t_stop(x) { gettimeofday( &(x.stop), NULL); x.sec = (double)(x.stop.tv_sec) - (double)(x.start.tv_sec) + ((double)(x.stop.tv_usec) - (double)(x.start.tv_usec)) / 1000000;}
# define t_start(x) { gettimeofday( &((x).start), NULL);}
# define t_stop(x) { gettimeofday( &((x).stop), NULL); (x).sec = (double)((x).stop.tv_sec) - (double)((x).start.tv_sec) + ((double)((x).stop.tv_usec) - (double)((x).start.tv_usec)) / 1000000;}
# define seed_get(x) (int)( (x).start.tv_sec)
#endif
@@ -241,6 +245,8 @@ Command Command_Tab[] =
{ INDEX_REORG, "Index_Reorg", "Reorg Index", ( DS_STATE_OPENED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)},
{ INDEX_INFO_PRINT, "Index_Info_Print", "Print Index Informations", ( DS_STATE_OPENED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)},
{ INDEX_VALUE_PRINT, "Index_Value_Print", "Print Index Values", ( DS_STATE_OPENED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)},
{ INDEX_VALUE_BREAK, "Index_Value_Break", "Break Index Value", ( DS_STATE_OPENED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)},
{ INDEX_NODE_BREAK, "Index_Node_Break", "Break Index Node", ( DS_STATE_OPENED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)},
{ BATCH_RUN, "Batch_Run", "Run NDBench Bach", ( DS_STATE_OPENED | DS_STATE_CLOSED), ( NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)}
};
@@ -265,7 +271,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.7 $ $Name: $ $Date: 2004/08/01 23:38:52 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.8 $ $Name: $ $Date: 2004/08/24 20:31:28 $ $Author: agibert $";
return( NDS_OK);
}
@@ -703,9 +709,9 @@ void Command_Index_Range_Get( FILE *File_Output, int *Low, int *High, char
void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, char *Arg1, char *Arg2, FILE *File_Input)
{
int low, high, i, j, nb_removed, Nb_Detected, Nb_Corrected;
T_Module Ref_Module, *Module_Ptr;
char buf[BUF_SIZE];
int low, high, i, j, nb_removed, Nb_Detected, Nb_Corrected;
T_Module Ref_Module, *Module_Ptr;
char buf[BUF_SIZE];
NDT_Index_Type index_subtype;
@@ -1001,7 +1007,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
while( i < j)
{
Ref_Module.Id = low +( rand( ) % ( high - low));
Ref_Module.Id = low + (int)( (double)( high - low) * rand() / ( RAND_MAX + 1.0));
ND_DataStruct_Value_Find( (void *)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module);
i++;
}
@@ -1090,6 +1096,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
case INDEX_LIST_SUBTYPE_SET:
{
int subtype;
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
if( low != -1)
@@ -1102,9 +1111,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
Arg2 = buf;
}
Choice = atoi( Arg2);
subtype = atoi( Arg2);
switch( Choice)
switch( subtype)
{
case 0:
{
@@ -1127,7 +1136,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
default:
{
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
printf ("Index_List_SubType_Set: Invalid selection (%d) !\n", Choice);
printf ("Index_List_SubType_Set: Invalid selection (%d) !\n", subtype);
break;
}
}
@@ -1161,6 +1170,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
case INDEX_TREE_SUBTYPE_SET:
{
int subtype;
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
if( low != -1)
@@ -1173,9 +1185,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
Arg2 = buf;
}
Choice = atoi( Arg2);
subtype = atoi( Arg2);
switch( Choice)
switch( subtype)
{
case 0:
{
@@ -1192,7 +1204,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
default:
{
index_subtype = NDD_INDEX_SUBTYPE_UNKNOWN;
printf ("Index_Tree_SubType_Set: Invalid selection (%d)!\n", Choice);
printf ("Index_Tree_SubType_Set: Invalid selection (%d)!\n", subtype);
break;
}
}
@@ -1301,7 +1313,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
fprintf( File_Output, "DS_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);
for( i = low; i <= high; i++)
@@ -1322,6 +1334,88 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
break;
}
case INDEX_VALUE_BREAK:
{
int position;
NDT_Node *node_ptr;
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
if( low != -1)
{
if( Arg2 == NULL)
{
fprintf( File_Output, "Index_Value_Break: Value position (0:Head | 1:Tail | 2:Random) ? ");
fgets( buf, BUF_LEN, stdin);
Arg2 = buf;
}
position = atoi( Arg2);
fprintf( File_Output, "Index_Value_Break: Breaking %s values from index : (%d) to: (%d)...\n",
( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
low, high);
fflush( File_Output);
t_start( t_exec);
fprintf( File_Output, "Index_Value_Break: Breaking value of nodes: ");
fflush( File_Output);
for( i = low; i <= high; i++)
{
switch( position)
{
case 0:
{
node_ptr =(*DS_Ptr_Ptr)->Index_Tab[i].Head;
break;
}
case 1:
{
node_ptr=(*DS_Ptr_Ptr)->Index_Tab[i].Tail;
break;
}
case 2:
{
j = (int)( (double)( (*DS_Ptr_Ptr)->Index_Tab[i].Node_Number) * rand() / ( RAND_MAX + 1.0));
for( node_ptr = (*DS_Ptr_Ptr)->Index_Tab[i].Head; j > 0; j--)
{
node_ptr = node_ptr->Right;
}
break;
}
}
fprintf( File_Output, "0x(%x)", node_ptr);
fflush( File_Output);
node_ptr->Value = (void *)-1;
}
t_stop (t_exec);
fprintf( File_Output, "\n");
fflush( File_Output);
Command_Exec_End_Print( File_Output, Choice, t_exec, high - low);
}
break;
}
case INDEX_NODE_BREAK:
{
break;
}
case INDEX_CHECK:
{
Command_Index_Range_Get( File_Output, &low, &high, Arg1, File_Input, Choice, "Index");
@@ -1431,11 +1525,19 @@ void Batch_Run( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, FILE *File_Input,
/* */
/*---------------------------------------------------------------------------------*/
int main( int argc, char ** argv)
int main( int argc, char **argv)
{
NDT_Root *ds_ptr = NULL;
/* Init Random numbers... */
t_start( t_exec);
t_stop( t_exec);
srand( seed_get(t_exec));
/* Args Parsing */
if( argc >= 2)

View File

@@ -8,4 +8,8 @@ Lib_Open 1
DS_Open
Index_List_Open 0-0
DS_Value_Add 1-10 0
Index_Value_Break 0-0 0
Index_Value_Break 0-0 1
Index_Value_Break 0-0 2
DS_Check
Lib_Close