From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "carlo\.bramix" Newsgroups: gmane.lisp.guile.devel Subject: Re: Again on Windows support Date: Fri, 27 Mar 2009 10:39:21 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1238146819 3835 80.91.229.12 (27 Mar 2009 09:40:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2009 09:40:19 +0000 (UTC) To: "guile-devel" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Mar 27 10:41:37 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ln8ZE-0004u2-9E for guile-devel@m.gmane.org; Fri, 27 Mar 2009 10:41:36 +0100 Original-Received: from localhost ([127.0.0.1]:56286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ln8Xq-0002AM-T2 for guile-devel@m.gmane.org; Fri, 27 Mar 2009 05:40:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ln8XK-0001xl-Tg for guile-devel@gnu.org; Fri, 27 Mar 2009 05:39:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ln8XD-0001uO-7O for guile-devel@gnu.org; Fri, 27 Mar 2009 05:39:35 -0400 Original-Received: from [199.232.76.173] (port=41949 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ln8XC-0001uH-R5 for guile-devel@gnu.org; Fri, 27 Mar 2009 05:39:31 -0400 Original-Received: from cp-out4.libero.it ([212.52.84.104]:60361) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ln8XC-0002hp-6R for guile-devel@gnu.org; Fri, 27 Mar 2009 05:39:30 -0400 Original-Received: from libero.it (192.168.17.3) by cp-out4.libero.it (8.5.016.1) id 49BA741E00EEE125 for guile-devel@gnu.org; Fri, 27 Mar 2009 10:39:24 +0100 X-Sensitivity: 3 X-XaM3-API-Version: 4.3 (R1) (B3pl25) X-SenderIP: 213.203.169.135 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8338 Archived-At: Hello, I did a patch in the usual way instead of using GIT. I hope it will be ok anyways. Actually this patch adds the fixes described into the previous emails (st= ill need to know if the mapping created in function make_objcode_by_mmap(= ) needs to be freed somewhere or not!); I was not really ablt to bypass t= he error when it tried to create documentation, so I bypassed it by doing= a little hack into generated Makefile. After that, compilation continued until it said that there was an error w= ith "restrict" keyword. I was forced to change it to "__restrict" or "__r= estrict__" otherwise it did not work. It is already included into my patch too. I think it has been almost compiled now... unfortunately it still fails w= ith another error: I do not know what it means... make[3]: Entering directory `/home/Carlo/g/module' /bin/mkdir -p `dirname system/base/pmatch.go` ../pre-inst-guile-env ../guile-tools compile -o "system/base/pmatch.go" "= ../../guile/module/system/base/pmatch.scm" ERROR: In procedure dynamic-func: ERROR: symbol not found make[3]: *** [system/base/pmatch.go] Error 1 Sincerely, Carlo Bramini. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff -r -u guile-old/configure.in guile-new/configure.in --- guile-old/configure.in Wed Mar 25 09:10:31 2009 +++ guile-new/configure.in Wed Mar 25 09:47:52 2009 @@ -627,7 +627,7 @@ regex.h rxposix.h rx/rxposix.h sys/dir.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 grp.h sys/utsname.h \ -direct.h langinfo.h nl_types.h]) +sys/mman.h direct.h langinfo.h nl_types.h windows.h]) # "complex double" is new in C99, and "complex" is only a keyword if # is included diff -r -u guile-old/lib/time.in.h guile-new/lib/time.in.h --- guile-old/lib/time.in.h Wed Mar 25 09:10:31 2009 +++ guile-new/lib/time.in.h Fri Mar 27 08:55:17 2009 @@ -74,10 +74,10 @@ # define localtime_r rpl_localtime_r # undef gmtime_r # define gmtime_r rpl_gmtime_r -struct tm *localtime_r (time_t const *restrict __timer, - struct tm *restrict __result); -struct tm *gmtime_r (time_t const *restrict __timer, - struct tm *restrict __result); +struct tm *localtime_r (time_t const * __restrict __timer, + struct tm * __restrict __result); +struct tm *gmtime_r (time_t const * __restrict __timer, + struct tm * __restrict __result); # endif /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and = store @@ -86,8 +86,8 @@ # if @REPLACE_STRPTIME@ # undef strptime # define strptime rpl_strptime -char *strptime (char const *restrict __buf, char const *restrict __forma= t, - struct tm *restrict __tm); +char *strptime (char const * __restrict __buf, char const * __restrict _= _format, + struct tm * __restrict __tm); # endif /* Convert TM to a time_t value, assuming UTC. */ Only in guile-new/lib: time.in.h.bak diff -r -u guile-old/libguile/null-threads.h guile-new/libguile/null-thre= ads.h --- guile-old/libguile/null-threads.h Wed Mar 25 09:10:32 2009 +++ guile-new/libguile/null-threads.h Wed Mar 25 09:36:49 2009 @@ -33,18 +33,20 @@ */ #include + +static inline int scm_i_pthread_dummy(void) { return 0; } /* Threads */ #define scm_i_pthread_t int -#define scm_i_pthread_self() 0 +#define scm_i_pthread_self() scm_i_pthread_dummy() #define scm_i_pthread_create(t,a,f,d) (*(t)=3D0, (void)(f), ENOSYS= ) #define scm_i_pthread_detach(t) do { } while (0) #define scm_i_pthread_exit(v) exit(0) -#define scm_i_pthread_cancel(t) 0 -#define scm_i_pthread_cleanup_push(t,v) 0 -#define scm_i_pthread_cleanup_pop(e) 0 -#define scm_i_sched_yield() 0 +#define scm_i_pthread_cancel(t) scm_i_pthread_dummy() +#define scm_i_pthread_cleanup_push(t,v) scm_i_pthread_dummy() +#define scm_i_pthread_cleanup_pop(e) scm_i_pthread_dummy() +#define scm_i_sched_yield() scm_i_pthread_dummy() /* Signals */ @@ -59,7 +61,7 @@ #define scm_i_pthread_mutex_trylock(m) ((*(m))++) #define scm_i_pthread_mutex_lock(m) ((*(m))++) #define scm_i_pthread_mutex_unlock(m) ((*(m))--) -#define scm_i_pthread_mutexattr_recursive 0 +#define scm_i_pthread_mutexattr_recursive scm_i_pthread_dummy() /* Condition variables */ diff -r -u guile-old/libguile/objcodes.c guile-new/libguile/objcodes.c --- guile-old/libguile/objcodes.c Wed Mar 25 09:10:32 2009 +++ guile-new/libguile/objcodes.c Wed Mar 25 09:18:46 2009 @@ -43,10 +43,20 @@ # include #endif +#if HAVE_WINDOWS_H +# define WIN32_LEAN_AND_MEAN +# include +#endif + #include #include #include -#include +#if HAVE_IO_H +# include +#endif +#if HAVE_SYS_MMAN_H +# include +#endif #include #include #include @@ -74,6 +84,9 @@ struct stat st; SCM sret =3D SCM_BOOL_F; struct scm_objcode *data; +#ifdef HAVE_WINDOWS_H + HANDLE hFile, hMapFile; +#endif ret =3D fstat (fd, &st); if (ret < 0) @@ -83,9 +96,28 @@ scm_misc_error (FUNC_NAME, "object file too small (~a bytes)", SCM_LIST1 (SCM_I_MAKINUM (st.st_size))); +#ifdef HAVE_WINDOWS_H + /* Retrieve system handle from fd */ + hFile =3D (HANDLE)_get_osfhandle(fd); + if (hFile =3D=3D INVALID_HANDLE_VALUE) + SCM_SYSERROR; + + /* Create mapping object */ + hMapFile =3D CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)= ; + if (hMapFile =3D=3D INVALID_HANDLE_VALUE) + SCM_SYSERROR; + + /* Select which portions of the file we need (entire file) */ + addr =3D (char *)MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0)= ; + if (addr =3D=3D NULL) { + CloseHandle(hMapFile); + SCM_SYSERROR; + } +#else addr =3D mmap (0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); if (addr =3D=3D MAP_FAILED) SCM_SYSERROR; +#endif if (memcmp (addr, OBJCODE_COOKIE, strlen (OBJCODE_COOKIE))) SCM_SYSERROR; diff -r -u guile-old/libguile/stime.c guile-new/libguile/stime.c --- guile-old/libguile/stime.c Wed Mar 25 09:10:32 2009 +++ guile-new/libguile/stime.c Wed Mar 25 09:39:24 2009 @@ -81,11 +81,11 @@ #include /* for Darwin _NSGetEnviron */ #endif -#ifndef tzname /* For SGI. */ -extern char *tzname[]; /* RS6000 and others reject char **tzname. */ -#endif #if defined (__MINGW32__) # define tzname _tzname +#endif +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ #endif #if ! HAVE_DECL_STRPTIME