(g2-UU+5B73): Add `=decomposition@hanyo-denshi'.
[chise/xemacs-chise.git.1] / src / systime.h
index d0f4ae1..915cf29 100644 (file)
@@ -24,14 +24,14 @@ Boston, MA 02111-1307, USA.  */
 #define INCLUDED_systime_h_
 
 #ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
+# include <sys/time.h>
+# include <time.h>
 #else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
+# ifdef HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
 #endif
 
 /* select() is supposed to be (Unix98) defined in sys/time.h,
@@ -41,17 +41,39 @@ Boston, MA 02111-1307, USA.  */
 #include <unistd.h>
 #endif
 
-#if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS)
+#ifdef WIN32_NATIVE
+
+/* This defines struct timeval */
+#include <winsock.h>
+
+struct timezone 
+  {
+    int        tz_minuteswest; /* minutes west of Greenwich */
+    int        tz_dsttime;     /* type of dst correction */
+  };
+
+#ifdef HAVE_X_WINDOWS
 /* Provides gettimeofday etc */
 #include <X11/Xw32defs.h>
 #include <X11/Xos.h>
-#endif
+#else
+/* X11R6 on NT provides the single parameter version of this command */
+void gettimeofday (struct timeval *, struct timezone *);
+#endif /* HAVE_X_WINDOWS */
 
-#ifdef HAVE_UTIME_H
+#endif /* WIN32_NATIVE */
+
+/* struct utimbuf */
+
+#ifdef HAVE_UTIME
 # include <utime.h>
 #endif
 
-#if defined(HAVE_TZNAME) && !defined(WINDOWSNT) && !defined(__CYGWIN32__)
+#ifdef WIN32_NATIVE
+# include <sys/utime.h>
+#endif
+
+#if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN)
 #ifndef tzname         /* For SGI.  */
 extern char *tzname[]; /* RS6000 and others want it this way.  */
 #endif
@@ -147,37 +169,23 @@ do {                                              \
 #define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds))
 
 #if !defined (HAVE_GETTIMEOFDAY)
-struct timezone;
-int gettimeofday (struct timeval *, struct timezone *);
+int gettimeofday (struct timeval *, void *);
 #endif
 
 /* On SVR4, the compiler may complain if given this extra BSD arg.  */
 #ifdef GETTIMEOFDAY_ONE_ARGUMENT
-# ifdef SOLARIS2
-/* Solaris (at least) omits this prototype.  IRIX5 has it and chokes if we
-   declare it here. */
-int gettimeofday (struct timeval *);
-# endif
+#define EMACS_GETTIMEOFDAY(time) gettimeofday(time)
+#else
+#define EMACS_GETTIMEOFDAY(time) gettimeofday(time,0)
+#endif
+
 /* According to the Xt sources, some NTP daemons on some systems may
    return non-normalized values. */
 #define EMACS_GET_TIME(time)                                   \
 do {                                                           \
-  gettimeofday (&(time));                                      \
+  EMACS_GETTIMEOFDAY (&(time));                                        \
   EMACS_NORMALIZE_TIME (time);                                 \
 } while (0)
-#else /* not GETTIMEOFDAY_ONE_ARGUMENT */
-# ifdef SOLARIS2
-/* Solaris doesn't provide any prototype of this unless a bunch of
-   crap we don't define are defined. */
-int gettimeofday (struct timeval *, void *dummy);
-# endif
-#define EMACS_GET_TIME(time)                                   \
-do {                                                           \
-  struct timezone dummy;                                       \
-  gettimeofday (&(time), &dummy);                              \
-  EMACS_NORMALIZE_TIME (time);                                 \
-} while (0)
-#endif /* not GETTIMEOFDAY_ONE_ARGUMENT */
 
 #define EMACS_NORMALIZE_TIME(time)                             \
 do {                                                           \
@@ -226,12 +234,14 @@ do {                                                              \
 #define EMACS_SET_SECS_USECS(time, secs, usecs)                \
   (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs))
 
-int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime);
+#ifdef emacs
+int set_file_times (Lisp_Object path, EMACS_TIME atime, EMACS_TIME mtime);
+#endif
 
 void get_process_times (double *user_time, double *system_time,
                        double *real_time);
 
-#if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__)
+#if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN)
 
 /* setitimer emulation for Win32 (see nt.c) */
 
@@ -241,12 +251,46 @@ struct itimerval
   struct timeval it_interval;
 };
 
-int setitimer (int kind, const struct itimerval* itnew,
-              struct itimerval* itold);
-
 #define ITIMER_REAL 1
 #define ITIMER_PROF 2
 
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE || BROKEN_CYGWIN */
+
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
+
+int mswindows_setitimer (int kind, const struct itimerval *itnew,
+                        struct itimerval *itold);
+
+#endif /* defined (WIN32_NATIVE) || defined (CYGWIN) */
+
+/* #### Move this comment elsewhere when we figure out the place.
+
+   "qxe" is a unique prefix used to identify encapsulations of standard
+   library functions.  We used to play pre-processing games but in
+   general this leads to nothing but trouble because someone first
+   encountering the code will have no idea that what appears to be a
+   call to a library function has actually been redefined to be a call
+   somewhere else.  This is doubly true when the redefinition occurs
+   in out-of-the way s+m files and only on certainly systems.
+
+   By making the encapsulation explicit we might be making the code
+   that uses is slightly less pretty, but this is more than compensated
+   for by the huge increase in clarity.
+
+   "Standard library function" can refer to any function in any
+   standard library.  If we are explicitly changing the semantics
+   (e.g. Mule-encapsulating), we should use an extended version of
+   the prefix, e.g. perhaps "qxe_xlat_" for functions that Mule-
+   encapsulate, or "qxe_retry_" for functions that automatically
+   retry a system call interrupted by EINTR.  In general, if there
+   is no prefix extension, it means the function is trying to
+   provide (more or less) the same semantics as the standard library
+   function; but be aware that the reimplementation may be incomplete
+   or differ in important respects.  This is especially the case
+   when attempts are made to implement Unix functions on MS Windows.
+*/
+
+int qxe_setitimer (int kind, const struct itimerval *itnew,
+                  struct itimerval *itold);
 
 #endif /* INCLUDED_systime_h_ */