Author: tkreuzer
Date: Sat Nov 6 11:15:12 2010
New Revision: 49508
URL:
http://svn.reactos.org/svn/reactos?rev=49508&view=rev
Log:
[spec2pdef]
Add library name as 3rd parameter and use it in the header.
Print syntax when less than 3 parameters are given.
Modified:
branches/cmake-bringup/tools/spec2pdef/spec2pdef.c
Modified: branches/cmake-bringup/tools/spec2pdef/spec2pdef.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/spec2pdef/s…
==============================================================================
--- branches/cmake-bringup/tools/spec2pdef/spec2pdef.c [iso-8859-1] (original)
+++ branches/cmake-bringup/tools/spec2pdef/spec2pdef.c [iso-8859-1] Sat Nov 6 11:15:12
2010
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
enum
{
@@ -265,11 +266,11 @@
}
void
-OutputHeader(FILE *file)
+OutputHeader(FILE *file, char *libname)
{
fprintf(file,
"; File generated automatically, do not edit!\n\n"
- "LIBRARY ntoskrnl.exe\n\n"
+ "LIBRARY %s\n\n"
"EXPORTS\n"
"#define FOOL(x) x\n"
"#ifdef _MSC_VER\n"
@@ -282,9 +283,14 @@
"#define _NAME_CDECL(name, stackbytes) FOOL(name)\n"
"#endif\n"
"#define _NAME_EXTERN(name, stackbytes) name\n"
- "#define _NAME(name, cc, stackbytes) _NAME_##cc(name,
stackbytes)\n");
-}
-
+ "#define _NAME(name, cc, stackbytes) _NAME_##cc(name,
stackbytes)\n",
+ libname);
+}
+
+void usage(void)
+{
+ printf("syntax: spec2pdef <source file> <dest file>
<libname>\n");
+}
int main(int argc, char *argv[])
{
@@ -294,6 +300,12 @@
FILE *fileSource, *fileDest;
EXPORT exp;
+ if (argc < 4)
+ {
+ usage();
+ return 0;
+ }
+
/* Open input file argv[1] */
fileSource = fopen(argv[1], "r");
if (!fileSource)
@@ -325,7 +337,7 @@
return -1;
}
- OutputHeader(fileDest);
+ OutputHeader(fileDest, argv[3]);
pcLine = pszSource;
for (nLine = 1; *pcLine != 0; pcLine = NextLine(pcLine), nLine++)