[MLton-commit] r4302
Matthew Fluet
MLton@mlton.org
Sun, 22 Jan 2006 19:12:24 -0800
Generate C-side/ML-side basis ffi files
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
U mlton/branches/on-20050822-x86_64-branch/runtime/TODO
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/Debug.c
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/IEEEReal.c
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/OS/
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/PackReal.c
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/CommandLine.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Date.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/OS/
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/OS/IO/poll.c
A mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Time.c
D mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c
U mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
A mlton/branches/on-20050822-x86_64-branch/runtime/gen/basis-ffi.def
A mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-basis-ffi.sml
U mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2006-01-23 03:12:19 UTC (rev 4302)
@@ -97,6 +97,7 @@
$(GCHFILES) \
gc.h \
types.h \
+ basis-ffi.h \
platform.h \
platform/$(TARGET_OS).h
@@ -173,6 +174,13 @@
./gen-types
rm -f gen-types
+basis-ffi.h: gen/gen-basis-ffi.sml gen/basis-ffi.def
+ rm -f basis-ffi.def
+ cd gen && mlton gen-basis-ffi.sml
+ cd gen && ./gen-basis-ffi
+ cp gen/basis-ffi.h basis-ffi.h
+ rm -f gen/gen-basis-ffi gen/basis-ffi.h gen/basis-ffi.sml
+
gc-gdb.o: gc.c $(GCCFILES) $(HFILES)
$(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -c -o $@ $<
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/TODO
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/TODO 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/TODO 2006-01-23 03:12:19 UTC (rev 4302)
@@ -3,3 +3,106 @@
* Why does hash-table use malloc/free while generational maps use mmap/munmap?
* Use C99 <assert.h> instead of util/assert.{c,h}
+
+
+Posix/Error.c
+Posix/FileSys/Dirstream.c
+Posix/FileSys/ST.c
+Posix/FileSys/Stat.c
+Posix/FileSys/Utimbuf.c
+Posix/FileSys/access.c
+Posix/FileSys/chdir.c
+Posix/FileSys/chmod.c
+Posix/FileSys/chown.c
+Posix/FileSys/fchmod.c
+Posix/FileSys/fchown.c
+Posix/FileSys/fpathconf.c
+Posix/FileSys/ftruncate.c
+Posix/FileSys/getcwd.c
+Posix/FileSys/link.c
+Posix/FileSys/mkdir.c
+Posix/FileSys/mkfifo.c
+Posix/FileSys/open.c
+Posix/FileSys/pathconf.c
+Posix/FileSys/readlink.c
+Posix/FileSys/rename.c
+Posix/FileSys/rmdir.c
+Posix/FileSys/symlink.c
+Posix/FileSys/umask.c
+Posix/FileSys/unlink.c
+Posix/IO/FLock.c
+Posix/IO/close.c
+Posix/IO/dup.c
+Posix/IO/dup2.c
+Posix/IO/fcntl2.c
+Posix/IO/fcntl3.c
+Posix/IO/fsync.c
+Posix/IO/lseek.c
+Posix/IO/pipe.c
+Posix/IO/read.c
+Posix/IO/write.c
+Posix/ProcEnv/ProcEnv.c
+Posix/ProcEnv/Tms.c
+Posix/ProcEnv/Uname.c
+Posix/ProcEnv/environ.c
+Posix/ProcEnv/getenv.c
+Posix/ProcEnv/getgroups.c
+Posix/ProcEnv/getlogin.c
+Posix/ProcEnv/getpgrp.c
+Posix/ProcEnv/isatty.c
+Posix/ProcEnv/setenv.c
+Posix/ProcEnv/setgroups.c
+Posix/ProcEnv/sysconf.c
+Posix/ProcEnv/ttyname.c
+Posix/Process/alarm.c
+Posix/Process/exece.c
+Posix/Process/execp.c
+Posix/Process/exit.c
+Posix/Process/exitStatus.c
+Posix/Process/fork.c
+Posix/Process/ifExited.c
+Posix/Process/ifSignaled.c
+Posix/Process/ifStopped.c
+Posix/Process/kill.c
+Posix/Process/nanosleep.c
+Posix/Process/pause.c
+Posix/Process/sleep.c
+Posix/Process/stopSig.c
+Posix/Process/system.c
+Posix/Process/termSig.c
+Posix/Process/waitpid.c
+Posix/Signal.c
+Posix/SysDB/Group.c
+Posix/SysDB/Passwd.c
+Posix/TTY.c
+basis/IEEEReal.c
+basis/Int/Word.c
+basis/Int/Word8Array.c
+basis/Int/Word8Vector.c
+basis/IntInf.c
+basis/Itimer/set.c
+basis/MLton/allocTooLarge.c
+basis/MLton/bug.c
+basis/MLton/rlimit.c
+basis/MLton/rusage.c
+basis/MLton/spawne.c
+basis/MLton/spawnp.c
+basis/Net/Net.c
+basis/Net/NetHostDB.c
+basis/Net/NetProtDB.c
+basis/Net/NetServDB.c
+basis/Net/Socket/GenericSock.c
+basis/Net/Socket/INetSock.c
+basis/Net/Socket/Socket.c
+basis/Net/Socket/UnixSock.c
+basis/PackReal.c
+basis/Ptrace.c
+basis/Real/Math.c
+basis/Real/class.c
+basis/Real/frexp.c
+basis/Real/gdtoa.c
+basis/Real/modf.c
+basis/Real/nextAfter.c
+basis/Real/real.c
+basis/Real/signBit.c
+basis/Real/strto.c
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,6 +0,0 @@
-#include "platform.h"
-
-/* Manual initialization is a work-around for a Darwin linker issue. */
-Int CommandLine_argc = 0;
-CstringArray CommandLine_argv = 0;
-Cstring CommandLine_commandName = 0;
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,108 +0,0 @@
-#include "platform.h"
-
-#ifndef DEBUG
-#define DEBUG FALSE
-#endif
-
-static struct tm tm;
-static struct tm *tmp;
-
-Int Date_Tm_sec() {
- return tmp->tm_sec;
-}
-
-Int Date_Tm_min() {
- return tmp->tm_min;
-}
-
-Int Date_Tm_hour() {
- return tmp->tm_hour;
-}
-
-Int Date_Tm_mday() {
- return tmp->tm_mday;
-}
-
-Int Date_Tm_mon() {
- return tmp->tm_mon;
-}
-
-Int Date_Tm_year() {
- return tmp->tm_year;
-}
-
-Int Date_Tm_wday() {
- return tmp->tm_wday;
-}
-
-Int Date_Tm_yday() {
- return tmp->tm_yday;
-}
-
-Int Date_Tm_isdst() {
- return tmp->tm_isdst;
-}
-
-void Date_Tm_setSec(Int x) {
- tm.tm_sec = x;
-}
-
-void Date_Tm_setMin(Int x) {
- tm.tm_min = x;
-}
-
-void Date_Tm_setHour(Int x) {
- tm.tm_hour = x;
-}
-
-void Date_Tm_setMday(Int x) {
- tm.tm_mday = x;
-}
-
-void Date_Tm_setMon(Int x) {
- tm.tm_mon = x;
-}
-
-void Date_Tm_setYear(Int x) {
- tm.tm_year = x;
-}
-
-void Date_Tm_setWday(Int x) {
- tm.tm_wday = x;
-}
-
-void Date_Tm_setYday(Int x) {
- tm.tm_yday = x;
-}
-
-void Date_Tm_setIsdst(Int x) {
- tm.tm_isdst = x;
-}
-
-void Date_gmTime(Pointer p) {
- tmp = gmtime((time_t*)p);
-}
-
-/* The idea for Date_localOffset comes from KitV3 src/Runtime/Time.c */
-Int Date_localOffset() {
- time_t t1, t2;
-
- t1 = time(NULL);
- t2 = mktime(gmtime(&t1));
- return difftime(t2, t1);
-}
-
-void Date_localTime(Pointer p) {
- tmp = localtime((time_t*)p);
- if (DEBUG)
- fprintf (stderr, FMTPTR" = Date_localTime ("FMTPTR")\n",
- (uintptr_t)tmp, (uintptr_t)p);
-}
-
-Int Date_mkTime() {
- return mktime(&tm);
-}
-
-Int Date_strfTime(Pointer buf, Int n, Pointer fmt) {
- return strftime((char*)(buf), n, (char*)(fmt), &tm);
-}
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Debug.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Debug.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Debug.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,31 +0,0 @@
-#include "platform.h"
-
-enum {
- INDENTATION = 1,
-};
-
-static int depth = 0;
-
-static void spaces(int depth) {
- int i;
-
- depth %= 40;
- for (i = 0; i < depth; ++i)
- fprintf(stderr, " ");
-}
-
-void Debug_enter(Pointer name) {
- depth += INDENTATION;
- spaces(depth);
- fprintf(stderr, "Entering ");
- Stdio_print(name);
- fprintf(stderr, "\n");
-}
-
-void Debug_leave(Pointer name) {
- spaces(depth);
- fprintf(stderr, "Leaving ");
- Stdio_print(name);
- fprintf(stderr, "\n");
- depth -= INDENTATION;
-}
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/IEEEReal.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/IEEEReal.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/IEEEReal.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,45 +0,0 @@
-#include "platform.h"
-
-#if !HAS_FEROUND
-
-#if (defined __i386__)
-
-/* Macros for accessing the hardware control word. */
-#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
-#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
-
-#define ROUNDING_CONTROL_MASK 0x0C00
-#define ROUNDING_CONTROL_SHIFT 10
-
-int fegetround () {
- unsigned short controlWord;
-
- _FPU_GETCW (controlWord);
- return (controlWord & ROUNDING_CONTROL_MASK) >> ROUNDING_CONTROL_SHIFT;
-}
-
-static inline void fesetround (int mode) {
- unsigned short controlWord;
-
- _FPU_GETCW (controlWord);
- controlWord &= ~ROUNDING_CONTROL_MASK;
- controlWord |= mode << ROUNDING_CONTROL_SHIFT;
- _FPU_SETCW (controlWord);
-}
-
-#else
-
-#error fe{get,set}round not implemented
-
-#endif
-
-#endif
-
-Int IEEEReal_getRoundingMode () {
- return fegetround ();
-}
-
-void IEEEReal_setRoundingMode (Int m) {
- assert (m != FE_NOSUPPORT);
- fesetround (m);
-}
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,85 +0,0 @@
-#include "platform.h"
-
-Real32 PackReal32_subVec (Pointer v, Int offset) {
- Real32 r;
- pointer p = (pointer)&r;
- pointer s = v + offset;
- int i;
-
- for (i = 0; i < 4; ++i)
- p[i] = s[i];
- return r;
-}
-
-Real32 PackReal32_subVecRev (Pointer v, Int offset) {
- Real32 r;
- pointer p = (pointer)&r;
- pointer s = v + offset;
- int i;
-
- for (i = 0; i < 4; ++i)
- p[i] = s[3 - i];
- return r;
-}
-
-Real64 PackReal64_subVec (Pointer v, Int offset) {
- Real64 r;
- pointer p = (pointer)&r;
- pointer s = v + offset;
- int i;
-
- for (i = 0; i < 8; ++i)
- p[i] = s[i];
- return r;
-}
-
-Real64 PackReal64_subVecRev (Pointer v, Int offset) {
- Real64 r;
- pointer p = (pointer)&r;
- pointer s = v + offset;
- int i;
-
- for (i = 0; i < 8; ++i)
- p[i] = s[7 - i];
- return r;
-}
-
-void PackReal32_update (Pointer a, Int offset, Real32 r) {
- pointer p = (pointer)&r;
- pointer s = a + offset;
- int i;
-
- for (i = 0; i < 4; ++i) {
- s[i] = p[i];
- }
-}
-
-void PackReal32_updateRev (Pointer a, Int offset, Real32 r) {
- pointer p = (pointer)&r;
- pointer s = a + offset;
- int i;
-
- for (i = 0; i < 4; ++i) {
- s[i] = p[3 - i];
- }
-}
-
-void PackReal64_update (Pointer a, Int offset, Real64 r) {
- pointer p = (pointer)&r;
- pointer s = a + offset;
- int i;
-
- for (i = 0; i < 8; ++i) {
- s[i] = p[i];
- }
-}
-
-void PackReal64_updateRev (Pointer a, Int offset, Real64 r) {
- pointer p = (pointer)&r;
- pointer s = a + offset;
- int i;
-
- for (i = 0; i < 8; ++i) {
- s[i] = p[7 - i];
- }
-}
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/IEEEReal.c)
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/PackReal.c (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c)
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,9 +1,9 @@
#include "platform.h"
-void Stdio_print (Pointer s) {
- uintmax_t size = GC_getArrayLength (s);
- if (0 == size)
- return;
- while (1 != fwrite (s, (size_t)size, 1, stderr))
- /* nothing */;
+void Stdio_print (String_t s) {
+ uintmax_t size = GC_getArrayLength (s);
+ if (0 == size)
+ return;
+ while (1 != fwrite (s, (size_t)size, 1, stderr))
+ /* nothing */;
}
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/CommandLine.c (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c)
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/CommandLine.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/CommandLine.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -0,0 +1,6 @@
+#include "platform.h"
+
+/* Manual initialization is a work-around for a Darwin linker issue. */
+C_Int_t CommandLine_argc = 0;
+C_StringArray_t CommandLine_argv = (C_StringArray_t)NULL;
+C_String_t CommandLine_commandName = (C_StringArray_t)NULL;
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Date.c (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c)
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Date.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -0,0 +1,63 @@
+#include "platform.h"
+
+#ifndef DEBUG
+#define DEBUG FALSE
+#endif
+
+static struct tm tm;
+static struct tm *tmp;
+
+C_Int_t Date_Tm_getHour(void) { return tmp->tm_hour; }
+C_Int_t Date_Tm_getIsDst(void) { return tmp->tm_isdst; }
+C_Int_t Date_Tm_getMDay(void) { return tmp->tm_mday; }
+C_Int_t Date_Tm_getMin(void) { return tmp->tm_min; }
+C_Int_t Date_Tm_getMon(void) { return tmp->tm_mon; }
+C_Int_t Date_Tm_getSec(void) { return tmp->tm_sec; }
+C_Int_t Date_Tm_getWDay(void) { return tmp->tm_wday; }
+C_Int_t Date_Tm_getYDay(void) { return tmp->tm_yday; }
+C_Int_t Date_Tm_getYear(void) { return tmp->tm_year; }
+
+void Date_Tm_setHour(C_Int_t x) { tm.tm_hour = x; }
+void Date_Tm_setIsDst(C_Int_t x) { tm.tm_isdst = x; }
+void Date_Tm_setMDay(C_Int_t x) { tm.tm_mday = x; }
+void Date_Tm_setMin(C_Int_t x) { tm.tm_min = x; }
+void Date_Tm_setMon(C_Int_t x) { tm.tm_mon = x; }
+void Date_Tm_setSec(C_Int_t x) { tm.tm_sec = x; }
+void Date_Tm_setWDay(C_Int_t x) { tm.tm_wday = x; }
+void Date_Tm_setYDay(C_Int_t x) { tm.tm_yday = x; }
+void Date_Tm_setYear(C_Int_t x) { tm.tm_year = x; }
+
+C_Errno_t(C_Int_t) Date_gmTime(Ref(C_Time_t) p) {
+ tmp = gmtime((time_t*)p);
+ if (DEBUG)
+ fprintf (stderr, FMTPTR" = Date_gmTime ("FMTPTR")\n",
+ (uintptr_t)tmp, (uintptr_t)p);
+ if (tmp == NULL) return -1;
+ return 0;
+}
+
+/* The idea for Date_localOffset comes from KitV3 src/Runtime/Time.c */
+C_Double_t Date_localOffset(void) {
+ time_t t1, t2;
+
+ t1 = time(NULL);
+ t2 = mktime(gmtime(&t1));
+ return difftime(t2, t1);
+}
+
+C_Errno_t(C_Int_t) Date_localTime(Ref(C_Time_t) p) {
+ tmp = localtime((time_t*)p);
+ if (DEBUG)
+ fprintf (stderr, FMTPTR" = Date_localTime ("FMTPTR")\n",
+ (uintptr_t)tmp, (uintptr_t)p);
+ if (tmp == NULL) return -1;
+ return 0;
+}
+
+C_Errno_t(C_Time_t) Date_mkTime(void) {
+ return mktime(&tm);
+}
+
+C_Size_t Date_strfTime(String_t buf, C_Size_t n, NullString_t fmt) {
+ return strftime((char*)(buf), n, (char*)(fmt), &tm);
+}
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/OS (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/OS)
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/OS/IO/poll.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/OS/IO/poll.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/OS/IO/poll.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,16 +1,21 @@
#include "platform.h"
-Int OS_IO_poll (Fd *fds, Word *eventss, Int n, Int timeout, Word *reventss) {
- int i, res;
- struct pollfd ufds[n];
+C_Int_t OS_IO_poll (Vector(C_Fd_t) fds,
+ Vector(C_Short_t) eventss,
+ C_NFds_t n,
+ C_Int_t timeout,
+ Array(C_Short_t) reventss) {
+ unsigned int i
+ int res;
+ struct pollfd ufds[n];
- for (i = 0; i < n; i++) {
- ufds[i].fd = fds[i];
- ufds[i].events = eventss[i];
- }
- res = poll (ufds, n, timeout);
- for (i = 0; i < n; i++) {
- reventss[i] = ufds[i].revents;
- }
- return res;
+ for (i = 0; i < n; i++) {
+ ufds[i].fd = fds[i];
+ ufds[i].events = eventss[i];
+ }
+ res = poll (ufds, n, timeout);
+ for (i = 0; i < n; i++) {
+ reventss[i] = ufds[i].revents;
+ }
+ return res;
}
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Time.c (from rev 4301, mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c)
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/System/Time.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -0,0 +1,19 @@
+#include "platform.h"
+
+#ifndef DEBUG
+#define DEBUG FALSE
+#endif
+
+static struct timeval timeval;
+
+C_Int_t Time_gettimeofday (void) {
+ int res;
+ res = gettimeofday (&timeval, (struct timezone*)NULL);
+ if (DEBUG)
+ fprintf (stderr, "%d = Time_gettimeofday ()\n", res);
+ return res;
+}
+
+C_Time_t Time_sec (void) { return timeval.tv_sec; }
+
+C_SUSeconds_t Time_usec (void) { return timeval.tv_usec; }
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Time.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -1,24 +0,0 @@
-#include "platform.h"
-
-#ifndef DEBUG
-#define DEBUG FALSE
-#endif
-
-static struct timeval timeval;
-
-Int Time_gettimeofday () {
- Int res;
-
- res = gettimeofday (&timeval, (struct timezone*)NULL);
- if (DEBUG)
- fprintf (stderr, "%d = Time_gettimeofday ()\n", (int)res);
- return res;
-}
-
-Int Time_sec () {
- return timeval.tv_sec;
-}
-
-Int Time_usec () {
- return timeval.tv_usec;
-}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h 2006-01-23 03:12:19 UTC (rev 4302)
@@ -46,10 +46,13 @@
// #include <wchar.h>
// #include <wctype.h>
+
+
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
+#include <poll.h>
#include <termios.h>
#include <utime.h>
#include <sys/resource.h>
Added: mlton/branches/on-20050822-x86_64-branch/runtime/gen/basis-ffi.def
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/basis-ffi.def 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/basis-ffi.def 2006-01-23 03:12:19 UTC (rev 4302)
@@ -0,0 +1,34 @@
+CommandLine.argc = _symbol : C.Int.t
+CommandLine.argv = _symbol : C.StringArray.t
+CommandLine.commandName = _symbol : C.String.t
+Date.Tm.getHour = _import : unit -> C.Int.t
+Date.Tm.getIsDst = _import : unit -> C.Int.t
+Date.Tm.getMDay = _import : unit -> C.Int.t
+Date.Tm.getMin = _import : unit -> C.Int.t
+Date.Tm.getMon = _import : unit -> C.Int.t
+Date.Tm.getSec = _import : unit -> C.Int.t
+Date.Tm.getWDay = _import : unit -> C.Int.t
+Date.Tm.getYDay = _import : unit -> C.Int.t
+Date.Tm.getYear = _import : unit -> C.Int.t
+Date.Tm.setHour = _import : C.Int.t -> unit
+Date.Tm.setIsDst = _import : C.Int.t -> unit
+Date.Tm.setMDay = _import : C.Int.t -> unit
+Date.Tm.setMin = _import : C.Int.t -> unit
+Date.Tm.setMon = _import : C.Int.t -> unit
+Date.Tm.setSec = _import : C.Int.t -> unit
+Date.Tm.setWDay = _import : C.Int.t -> unit
+Date.Tm.setYDay = _import : C.Int.t -> unit
+Date.Tm.setYear = _import : C.Int.t -> unit
+Date.gmTime = _import : C.Time.t ref -> C.Int.t C.Errno.t
+Date.localOffset = _import : unit -> C.Double.t
+Date.localTime = _import : C.Time.t ref -> C.Int.t C.Errno.t
+Date.mkTime = _import : unit -> C.Time.t C.Errno.t
+Date.strfTime = _import : String.t * C.Size.t * NullString.t -> C.Size.t
+OS.IO.POLLIN = _const : C.Short.t
+OS.IO.POLLOUT = _const : C.Short.t
+OS.IO.POLLPRI = _const : C.Short.t
+OS.IO.poll = _import : C.Fd.t vector * C.Short.t vector * C.NFds.t * C.Int.t * C.Short.t array -> C.Int.t
+Stdio.print = _import : String.t -> unit
+Time.gettimeofday = _import : unit -> C.Int.t
+Time.sec = _import : unit -> C.Time.t
+Time.usec = _import : unit -> C.SUSeconds.t
Added: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-basis-ffi.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-basis-ffi.sml 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-basis-ffi.sml 2006-01-23 03:12:19 UTC (rev 4302)
@@ -0,0 +1,376 @@
+(* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh
+ * Jagannathan, and Stephen Weeks.
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure List =
+ struct
+ open List
+
+ fun sort f l =
+ let
+ fun qsort l =
+ case l of
+ [] => []
+ | hd::tl =>
+ let
+ val (lt,eq,gt) =
+ List.foldr
+ (fn (x,(lt,eq,gt)) =>
+ case f (x,hd) of
+ LESS => (x::lt,eq,gt)
+ | EQUAL => (lt,x::eq,gt)
+ | GREATER => (lt,eq,x::gt))
+ ([],[],[])
+ tl
+ val lt = qsort lt
+ val gt = qsort gt
+ in
+ lt @ (hd :: eq) @ gt
+ end
+ in
+ qsort l
+ end
+ end
+
+structure Substring =
+ struct
+ open Substring
+
+ fun droplSpace ss =
+ dropl Char.isSpace ss
+ fun droprSpace ss =
+ dropr Char.isSpace ss
+
+ end
+
+structure Name =
+ struct
+ datatype t = T of string list
+
+ fun compare (T ss1, T ss2) =
+ List.collate
+ (fn (s1,s2) =>
+ String.compare (CharVector.map Char.toLower s1,
+ CharVector.map Char.toLower s2))
+ (ss1, ss2)
+
+ fun last (T ss) = List.last ss
+ fun toC (T ss) =
+ String.concatWith "_" ss
+ fun toML (T ss) =
+ String.concatWith "." ss
+
+ fun parse ss =
+ let
+ val ss = Substring.droplSpace ss
+ val (names, rest) =
+ Substring.splitl
+ (fn c => Char.isAlpha c orelse c = #".")
+ ss
+ val rest = Substring.droplSpace rest
+ in
+ if Substring.isEmpty names
+ then NONE
+ else let
+ val names = Substring.fields (fn c => #"." = c) names
+ val names = List.map Substring.string names
+ in
+ SOME (T names, rest)
+ end
+ end
+ end
+
+
+structure Type =
+ struct
+ datatype t =
+ Array of t
+ | Base of Name.t
+ | Con of Name.t * t
+ | Ref of t
+ | Unit
+ | Vector of t
+
+ fun toC t =
+ case t of
+ Array t => concat ["Array(", toC t, ")"]
+ | Base name => Name.toC name
+ | Con (name, t) => concat [Name.toC name, "(", toC t, ")"]
+ | Ref t => concat ["Ref(", toC t, ")"]
+ | Unit => "void"
+ | Vector t => concat ["Vector(", toC t, ")"]
+ fun toML t =
+ case t of
+ Array t => concat ["(", toML t, ") array"]
+ | Base name => Name.toML name
+ | Con (name, t) => concat ["(", toML t, ") ", Name.toML name]
+ | Ref t => concat ["(", toML t, ") ref"]
+ | Unit => "unit"
+ | Vector t => concat ["(", toML t, ") vector"]
+
+ fun parse s =
+ let
+ fun loop (s, t) =
+ case Name.parse s of
+ NONE => (t, s)
+ | SOME (Name.T ["array"], rest) => loop (rest, Array t)
+ | SOME (Name.T ["ref"], rest) => loop (rest, Ref t)
+ | SOME (Name.T ["vector"], rest) => loop (rest, Vector t)
+ | SOME (name, rest) => loop (rest, Con (name, t))
+ in
+ case Name.parse s of
+ NONE => raise Fail "Type.parse"
+ | SOME (Name.T ["unit"], rest) => loop (rest, Unit)
+ | SOME (name, rest) => loop (rest, Base name)
+ end
+
+ fun parseFn s =
+ let
+ fun loop (s, args) =
+ let
+ val (arg, rest) = parse s
+ in
+ if Substring.isPrefix "*" rest
+ then let
+ val rest = #2 (Substring.splitAt (rest, 1))
+ in
+ loop (rest, arg::args)
+ end
+ else if Substring.isPrefix "->" rest
+ then let
+ val rest = #2 (Substring.splitAt (rest, 2))
+ val (ret, rest) = parse rest
+ in
+ ({args = List.rev (arg::args),
+ ret = ret},
+ rest)
+ end
+ else raise Fail "Type.parseFn"
+ end
+ in
+ loop (s, [])
+ end
+ end
+
+structure Entry =
+ struct
+ datatype t =
+ Const of {name: Name.t,
+ ty: Type.t}
+ | Import of {name: Name.t,
+ ty: {args: Type.t list,
+ ret: Type.t}}
+ | Symbol of {name: Name.t,
+ ty: Type.t}
+
+ fun name entry =
+ case entry of
+ Const {name,...} => name
+ | Import {name,...} => name
+ | Symbol {name,...} => name
+
+ fun compare (entry1, entry2) =
+ Name.compare (name entry1, name entry2)
+
+ fun toC entry =
+ case entry of
+ Const {name, ty} =>
+ String.concat
+ ["/* ",
+ Name.toC name,
+ " */"]
+ | Import {name, ty = {args, ret}} =>
+ String.concat
+ [Type.toC ret,
+ " ",
+ Name.toC name,
+ "(",
+ String.concatWith "," (List.map Type.toC args),
+ ");"]
+ | Symbol {name, ty} =>
+ String.concat
+ ["extern ",
+ Type.toC ty,
+ " ",
+ Name.toC name,
+ ";"]
+ fun toML entry =
+ case entry of
+ Const {name, ty} =>
+ String.concat
+ ["val ",
+ Name.last name,
+ " = _const \"",
+ Name.toC name,
+ "\" : ",
+ Type.toML ty,
+ ";"]
+ | Import {name, ty = {args, ret}} =>
+ String.concat
+ ["val ",
+ Name.last name,
+ " = _import \"",
+ Name.toC name,
+ "\" : ",
+ String.concatWith " * " (List.map Type.toML args),
+ " -> ",
+ Type.toML ret,
+ ";"]
+ | Symbol {name, ty} =>
+ String.concat
+ ["val ",
+ Name.last name,
+ " = #2 (_symbol \"",
+ Name.toC name,
+ "\": (",
+ Type.toML ty,
+ ") GetSet.t;"]
+
+ fun parseConst (s, name) =
+ let
+ val s = #2 (Substring.splitAt (s, 6))
+ val s = Substring.droplSpace s
+ val s = if Substring.isPrefix ":" s
+ then #2 (Substring.splitAt (s, 1))
+ else raise Fail "Entry.parseSymbol"
+ val (ret, rest) = Type.parse s
+ val () = if Substring.isEmpty rest
+ then ()
+ else raise Fail "Entry.parseSymbol"
+ in
+ Const {name = name,
+ ty = ret}
+ end
+
+ fun parseImport (s, name) =
+ let
+ val s = #2 (Substring.splitAt (s, 7))
+ val s = Substring.droplSpace s
+ val s = if Substring.isPrefix ":" s
+ then #2 (Substring.splitAt (s, 1))
+ else raise Fail "Entry.parseImport"
+ val ({args, ret}, rest) = Type.parseFn s
+ val () = if Substring.isEmpty rest
+ then ()
+ else raise Fail "Entry.parseImport"
+ in
+ Import {name = name,
+ ty = {args = args, ret = ret}}
+ end
+
+ fun parseSymbol (s, name) =
+ let
+ val s = #2 (Substring.splitAt (s, 7))
+ val s = Substring.droplSpace s
+ val s = if Substring.isPrefix ":" s
+ then #2 (Substring.splitAt (s, 1))
+ else raise Fail "Entry.parseSymbol"
+ val (ret, rest) = Type.parse s
+ val () = if Substring.isEmpty rest
+ then ()
+ else raise Fail "Entry.parseSymbol"
+ in
+ Symbol {name = name,
+ ty = ret}
+ end
+
+ fun parse s =
+ case Name.parse s of
+ NONE => raise Fail "Entry.parse"
+ | SOME (name, rest) =>
+ if Substring.isPrefix "=" rest
+ then let
+ val rest = #2 (Substring.splitAt (rest, 1))
+ val rest = Substring.droplSpace rest
+ in
+ if Substring.isPrefix "_const" rest
+ then parseConst (rest, name)
+ else if Substring.isPrefix "_import" rest
+ then parseImport (rest, name)
+ else if Substring.isPrefix "_symbol" rest
+ then parseSymbol (rest, name)
+ else raise Fail "Entry.parse"
+ end
+ else raise Fail "Entry.parse"
+ end
+
+val entries =
+ let
+ val f = TextIO.openIn "basis-ffi.def"
+ fun loop entries =
+ case TextIO.inputLine f of
+ NONE => List.rev entries
+ | SOME s => let
+ val entry = Entry.parse (Substring.full s)
+ in
+ loop (entry :: entries)
+ end
+ val entries = loop []
+ val () = TextIO.closeIn f
+ val entries = List.sort Entry.compare entries
+ in
+ entries
+ end
+
+fun outputC entries =
+ let
+ val f = TextIO.openOut "basis-ffi.h"
+ fun print s = TextIO.output (f, s)
+ fun println s = (print s; print "\n")
+
+ val () = println "/* This file is automatically generated. Do not edit. */\n"
+ val () = List.app (fn entry => println (Entry.toC entry)) entries
+ val () = TextIO.closeOut f
+ in
+ ()
+ end
+
+fun outputML entries =
+ let
+ val f = TextIO.openOut "basis-ffi.sml"
+ fun print s = TextIO.output (f, s)
+ fun println s = (print s; print "\n")
+
+ val () = println "(* This file is automatically generated. Do not edit. *)\n"
+ val () = println "structure PrimitiveFFI ="
+ val () = println "struct"
+ val cur =
+ List.foldl
+ (fn (entry, cur) =>
+ let
+ val Name.T names = Entry.name entry
+ val str = List.rev (List.tl (List.rev names))
+ fun loop (cur, str) =
+ case (cur, str) of
+ ([], []) => ()
+ | ([], str) =>
+ List.app (fn s =>
+ (println ("structure " ^ s ^ " = ")
+ ; println "struct"))
+ str
+ | (cur, []) =>
+ List.app (fn _ => println "end") cur
+ | (c::cur,s::str) =>
+ if c = s
+ then loop (cur, str)
+ else (println "end"
+ ; loop (cur, s::str))
+ in
+ loop (cur, str)
+ ; println (Entry.toML entry)
+ ; str
+ end)
+ []
+ entries
+ val () = List.app (fn _ => println "end") cur
+ val () = println "end"
+ val () = TextIO.closeOut f
+ in
+ ()
+ end
+
+val () = outputC entries
+val () = outputML entries
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2006-01-23 03:12:19 UTC (rev 4302)
@@ -47,6 +47,8 @@
"#define Ref(t) Pointer",
"#define Vector(t) Pointer",
"",
+ "typedef void unit;",
+ "",
"typedef int8_t Int8;",
"typedef int16_t Int16;",
"typedef int32_t Int32;",
@@ -84,6 +86,9 @@
"typedef Word32 Word;",
""
"typedef String NullString;",
+ "",
+ "typedef String String_t;",
+ "typedef String NullString_t;",
NULL
};
@@ -117,14 +122,16 @@
static char* suffix[] = {
"",
- "typedef C_Pointer Cpointer;",
- "typedef C_Size Size;",
+ "#define C_Errno_t(t) t",
+ "",
+ "typedef C_Pointer_t Cpointer;",
+ "typedef C_Size_t Size;",
"typedef C_SSize Ssize;",
- "typedef C_String Cstring;",
- "typedef C_StringArray CstringArray;",
+ "typedef C_String_t Cstring;",
+ "typedef C_StringArray_t CstringArray;",
"typedef C_Off Position;"
"",
- "typedef C_Fd Fd;",
+ "typedef C_Fd_t Fd;",
"typedef C_TCFlag Flag;",
"typedef C_GId Gid;",
"typedef C_Mode Mode;",
@@ -155,34 +162,42 @@
writeNewline (fd);
writeString (fd, "/* C */");
writeNewline (fd);
- chkintsystype(char, "C_Char");
- systype(signed char, "Int", "C_SChar");
- systype(unsigned char, "Word", "C_UChar");
- systype(short, "Int", "C_Short");
- systype(unsigned short, "Word", "C_UShort");
- systype(int, "Int", "C_Int");
- systype(unsigned int, "Word", "C_UInt");
- systype(long, "Int", "C_Long");
- systype(unsigned long, "Word", "C_ULong");
- systype(long long, "Int", "C_LongLong");
- systype(unsigned long long, "Word", "C_ULongLong");
- systype(float, "Real", "C_Float");
- systype(double, "Real", "C_Double");
+ chkintsystype(char, "C_Char_t");
+ systype(signed char, "Int", "C_SChar_t");
+ systype(unsigned char, "Word", "C_UChar_t");
+ systype(short, "Int", "C_Short_t");
+ systype(unsigned short, "Word", "C_UShort_t");
+ systype(int, "Int", "C_Int_t");
+ systype(unsigned int, "Word", "C_UInt_t");
+ systype(long, "Int", "C_Long_t");
+ systype(unsigned long, "Word", "C_ULong_t");
+ systype(long long, "Int", "C_LongLong_t");
+ systype(unsigned long long, "Word", "C_ULongLong_t");
+ systype(float, "Real", "C_Float_t");
+ systype(double, "Real", "C_Double_t");
// systype(long double, "Real", "C_LongDouble");
- systype(size_t, "Word", "C_Size");
+ systype(size_t, "Word", "C_Size_t");
writeNewline (fd);
- systype(void*, "Word", "C_Pointer");
- systype(char*, "Word", "C_String");
- systype(char**, "Word", "C_StringArray");
+ systype(void*, "Word", "C_Pointer_t");
+ systype(char*, "Word", "C_String_t");
+ systype(char**, "Word", "C_StringArray_t");
writeNewline (fd);
writeString (fd, "/* C99 */");
writeNewline (fd);
- systype(_Bool, "Word", "C_Bool");
- systype(intmax_t, "Int", "C_Intmax");
- systype(uintmax_t, "Word", "C_Uintmax");
- systype(intptr_t, "Int", "C_Intptr");
- systype(uintptr_t, "Word", "C_UIntptr");
+ systype(_Bool, "Word", "C_Bool_t");
+ systype(intmax_t, "Int", "C_Intmax_t");
+ systype(uintmax_t, "Word", "C_Uintmax_t");
+ systype(intptr_t, "Int", "C_Intptr_t");
+ systype(uintptr_t, "Word", "C_UIntptr_t");
writeNewline (fd);
+ writeString (fd, "/* Generic integers */");
+ writeNewline (fd);
+ systype(int, "Int", "C_Fd_t");
+ writeNewline (fd);
+ writeString (fd, "/* from <poll.h> */");
+ writeNewline (fd);
+ systype(nfds_t, "Word", "C_NFds_t");
+ writeNewline (fd);
writeString (fd, "/* from <sys/resource.h> */");
writeNewline (fd);
systype(rlim_t, "Word", "C_RLim");
@@ -196,19 +211,18 @@
systype(off_t, "Int", "C_Off");
systype(pid_t, "Int", "C_PId");
systype(ssize_t, "Int", "C_SSize");
- // systype(suseconds_t, "Int", "C_SUSeconds");
- chknumsystype(time_t, "C_Time");
+ systype(suseconds_t, "Int", "C_SUSeconds_t");
+ chknumsystype(time_t, "C_Time_t");
chkintsystype(uid_t, "C_UId");
- systype(useconds_t, "Word", "C_USeconds");
+ systype(useconds_t, "Word", "C_USeconds_t");
writeNewline (fd);
writeString (fd, "/* from <termios.h> */");
writeNewline (fd);
systype(tcflag_t, "Word", "C_TCFlag");
systype(speed_t, "Word", "C_Speed");
writeNewline (fd);
- writeString (fd, "/* Generic integers */");
+ writeString (fd, "/* Misc */");
writeNewline (fd);
- systype(int, "Int", "C_Fd");
systype(int, "Int", "C_Resource");
systype(int, "Int", "C_Signal");
systype(int, "Int", "C_Status");
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform.h 2006-01-09 22:47:28 UTC (rev 4301)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform.h 2006-01-23 03:12:19 UTC (rev 4302)
@@ -119,6 +119,7 @@
#endif
#include "types.h"
+#include "basis-ffi.h"
/* ---------------------------------------------------------------- */
/* Runtime Init/Exit */
@@ -178,52 +179,6 @@
/* ---------------------------------------------------------------- */
/* ------------------------------------------------- */
-/* CommandLine */
-/* ------------------------------------------------- */
-
-/* These are initialized by MLton_init. */
-extern Int CommandLine_argc;
-extern CstringArray CommandLine_argv;
-extern Cstring CommandLine_commandName;
-
-/* ------------------------------------------------- */
-/* Date */
-/* ------------------------------------------------- */
-
-Int Date_Tm_sec (void);
-Int Date_Tm_min (void);
-Int Date_Tm_hour (void);
-Int Date_Tm_mday (void);
-Int Date_Tm_mon (void);
-Int Date_Tm_year (void);
-Int Date_Tm_wday (void);
-Int Date_Tm_yday (void);
-Int Date_Tm_isdst (void);
-void Date_Tm_setSec (Int x);
-void Date_Tm_setMin (Int x);
-void Date_Tm_setHour (Int x);
-void Date_Tm_setMday (Int x);
-void Date_Tm_setMon (Int x);
-void Date_Tm_setYear (Int x);
-void Date_Tm_setWday (Int x);
-void Date_Tm_setYday (Int x);
-void Date_Tm_setIsdst (Int x);
-
-Cstring Date_ascTime (void);
-void Date_gmTime (Pointer p);
-Int Date_localOffset (void);
-void Date_localTime (Pointer p);
-Int Date_mkTime (void);
-Int Date_strfTime (Pointer buf, Int n, Pointer fmt);
-
-/* ------------------------------------------------- */
-/* Debug */
-/* ------------------------------------------------- */
-
-void Debug_enter (Pointer name);
-void Debug_leave (Pointer name);
-
-/* ------------------------------------------------- */
/* IEEEReal */
/* ------------------------------------------------- */
@@ -433,9 +388,6 @@
#define OS_IO_POLLPRI POLLPRI
#define OS_IO_POLLOUT POLLOUT
-Cstring OS_FileSys_tmpnam (void);
-Int OS_IO_poll (Int *fds, Word *eventss, Int n, Int timeout, Word *reventss);
-
/* ------------------------------------------------- */
/* PackReal */
/* ------------------------------------------------- */
@@ -1067,26 +1019,6 @@
void INetSock_getInAddr (Pointer addr);
/* ------------------------------------------------- */
-/* Stdio */
-/* ------------------------------------------------- */
-
-void Stdio_print (Pointer s);
-
-/* ------------------------------------------------- */
-/* String */
-/* ------------------------------------------------- */
-
-int String_equal (char * s1, char * s2);
-
-/* ------------------------------------------------- */
-/* Time */
-/* ------------------------------------------------- */
-
-Int Time_gettimeofday (void);
-Int Time_sec (void);
-Int Time_usec (void);
-
-/* ------------------------------------------------- */
/* Windows */
/* ------------------------------------------------- */
@@ -1106,19 +1038,16 @@
Bool Word##size##_negCheckOverflows (WordS##size x);
#define SsubCheckOverflows(size) \
Bool WordS##size##_subCheckOverflows (WordS##size x, WordS##size y);
-
#define all(size) \
SaddCheckOverflows (size) \
UaddCheckOverflows (size) \
- negCheckOverflows (size) \
SmulCheckOverflows (size) \
- SsubCheckOverflows (size) \
-
+ negCheckOverflows (size) \
+ SsubCheckOverflows (size)
all (8)
all (16)
all (32)
all (64)
-
#undef SaddCheckOverflows
#undef UaddCheckOverflows
#undef SmulCheckOverflows