41 Commits

Author SHA1 Message Date
agibert
2910b792d3 Initial creation. 2002-02-27 17:32:52 +00:00
agibert
ddfea222ca Add into 2.0.2-1 entry:
libnode.rc resource file addition and use.
2002-02-27 17:25:12 +00:00
agibert
4c11aa6001 Add CVS tags. 2002-02-27 17:17:05 +00:00
agibert
2113d2fa5b Initial creation. 2002-02-27 17:00:03 +00:00
agibert
2103e4fa5e Add libnode.rc resource file. 2002-02-27 16:58:37 +00:00
agibert
325bf712f4 Add into 2.0.2-1 entry:
VisualStudio Project now generate Windows DLL.
2002-02-27 16:29:12 +00:00
agibert
417673d1cd Replace stderr by File_Out in ND_DataStruct_Check() and ND_Index_Check() functions,
Replace out dated _LIBVER by _LIBVER_SUPPORT.
2002-02-27 16:14:22 +00:00
agibert
b649d3b5ea Rework ND_DataStruct_Check_I() and ND_Index_Check_I() functions. 2002-02-27 16:08:07 +00:00
agibert
2a80300887 Comment out strdup () and sigrelse() unused functions. 2002-02-27 16:05:15 +00:00
agibert
94ae4f3448 Add Windows DLL support:
Add NDD_DLL_API and LIBNODE_STATIC defines.
2002-02-27 16:04:10 +00:00
agibert
17fad87ce2 Add dynamic librarie creation,
Switch to Multi-Thread DLL debug mode.
2002-02-27 16:02:15 +00:00
agibert
1de5944904 Switch to Multi-Thread DLL debug mode. 2002-02-27 15:57:53 +00:00
agibert
508aba8bde Add in 2.0.2-1 entry:
Add no libver support in Makefiles.
2002-02-26 19:30:13 +00:00
agibert
3002869e96 Fix no libver handling. 2002-02-26 16:51:47 +00:00
agibert
1f50073641 Fix Index loop counting bugs in ND_DataStruct_Flush_I() and ND_Node_Root_Alloc()... 2002-02-26 16:38:19 +00:00
agibert
e56381b50e Minor spell s sta 2002-02-25 23:40:42 +00:00
agibert
85b6b70aa2 Now generates static and dynamic executables. 2002-02-25 23:38:22 +00:00
agibert
719416547a Now generates static and dynamic executablesje 2002-02-25 23:37:49 +00:00
agibert
5ed694ea38 Now generates static and dynamic libraries. 2002-02-25 23:37:21 +00:00
agibert
2e4fefc2b1 Implement Index_Close and Index_Info_Print functions. 2002-02-25 23:35:51 +00:00
agibert
86b1498a2e Rename Index_Open_Nb intoIndex_Open_Count,
Fix bug in ND_Node_Root_Alloc() on Index_Open_Count handling.
2002-02-25 23:34:36 +00:00
agibert
724109a537 Add 2.0.2-1 entry:
Fix Index_Open_Count bug in LibNodeles generate static and dynamic objects,,
   Makefiles generate static and dynamic objects,
   NbBench implement Inde
2002-02-25 23:32:41 +00:00
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
24 changed files with 7094 additions and 2105 deletions

View File

@@ -1,11 +1,28 @@
# $RCSfile: ReadMe.txt,v $
# $Revision: 1.1 $
# $Revision: 2.2 $
# $Name: $
# $Date: 2001/09/19 10:24:34 $
# $Date: 2002/02/25 23:40:42 $
# $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 is outdated...
Please read demo and ndbench code.
Enjoy it!
Your LibNode Team.

View File

@@ -1,32 +1,102 @@
# $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.2 $
# $Revision: 2.7 $
# $Name: $
# $Date: 2001/09/19 10:53:30 $
# $Date: 2002/02/27 17:25:12 $
# $Author: agibert $
--------------------------------------------------------------------------------
LibNode V 0.1.0 - A. Gibert - 1/12/90
LibNode V 2.0.2-1 - A. Gibert - 27/02/02
--------------------------------------------------------------------------------
Inital version in Pascal on Pyramid (Swansee University - Wales).
All: Makefiles now generate static and dynamic objects,
All: Add no libver support in Makefiles,
LibNode: VisualStudio Project now generate Windows DLL and use libnode.rc resource file,
LibNode: Rename Index_Open_Nb into Index_Open_Count,
LibNode: Fix bugs in ND_Node_Root_Alloc() on Index_Open_Count handling,
LibNode: Minor fix into ND_DataStruct_Check_I() and ND_Index_Check_I() functions.
NbBench: Implement Index_Close and Index_Info_Print functions.
--------------------------------------------------------------------------------
LibNode V 0.2.0 - A. Gibert - 1/3/91
LibNode V 2.0.1-1 - A. Gibert - 28/11/01
--------------------------------------------------------------------------------
C version aided by p2c tools on Pyramid (Swansee University - Wales).
LibNode: Fix the error level of TIMAS_KO: it's now an error status.
--------------------------------------------------------------------------------
LibNode V 0.2.1 - A. Gibert - 1/4/92
LibNode V 2.0.0-1 - A. Gibert - 26/11/01
--------------------------------------------------------------------------------
Amiga and PC support (Bareau de Draguignan - Ste Maxime).
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,
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 +109,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).

10
demo/Makefile Normal file
View File

@@ -0,0 +1,10 @@
all: demo0 demo0-static
demo0-static: demo0.c ../lib/node.h ../lib/libnode.a Makefile
gcc -g -o demo0-static -I ../lib -ldl demo0.c ../lib/libnode.a
demo0: demo0.c ../lib/node.h ../lib/libnode.so Makefile
gcc -g -o demo0 -I ../lib -L ../lib -ldl -lnode demo0.c
clean:
rm -f demo0 demo0-static

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

110
demo/nddemo0.dsp Normal file
View File

@@ -0,0 +1,110 @@
# 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
!IF "$(CFG)" == "demo0 - Win32 Release"
!ELSEIF "$(CFG)" == "demo0 - Win32 Debug"
# ADD CPP /MDd
!ENDIF
# 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

18
lib/Makefile Normal file
View File

@@ -0,0 +1,18 @@
ifdef _LIBVER_SUPPORT
INCLUDE_VER = ../../libver/ver.h
LIB_VER = -I ../../libver
endif
all: libnode.a libnode.so
libnode.o: libnode.c node.h libnode.h $(INCLUDE_VER) Makefile
gcc -c -g -o libnode.o -I . $(LIB_VER) libnode.c
libnode.a: libnode.o
ar -r libnode.a libnode.o
libnode.so: libnode.o
ld -shared -o libnode.so libnode.o
clean:
rm -f libnode.o libnode.a libnode.so

File diff suppressed because it is too large Load Diff

136
lib/libnode.dsp Normal file
View File

@@ -0,0 +1,136 @@
# 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) Dynamic-Link Library" 0x0102
CFG=libnode - Win32 Release
!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 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libnode - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libnode - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNODE_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNODE_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# 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 /nologo /dll /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 /nologo /dll /machine:I386
# Begin Custom Build - Creating static library libnode_a.lib...
InputPath=.\Release\libnode.dll
SOURCE="$(InputPath)"
"Release\libnode_a.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
lib /nologo /out:Release\libnode_a.lib Release\*.obj
# End Custom Build
!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 Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBNODE_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
# SUBTRACT CPP /WX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# 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 /nologo /dll /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 /nologo /dll /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /map
# Begin Custom Build - Creating static library libnode_a.lib...
InputPath=.\Debug\libnode.dll
SOURCE="$(InputPath)"
"Debug\libnode_a.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
lib /nologo /out:Debug\libnode_a.lib Debug\*.obj
# End Custom Build
!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
# Begin Source File
SOURCE=.\libnode.rc
# 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
# 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
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.1 $ */
/* $Name: $ */
/* $Date: 2002/02/27 16:05:15 $ */
/* $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 */
@@ -29,8 +52,8 @@ struct Symbol {
NDT_Root * Tmp_Root;
extern char * strdup (const char *);
extern int sigrelse (int sig);
//extern char * strdup (const char *);
//extern int sigrelse (int sig);
int Sig_Trapped;
@@ -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);

109
lib/libnode.rc Normal file
View File

@@ -0,0 +1,109 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,0
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Memory list or tree node structures management library\0"
VALUE "CompanyName", "Rx3\0"
VALUE "FileDescription", "Node Library\0"
VALUE "FileVersion", "$Revision: 1.2 $\0"
VALUE "InternalName", "libnode\0"
VALUE "LegalCopyright", "GNU General Public Licence (GPL) - 1993-2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libnode.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "libnode\0"
VALUE "ProductVersion", "$Name: $\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // !_MAC
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

15
lib/resource.h Normal file
View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by libnode.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

17
util/Makefile Normal file
View File

@@ -0,0 +1,17 @@
ifdef _LIBVER_SUPPORT
DEP_VER_STATIC = ../../libver/ver.h ../../libver/libver.a
DEP_VER_DYNAMIC = ../../libver/ver.h ../../libver/libver.so
LIB_VER_STATIC = -I ../../libver ../../libver/libver.a
LIB_VER_DYNAMIC = -I ../../libver -L ../../libver -lver
endif
all: ndbench ndbench-static
ndbench-static: ndbench.c $(DEP_VER_STATIC) ../lib/node.h ../lib/libnode.a Makefile
gcc -g -o ndbench-static -I ../lib ndbench.c -ldl $(LIB_VER_STATIC) ../lib/libnode.a
ndbench: ndbench.c $(DEP_VER_DYNAMIC) ../lib/node.h ../lib/libnode.so Makefile
gcc -g -o ndbench -ldl $(LIB_VER_DYNAMIC) -I ../lib -L ../lib -lnode ndbench.c
clean:
rm -f ndbench ndbench-static

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 /MDd /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
# 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