Compare commits
10 Commits
libnode-2_
...
libnode-2_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d91078a5c | ||
|
|
51482fb475 | ||
|
|
75cfc21e01 | ||
|
|
5aea056299 | ||
|
|
3f6d118ae2 | ||
|
|
7c96ad706b | ||
|
|
c70c4e5aba | ||
|
|
7f142acda3 | ||
|
|
64baaa1bc5 | ||
|
|
77330558f0 |
105
ReleaseNotes.txt
105
ReleaseNotes.txt
@@ -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).
|
||||
|
||||
@@ -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 $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
#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
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
@@ -607,16 +608,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: ");
|
||||
|
||||
if( ( status = ND_DataStruct_Convert( demo_ds_ptr, index_type_final_tab)) != NDS_OK)
|
||||
@@ -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)
|
||||
|
||||
@@ -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 $ */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
#include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
#include <signal.h>
|
||||
# include <stdarg.h>
|
||||
|
||||
# ifdef _LIBVER_SUPPORT
|
||||
@@ -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;
|
||||
|
||||
|
||||
137
lib/libnode.c
137
lib/libnode.c
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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)
|
||||
{
|
||||
#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 */
|
||||
|
||||
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();
|
||||
|
||||
return( NDS_KO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Target address access try */
|
||||
|
||||
if( setjmp( NDG_Base.SigLongJmp_Env) == 0 )
|
||||
{
|
||||
test = *( (int *)Address);
|
||||
|
||||
// sigrelse( SIGBUS); Win32
|
||||
// sigrelse( SIGSEGV); Win32
|
||||
status = NDS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = NDS_KO;
|
||||
}
|
||||
|
||||
if( NDG_Base.Sig_Trapped != 0) return( NDS_KO);
|
||||
|
||||
return( NDS_OK);
|
||||
|
||||
/* 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
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 <errno.h>
|
||||
# include <signal.h>
|
||||
# include <setjmp.h>
|
||||
|
||||
//#include <dlfcn.h>
|
||||
|
||||
#include <node.h>
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -90,6 +99,7 @@ NDT_Base NDG_Base =
|
||||
"",
|
||||
(FILE *) -1,
|
||||
0,
|
||||
{0},
|
||||
(NDT_Symbol *) NULL,
|
||||
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
||||
(NDT_Root *) NULL
|
||||
@@ -97,8 +107,6 @@ NDT_Base NDG_Base =
|
||||
|
||||
|
||||
|
||||
//extern int sigrelse (int sig);
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
134
util/ndbench.c
134
util/ndbench.c
@@ -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
|
||||
|
||||
@@ -151,6 +153,7 @@ typedef struct
|
||||
|
||||
# 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);
|
||||
}
|
||||
@@ -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");
|
||||
@@ -1436,6 +1530,14 @@ 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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user