diff options
author | Klaus Kaempf <kkaempf@progis.de> | 1998-02-01 12:01:18 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-02-01 05:01:18 -0700 |
commit | d2f05a0aade7c265d3c88fa8db62699c01f5e8d4 (patch) | |
tree | 33abd0b57be208d1dfe350db29d24fb64cdc83eb /gcc/cccp.c | |
parent | f8dac6eb3f71d5810ff9c8b417d52e0d0a76fe3d (diff) | |
download | gcc-d2f05a0aade7c265d3c88fa8db62699c01f5e8d4.zip gcc-d2f05a0aade7c265d3c88fa8db62699c01f5e8d4.tar.gz gcc-d2f05a0aade7c265d3c88fa8db62699c01f5e8d4.tar.bz2 |
* cccp.c (main): Predefine __VMS_VER on VMS.
From-SVN: r17578
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r-- | gcc/cccp.c | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -130,6 +130,8 @@ extern char *getenv (); /* VMS-specific definitions */ #ifdef VMS #include <descrip.h> +#include <ssdef.h> +#include <syidef.h> #define open(fname,mode,prot) VMS_open (fname,mode,prot) #define fopen(fname,mode) VMS_fopen (fname,mode) #define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile) @@ -1732,6 +1734,63 @@ main (argc, argv) if (!inhibit_predefs) { char *p = (char *) alloca (strlen (predefs) + 1); + +#ifdef VMS + struct dsc$descriptor_s lcl_name; + struct item_list { + unsigned short length; /* input length */ + unsigned short code; /* item code */ + unsigned long dptr; /* data ptr */ + unsigned long lptr; /* output length ptr */ + }; + + unsigned long syi_length; + char syi_data[16]; + + struct item_list items[] = { + { 16, SYI$_VERSION, 0, 0 }, + { 0, 0, 0, 0 } + }; + + items[0].dptr = (unsigned long)syi_data; + items[0].lptr = (unsigned long)(&syi_length); + + if (SYS$GETSYIW (0, 0, 0, items, NULL, NULL, NULL, NULL) == SS$_NORMAL) + { + unsigned long vms_version_value; + char *vers; + + vers = syi_data; + vms_version_value = 0; + + if (*vers == 'V') + vers++; + if (isdigit (*vers)) + { + vms_version_value = (*vers - '0') * 10000000; + } + vers++; + if (*vers == '.') + { + vers++; + if (isdigit (*vers)) + { + vms_version_value += (*vers - '0') * 100000; + } + } + + if (vms_version_value > 0) + { + char versbuf[32]; + + sprintf (versbuf, "__VMS_VER=%08ld", vms_version_value); + if (debug_output) + output_line_directive (fp, &outbuf, 0, same_file); + make_definition (versbuf, &outbuf); + } + } +#endif + strcpy (p, predefs); while (*p) { char *q; |