shithub: MicroHs

Download patch

ref: a22244670fecac59e9ccfcf46370dc92109830d7
parent: cf0166d6f96c0980cf5c207866c730f6380f2788
author: Lennart Augustsson <lennart@augustsson.net>
date: Mon Oct 7 16:47:18 EDT 2024

Fix spelling.  Add CTime

--- a/src/runtime/config-unix-64.h
+++ b/src/runtime/config-unix-64.h
@@ -39,6 +39,11 @@
 #define WANT_DIR 1
 
 /*
+ * Include time_t type
+ */
+#define WANT_TIME 1
+
+/*
  * Number of bits in a word.  Only 32 and 64 are supported.
  */
 //#define WORD_SIZE 64
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -19,6 +19,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #endif  /* WANT_DIR */
+#if WANT_TIME
+#include <time.h>
+#endif
 
 #if WANT_MD5
 #include "md5.h"
@@ -4246,6 +4249,9 @@
 MHS_FROM(mhs_from_CLLong, SETINT, long long);
 MHS_FROM(mhs_from_CULLong, SETINT, unsigned long long);
 MHS_FROM(mhs_from_CSize, SETINT, size_t);
+#if WANT_TIME
+MHS_FROM(mhs_from_CTime, SETINT, time_t);
+#endif
 // MHS_FROM(mhs_from_CSSize, SETINT, ssize_t);
 MHS_FROM(mhs_from_CIntPtr, SETINT, intptr_t);
 MHS_FROM(mhs_from_CUIntPtr, SETINT, uintptr_t);
@@ -4279,6 +4285,9 @@
 MHS_TO(mhs_to_CLLong, evalint, long long);
 MHS_TO(mhs_to_CULLong, evalint, unsigned long long);
 MHS_TO(mhs_to_CSize, evalint, size_t);
+#if WANT_TIME
+MHS_TO(mhs_to_CTime, evalint, time_t);
+#endif
 // MHS_TO(mhs_to_CSSize, evalint, ssize_t);
 MHS_TO(mhs_to_CIntPtr, evalint, intptr_t);
 MHS_TO(mhs_to_CUIntPtr, evalint, uintptr_t);
--- a/src/runtime/mhsffi.h
+++ b/src/runtime/mhsffi.h
@@ -39,15 +39,16 @@
 void mhs_from_CChar(intptr_t, int, char);
 void mhs_from_CSChar(intptr_t, int, signed char);
 void mhs_from_CUChar(intptr_t, int, unsigned char);
-void mhs_from_CSHORT(intptr_t, int, short);
-void mhs_from_CUSHORT(intptr_t, int, unsigned short);
-void mhs_from_CINT(intptr_t, int, int);
-void mhs_from_CUINT(intptr_t, int, unsigned int);
-void mhs_from_CLONG(intptr_t, int, long);
-void mhs_from_CULONG(intptr_t, int, unsigned long);
-void mhs_from_CLLONG(intptr_t, int, long long);
-void mhs_from_CULLONG(intptr_t, int, unsigned long long);
+void mhs_from_CShort(intptr_t, int, short);
+void mhs_from_CUShort(intptr_t, int, unsigned short);
+void mhs_from_CInt(intptr_t, int, int);
+void mhs_from_CUInt(intptr_t, int, unsigned int);
+void mhs_from_CLong(intptr_t, int, long);
+void mhs_from_CULong(intptr_t, int, unsigned long);
+void mhs_from_CLLong(intptr_t, int, long long);
+void mhs_from_CULLong(intptr_t, int, unsigned long long);
 void mhs_from_CSize(intptr_t, int, size_t);
+void mhs_from_CTime(intptr_t, int, long); /* XXX wrong */
 // not on MacOS void mhs_from_CSSize(intptr_t, int, ssize_t);
 void mhs_from_CIntPtr(intptr_t, int, intptr_t);
 void mhs_from_CUIntPtr(intptr_t, int, uintptr_t);
@@ -62,15 +63,16 @@
 char               mhs_to_CChar(intptr_t, int);
 signed char        mhs_to_CSChar(intptr_t, int);
 unsigned char      mhs_to_CUChar(intptr_t, int);
-short              mhs_to_CSHORT(intptr_t, int);
-unsigned short     mhs_to_CUSHORT(intptr_t, int);
-int                mhs_to_CINT(intptr_t, int);
-unsigned int       mhs_to_CUINT(intptr_t, int);
-long               mhs_to_CLONG(intptr_t, int);
-unsigned long      mhs_to_CULONG(intptr_t, int);
-long long          mhs_to_CLLONG(intptr_t, int);
-unsigned long long mhs_to_CULLONG(intptr_t, int);
+short              mhs_to_CShort(intptr_t, int);
+unsigned short     mhs_to_CUShort(intptr_t, int);
+int                mhs_to_CInt(intptr_t, int);
+unsigned int       mhs_to_CUInt(intptr_t, int);
+long               mhs_to_CLong(intptr_t, int);
+unsigned long      mhs_to_CULong(intptr_t, int);
+long long          mhs_to_CLLong(intptr_t, int);
+unsigned long long mhs_to_CULLong(intptr_t, int);
 size_t             mhs_to_CSize(intptr_t, int);
+long               mhs_to_CTime(intptr_t, int); /* XXX wrong */
 // ssize_t            mhs_to_CSSize(intptr_t, int);
 intptr_t           mhs_to_CIntPtr(intptr_t, int);
 uintptr_t          mhs_to_CUIntPtr(intptr_t, int);
--