guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core ANON-CVS ChangeLog HACKING THA...


From: Martin Grabmueller
Subject: guile/guile-core ANON-CVS ChangeLog HACKING THA...
Date: Tue, 26 Jun 2001 10:53:09 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Martin Grabmueller <address@hidden>     01/06/26 10:53:09

Modified files:
        guile-core     : ANON-CVS ChangeLog HACKING THANKS configure.in 
        guile-core/libguile: ChangeLog _scm.h async.h backtrace.c 
                             filesys.c fports.c gdb_interface.h guile.c 
                             inet_aton.c iselect.h net_db.c ports.c 
                             posix.c random.c scmsigs.c socket.c stime.c 

Log message:
        Make compilation under Windows easier.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/ANON-CVS.diff?cvsroot=OldCVS&tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/ChangeLog.diff?cvsroot=OldCVS&tr1=1.270&tr2=1.271&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/HACKING.diff?cvsroot=OldCVS&tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/THANKS.diff?cvsroot=OldCVS&tr1=1.169&tr2=1.170&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/configure.in.diff?cvsroot=OldCVS&tr1=1.156&tr2=1.157&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/ChangeLog.diff?cvsroot=OldCVS&tr1=1.1451&tr2=1.1452&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/_scm.h.diff?cvsroot=OldCVS&tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/async.h.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/backtrace.c.diff?cvsroot=OldCVS&tr1=1.68&tr2=1.69&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/filesys.c.diff?cvsroot=OldCVS&tr1=1.102&tr2=1.103&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/fports.c.diff?cvsroot=OldCVS&tr1=1.99&tr2=1.100&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/gdb_interface.h.diff?cvsroot=OldCVS&tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/guile.c.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/inet_aton.c.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/iselect.h.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/net_db.c.diff?cvsroot=OldCVS&tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/ports.c.diff?cvsroot=OldCVS&tr1=1.151&tr2=1.152&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/posix.c.diff?cvsroot=OldCVS&tr1=1.90&tr2=1.91&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/random.c.diff?cvsroot=OldCVS&tr1=1.43&tr2=1.44&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/scmsigs.c.diff?cvsroot=OldCVS&tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/socket.c.diff?cvsroot=OldCVS&tr1=1.78&tr2=1.79&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/stime.c.diff?cvsroot=OldCVS&tr1=1.68&tr2=1.69&r1=text&r2=text

Patches:
Index: guile/guile-core/ANON-CVS
diff -u guile/guile-core/ANON-CVS:1.12 guile/guile-core/ANON-CVS:1.13
--- guile/guile-core/ANON-CVS:1.12      Sat Dec 23 09:27:04 2000
+++ guile/guile-core/ANON-CVS   Tue Jun 26 10:53:08 2001
@@ -46,7 +46,6 @@
 The modules available for checkout are:
 
   guile-core --- The scheme interpreter itself.
-  guile-doc --- Guile documentation-in-progress.
   guile-tcltk --- An interface between Guile and Tcl/Tk.
   guile-scsh --- An incomplete port of SCSH 0.4.4 to Guile.
   guile-rgx-ctax --- This has been discontinued; use Andrew Archibald's
Index: guile/guile-core/ChangeLog
diff -u guile/guile-core/ChangeLog:1.270 guile/guile-core/ChangeLog:1.271
--- guile/guile-core/ChangeLog:1.270    Mon Jun 25 15:24:40 2001
+++ guile/guile-core/ChangeLog  Tue Jun 26 10:53:08 2001
@@ -1,3 +1,9 @@
+2001-06-26  Martin Grabmueller  <address@hidden>
+
+       * HACKING, ANON-CVS: Removed mentioning of guile-doc CVS module.
+
+       * configure.in: Added some header and function checks.
+
 2001-06-25  Neil Jerram  <address@hidden>
 
        * autogen.sh: Quoting fix for `--enable-maintainer-mode'.
Index: guile/guile-core/HACKING
diff -u guile/guile-core/HACKING:1.48 guile/guile-core/HACKING:1.49
--- guile/guile-core/HACKING:1.48       Sun Jun 24 20:31:10 2001
+++ guile/guile-core/HACKING    Tue Jun 26 10:53:08 2001
@@ -103,8 +103,6 @@
 The Guile sources live in several modules:
 
   - guile-core --- the interpreter, QuickThreads, and ice-9
-  - guile-doc --- documentation in progress.  When complete, this will
-       be incorporated into guile-core.
   - guile-tcltk --- the Guile/Tk interface
   - guile-tk --- the new Guile/Tk interface, based on STk's modified Tk
   - guile-rgx-ctax --- the Guile/Rx interface, and the ctax implementation
Index: guile/guile-core/THANKS
diff -u guile/guile-core/THANKS:1.169 guile/guile-core/THANKS:1.170
--- guile/guile-core/THANKS:1.169       Tue Jun  5 08:18:46 2001
+++ guile/guile-core/THANKS     Tue Jun 26 10:53:08 2001
@@ -33,6 +33,7 @@
        Utz-Uwe Haus
         Karl M. Hegbloom
         Anders Holst
+         Stefan Jahn
       Steven G. Johnson
        Richard Kim
       Alexander Klimov
Index: guile/guile-core/configure.in
diff -u guile/guile-core/configure.in:1.156 guile/guile-core/configure.in:1.157
--- guile/guile-core/configure.in:1.156 Thu Jun 14 10:36:03 2001
+++ guile/guile-core/configure.in       Tue Jun 26 10:53:08 2001
@@ -192,7 +192,7 @@
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(io.h libc.h limits.h malloc.h memory.h string.h regex.h 
rxposix.h rx/rxposix.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h 
sys/times.h sys/stdtypes.h sys/types.h sys/utime.h time.h unistd.h utime.h)
+AC_CHECK_HEADERS(io.h libc.h limits.h malloc.h memory.h string.h regex.h 
rxposix.h rx/rxposix.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h 
sys/times.h sys/stdtypes.h sys/types.h sys/utime.h time.h unistd.h utime.h 
pwd.h winsock2.h grp.h sys/utsname.h)
 GUILE_HEADER_LIBC_WITH_UNISTD
 
 AC_TYPE_GETGROUPS
@@ -232,7 +232,7 @@
 AC_SUBST(LIBLTDL)
 AC_SUBST(DLPREOPEN)
 
-AC_CHECK_FUNCS(ctermid ftime fchown getcwd geteuid gettimeofday lstat mkdir 
mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid 
setsid sigaction siginterrupt strftime strptime symlink sync tcgetpgrp 
tcsetpgrp times uname waitpid strdup system usleep atexit on_exit)
+AC_CHECK_FUNCS(ctermid ftime fchown getcwd geteuid gettimeofday lstat mkdir 
mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid 
setsid sigaction siginterrupt strftime strptime symlink sync tcgetpgrp 
tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link 
fcntl ttyname getpwent getgrent kill getppid getpgrp fork)
 
 AC_CHECK_HEADERS(crypt.h sys/resource.h sys/file.h)
 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass 
sethostname gethostname)
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1451 
guile/guile-core/libguile/ChangeLog:1.1452
--- guile/guile-core/libguile/ChangeLog:1.1451  Tue Jun 26 08:46:39 2001
+++ guile/guile-core/libguile/ChangeLog Tue Jun 26 10:53:09 2001
@@ -1,3 +1,59 @@
+2001-06-26  Martin Grabmueller  <address@hidden>
+
+       * ports.c (scm_output_port_p): Use result of SCM_COERCE_OUTPORT.
+
+       The following set of changes makes compiling Guile under various
+       Windows compilers easier.  Compilation under GNU systems should
+       not be affected at all.
+
+       Thanks to Stefan Jahn for all necessary information, patches and
+       testing.
+       
+       * posix.c: Conditialize getpwent, getgrent, kill, getppid, getuid,
+       getpgrp, ttyname, primitive-fork and some header inclusion for
+       Windows.
+
+       * random.c: Define M_PI, if not predefined and use __int64 for
+       LONG64 under Windows.
+
+       * scmsigs.c: Emulate some functions (alarm, sleep, kill) under
+       Windows and conditionalize some signal names.
+
+       * socket.c (scm_getsockopt): Added missing comma.  
+       Include socket library header under Windows.
+
+       * stime.c (CLKTCK): Add cast to int, to make it compile under
+       Windows.
+
+       * ports.c (truncate): New function, compiled only under Windows.
+
+       * net_db.c: Do not declare errno under Windows.
+
+       * iselect.h, inet_aton.c: Include socket library headers under
+       Windows.
+
+       * guile.c (inner_main): Under Windows, initialize socket library
+       and initialize gdb_interface data structures.
+
+       * gdb_interface.h: Under Windows, gdb_interface cannot be
+       initialized statically.  Initialize at runtime instead.
+
+       * fports.c (write_all): ssize_t -> size_t.
+       (fport_print): Conditionalize call to ttyname().
+       (getflags): New function, compiled only under Windows.
+
+       * filesys.c: Conditionalize inclusion of <pwd.h>.  Conditionalize
+       primitives chown, link, fcntl.
+       (scm_basename, scm_dirname): Under Windows, handle \ as well as /
+       as path seperator.
+
+       * backtrace.c: Include <io.h> under Windows.
+
+       * async.h (ASYNCH, SCM_ASYNC_H): Rename <foo>H to SCM_<foo>_H.
+
+       * _scm.h: Added preprocessor conditional for __MINGW32__ for errno
+       declaration.
+
 2001-06-27  Keisuke Nishida  <address@hidden>
 
        * eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3,
Index: guile/guile-core/libguile/_scm.h
diff -u guile/guile-core/libguile/_scm.h:1.23 
guile/guile-core/libguile/_scm.h:1.24
--- guile/guile-core/libguile/_scm.h:1.23       Tue May 15 07:57:22 2001
+++ guile/guile-core/libguile/_scm.h    Tue Jun 26 10:53:09 2001
@@ -111,13 +111,13 @@
 # define SCM_SYSCALL(line) line;
 #endif /* ndef SCM_SYSCALL */
 
-#ifndef MSDOS
+#if !defined (MSDOS) && !defined (__MINGW32__)
 # ifdef ARM_ULIB
     extern volatile int errno;
 # else
     extern int errno;
 # endif /* def ARM_ULIB */
-#endif /* ndef MSDOS */
+#endif /* ndef MSDOS && ndef __MINGW32__*/
 
 
 
Index: guile/guile-core/libguile/async.h
diff -u guile/guile-core/libguile/async.h:1.17 
guile/guile-core/libguile/async.h:1.18
--- guile/guile-core/libguile/async.h:1.17      Wed Jun 28 03:26:52 2000
+++ guile/guile-core/libguile/async.h   Tue Jun 26 10:53:09 2001
@@ -1,7 +1,7 @@
 /* classes: h_files */
 
-#ifndef ASYNCH
-#define ASYNCH
+#ifndef SCM_ASYNC_H
+#define SCM_ASYNC_H
 /* Copyright (C) 1995, 96, 97, 98, 2000 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -70,7 +70,7 @@
 extern SCM scm_mask_signals (void);
 extern void scm_init_async (void);
 
-#endif  /* ASYNCH */
+#endif  /* SCM_ASYNC_H */
 
 /*
   Local Variables:
Index: guile/guile-core/libguile/backtrace.c
diff -u guile/guile-core/libguile/backtrace.c:1.68 
guile/guile-core/libguile/backtrace.c:1.69
--- guile/guile-core/libguile/backtrace.c:1.68  Sat Jun 23 08:25:57 2001
+++ guile/guile-core/libguile/backtrace.c       Tue Jun 26 10:53:09 2001
@@ -54,6 +54,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
 
 #include "libguile/stacks.h"
 #include "libguile/srcprop.h"
Index: guile/guile-core/libguile/filesys.c
diff -u guile/guile-core/libguile/filesys.c:1.102 
guile/guile-core/libguile/filesys.c:1.103
--- guile/guile-core/libguile/filesys.c:1.102   Tue Jun 26 03:59:34 2001
+++ guile/guile-core/libguile/filesys.c Tue Jun 26 10:53:09 2001
@@ -93,7 +93,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif
 
 
 #if HAVE_DIRENT_H
@@ -117,6 +119,26 @@
 #if defined (S_IFSOCK) && ! defined (S_ISSOCK)
 #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
 #endif
+
+/* The MinGW gcc does not define the S_ISSOCK macro. Any other native Windows
+   compiler like BorlandC or MSVC has none of these macros defined. */
+#ifdef __MINGW32__
+# define S_ISSOCK(mode) (0)
+#endif
+#if defined (__BORLANDC__) || defined (_MSC_VER)
+# define S_ISBLK(mode) (0)
+# define S_ISFIFO(mode) (((mode) & _S_IFMT) == _S_IFIFO)
+# define S_ISCHR(mode) (((mode) & _S_IFMT) == _S_IFCHR)
+# define S_ISDIR(mode) (((mode) & _S_IFMT) == _S_IFDIR)
+# define S_ISREG(mode) (((mode) & _S_IFMT) == _S_IFREG)
+#endif
+
+/* Some more definitions for the native Windows port. */
+#ifdef __MINGW32__
+# define mkdir(path, mode) mkdir (path)
+# define fsync(fd) _commit (fd)
+# define fchmod(fd, mode) (-1)
+#endif /* __MINGW32__ */
 
 
 
@@ -125,6 +147,7 @@
 /* {Permissions}
  */
 
+#ifdef HAVE_CHOWN
 SCM_DEFINE (scm_chown, "chown", 3, 0, 0, 
             (SCM object, SCM owner, SCM group),
            "Change the ownership and group of the file referred to by 
@var{object} to\n"
@@ -167,6 +190,7 @@
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
+#endif /* HAVE_CHOWN */
 
 
 SCM_DEFINE (scm_chmod, "chmod", 2, 0, 0,
@@ -561,6 +585,7 @@
 /* {Modifying Directories}
  */
 
+#ifdef HAVE_LINK
 SCM_DEFINE (scm_link, "link", 2, 0, 0,
             (SCM oldpath, SCM newpath),
            "Creates a new name @var{newpath} in the file system for the\n"
@@ -582,6 +607,7 @@
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
+#endif /* HAVE_LINK */
 
 
 
@@ -1145,6 +1171,7 @@
 
 
 
+#ifdef HAVE_FCNTL
 SCM_DEFINE (scm_fcntl, "fcntl", 2, 1, 0,
             (SCM object, SCM cmd, SCM value),
            "Apply @var{command} to the specified file descriptor or the 
underlying\n"
@@ -1199,6 +1226,7 @@
   return SCM_MAKINUM (rv);
 }
 #undef FUNC_NAME
+#endif /* HAVE_FCNTL */
 
 SCM_DEFINE (scm_fsync, "fsync", 1, 0, 0, 
             (SCM object),
@@ -1368,12 +1396,22 @@
   len = SCM_STRING_LENGTH (filename);
 
   i = len - 1;
+#ifdef __MINGW32__
+  while (i >= 0 && (s[i] == '/' || s[i] == '\\')) --i;
+  while (i >= 0 && (s[i] != '/' || s[i] != '\\')) --i;
+  while (i >= 0 && (s[i] == '/' || s[i] == '\\')) --i;
+#else
   while (i >= 0 && s[i] == '/') --i;
   while (i >= 0 && s[i] != '/') --i;
   while (i >= 0 && s[i] == '/') --i;
+#endif /* ndef __MINGW32__ */
   if (i < 0)
     {
+#ifdef __MINGW32__
+      if (len > 0 && (s[0] == '/' || s[0] == '\\'))
+#else
       if (len > 0 && s[0] == '/')
+#endif /* ndef __MINGW32__ */
        return scm_substring (filename, SCM_INUM0, SCM_MAKINUM (1));
       else
        return scm_dot_string;
@@ -1407,15 +1445,27 @@
       j = SCM_STRING_LENGTH (suffix) - 1;
     }
   i = len - 1;
+#ifdef __MINGW32__
+  while (i >= 0 && (f[i] == '/' || f[i] == '\\')) --i;
+#else
   while (i >= 0 && f[i] == '/') --i;
+#endif /* ndef __MINGW32__ */
   end = i;
   while (i >= 0 && j >= 0 && f[i] == s[j]) --i, --j;
   if (j == -1)
     end = i;
+#ifdef __MINGW32__
+  while (i >= 0 && (f[i] != '/' || f[i] != '\\')) --i;
+#else
   while (i >= 0 && f[i] != '/') --i;
+#endif /* ndef __MINGW32__ */
   if (i == end)
     {
+#ifdef __MINGW32__
+      if (len > 0 && (f[0] == '/' || f[i] == '\\'))
+#else
       if (len > 0 && f[0] == '/')
+#endif /* ndef __MINGW32__ */
        return scm_substring (filename, SCM_INUM0, SCM_MAKINUM (1));
       else
        return scm_dot_string;
Index: guile/guile-core/libguile/fports.c
diff -u guile/guile-core/libguile/fports.c:1.99 
guile/guile-core/libguile/fports.c:1.100
--- guile/guile-core/libguile/fports.c:1.99     Thu Jun 14 12:50:43 2001
+++ guile/guile-core/libguile/fports.c  Tue Jun 26 10:53:09 2001
@@ -68,6 +68,12 @@
 #include <errno.h>
 
 #include "libguile/iselect.h"
+/* Some defines for Windows. */
+#ifdef __MINGW32__
+# include <sys/stat.h>
+# include <winsock2.h>
+# define ftruncate(fd, size) chsize (fd, size)
+#endif /* __MINGW32__ */
 
 
 scm_t_bits scm_tc16_fport;
@@ -349,6 +355,46 @@
 #undef FUNC_NAME
 
 
+#ifdef __MINGW32__
+/*
+ * Try getting the appropiate file flags for a given file descriptor
+ * under Windows. This incorporates some fancy operations because Windows
+ * differentiates between file, pipe and socket descriptors.
+ */
+#ifndef O_ACCMODE
+# define O_ACCMODE 0x0003
+#endif
+
+static int getflags (int fdes)
+{
+  int flags = 0;
+  struct stat buf;
+  int error, optlen = sizeof (int);
+
+  /* Is this a socket ? */
+  if (getsockopt (fdes, SOL_SOCKET, SO_ERROR, (void *) &error, &optlen) >= 0)
+    flags = O_RDWR;
+  /* Maybe a regular file ? */
+  else if (fstat (fdes, &buf) < 0)
+    flags = -1;
+  else
+    {
+      /* Or an anonymous pipe handle ? */
+      if (buf.st_mode & 0x1000 /* _O_SHORT_LIVED */)
+       flags = O_RDWR;
+      /* stdin ? */
+      else if (fdes == 0 && isatty (fdes))
+       flags = O_RDONLY;
+      /* stdout / stderr ? */
+      else if ((fdes == 1 || fdes == 2) && isatty (fdes))
+       flags = O_WRONLY;
+      else
+       flags = buf.st_mode;
+    }
+  return flags;
+}
+#endif /* __MINGW32__ */
+
 /* Building Guile ports from a file descriptor.  */
 
 /* Build a Scheme port from an open file descriptor `fdes'.
@@ -366,7 +412,11 @@
   int flags;
 
   /* test that fdes is valid.  */
+#ifdef __MINGW32__
+  flags = getflags (fdes);
+#else
   flags = fcntl (fdes, F_GETFL, 0);
+#endif
   if (flags == -1)
     SCM_SYSERROR;
   flags &= O_ACCMODE;
@@ -456,9 +506,11 @@
       scm_putc (' ', port);
       fdes = (SCM_FSTREAM (exp))->fdes;
       
+#ifdef HAVE_TTYNAME
       if (isatty (fdes))
        scm_puts (ttyname (fdes), port);
       else
+#endif /* HAVE_TTYNAME */
        scm_intprint (fdes, 10, port);
     }
   else
@@ -595,7 +647,7 @@
 
   while (remaining > 0)
     {
-      ssize_t done;
+      size_t done;
 
       SCM_SYSCALL (done = write (fdes, data, remaining));
 
Index: guile/guile-core/libguile/gdb_interface.h
diff -u guile/guile-core/libguile/gdb_interface.h:1.9 
guile/guile-core/libguile/gdb_interface.h:1.10
--- guile/guile-core/libguile/gdb_interface.h:1.9       Sun Jun  3 16:32:27 2001
+++ guile/guile-core/libguile/gdb_interface.h   Tue Jun 26 10:53:09 2001
@@ -58,6 +58,7 @@
    interface in your main program.  This is necessary if the interface
    is defined in a library, such as Guile. */
 
+#ifndef __MINGW32__
 #define GDB_INTERFACE \
 void *gdb_interface[] = { \
   &gdb_options, \
@@ -71,6 +72,27 @@
   (void *) gdb_print, \
   (void *) gdb_binding \
 }
+#else /* __MINGW32__ */
+/* Because the following functions are imported from a DLL (some kind of
+   shared library) these are NO static initializers. That is why you need to
+   define them and assign the functions and data items at run time. */
+#define GDB_INTERFACE \
+void *gdb_interface[] = \
+  { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+#define GDB_INTERFACE_INIT \
+  do { \
+    gdb_interface[0] = &gdb_options; \
+    gdb_interface[1] = &gdb_language; \
+    gdb_interface[2] = &gdb_result; \
+    gdb_interface[3] = &gdb_output; \
+    gdb_interface[4] = &gdb_output_length; \
+    gdb_interface[5] = (void *) gdb_maybe_valid_type_p; \
+    gdb_interface[6] = (void *) gdb_read; \
+    gdb_interface[7] = (void *) gdb_eval; \
+    gdb_interface[8] = (void *) gdb_print; \
+    gdb_interface[9] = (void *) gdb_binding; \
+  } while (0);
+#endif /* __MINGW32__ */
 
 /* GDB_OPTIONS is a set of flags informing gdb what features are present
    in the interface.  Currently only one option is supported: */
Index: guile/guile-core/libguile/guile.c
diff -u guile/guile-core/libguile/guile.c:1.7 
guile/guile-core/libguile/guile.c:1.8
--- guile/guile-core/libguile/guile.c:1.7       Thu Jun  7 14:12:19 2001
+++ guile/guile-core/libguile/guile.c   Tue Jun 26 10:53:09 2001
@@ -55,6 +55,10 @@
 #include <libltdl/ltdl.h>
 #endif
 
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
 /* Debugger interface (don't change the order of the following lines) */
 #define GDB_TYPE SCM
 #include <libguile/gdb_interface.h>
@@ -63,8 +67,19 @@
 static void
 inner_main (void *closure SCM_UNUSED, int argc, char **argv)
 {
+#ifdef __MINGW32__
+  /* This is necessary to startup the Winsock API under Win32. */
+  WSADATA WSAData;
+  WSAStartup (0x0202, &WSAData);
+  GDB_INTERFACE_INIT;
+#endif /* __MINGW32__ */
+
   /* module initializations would go here */
   scm_shell (argc, argv);
+
+#ifdef __MINGW32__
+  WSACleanup ();
+#endif /* __MINGW32__ */
 }
 
 int
Index: guile/guile-core/libguile/inet_aton.c
diff -u guile/guile-core/libguile/inet_aton.c:1.6 
guile/guile-core/libguile/inet_aton.c:1.7
--- guile/guile-core/libguile/inet_aton.c:1.6   Mon Jun 12 14:24:29 2000
+++ guile/guile-core/libguile/inet_aton.c       Tue Jun 26 10:53:09 2001
@@ -40,9 +40,13 @@
 
 #include <ctype.h>
 
+#ifdef __MINGW32__
+#include <winsock2.h>
+#else
 #include <sys/param.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 #if 0
 
Index: guile/guile-core/libguile/iselect.h
diff -u guile/guile-core/libguile/iselect.h:1.8 
guile/guile-core/libguile/iselect.h:1.9
--- guile/guile-core/libguile/iselect.h:1.8     Sun Mar 19 11:01:12 2000
+++ guile/guile-core/libguile/iselect.h Tue Jun 26 10:53:09 2001
@@ -67,6 +67,10 @@
 #include <sys/select.h>
 #endif
 
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
 #ifdef FD_SET
 
 #define SELECT_TYPE fd_set
Index: guile/guile-core/libguile/net_db.c
diff -u guile/guile-core/libguile/net_db.c:1.60 
guile/guile-core/libguile/net_db.c:1.61
--- guile/guile-core/libguile/net_db.c:1.60     Tue Jun 26 03:59:34 2001
+++ guile/guile-core/libguile/net_db.c  Tue Jun 26 10:53:09 2001
@@ -66,12 +66,17 @@
 #endif
 
 #include <sys/types.h>
+
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
-#ifndef HAVE_H_ERRNO
+#if !defined (HAVE_H_ERRNO) && !defined (__MINGW32__)
 /* h_errno not found in netdb.h, maybe this will help.  */
 extern int h_errno;
 #endif
Index: guile/guile-core/libguile/ports.c
diff -u guile/guile-core/libguile/ports.c:1.151 
guile/guile-core/libguile/ports.c:1.152
--- guile/guile-core/libguile/ports.c:1.151     Tue Jun 26 08:46:40 2001
+++ guile/guile-core/libguile/ports.c   Tue Jun 26 10:53:09 2001
@@ -77,6 +77,11 @@
 #include <sys/ioctl.h>
 #endif
 
+#ifdef __MINGW32__
+#include <fcntl.h>
+#define ftruncate(fd, size) chsize (fd, size)
+#endif
+
 
 /* The port kind table --- a dynamically resized array of port types.  */
 
@@ -802,7 +807,7 @@
            "@code{port?}.")
 #define FUNC_NAME s_scm_output_port_p
 {
-  SCM_COERCE_OUTPORT (x);
+  x = SCM_COERCE_OUTPORT (x);
   return SCM_BOOL (SCM_OUTPUT_PORT_P (x));
 }
 #undef FUNC_NAME
@@ -1324,6 +1329,20 @@
   return scm_long2num (rv);
 }
 #undef FUNC_NAME
+
+#ifdef __MINGW32__
+/* Define this function since it is not supported under Windows. */
+static int truncate (char *file, int length)
+{
+  int ret = -1, fdes;
+  if ((fdes = open (file, O_BINARY | O_WRONLY)) != -1)
+    {
+      ret = chsize (fdes, length);
+      close (fdes);
+    }
+  return ret;
+}
+#endif /* __MINGW32__ */
 
 SCM_DEFINE (scm_truncate_file, "truncate-file", 1, 1, 0,
             (SCM object, SCM length),
Index: guile/guile-core/libguile/posix.c
diff -u guile/guile-core/libguile/posix.c:1.90 
guile/guile-core/libguile/posix.c:1.91
--- guile/guile-core/libguile/posix.c:1.90      Wed May 23 17:50:47 2001
+++ guile/guile-core/libguile/posix.c   Tue Jun 26 10:53:09 2001
@@ -91,7 +91,20 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
+#ifdef __MINGW32__
+/* Some defines for Windows here. */
+# define pipe(fd) _pipe (fd, 256, O_BINARY)
+#endif /* __MINGW32__ */
 
 #if HAVE_SYS_WAIT_H
 # include <sys/wait.h>
@@ -107,8 +120,12 @@
 
 extern char ** environ;
 
+#ifdef HAVE_GRP_H
 #include <grp.h>
+#endif
+#ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
+#endif
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
@@ -247,7 +264,7 @@
 #undef FUNC_NAME  
 #endif
 
-
+#ifdef HAVE_GETPWENT
 SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
             (SCM user),
            "Look up an entry in the user database.  @var{obj} can be an 
integer,\n"
@@ -298,6 +315,7 @@
   return result;
 }
 #undef FUNC_NAME
+#endif /* HAVE_GETPWENT */
 
 
 #ifdef HAVE_SETPWENT
@@ -317,8 +335,8 @@
 #undef FUNC_NAME
 #endif
 
-
 
+#ifdef HAVE_GETGRENT
 /* Combines getgrgid and getgrnam.  */
 SCM_DEFINE (scm_getgrgid, "getgr", 0, 1, 0,
             (SCM name),
@@ -375,9 +393,9 @@
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
+#endif /* HAVE_GETGRENT */
 
 
-
 SCM_DEFINE (scm_kill, "kill", 2, 0, 0,
             (SCM pid, SCM sig),
            "Sends a signal to the specified process or group of processes.\n\n"
@@ -407,8 +425,13 @@
   SCM_VALIDATE_INUM (1,pid);
   SCM_VALIDATE_INUM (2,sig);
   /* Signal values are interned in scm_init_posix().  */
+#ifdef HAVE_KILL
   if (kill ((int) SCM_INUM (pid), (int) SCM_INUM (sig)) != 0)
-    SCM_SYSERROR;
+#else
+  if ((int) SCM_INUM (pid) == getpid ())
+    if (raise ((int) SCM_INUM (sig)) != 0)
+#endif
+      SCM_SYSERROR;
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
@@ -472,6 +495,7 @@
 #undef FUNC_NAME
 #endif /* HAVE_WAITPID */
 
+#ifndef __MINGW32__
 SCM_DEFINE (scm_status_exit_val, "status:exit-val", 1, 0, 0, 
             (SCM status),
            "Return the exit status value, as would be set if a process\n"
@@ -528,7 +552,9 @@
     return SCM_BOOL_F;
 }
 #undef FUNC_NAME
+#endif /* __MINGW32__ */
 
+#ifdef HAVE_GETPPID
 SCM_DEFINE (scm_getppid, "getppid", 0, 0, 0,
             (),
            "Return an integer representing the process ID of the parent\n"
@@ -538,9 +564,10 @@
   return SCM_MAKINUM (0L + getppid ());
 }
 #undef FUNC_NAME
+#endif /* HAVE_GETPPID */
 
 
-
+#ifndef __MINGW32__
 SCM_DEFINE (scm_getuid, "getuid", 0, 0, 0,
             (),
            "Return an integer representing the current real user ID.")
@@ -549,6 +576,7 @@
   return SCM_MAKINUM (0L + getuid ());
 }
 #undef FUNC_NAME
+#endif /* __MINGW32__ */
 
 
 
@@ -580,7 +608,6 @@
 #undef FUNC_NAME
 
 
-
 SCM_DEFINE (scm_getegid, "getegid", 0, 0, 0,
             (),
            "Return an integer representing the current effective group ID.\n"
@@ -675,6 +702,8 @@
 #undef FUNC_NAME
 #endif
 
+
+#ifdef HAVE_GETPGRP
 SCM_DEFINE (scm_getpgrp, "getpgrp", 0, 0, 0,
             (),
            "Return an integer representing the current process group ID.\n"
@@ -686,6 +715,8 @@
   return SCM_MAKINUM (fn (0));
 }
 #undef FUNC_NAME
+#endif /* HAVE_GETPGRP */
+
 
 #ifdef HAVE_SETPGID
 SCM_DEFINE (scm_setpgid, "setpgid", 2, 0, 0, 
@@ -724,6 +755,7 @@
 #undef FUNC_NAME
 #endif /* HAVE_SETSID */
 
+#ifdef HAVE_TTYNAME
 SCM_DEFINE (scm_ttyname, "ttyname", 1, 0, 0, 
             (SCM port),
            "Return a string with the name of the serial terminal device\n"
@@ -745,6 +777,7 @@
   return (scm_makfrom0str (ans));
 }
 #undef FUNC_NAME
+#endif /* HAVE_TTYNAME */
 
 #ifdef HAVE_CTERMID
 SCM_DEFINE (scm_ctermid, "ctermid", 0, 0, 0,
@@ -947,6 +980,7 @@
 }
 #undef FUNC_NAME
 
+#ifdef HAVE_FORK
 SCM_DEFINE (scm_fork, "primitive-fork", 0, 0, 0,
             (),
            "Creates a new \"child\" process by duplicating the current 
\"parent\" process.\n"
@@ -963,6 +997,7 @@
   return SCM_MAKINUM (0L+pid);
 }
 #undef FUNC_NAME
+#endif /* HAVE_FORK */
 
 #ifdef HAVE_UNAME
 SCM_DEFINE (scm_uname, "uname", 0, 0, 0,
Index: guile/guile-core/libguile/random.c
diff -u guile/guile-core/libguile/random.c:1.43 
guile/guile-core/libguile/random.c:1.44
--- guile/guile-core/libguile/random.c:1.43     Thu Jun 14 12:50:43 2001
+++ guile/guile-core/libguile/random.c  Tue Jun 26 10:53:09 2001
@@ -91,6 +91,10 @@
 
 #define A 2131995753UL
 
+#ifndef M_PI
+#define M_PI 3.14159265359
+#endif
+
 #if SIZEOF_LONG > 4
 #if SIZEOF_INT > 4
 #define LONG32 unsigned short
@@ -100,7 +104,11 @@
 #define LONG64 unsigned long
 #else
 #define LONG32 unsigned long
+#ifdef __MINGW32__
+#define LONG64 unsigned __int64
+#else
 #define LONG64 unsigned long long
+#endif
 #endif
 
 #if SIZEOF_LONG > 4 || defined (HAVE_LONG_LONGS)
Index: guile/guile-core/libguile/scmsigs.c
diff -u guile/guile-core/libguile/scmsigs.c:1.59 
guile/guile-core/libguile/scmsigs.c:1.60
--- guile/guile-core/libguile/scmsigs.c:1.59    Tue Jun 26 08:46:40 2001
+++ guile/guile-core/libguile/scmsigs.c Tue Jun 26 10:53:09 2001
@@ -74,6 +74,14 @@
 
 #endif
 
+#ifdef __MINGW32__
+#include <windows.h>
+#define alarm(sec) (0)
+/* This weird comma expression is because Sleep is void under Windows. */
+#define sleep(sec) (Sleep ((sec) * 1000), 0)
+#define kill(pid, sig) raise (sig)
+#endif
+
 
 
 /* SIGRETTYPE is the type that signal handlers return.  See <signal.h> */
@@ -298,12 +306,16 @@
     case SIGFPE:
     case SIGILL:
     case SIGSEGV:
+#ifdef SIGBUS
     case SIGBUS:
+#endif
     case SIGABRT:
 #if defined(SIGIOT) && (SIGIOT != SIGABRT)
     case SIGIOT:
 #endif
+#ifdef SIGTRAP
     case SIGTRAP:
+#endif
 #ifdef SIGEMT
     case SIGEMT:
 #endif
Index: guile/guile-core/libguile/socket.c
diff -u guile/guile-core/libguile/socket.c:1.78 
guile/guile-core/libguile/socket.c:1.79
--- guile/guile-core/libguile/socket.c:1.78     Tue Jun 26 03:59:34 2001
+++ guile/guile-core/libguile/socket.c  Tue Jun 26 10:53:09 2001
@@ -63,6 +63,9 @@
 #include <unistd.h>
 #endif
 #include <sys/types.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
 #ifdef HAVE_UNIX_DOMAIN_SOCKETS
 #include <sys/un.h>
@@ -70,6 +73,7 @@
 #include <netinet/in.h>
 #include <netdb.h>
 #include <arpa/inet.h>
+#endif
 
 #if defined (HAVE_UNIX_DOMAIN_SOCKETS) && !defined (SUN_LEN)
 #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
@@ -523,7 +527,7 @@
          return scm_cons (scm_long2num (ling->l_onoff),
                           scm_long2num (ling->l_linger));
 #else
-         return scm_cons (scm_long2num (*(int *) optval)
+         return scm_cons (scm_long2num (*(int *) optval),
                           SCM_MAKINUM (0));
 #endif
        }
Index: guile/guile-core/libguile/stime.c
diff -u guile/guile-core/libguile/stime.c:1.68 
guile/guile-core/libguile/stime.c:1.69
--- guile/guile-core/libguile/stime.c:1.68      Tue Jun 26 03:59:34 2001
+++ guile/guile-core/libguile/stime.c   Tue Jun 26 10:53:09 2001
@@ -99,10 +99,10 @@
 
 /* This should be figured out by autoconf.  */
 #if ! defined(CLKTCK) && defined(CLK_TCK)
-#  define CLKTCK CLK_TCK
+#  define CLKTCK ((int) CLK_TCK)
 #endif
 #if ! defined(CLKTCK) && defined(CLOCKS_PER_SEC)
-#  define CLKTCK CLOCKS_PER_SEC
+#  define CLKTCK ((int) CLOCKS_PER_SEC)
 #endif
 #if ! defined(CLKTCK)
 #  define CLKTCK 60



reply via email to

[Prev in Thread] Current Thread [Next in Thread]