[M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Sun Sep 8 05:12:49 CEST 2013


Index: m3core/src/time/WIN32/DateWin32.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/m3core/src/time/WIN32/DateWin32.m3,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 DateWin32.m3
--- m3core/src/time/WIN32/DateWin32.m3    24 Jan 2001 16:48:11 -0000    1.1.1.2
+++ m3core/src/time/WIN32/DateWin32.m3    8 Sep 2013 03:06:28 -0000
@@ -62,7 +62,7 @@
       <*ASSERT t > 0.0D0*>
       firstDayOfEpoch := TRUE
     END;
-    ft := TimeWin32.ToFileTime(t);
+    TimeWin32.ToFileTime(t, ft);
     status := WinBase.FileTimeToSystemTime(ADR(ft), ADR(st));
     <*ASSERT status # 0*>
     tzrc := WinBase.GetTimeZoneInformation(ADR(tz));
@@ -134,7 +134,7 @@
 PROCEDURE FromTimeUTC(<*UNUSED*> z: TimeZone; t: Time.T): T =
   VAR d: T; st: WinBase.SYSTEMTIME; ft: WinBase.FILETIME;  status: INTEGER;
   BEGIN
-    ft := TimeWin32.ToFileTime(t);
+    TimeWin32.ToFileTime(t, ft);
     status := WinBase.FileTimeToSystemTime(ADR(ft), ADR(st));
     <*ASSERT status # 0 *>
     d := FromSystemTime(st);
Index: m3core/src/time/WIN32/Time.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/m3core/src/time/WIN32/Time.m3,v
retrieving revision 1.7
diff -u -r1.7 Time.m3
--- m3core/src/time/WIN32/Time.m3    29 Jun 2009 19:20:44 -0000    1.7
+++ m3core/src/time/WIN32/Time.m3    8 Sep 2013 03:06:28 -0000
@@ -6,8 +6,6 @@
 (*      modified on Wed Sep 22 14:53:33 PDT 1993 by steveg     *)
 (*      modified on Thu Mar 11 13:01:04 PST 1993 by mjordan    *)
 
-(* $Id: Time.m3,v 1.7 2009-06-29 19:20:44 jkrell Exp $ *)
-
 MODULE Time;
 
 IMPORT WinBase;
Index: m3core/src/time/WIN32/TimeWin32.c
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/m3core/src/time/WIN32/TimeWin32.c,v
retrieving revision 1.4
diff -u -r1.4 TimeWin32.c
--- m3core/src/time/WIN32/TimeWin32.c    14 Apr 2010 14:04:52 -0000    1.4
+++ m3core/src/time/WIN32/TimeWin32.c    8 Sep 2013 03:06:28 -0000
@@ -15,27 +15,25 @@
 extern "C" {
 #endif
 
-FILETIME
+void
 __cdecl
-TimeWin32__ToFileTime(double t)
+TimeWin32__ToFileTime(double t, FILETIME * ft)
 {
-    FILETIME ft;
     LARGE_INTEGER li;
 
     li.QuadPart = (__int64)(t * 1.0e7);
-    ft.dwLowDateTime = li.LowPart;
-    ft.dwHighDateTime = li.HighPart;
-    return ft;
+    ft->dwLowDateTime = li.LowPart;
+    ft->dwHighDateTime = li.HighPart;
 }
 
 double
 __cdecl
-TimeWin32__FromFileTime(FILETIME ft)
+TimeWin32__FromFileTime(const FILETIME * ft)
 {
     LARGE_INTEGER li;
 
-    li.LowPart = ft.dwLowDateTime;
-    li.HighPart = ft.dwHighDateTime;
+    li.LowPart = ft->dwLowDateTime;
+    li.HighPart = ft->dwHighDateTime;
     return ((double)li.QuadPart) / 1.0e7;
 }
 
Index: m3core/src/time/WIN32/TimeWin32.i3
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/m3core/src/time/WIN32/TimeWin32.i3,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TimeWin32.i3
--- m3core/src/time/WIN32/TimeWin32.i3    24 Jan 2001 12:24:35 -0000    1.1.1.1
+++ m3core/src/time/WIN32/TimeWin32.i3    8 Sep 2013 03:06:28 -0000
@@ -9,8 +9,13 @@
 
 (* Conversions between a "Time.T" and a "WinBase.FILETIME". *)
 
-PROCEDURE ToFileTime(n: Time.T): WinBase.FILETIME;
+(* READONLY is to avoid passing struct by value *)
+PROCEDURE FromFileTime(READONLY ft: WinBase.FILETIME): Time.T;
 
-PROCEDURE FromFileTime(ft: WinBase.FILETIME): Time.T;
+<*EXTERNAL TimeWin32__ToFileTime*>
+PROCEDURE ToFileTime(n: Time.T; (*OUT*)VAR ft: WinBase.FILETIME);
+
+<*EXTERNAL TimeWin32__FromFileTime*>
+PROCEDURE FromFileTime(READONLY ft: WinBase.FILETIME): Time.T;
 
 END TimeWin32.
Index: m3core/src/time/WIN32/m3makefile
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/m3core/src/time/WIN32/m3makefile,v
retrieving revision 1.2
diff -u -r1.2 m3makefile
--- m3core/src/time/WIN32/m3makefile    11 Feb 2008 08:56:15 -0000    1.2
+++ m3core/src/time/WIN32/m3makefile    8 Sep 2013 03:06:28 -0000
@@ -6,14 +6,9 @@
 %      modified on Tue Jun 15 21:53:44 PDT 1993 by harrison
 %      modified on Tue May  4 10:16:00 PDT 1993 by mjordan
 
-if equal (OS_TYPE, "POSIX")
+% Cygwin could use some of this
 
 Module ("TimeWin32")
-
-else
-
 implementation ("Time")
-Module ("TimeWin32")
 implementation ("DateWin32")
-
-end
+c_source ("TimeWin32")
Index: libm3/src/os/WIN32/FSWin32.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-libs/libm3/src/os/WIN32/FSWin32.m3,v
retrieving revision 1.9
diff -u -r1.9 FSWin32.m3
--- libm3/src/os/WIN32/FSWin32.m3    27 Aug 2013 15:23:30 -0000    1.9
+++ libm3/src/os/WIN32/FSWin32.m3    8 Sep 2013 03:06:28 -0000
@@ -442,8 +442,9 @@
 
 PROCEDURE SetModificationTime(p: Pathname.T; READONLY t: Time.T)
   RAISES {OSError.E} =
-  VAR h: File.T; lastWrite := TimeWin32.ToFileTime(t);
+  VAR h: File.T; lastWrite: WinBase.FILETIME;
   BEGIN
+    TimeWin32.ToFileTime(t, lastWrite);
     h := OpenFileReadonly(p);
     TRY
       IF WinBase.SetFileTime(





> Date: Sun, 8 Sep 2013 05:09:37 +0000
> To: m3commit at elegosoft.com
> From: jkrell at elego.de
> Subject: [M3commit] CVS Update: cm3
> 
> CVSROOT:	/usr/cvs
> Changes by:	jkrell at birch.	13/09/08 05:09:37
> 
> Modified files:
> 	cm3/m3-libs/libm3/src/os/WIN32/: FSWin32.m3 
> 	./: FSWin32.m3 
> 	cm3/m3-libs/m3core/src/time/WIN32/: DateWin32.m3 Time.m3 
> 	                                    TimeWin32.c TimeWin32.i3 
> 	                                    m3makefile 
> Removed files:
> 	cm3/m3-libs/m3core/src/time/WIN32/: TimeWin32.m3 
> 
> Log message:
> 	replace confusing Modula-3 with simple C
> 	specifically converting between a 64bit integer
> 	and a floating point value merely by casting,
> 	instead of having to operate on the 32bit halves
> 	don't pass/return structs by value to that C
> 	specifically because the ABI of our generated C
> 	doesn't pass/return them directly and therefore
> 	doesn't interoperate with C well, currently
> 	I didn't have good type information for a long time,
> 	just struct sizes..which I guess would have sufficed.
> 	This should be fixable, if we can stand to lose K&R compatibility
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20130908/7ea49b01/attachment-0002.html>


More information about the M3commit mailing list