summaryrefslogtreecommitdiffstats
path: root/Modules/getbuildinfo.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-12-06 12:48:53 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-12-06 12:48:53 (GMT)
commit79acb9edfa893b5072350c82fd0645d023b13b03 (patch)
tree7b9417700c6942124614f4639bfbea8ff5c68b9e /Modules/getbuildinfo.c
parent468742878f53bb0a9061e6b167b3150f341fdf1c (diff)
downloadcpython-79acb9edfa893b5072350c82fd0645d023b13b03.zip
cpython-79acb9edfa893b5072350c82fd0645d023b13b03.tar.gz
cpython-79acb9edfa893b5072350c82fd0645d023b13b03.tar.bz2
Patch #614055: Support OpenVMS.
Diffstat (limited to 'Modules/getbuildinfo.c')
-rw-r--r--Modules/getbuildinfo.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
index b59d9a7..23b57c5 100644
--- a/Modules/getbuildinfo.c
+++ b/Modules/getbuildinfo.c
@@ -28,12 +28,70 @@
#define BUILD 0
#endif
+#ifdef __VMS
+# ifdef __DECC
+# pragma extern_model save
+# pragma extern_model strict_refdef
+extern long ctl$gl_imghdrbf;
+# pragma extern_model restore
+# endif
+
+# ifdef __ALPHA
+# define EIHD$L_IMGIDOFF 24
+# define EIHI$Q_LINKTIME 8
+# define _IMGIDOFF EIHD$L_IMGIDOFF
+# define _LINKTIME EIHI$Q_LINKTIME
+# else
+# define IHD$W_IMGIDOFF 6
+# define IHI$Q_LINKTIME 56
+# define _IMGIDOFF IHD$W_IMGIDOFF
+# define _LINKTIME IHI$Q_LINKTIME
+# endif /* __VMS */
+
+long*
+vms__get_linktime (void)
+{
+ long* al_imghdrbf;
+ unsigned short* aw_imgidoff;
+ unsigned short w_imgidoff;
+ long* aq_linktime;
+ unsigned char* ab_ihi;
+
+ al_imghdrbf = &ctl$gl_imghdrbf;
+
+ al_imghdrbf = (long *)*al_imghdrbf;
+ al_imghdrbf = (long *)*al_imghdrbf;
+
+ aw_imgidoff = (unsigned short *)
+ ((unsigned char *)al_imghdrbf + _IMGIDOFF);
+
+ w_imgidoff = *aw_imgidoff;
+
+ ab_ihi = (unsigned char *)al_imghdrbf + w_imgidoff;
+
+ aq_linktime = (long *) (ab_ihi + _LINKTIME);
+
+ return aq_linktime;
+} /* vms__get_linktime (void) */
+extern void vms__cvt_v2u_time (long * aq_vmstime, time_t * al_unixtime);
+ /* input , output */
+#endif /* __VMS */
+
const char *
Py_GetBuildInfo(void)
{
static char buildinfo[50];
+#ifdef __VMS
+ time_t l_unixtime;
+
+ vms__cvt_v2u_time(vms__get_linktime (), &l_unixtime );
+
+ memset(buildinfo, 0, 40);
+ sprintf(buildinfo, "#%d, %.24s", BUILD, ctime (&l_unixtime));
+#else
PyOS_snprintf(buildinfo, sizeof(buildinfo),
"#%d, %.20s, %.9s", BUILD, DATE, TIME);
+#endif
return buildinfo;
}