Rob Shearman : widl: Include the version number in the __WIDL__ preprocessor definition.
Alexandre Julliard
julliard at winehq.org
Thu Mar 26 11:05:47 CDT 2009
Module: wine
Branch: master
Commit: 0a8e3c39a1e05f47136c69671ff691dc02ae0a88
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0a8e3c39a1e05f47136c69671ff691dc02ae0a88
Author: Rob Shearman <robertshearman at gmail.com>
Date: Thu Mar 26 13:31:25 2009 +0000
widl: Include the version number in the __WIDL__ preprocessor definition.
---
tools/widl/widl.c | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 62b7ff5..cbc35b7 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -196,6 +196,36 @@ static char *dup_basename_token(const char *name, const char *ext)
return ret;
}
+static void add_widl_version_define(void)
+{
+ unsigned int version;
+ const char *p = PACKAGE_VERSION;
+
+ /* major */
+ version = atoi(p) * 0x10000;
+ p = strchr(p, '.');
+
+ /* minor */
+ if (p)
+ {
+ version += atoi(p + 1) * 0x100;
+ p = strchr(p + 1, '.');
+ }
+
+ /* build */
+ if (p)
+ version += atoi(p + 1);
+
+ if (version != 0)
+ {
+ char version_str[11];
+ snprintf(version_str, sizeof(version_str), "0x%x", version);
+ wpp_add_define("__WIDL__", version_str);
+ }
+ else
+ wpp_add_define("__WIDL__", NULL);
+}
+
/* clean things up when aborting on a signal */
static void exit_on_signal( int sig )
{
@@ -596,7 +626,7 @@ int main(int argc,char *argv[])
if (do_client) client_token = dup_basename_token(client_name,"_c.c");
if (do_server) server_token = dup_basename_token(server_name,"_s.c");
- wpp_add_cmdline_define("__WIDL__");
+ add_widl_version_define();
atexit(rm_tempfile);
if (!no_preprocess)
More information about the wine-cvs
mailing list