Author: ion
Date: Wed May 9 03:00:35 2007
New Revision: 26656
URL:
http://svn.reactos.org/svn/reactos?rev=26656&view=rev
Log:
- Buildno now generates a KERNEL_VERSION_BUILD_HEX ULONG containing the SVN revision.
Modified:
trunk/reactos/tools/buildno/buildno.cpp
Modified: trunk/reactos/tools/buildno/buildno.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/buildno/buildno.cpp?…
==============================================================================
--- trunk/reactos/tools/buildno/buildno.cpp (original)
+++ trunk/reactos/tools/buildno/buildno.cpp Wed May 9 03:00:35 2007
@@ -63,124 +63,6 @@
for( i = 0; str[i]; i++ );
return i;
-}
-
-void
-write_h (int build, char *buildstr)
-{
- FILE *h = NULL;
- char* s;
- char* s1;
- unsigned int length;
- int dllversion = KERNEL_VERSION_MAJOR + 42;
-
- s1 = s = (char *) malloc(256 * 1024);
-
- s = s + sprintf (s, "/* Do not edit - Machine generated */\n");
-
- s = s + sprintf (s, "#ifndef _INC_REACTOS_BUILDNO\n" );
- s = s + sprintf (s, "#define _INC_REACTOS_BUILDNO\n" );
-
- s = s + sprintf (s, "#define KERNEL_VERSION_BUILD\t%d\n", build);
- s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_STR\t\"%s\"\n",
buildstr);
- s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_RC\t\"%s\\0\"\n",
buildstr);
- s = s + sprintf (s, "#define KERNEL_RELEASE_RC\t\"%d.%d",
- KERNEL_VERSION_MAJOR, KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define KERNEL_RELEASE_STR\t\"%d.%d",
- KERNEL_VERSION_MAJOR,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define KERNEL_VERSION_RC\t\"%d.%d",
- KERNEL_VERSION_MAJOR,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define KERNEL_VERSION_STR\t\"%d.%d",
- KERNEL_VERSION_MAJOR,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define REACTOS_DLL_VERSION_MAJOR\t%d\n", dllversion);
- s = s + sprintf (s, "#define REACTOS_DLL_RELEASE_RC\t\"%d.%d",
- dllversion, KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define REACTOS_DLL_RELEASE_STR\t\"%d.%d",
- dllversion,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define REACTOS_DLL_VERSION_RC\t\"%d.%d",
- dllversion,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#define REACTOS_DLL_VERSION_STR\t\"%d.%d",
- dllversion,
- KERNEL_VERSION_MINOR);
- if (0 != KERNEL_VERSION_PATCH_LEVEL)
- {
- s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
- }
- s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
- s = s + sprintf (s, "#endif\n/* EOF */\n");
-
- h = fopen (filename, "wb");
- if (h != NULL)
- {
- fseek(h, 0, SEEK_END);
- length = ftell(h);
- if (length == strlen(s1))
- {
- char* orig;
-
- orig = (char *) malloc(length);
- fseek(h, 0, SEEK_SET);
- fread(orig, 1, length, h);
- if (memcmp(s1, orig, length) == 0)
- {
- fclose(h);
- return;
- }
- }
- fclose(h);
- }
-
- h = fopen (filename, "wb");
- if (!h)
- {
- fprintf (stderr,
- "%s: can not create file \"%s\"!\n",
- argv0,
- filename);
- return;
- }
- fwrite(s1, 1, strlen(s1), h);
- fclose (h);
}
char *
@@ -278,6 +160,124 @@
return Unknown;
}
+void
+write_h (int build, char *buildstr)
+{
+ FILE *h = NULL;
+ char* s;
+ char* s1;
+ unsigned int length;
+ int dllversion = KERNEL_VERSION_MAJOR + 42;
+
+ s1 = s = (char *) malloc(256 * 1024);
+
+ s = s + sprintf (s, "/* Do not edit - Machine generated */\n");
+
+ s = s + sprintf (s, "#ifndef _INC_REACTOS_BUILDNO\n" );
+ s = s + sprintf (s, "#define _INC_REACTOS_BUILDNO\n" );
+
+ s = s + sprintf (s, "#define KERNEL_VERSION_BUILD\t%d\n", build);
+ s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_HEX\t0x%x\n",
atoi(GetRev()));
+ s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_STR\t\"%s\"\n",
buildstr);
+ s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_RC\t\"%s\\0\"\n",
buildstr);
+ s = s + sprintf (s, "#define KERNEL_RELEASE_RC\t\"%d.%d",
+ KERNEL_VERSION_MAJOR, KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define KERNEL_RELEASE_STR\t\"%d.%d",
+ KERNEL_VERSION_MAJOR,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define KERNEL_VERSION_RC\t\"%d.%d",
+ KERNEL_VERSION_MAJOR,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define KERNEL_VERSION_STR\t\"%d.%d",
+ KERNEL_VERSION_MAJOR,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define REACTOS_DLL_VERSION_MAJOR\t%d\n", dllversion);
+ s = s + sprintf (s, "#define REACTOS_DLL_RELEASE_RC\t\"%d.%d",
+ dllversion, KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define REACTOS_DLL_RELEASE_STR\t\"%d.%d",
+ dllversion,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define REACTOS_DLL_VERSION_RC\t\"%d.%d",
+ dllversion,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\\0\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#define REACTOS_DLL_VERSION_STR\t\"%d.%d",
+ dllversion,
+ KERNEL_VERSION_MINOR);
+ if (0 != KERNEL_VERSION_PATCH_LEVEL)
+ {
+ s = s + sprintf (s, ".%d", KERNEL_VERSION_PATCH_LEVEL);
+ }
+ s = s + sprintf (s, "-%s\"\n", kernel_version_build_type);
+ s = s + sprintf (s, "#endif\n/* EOF */\n");
+
+ h = fopen (filename, "wb");
+ if (h != NULL)
+ {
+ fseek(h, 0, SEEK_END);
+ length = ftell(h);
+ if (length == strlen(s1))
+ {
+ char* orig;
+
+ orig = (char *) malloc(length);
+ fseek(h, 0, SEEK_SET);
+ fread(orig, 1, length, h);
+ if (memcmp(s1, orig, length) == 0)
+ {
+ fclose(h);
+ return;
+ }
+ }
+ fclose(h);
+ }
+
+ h = fopen (filename, "wb");
+ if (!h)
+ {
+ fprintf (stderr,
+ "%s: can not create file \"%s\"!\n",
+ argv0,
+ filename);
+ return;
+ }
+ fwrite(s1, 1, strlen(s1), h);
+ fclose (h);
+}
void
usage (void)