Fix LibVer support.

This commit is contained in:
agibert 2003-01-17 08:06:57 +00:00
parent 9bb2b42716
commit a0addad286
5 changed files with 85 additions and 65 deletions

View File

@ -1,10 +1,20 @@
ifdef _LIBVER_SUPPORT
DEP_STATIC += ../../libver/ver.h ../../libver/libver.a
DEP_DYNAMIC += ../../libver/ver.h ../../libver/libver.so
INCLUDE += -I ../../libver
LIBDIR += -L ../../libver
LIB_STATIC += ../../libver/libver.a
LIB_DYNAMIC += -lver
FLAG += -D_LIBVER_SUPPORT
endif
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-static: demo0.c $(DEP_STATIC) ../lib/node.h ../lib/libnode.a Makefile
gcc -g -o demo0-static $(FLAG) $(INCLUDE) -I ../lib demo0.c -ldl $(LIB_STATIC) ../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
demo0: demo0.c $(DEP_DYNAMIC) ../lib/node.h ../lib/libnode.so Makefile
gcc -g -o demo0 $(FLAG) $(INCLUDE) -I ../lib $(LIBDIR) -L ../lib -ldl $(LIB_DYNAMIC) -lnode demo0.c
clean:
rm -f demo0 demo0-static

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: nddemo0.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.1 $ */
/* $Revision: 2.2 $ */
/* $Name: $ */
/* $Date: 2002/02/28 22:00:35 $ */
/* $Date: 2003/01/17 08:07:46 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -31,11 +31,24 @@
#include <stdio.h>
#include <errno.h>
#ifdef _LIBVER_SUPPORT
# include <ver.h>
#endif
#include <node.h>
//#include <windows.h>
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT( ndbench, "$Revision: 2.2 $", "$Name: $", __FILE__, "$Author: agibert $")
# define USAGE "Usage : %s [ --help | --version [-v]]\n"
#else
# define USAGE "Usage : %s [ --help]\n"
#endif
#define DEMO_FILE_NAME "demo0.txt"
#define STRING_LEN (short)1024
#define STRING_SIZE (short)(STRING_LEN + 1)
@ -64,7 +77,7 @@ typedef struct Demo_Value
/* Prototypes */
/*---------------------------------------------------------------------------------*/
NDT_Status Manager_Demo_DS( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
NDT_Status Manager_Demo0_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);
@ -80,7 +93,7 @@ int main( int, char **);
/* */
/*---------------------------------------------------------------------------------*/
NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list Args)
NDT_Status Manager_Demo0_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;
@ -94,7 +107,7 @@ NDT_Status Manager_Demo_DS( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_No
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.1 $ $Name: $ $Date: 2002/02/28 22:00:35 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.2 $ $Name: $ $Date: 2003/01/17 08:07:46 $ $Author: agibert $";
return( NDS_OK);
}
@ -576,7 +589,7 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
if( ( status = ND_DataStruct_Open( &demo_ds_ptr, INDEX_NB, index_type_ptr, "Manager_Demo_DS", Manager_Demo_DS, NULL, NULL, NULL, NULL,0, NULL)) != NDS_OK)
if( ( status = ND_DataStruct_Open( &demo_ds_ptr, INDEX_NB, index_type_ptr, "Manager_Demo0_DS", Manager_Demo0_DS, NULL, NULL, NULL, NULL,0, NULL)) != NDS_OK)
{
printf( "ND_DataStruct_Open() failed (%d) !\n", status);
}
@ -665,39 +678,33 @@ void Demo( char *Demo_File_Name, short Optimized_Mode)
int main( int argc, char **argv)
{
/* Args Parsing */
if( argc >= 2)
{
if( !strcmp( argv[1], "--help"))
{
fprintf( stderr, USAGE, argv[0]);
return( 1);
}
#ifdef _LIBVER_SUPPORT
else if( !strcmp( argv[1], "--version"))
{
if( argc >= 3 && !strcmp( argv[2], "-v"))
{
return( VER_Object_Print( stdout, VERD_VERBOSE));
}
else
{
return( VER_Object_Print( stdout, VERD_MINIMAL));
}
}
#endif
}
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");
}
*/

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.7 $ */
/* $Revision: 2.8 $ */
/* $Name: $ */
/* $Date: 2002/07/29 14:53:50 $ */
/* $Date: 2003/01/17 08:06:57 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -33,8 +33,8 @@
#include <libnode.h>
#ifdef _LIBVER
VER_INFO_EXPORT (libnode,"$Revision: 2.7 $", "$Name: $",__FILE__,"$Author: agibert $")
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT (libnode,"$Revision: 2.8 $", "$Name: $",__FILE__,"$Author: agibert $")
#endif
@ -63,7 +63,7 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.7 $ $Name: $ $Date: 2002/07/29 14:53:50 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.8 $ $Name: $ $Date: 2003/01/17 08:06:57 $ $Author: agibert $";
return( NDS_OK);
}

View File

@ -1,17 +1,20 @@
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
DEP_STATIC += ../../libver/ver.h ../../libver/libver.a
DEP_DYNAMIC += ../../libver/ver.h ../../libver/libver.so
INCLUDE += -I ../../libver
LIBDIR += -L ../../libver
LIB_STATIC += ../../libver/libver.a
LIB_DYNAMIC += -lver
FLAG_VER = -D_LIBVER_SUPPORT
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-static: ndbench.c $(DEP_STATIC) ../lib/node.h ../lib/libnode.a Makefile
gcc -g -o ndbench-static $(FLAG_VER) $(INCLUDE) -I ../lib ndbench.c -ldl $(LIB_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
ndbench: ndbench.c $(DEP_DYNAMIC) ../lib/node.h ../lib/libnode.so Makefile
gcc -g -o ndbench -ldl $(FLAG_VER) $(INCLUDE) -I ../lib $(LIBDIR) -L ../lib $(LIB_DYNAMIC) -lnode ndbench.c
clean:
rm -f ndbench ndbench-static

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: ndbench.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.4 $ */
/* $Revision: 2.5 $ */
/* $Name: $ */
/* $Date: 2002/07/29 14:55:57 $ */
/* $Date: 2003/01/17 08:11:11 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
@ -64,8 +64,12 @@
/* Defines */
/*---------------------------------------------------------------------------------*/
#ifdef _LIBVER
VER_INFO_EXPORT( ndbench, "$Revision: 2.4 $", "$Name: $", __FILE__, "$Author: agibert $")
#ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT( ndbench, "$Revision: 2.5 $", "$Name: $", __FILE__, "$Author: agibert $")
# define USAGE "Usage : %s [ --help | --version [-v] | --batch_run <batch_file_name>]\n"
#else
# define USAGE "Usage : %s [ --help | --batch_run <batch_file_name>]\n"
#endif
#define ND_MODE 1
@ -73,8 +77,6 @@ VER_INFO_EXPORT( ndbench, "$Revision: 2.4 $", "$Name: $", __FILE__, "$Author: a
#define USAGE "Usage : %s [ --help | --version [-v] | --batch_run <batch_file_name>]\n"
#define QUIT 0
#define DS_OPEN 1
#define DS_CLOSE 2
@ -262,7 +264,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.4 $ $Name: $ $Date: 2002/07/29 14:55:57 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.5 $ $Name: $ $Date: 2003/01/17 08:11:11 $ $Author: agibert $";
return( NDS_OK);
}
@ -1409,21 +1411,19 @@ int main( int argc, char ** argv)
fprintf( stderr, USAGE, argv[0]);
return( 1);
}
#ifdef _LIBVER_SUPPORT
else if( !strcmp( argv[1], "--version"))
{
if( argc >= 3 && !strcmp( argv[2], "-v"))
{
#ifdef _LIBVER_SUPPORT
return( VER_Object_Print( stdout, VERD_VERBOSE));
#endif
}
else
{
#ifdef _LIBVER_SUPPORT
return( VER_Object_Print( stdout, VERD_MINIMAL));
#endif
return( VER_Object_Print( stdout, VERD_MINIMAL));
}
}
#endif
else if( !strcmp( argv[1], "--batch_run"))
{
/* Batch Mode */