19 Commits

Author SHA1 Message Date
agibert
023d30188c Add libnode-2.0.1-1 entry. 2001-11-28 13:57:51 +00:00
agibert
4f1b7a7ff7 Fix TIMAS_KO status in ND_ERROR() macro: TIMAS_KO is now an error. 2001-11-28 13:43:50 +00:00
agibert
f9a6fc60ff Update revision number to 2.0 ! 2001-11-26 14:23:50 +00:00
agibert
02cc0aec6d Add the release number (1) to the version tag (2.0.0). 2001-11-26 13:32:56 +00:00
agibert
eb9c0748fa Add initial entries. 2001-11-26 11:25:11 +00:00
agibert
4beb939977 Add os support and blah blah... 2001-11-26 11:15:25 +00:00
agibert
86935f0fea Update revision number to 2.0 ! 2001-11-26 11:07:08 +00:00
agibert
75eb3fdfb7 Add libnode-2.0.0 entry. 2001-11-26 11:06:03 +00:00
agibert
e1b5b3e9f2 Update revision number to 2.0 ! 2001-11-26 10:53:14 +00:00
agibert
0ba642fd2a Merge win32 branche (1.1.2.30) with main trunc ! 2001-11-26 10:17:44 +00:00
agibert
e6506338d5 Merge win32 branche (1.1.2.2) with main trunc ! 2001-11-26 10:17:44 +00:00
agibert
033656896c Merge win32 branche (1.1.2.19) with main trunc ! 2001-11-26 10:17:44 +00:00
agibert
97703fce97 Merge win32 branche (1.1.2.15) with main trunc ! 2001-11-26 10:17:44 +00:00
agibert
14f8c8c0a1 Merge win32 branche (1.1.2.5) with main trunc ! 2001-11-26 10:17:43 +00:00
agibert
89295b4091 Merge win32 branche (1.1.2.37) with main trunc ! 2001-11-26 10:17:43 +00:00
agibert
802571acdf Merge win32 branche (1.1.2.3) with main trunc ! 2001-11-26 10:17:43 +00:00
agibert
38edf33711 Merge win32 branche (1.1.2.17) with main trunc ! 2001-11-26 10:17:43 +00:00
agibert
4beb39c2dc Merge win32 branche (1.1.2.1) with main trunc ! 2001-11-26 10:17:43 +00:00
agibert
92131843d6 Reverse the history order... 2001-09-19 14:45:29 +00:00
22 changed files with 6839 additions and 2098 deletions

View File

@@ -1,11 +1,28 @@
# $RCSfile: ReadMe.txt,v $
# $Revision: 1.1 $
# $Revision: 2.1 $
# $Name: $
# $Date: 2001/09/19 10:24:34 $
# $Date: 2001/11/26 11:15:25 $
# $Author: agibert $
To be filled !
Welcome to LibNode 2.0.x !
This release of LibNode support the following OS:
- Linux 2.2.X and 2.4.x (tested on RedHat & Mandrake),
- Solaris 2.6,
- Windows NT4 & 2000.
The support of LibVer is now optional.
LibShm and LibDataStr are no more supported.
Warning: Associated documentation are outdated...
Please read demo and ndbench code.
Enjoy it!
Your LibNode Team.

View File

@@ -1,32 +1,88 @@
# $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.2 $
# $Revision: 2.3 $
# $Name: $
# $Date: 2001/09/19 10:53:30 $
# $Date: 2001/11/28 13:57:51 $
# $Author: agibert $
--------------------------------------------------------------------------------
LibNode V 0.1.0 - A. Gibert - 1/12/90
LibNode V 2.0.1-1 - A. Gibert - 28/11/01
--------------------------------------------------------------------------------
Inital version in Pascal on Pyramid (Swansee University - Wales).
LibNode: Fix the error level of TIMAS_KO: it's now an error status.
--------------------------------------------------------------------------------
LibNode V 0.2.0 - A. Gibert - 1/3/91
LibNode V 2.0.0-1 - A. Gibert - 26/11/01
--------------------------------------------------------------------------------
C version aided by p2c tools on Pyramid (Swansee University - Wales).
All: Merge the main CVS trunc with the win32 branche (2.0.0-alpha5),
Switch file release to 2.0.
--------------------------------------------------------------------------------
LibNode V 0.2.1 - A. Gibert - 1/4/92
LibNode V 2.0.0-alpha5 - A. Gibert - 25/10/01
--------------------------------------------------------------------------------
Amiga and PC support (Bareau de Draguignan - Ste Maxime).
LibNode: Add Open/Close Index support,
LibNode: Fix return code next to empty struct manipulations,
NdBench: Add full multi index support.
--------------------------------------------------------------------------------
LibNode V 2.0.0-alpha4 - A. Gibert - 28/9/01
--------------------------------------------------------------------------------
All: Add optional libver support,
LibNode: Fix missing recursive offset args,
LibNode: Start to fix some return code of empty struct manipulations,
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
--------------------------------------------------------------------------------
Re-enable libver support for unix,
Bug fixes,
Code cleanup.
--------------------------------------------------------------------------------
LibNode V 2.0.0-alpha1 - A. Gibert - 7/9/01
--------------------------------------------------------------------------------
Add Full win32 support,
Remove libver support,
Multi index support,
New manager args format,
Major Code cleanup et standardisation.
--------------------------------------------------------------------------------
LibNode V 1.0.0 - S. Mas / A. Gibert - 18/7/00
--------------------------------------------------------------------------------
Unix (Linux and Solaris) version only, for BDM project (Société Générale - Paris)
Major code rewrite.
@@ -39,8 +95,23 @@ Embeded version on OS/2 2.1 (Companie G
--------------------------------------------------------------------------------
LibNode V 1.0.0 - S. Mas / A. Gibert - 18/7/00
LibNode V 0.2.1 - A. Gibert - 1/4/92
--------------------------------------------------------------------------------
Unix (Linux and Solaris) version only, for BDM project (Société Générale - Paris)
Major code rewrite.
Amiga and PC support (Bareau de Draguignan - Ste Maxime).
--------------------------------------------------------------------------------
LibNode V 0.2.0 - A. Gibert - 1/3/91
--------------------------------------------------------------------------------
C version aided by p2c tools on Pyramid (Swansee University - Wales).
--------------------------------------------------------------------------------
LibNode V 0.1.0 - A. Gibert - 1/12/90
--------------------------------------------------------------------------------
Inital version in Pascal on Pyramid (Swansee University - Wales).

View File

@@ -1,11 +1,14 @@
# $RCSfile: ToDo.txt,v $
# $Revision: 1.1 $
# $Revision: 2.1 $
# $Name: $
# $Date: 2001/09/19 10:24:34 $
# $Date: 2001/11/26 11:25:11 $
# $Author: agibert $
- To be filled !
- More debug !
- New English documentation (man/tex),
- Improve API consitency,
- Re-enable LibShm/LibDataStr support (via TIMAT_DataStruct implementation).

8
demo/Makefile Normal file
View File

@@ -0,0 +1,8 @@
all: demo0
demo0: demo0.c ../../libver/ver.h ../lib/node.h ../../libver/libver.so ../lib/libnode.so Makefile
gcc -g -o demo0 -I ../../libver -I ../lib -ldl ../../libver/libver.so ../lib/libnode.so demo0.c
clean:
rm demo0

685
demo/nddemo0.c Normal file
View File

@@ -0,0 +1,685 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: nddemo0.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.0 $ */
/* $Name: $ */
/* $Date: 2001/11/26 10:53:34 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
#include <stdio.h>
#include <errno.h>
#include <node.h>
//#include <windows.h>
#define DEMO_FILE_NAME "demo0.txt"
#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
typedef struct Demo_Value
{
char Val0[VAL_SIZE];
char Val1[VAL_SIZE];
char Val2[VAL_SIZE];
char Val3[VAL_SIZE];
} Demo_Value;
/*---------------------------------------------------------------------------------*/
/* Prototypes */
/*---------------------------------------------------------------------------------*/
NDT_Status Manager_Demo_DS( 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);
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_Command_Name Command_Name;
switch( Command)
{
case NDD_CMD_MANAGER_VERSION:
{
NDT_Version_Name *Version_Name_Ptr = (NDT_Version_Name *)va_arg( Args, NDT_Version_Name *);
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.0 $ $Name: $ $Date: 2001/11/26 10:53:34 $ $Author: agibert $";
return( NDS_OK);
}
case NDD_CMD_INDEX_GET:
{
/*
NDT_Index_Id *Reply_Index_Id_Ptr = (NDT_Index_Id *)va_arg( Args, NDT_Index_Id *);
NDT_Command *Reply_Command_Ptr = (NDT_Command *)va_arg( Args, NDT_Command *);
NDT_Command Cmd = (NDT_Command)va_arg( Args, NDT_Command);
void *Value_ptr = (void *)va_arg( Args, void *);
*/
NDT_Index_Id *Reply_Index_Id_Ptr = (NDT_Index_Id *)va_arg( Args, NDT_Index_Id *);
NDT_Command *Reply_Command_Ptr = (NDT_Command *)va_arg( Args, NDT_Command *);
NDT_Command Cmd = (NDT_Command)va_arg( Args, NDT_Command);
Demo_Value *Value_ptr = (Demo_Value *)va_arg( Args, Demo_Value *);
Command_Name = "NDD_CMD_INDEX_GET";
switch(Cmd)
{
case NDT_CMD_INDEX0_PRINT:
{
*Reply_Index_Id_Ptr = 0;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX1_PRINT:
{
*Reply_Index_Id_Ptr = 1;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX2_PRINT:
{
*Reply_Index_Id_Ptr = 2;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
case NDT_CMD_INDEX3_PRINT:
{
*Reply_Index_Id_Ptr = 3;
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
break;
}
default:
{
*Reply_Index_Id_Ptr = Index_Id;
*Reply_Command_Ptr = Cmd;
break;
}
}
return( NDS_OK);
}
case NDD_CMD_VALUE_ALLOC:
{
/*
void **Value_Ptr_Ptr = (void **)va_arg( Args, void **);
va_list user_args = (va_list)va_arg( Args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
*/
Demo_Value **Value_Ptr_Ptr = va_arg( Args, Demo_Value **);
Command_Name = "NDD_CMD_VALUE_ALLOC";
if( ( *Value_Ptr_Ptr = (Demo_Value *)malloc( sizeof(Demo_Value))) == NULL)
{
return(NDS_ERRMEM);
}
else
{
(*Value_Ptr_Ptr)->Val0[0] = '\0';
(*Value_Ptr_Ptr)->Val1[0] = '\0';
(*Value_Ptr_Ptr)->Val2[0] = '\0';
(*Value_Ptr_Ptr)->Val3[0] = '\0';
return( NDS_OK);
}
}
case NDD_CMD_VALUE_FREE:
{
/*
void *Value_Ptr = (void *)va_arg( Args, void *);
va_list user_args = (va_list)va_arg( Args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
*/
Demo_Value *Value_Ptr = (Demo_Value *)va_arg( Args, Demo_Value *);
Command_Name = "NDD_CMD_VALUE_FREE";
free( Value_Ptr);
return( NDS_OK);
}
case NDD_CMD_VALUE_COMP:
{
/*
void *Value1_Ptr = (void *)va_arg( Args, void *);
void *Value2_Ptr = (void *)va_arg( Args, void *);
va_list user_args = (va_list)va_arg( Args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
*/
Demo_Value *Value1_Ptr = va_arg( Args, Demo_Value *);
Demo_Value *Value2_Ptr = va_arg( Args, Demo_Value *);
Command_Name = "NDD_CMD_VALUE_COMP";
switch( Index_Id)
{
case 0:
{
int rc;
rc = strcmp( Value1_Ptr->Val0, Value2_Ptr->Val0);
if( rc < 0)
{
return(NDS_LOWER);
}
else
{
if( rc > 0)
{
return(NDS_GREATER);
}
else
{
return(NDS_EQUAL);
}
}
}
case 1:
{
int val1 = atoi(Value1_Ptr->Val1);
int val2 = atoi(Value2_Ptr->Val1);
if( val1 < val2)
{
return(NDS_LOWER);
}
else
{
if( val1 > val2)
{
return(NDS_GREATER);
}
else
{
return(NDS_EQUAL);
}
}
}
case 2:
{
int val1 = strlen(Value1_Ptr->Val2);
int val2 = strlen(Value2_Ptr->Val2);
if( val1 < val2)
{
return(NDS_LOWER);
}
else
{
if( val1 > val2)
{
return(NDS_GREATER);
}
else
{
return(NDS_EQUAL);
}
}
}
default:
{
printf( "Unknown COMP idx (%d) !\n", Index_Id);
return( NDS_KO);
}
}
return( NDS_OK);
}
case NDD_CMD_VALUE_ADD:
{
/*
void *Value_Ptr = (void *)va_arg( Args, void *);
va_list user_args = (va_list)va_arg( Args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
*/
Command_Name = "NDD_CMD_VALUE_ADD";
return( NDS_OK);
}
case NDD_CMD_VALUE_REMOVE:
{
/*
void *Value_Ptr = (void *)va_arg( Args, void *);
va_list user_args = (va_list)va_arg( Args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
*/
Command_Name = "NDD_CMD_VALUE_REMOVE";
return( NDS_OK);
}
case NDD_CMD_VALUE_PRINT:
{
/*
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
va_list lib_args = (va_list)va_arg( Args, va_list);
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
va_list user_args = (va_list)va_arg( lib_args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
void *Value_Ptr = Node_Ptr->Value;
*/
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
va_list lib_args = (va_list)va_arg( Args, va_list);
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
Demo_Value *Value_Ptr = Node_Ptr->Value;
Command_Name = "NDD_CMD_VALUE_PRINT";
fprintf( Out, "Val0: (%s) Val1: (%s) Val2: (%s) Val3: (%s)\n",
Value_Ptr->Val0, Value_Ptr->Val1, Value_Ptr->Val2, Value_Ptr->Val3);
return( NDS_OK);
}
case NDD_CMD_INFO_PRINT:
{
/*
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
va_list lib_args = (va_list)va_arg( Args, va_list);
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
va_list user_args = (va_list)va_arg( lib_args, va_list);
user_type user_data = (user_type)va_arg( user_args, user_type);
... = (...)va_arg( user_args, ...);
void *Value_Ptr = Node_Ptr->Value;
*/
Command_Name = "NDD_CMD_INFO_PRINT";
return( NDS_OK);
}
default:
{
printf( "Demo_DS_Manager() called with an undefined command %d\n", Command);
return NDS_ERRAPI;
}
}
printf( "Demo_DS_Manager() called with command %d (%s)\n", Command, Command_Name);
return NDS_OK;
}
/*---------------------------------------------------------------------------------*/
/* */
/*---------------------------------------------------------------------------------*/
void DataStruct_Load( NDT_Root *ds_ptr, FILE *demo_file)
{
NDT_Status status;
char *str;
char input_string[STRING_SIZE];
char val0[VAL_SIZE], val1[VAL_SIZE], val2[VAL_SIZE], val3[VAL_SIZE];
Demo_Value *value_ptr;
while( !feof( demo_file))
{
str = fgets( input_string, STRING_SIZE, demo_file);
if( ( (const int)str != EOF) && ( str != NULL))
{
if( strlen( input_string) >= STRING_LEN)
{
printf( "Input line too long ! Skipping ...");
while( !feof( demo_file) && strlen( input_string) >= STRING_LEN)
{
printf( ".");
str = fgets( input_string, STRING_SIZE, demo_file);
}
printf("\n");
}
else
{
if( input_string[0] != '#')
{
if( sscanf( input_string, "%s %s %s %s\n", val0, val1, val2, val3) != 4)
{
printf( "Input line scaning error... Skipping !\n");
}
else
{
printf( "Input line read: \t(%s)\t(%s)\t(%s)\t(%s)\n", val0, val1, val2, val3);
printf( "Allocate Vallue: ");
if( ( status = ND_Value_Alloc( ds_ptr, (void **)&value_ptr)) != NDS_OK)
{
printf( "ND_Value_Alloc() failed (%d) !\n", status);
}
else
{
printf( "Ok !\n");
strcpy( value_ptr->Val0, val0);
strcpy( value_ptr->Val1, val1);
strcpy( value_ptr->Val2, val2);
strcpy( value_ptr->Val3, val3);
printf( "Add Vallue: ");
if( ( status = ND_DataStruct_Value_Add( ds_ptr, (void **)value_ptr)) != NDS_OK)
{
printf( "ND_Value_Add() failed (%d) !\n", status);
}
else
{
printf( "Ok !\n");
}
}
}
}
}
}
}
}
/*---------------------------------------------------------------------------------*/
/* */
/*---------------------------------------------------------------------------------*/
void DataStruct_Dump( NDT_Root *ds_ptr)
{
NDT_Status status;
printf( "Print DataStructure Info:\n");
if( ( status = ND_DataStruct_Info_Print( stdout, ds_ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 0, 0)) != NDS_OK)
{
printf( "ND_DataStruct_Info_Print() failed (%d) !\n", status);
}
printf( "\n");
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)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
printf( "\n");
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)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
printf( "\n");
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)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
printf( "\n");
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)
{
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
}
printf( "\n");
}
/*---------------------------------------------------------------------------------*/
/* */
/*---------------------------------------------------------------------------------*/
void Demo( char *Demo_File_Name, short Optimized_Mode)
{
NDT_Status status;
NDT_Root *demo_ds_ptr;
NDT_Index_Type index_type_initial_tab[INDEX_NB] =
{
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO)
};
NDT_Index_Type index_type_final_tab[INDEX_NB] =
{
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO)
};
NDT_Index_Type *index_type_ptr;
FILE *demo_file;
printf( "Create demo DataStructure: ");
if( Optimized_Mode)
{
index_type_ptr = index_type_initial_tab;
}
else
{
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)
{
printf( "ND_DataStruct_Open() failed (%d) !\n", status);
}
else
{
printf( "Ok !\n");
printf( "Open demo datafile: ");
if( ( demo_file = fopen( Demo_File_Name, "r")) == NULL)
{
printf( "fopen() failed (%d/%s) !\n", errno, strerror(errno));
}
else
{
printf( "Ok !\n");
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)
{
printf( "ND_DataStruct_Convert() failed (%d) !\n", status);
}
else
{
printf( "Ok !\n");
}
}
printf( "\n\n\nFinal Structure Dump:\n\n");
DataStruct_Dump( demo_ds_ptr);
printf( "Close demo datafile: ");
if( fclose( demo_file) != 0)
{
printf( "fclose() failed (%d/%s) !\n", errno, strerror(errno));
}
else
{
printf( "Ok !\n");
}
}
printf( "Close demo DataStructure: ");
if( ( status = ND_DataStruct_Close( demo_ds_ptr)) != NDS_OK)
{
printf( "ND_DataStruct_Close() failed (%d) !\n", status);
}
else
{
printf( "Ok !\n");
}
}
}
/*---------------------------------------------------------------------------------*/
/* */
/*---------------------------------------------------------------------------------*/
int main( int argc, char **argv)
{
printf( "Non Optimized Demo\n------------------\n\n\n");
Demo( DEMO_FILE_NAME, 0);
printf( "\n\n\n\n\nOptimized Demo\n--------------\n\n\n");
Demo( DEMO_FILE_NAME, 1);
{
/*
HMODULE my_module;
char buf[256];
FARPROC my_function;
my_module = GetModuleHandle( NULL);
printf( "Module_Handle: (%p)\n", my_module);
buf[0] = '\0';
GetModuleFileName( my_module, buf, 255);
printf( "Module_Name: (%s)\n", buf);
my_function = GetProcAddress( my_module, "zob");
printf( "Function_Addr: (%p)\n", my_function);
my_function();
*/
}
}
/*
__declspec(dllexport) void zob(void)
{
printf( "Zoby la mouche qui pête...!!!\n");
}
*/

15
demo/nddemo0.dat Normal file
View File

@@ -0,0 +1,15 @@
#---------------------------------------------------------------------------------
# $RCSfile: nddemo0.dat,v $
#---------------------------------------------------------------------------------
# $Revision: 2.0 $
# $Name: $
# $Date: 2001/11/26 10:53:34 $
# $Author: agibert $
#---------------------------------------------------------------------------------
ggg 1 xxxxxx example
aaa 7 x this
bbb 6 xxx is
ccc 5 xxxxx a
ddd 4 xxxx really
eee 3 xxxxxxx good
fff 2 xx libnode

101
demo/nddemo0.dsp Normal file
View File

@@ -0,0 +1,101 @@
# Microsoft Developer Studio Project File - Name="demo0" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=demo0 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "demo0.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "demo0.mak" CFG="demo0 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "demo0 - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "demo0 - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "demo0 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "demo0 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnode.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "demo0 - Win32 Release"
# Name "demo0 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\demo0.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

29
demo/nddemo0.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "demo0"=.\demo0\demo0.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

File diff suppressed because it is too large Load Diff

11
lib/Makefile Normal file
View File

@@ -0,0 +1,11 @@
all: libnode.so
libnode.o: libnode.c node.h libnode.h ../../libver/ver.h Makefile
gcc -c -g -o libnode.o -I . -I ../../libver libnode.c
libnode.so: libnode.o
ld -shared -o libnode.so libnode.o
clean:
rm libnode.o libnode.so

File diff suppressed because it is too large Load Diff

104
lib/libnode.dsp Normal file
View File

@@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="libnode" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libnode - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libnode.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libnode.mak" CFG="libnode - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libnode - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libnode - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libnode - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libnode - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "libnode - Win32 Release"
# Name "libnode - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\libnode.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\libnode.h
# End Source File
# Begin Source File
SOURCE=.\node.h
# End Source File
# End Group
# End Target
# End Project

29
lib/libnode.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libnode"=.\libnode.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,19 +1,42 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.h,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.0 $ */
/* $Name: $ */
/* $Date: 2001/11/26 10:54:13 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <dlfcn.h>
//#include <dlfcn.h>
#include <node.h>
#define HUGE_LONG 0xFFFFFFL
#ifndef min
#define min(A,B) ((A > B) ? B : A)
#ifdef __linux
# define NDD_PRINTF_PTR_PREFIX ""
#else
# define NDD_PRINTF_PTR_PREFIX "0x"
#endif
#ifndef max
#define max(A,B) ((A < B) ? B : A)
#endif
#define NDD_HUGE_LONG (long)0xFFFFFFL
/* Sortie standard des messages d'erreur */
@@ -45,17 +68,17 @@ int Sig_Trapped;
/*------------------------------------------------------------------------------*/
/* (I) va_list Arguments : Liste d'arguments contextuels */
/*------------------------------------------------------------------------------*/
NDT_Status Default_Manager (va_list Arguments);
NDT_Status Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Malloc (size_t Size, void ** ptr, void * User);
NDT_Status ND_Default_Allocator( size_t Size, void **ptr, void *User);
/*------------------------------------------------------------------------------*/
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Free (void * ptr);
NDT_Status ND_Default_Desallocator( void *, void *);
/*------------------------------------------------------------------------------*/
/* Création d'un noeud */
@@ -82,16 +105,14 @@ NDT_Status ND_Node_Free (NDT_Root * Root, NDT_Node * Node);
/* (I) Desallocater : pointeur vers la fonction de désallocation */
/* (I) Data : pointeur de données utiles à l'allocateur */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Root_Alloc (NDT_Root ** Root, NDT_DataStruct_Type Type, \
const char * Allocator, const char * Desallocator, \
void * Data);
NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], char *, NDT_Manager *, char *, NDT_Allocator *, char *, NDT_Desallocator *, short, void *);
/*------------------------------------------------------------------------------*/
/* Destruction d'une racine */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine à détruire */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Root_Free (NDT_Root * Root);
NDT_Status ND_Node_Root_Free (NDT_Root * Root);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à une liste chaînée */
@@ -99,7 +120,7 @@ NDT_Status ND_Root_Free (NDT_Root * Root);
/* (I) Root : pointeur sur la racine de la liste */
/* (I) New_Node : pointeur sur le noeud à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Node_Add (NDT_Root * Root, NDT_Node * New_Node);
NDT_Status ND_List_Node_Add (NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajout d'une nouvelle valeur à une liste */
@@ -107,7 +128,7 @@ NDT_Status ND_List_Node_Add (NDT_Root * Root, NDT_Node * New_Node);
/* (I) Root : pointeur sur la racine de la liste */
/* (I) Value : pointeur sur la valeur à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Value_Add (NDT_Root * Root, void * Value);
NDT_Status ND_List_Value_Add (NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Ajout d'un noeud à un arbre binaire */
@@ -115,31 +136,31 @@ NDT_Status ND_List_Value_Add (NDT_Root * Root, void * Value);
/* (I) Root : pointeur sur la racine de l'arbre */
/* (I) Value : pointeur sur la valeur à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Value_Add (NDT_Root * Root, void * Value);
NDT_Status ND_Tree_Value_Add (NDT_Root *, NDT_Index_Id, void *);
/*------------------------------------------------------------------------------*/
/* Supprime le noeud d'une liste */
/*------------------------------------------------------------------------------*/
/* (I) Node : pointeur sur le noeud à supprimer */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Node_Remove (NDT_Node * Node);
NDT_Status ND_List_Node_Remove (NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Conversion d'une structure en liste chaînée */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine du la structure à convertir */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Make (NDT_Root * Root);
NDT_Status ND_List_Make (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Recherche une valeur dans une liste et retourne le noeud correspondant */
/*------------------------------------------------------------------------------*/
NDT_Node * ND_List_Node_Find (NDT_Root * Root, void * Value, void * Data);
NDT_Node * ND_List_Node_Find (NDT_Root *, NDT_Index_Id, void *, va_list);
/*------------------------------------------------------------------------------*/
/* Recherche un noeud dans un arbre et retourne le pointeur sur le noeud */
/*------------------------------------------------------------------------------*/
NDT_Node * ND_Tree_Node_Find (NDT_Root * Root, void * Value, void * Data);
NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
/*------------------------------------------------------------------------------*/
/* Conversion d'une structure en arbre binaire */
@@ -147,14 +168,14 @@ NDT_Node * ND_Tree_Node_Find (NDT_Root * Root, void * Value, void * Data);
/* (I) Root : pointeur sur la racine du la structure à convertir */
/* (I) Type : type du futur arbre */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Make (NDT_Root * Root);
NDT_Status ND_Tree_Make (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Equilibrage d'un arbre */
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de l'arbre */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Equalize (NDT_Root * Root);
NDT_Status ND_Tree_Equalize (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Retourne la profondeur de la plus grande branche à partir d'un noeud */
@@ -176,7 +197,7 @@ long ND_Tree_MinDepth_Get (NDT_Node * Node);
/* (I) Root : pointeur sur la racine de l'arbre */
/* (I) Node : pointeur sur le noeud à ajouter */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_Node_Add (NDT_Root * Root, NDT_Node * Node);
NDT_Status ND_Tree_Node_Add (NDT_Root *, NDT_Index_Id, NDT_Node *);
/*------------------------------------------------------------------------------*/
/* Ajoute tous les noeud d'une liste à un arbre */
@@ -184,7 +205,7 @@ NDT_Status ND_Tree_Node_Add (NDT_Root * Root, NDT_Node * Node);
/* (I) Tree_Root : pointeur sur la racine de l'arbre */
/* (I) List_Root : pointeur sur la racine de la liste */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Tree_List_Add (NDT_Root * Tree_Root, NDT_Root * List_Root);
NDT_Status ND_Tree_List_Add (NDT_Root *, NDT_Index_Id, NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/* Fonction de comparaison de noeuds (pour le quick sort) */
@@ -196,7 +217,7 @@ int ND_Node_Compare (void ** Node1, void ** Node2);
/*------------------------------------------------------------------------------*/
/* (I) Root : pointeur sur la racine de la liste à trier */
/*------------------------------------------------------------------------------*/
NDT_Status ND_List_Sort (NDT_Root * Root);
NDT_Status ND_List_Sort (NDT_Root *, NDT_Index_Id);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
@@ -204,27 +225,27 @@ NDT_Status ND_List_Sort (NDT_Root * Root);
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
void ND_List_Check (NDT_Root *, int *, int *, FILE *);
void ND_List_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_List_Link_Check (NDT_Root *, int *, int *, FILE *);
void ND_List_Link_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Value_Check (NDT_Root *, int *, int *, FILE *);
void ND_Value_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Check (NDT_Root *, int *, int *, FILE *);
void ND_Tree_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
void ND_Tree_Link_Check (NDT_Root *, int *, int *, FILE *);
void ND_Tree_Link_Check (NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
NDT_Status ND_List_Recursive_Make (NDT_Node *, NDT_Root *);
NDT_Status ND_List_Recursive_Make (NDT_Node *, NDT_Root *, NDT_Index_Id);
NDT_Node * ND_Tree_Recursive_Make (long, long, NDT_Node *);
void ND_Tree_Node_Recursive_Add (NDT_Root *, NDT_Node *, NDT_Node **, long , NDT_Node *);
void ND_Tree_Node_Recursive_Add( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Node **, long , NDT_Node *);
NDT_Node * ND_Tree_Node_First_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Last_Recursive_Get (NDT_Node * Node);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, void * Data);
NDT_Node * ND_Tree_Node_Recursive_Find (NDT_Node * Node, void * Value, va_list);
NDT_Node * ND_Tree_Parent_Next_Recursive_Get (NDT_Node * Node);

8
util/Makefile Normal file
View File

@@ -0,0 +1,8 @@
all: ndbench
ndbench: ndbench.c ../../libver/ver.h ../lib/node.h ../../libver/libver.so ../lib/libnode.so Makefile
gcc -g -o ndbench -I ../../libver -I ../lib -ldl ../../libver/libver.so ../lib/libnode.so ndbench.c
clean:
rm ndbench

File diff suppressed because it is too large Load Diff

102
util/ndbench.dsp Normal file
View File

@@ -0,0 +1,102 @@
# Microsoft Developer Studio Project File - Name="ndbench" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=ndbench - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ndbench.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ndbench.mak" CFG="ndbench - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ndbench - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ndbench - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ndbench - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "ndbench - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libnode.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "ndbench - Win32 Release"
# Name "ndbench - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ndbench.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

29
util/ndbench.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "ndbench"=.\ndbench.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

8
util/test-100K.ndb Normal file
View File

@@ -0,0 +1,8 @@
DS_Open
Index_List_Open 0-0
DS_Value_Add 1-100000 0
DS_Value_Find 49900-50100
Index_List_To_Tree 0-0
DS_Value_Find 1-100000
DS_Check
DS_Close

8
util/test-10K.ndb Normal file
View File

@@ -0,0 +1,8 @@
DS_Open
Index_List_Open 0-0
DS_Value_Add 1-10000 0
DS_Value_Find 4000-6000
Index_List_To_Tree 0-0
DS_Value_Find 1-10000
DS_Check
DS_Close

8
util/test-1M.ndb Normal file
View File

@@ -0,0 +1,8 @@
DS_Open
Index_List_Open 0-0
DS_Value_Add 1-1000000 0
DS_Value_Find 499990-500010
Index_List_To_Tree 0-0
DS_Value_Find 1-1000000
DS_Check
DS_Close

3
util/test-all.ndb Normal file
View File

@@ -0,0 +1,3 @@
Batch_Run test-10K.ndb
Batch_Run test-100K.ndb
Batch_Run test-1M.ndb