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 all: demo0 demo0-static
demo0-static: demo0.c ../lib/node.h ../lib/libnode.a Makefile demo0-static: demo0.c $(DEP_STATIC) ../lib/node.h ../lib/libnode.a Makefile
gcc -g -o demo0-static -I ../lib -ldl demo0.c ../lib/libnode.a 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 demo0: demo0.c $(DEP_DYNAMIC) ../lib/node.h ../lib/libnode.so Makefile
gcc -g -o demo0 -I ../lib -L ../lib -ldl -lnode demo0.c gcc -g -o demo0 $(FLAG) $(INCLUDE) -I ../lib $(LIBDIR) -L ../lib -ldl $(LIB_DYNAMIC) -lnode demo0.c
clean: clean:
rm -f demo0 demo0-static rm -f demo0 demo0-static

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $RCSfile: nddemo0.c,v $ */ /* $RCSfile: nddemo0.c,v $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $Revision: 2.1 $ */ /* $Revision: 2.2 $ */
/* $Name: $ */ /* $Name: $ */
/* $Date: 2002/02/28 22:00:35 $ */ /* $Date: 2003/01/17 08:07:46 $ */
/* $Author: agibert $ */ /* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -31,11 +31,24 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#ifdef _LIBVER_SUPPORT
# include <ver.h>
#endif
#include <node.h> #include <node.h>
//#include <windows.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 DEMO_FILE_NAME "demo0.txt"
#define STRING_LEN (short)1024 #define STRING_LEN (short)1024
#define STRING_SIZE (short)(STRING_LEN + 1) #define STRING_SIZE (short)(STRING_LEN + 1)
@ -64,7 +77,7 @@ typedef struct Demo_Value
/* Prototypes */ /* 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 DataStruct_Load( NDT_Root *, FILE *); void DataStruct_Load( NDT_Root *, FILE *);
void Demo( char *, short); 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; 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"; 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); 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); 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) 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"); printf( "Non Optimized Demo\n------------------\n\n\n");
Demo( DEMO_FILE_NAME, 0); Demo( DEMO_FILE_NAME, 0);
printf( "\n\n\n\n\nOptimized Demo\n--------------\n\n\n"); printf( "\n\n\n\n\nOptimized Demo\n--------------\n\n\n");
Demo( DEMO_FILE_NAME, 1); 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 $ */ /* $RCSfile: libnode.c,v $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $Revision: 2.7 $ */ /* $Revision: 2.8 $ */
/* $Name: $ */ /* $Name: $ */
/* $Date: 2002/07/29 14:53:50 $ */ /* $Date: 2003/01/17 08:06:57 $ */
/* $Author: agibert $ */ /* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -33,8 +33,8 @@
#include <libnode.h> #include <libnode.h>
#ifdef _LIBVER #ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT (libnode,"$Revision: 2.7 $", "$Name: $",__FILE__,"$Author: agibert $") VER_INFO_EXPORT (libnode,"$Revision: 2.8 $", "$Name: $",__FILE__,"$Author: agibert $")
#endif #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"; 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); return( NDS_OK);
} }

View File

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

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $RCSfile: ndbench.c,v $ */ /* $RCSfile: ndbench.c,v $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $Revision: 2.4 $ */ /* $Revision: 2.5 $ */
/* $Name: $ */ /* $Name: $ */
/* $Date: 2002/07/29 14:55:57 $ */ /* $Date: 2003/01/17 08:11:11 $ */
/* $Author: agibert $ */ /* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -64,8 +64,12 @@
/* Defines */ /* Defines */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
#ifdef _LIBVER #ifdef _LIBVER_SUPPORT
VER_INFO_EXPORT( ndbench, "$Revision: 2.4 $", "$Name: $", __FILE__, "$Author: agibert $") 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 #endif
#define ND_MODE 1 #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 QUIT 0
#define DS_OPEN 1 #define DS_OPEN 1
#define DS_CLOSE 2 #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"; 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); return( NDS_OK);
} }
@ -1409,21 +1411,19 @@ int main( int argc, char ** argv)
fprintf( stderr, USAGE, argv[0]); fprintf( stderr, USAGE, argv[0]);
return( 1); return( 1);
} }
#ifdef _LIBVER_SUPPORT
else if( !strcmp( argv[1], "--version")) else if( !strcmp( argv[1], "--version"))
{ {
if( argc >= 3 && !strcmp( argv[2], "-v")) if( argc >= 3 && !strcmp( argv[2], "-v"))
{ {
#ifdef _LIBVER_SUPPORT
return( VER_Object_Print( stdout, VERD_VERBOSE)); return( VER_Object_Print( stdout, VERD_VERBOSE));
#endif
} }
else else
{ {
#ifdef _LIBVER_SUPPORT
return( VER_Object_Print( stdout, VERD_MINIMAL)); return( VER_Object_Print( stdout, VERD_MINIMAL));
}
}
#endif #endif
}
}
else if( !strcmp( argv[1], "--batch_run")) else if( !strcmp( argv[1], "--batch_run"))
{ {
/* Batch Mode */ /* Batch Mode */