diff -ru gcl-2.6.8.orig/configure gcl-2.6.8/configure --- gcl-2.6.8.orig/configure 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/configure 2013-09-05 15:07:38.000000000 +0900 @@ -6249,6 +6249,9 @@ /* end confdefs.h. */ #include #include +#ifdef __CYGWIN__ +#define getpagesize() 4096 +#endif int main() {size_t i=getpagesize(),j; FILE *fp=fopen("conftest1","w"); for (j=0;i>>=1;j++); @@ -6299,7 +6302,7 @@ b = (void *) malloc(1000); fp = fopen("conftest1","w"); -#ifdef _WIN32 +#if defined (_WIN32) || defined (__CYGWIN__) fprintf(fp,"_dbegin"); #else #if defined (__APPLE__) && defined (__MACH__) diff -ru gcl-2.6.8.orig/h/gnuwin95.defs gcl-2.6.8/h/gnuwin95.defs --- gcl-2.6.8.orig/h/gnuwin95.defs 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/h/gnuwin95.defs 2013-09-05 14:24:47.000000000 +0900 @@ -18,7 +18,7 @@ # This CC string will be used for compilation of the system, # and also in the compiler::*cc* variable for later compilation of # lisp files. -CC = gcc -fwritable-strings -DVOL=volatile -I$(GCLDIR)/o -fsigned-char +CC = gcc -DVOL=volatile -I$(GCLDIR)/o -fsigned-char AS= as AR= ar q RANLIB= ranlib @@ -26,6 +26,9 @@ LDCC=${CC} +# Unexec dependency +UNIX_SAVE_DEP = unexnt.c + # Enable the fastloading mechanism which does not use ld -A # requires c/rel_.. machine dependent code. diff -ru gcl-2.6.8.orig/h/gnuwin95.h gcl-2.6.8/h/gnuwin95.h --- gcl-2.6.8.orig/h/gnuwin95.h 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/h/gnuwin95.h 2013-09-25 19:58:43.715233300 +0900 @@ -3,9 +3,8 @@ /* #include "386.h" */ /* #include "fcntl.h" */ -#undef DBEGIN -/* we want finer than config.h */ -#define DBEGIN 0x1a000000 +#define DBEGIN_TY unsigned long +extern DBEGIN_TY _dbegin; @@ -20,7 +19,7 @@ /* #define BABY_MALLOC_SIZE 0x5000 */ /* #define RECREATE_HEAP if (initflag) recreate_heap(argv[0]); */ -#define RECREATE_HEAP if (initflag) recreate_heap1(); +/* #define RECREATE_HEAP if (initflag) recreate_heap1(); */ #ifdef IN_UNIXTIME #undef ATT @@ -35,12 +34,6 @@ #define BSD #endif -#define NEED_TO_REINSTALL_SIGNALS - -#ifndef SIGIO -#define SIGIO 23 -#endif - /* on most machines this will test in one instruction if the pointe/r is on the C stack or the 0 pointer in winnt our heap starts at DBEGIN @@ -48,7 +41,7 @@ /* #define NULL_OR_ON_C_STACK(y)\ */ /* (((unsigned int)(y)) == 0 || \ */ /* (((unsigned int)(y)) < DBEGIN && ((unsigned int)(y)) &0xf000000)) */ -#define NULL_OR_ON_C_STACK(y) (((void *)(y)) < ((void *)0x400000)) +#define NULL_OR_ON_C_STACK(x) (!(int *)x || ((int *)x>cs_limit && (int *)x<=cs_org)) @@ -58,16 +51,15 @@ #define HAVE_SIGACTION /* a noop */ #define SETUP_SIG_STACK -#define SV_ONSTACK 0 -#if 0 /* Different definition in - 2001-12-18 */ -#define SA_RESTART 0 -#endif +#define SA_ONSTACK 0 #define brk(x) printf("not doing break\n"); #include #include #define UNIXSAVE "unexnt.c" +#define MAXPATHLEN 260 +#define SEPARATE_SFASL_FILE "sfaslcoff.c" #define SPECIAL_RSYM "rsym_nt.c" #define HAVE_AOUT "wincoff.h" @@ -92,6 +84,7 @@ #define FCLOSE_SETBUF_OK +#define RUN_PROCESS #define IEEEFLOAT @@ -110,8 +103,12 @@ #define RELOC_FILE "rel_coff.c" -/* FIONREAD not supported */ #undef LISTEN_FOR_INPUT +#define LISTEN_FOR_INPUT(fp) do { \ + int c = 0; \ + if (((fp)->_r <= 0) && (ioctl((fp)->_file, FIONREAD, &c), c<=0)) \ + return 0; \ +} while (0) /* adjust the start to the offset */ #define ADJUST_RELOC_START(j) \ @@ -133,11 +130,22 @@ error("Someone allocated my memory!");} \ if (core_end != (sbrk(PAGESIZE*(n - m)))) - /* allow things like //c at beginning of pathnames, and c:/ */ -#define ALLOW_DRIVE_PATH - - -#define USE_INTERNAL_REAL_TIME_FOR_RUNTIME +#include +#include +#define GET_FULL_PATH_SELF(a_) do {\ + char b[20];\ + static char q[PATH_MAX];\ + struct stat ss;\ + if (snprintf(b,sizeof(b),"/proc/%d/exe",getpid())<=0)\ + error("Cannot write proc exe pathname");\ + if (stat(b,&ss)) \ + (a_)=argv[0];\ + else {\ + if (!realpath(b,q)) \ + error("realpath error");\ + (a_)=q;\ + }\ +} while(0) /* Begin for cmpinclude */ diff -ru gcl-2.6.8.orig/o/alloc.c gcl-2.6.8/o/alloc.c --- gcl-2.6.8.orig/o/alloc.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/alloc.c 2013-09-22 16:51:41.000000000 +0900 @@ -81,6 +81,10 @@ /* extern char etext; */ #endif +#ifdef __CYGWIN__ +void recreate_heap1(void); +#endif + int reserve_pages_for_signal_handler =30; int hole_overrun=0; @@ -1507,6 +1511,9 @@ return baby_malloc(size); #else +#ifdef __CYGWIN__ + recreate_heap1(); +#endif if (!initflag) gcl_init_alloc(); #ifdef RECREATE_HEAP diff -ru gcl-2.6.8.orig/o/file.d gcl-2.6.8/o/file.d --- gcl-2.6.8.orig/o/file.d 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/file.d 2013-09-23 21:15:35.000000000 +0900 @@ -1252,7 +1252,7 @@ #ifdef HAVE_READLINE if (readline_on && strm->sm.sm_fp==rl_instream) - return *rl_line_buffer ? TRUE : FALSE; + if (rl_line_buffer && !(*rl_line_buffer)) return FALSE; #endif if (strm->sm.sm_fp == NULL) closed_stream(strm); diff -ru gcl-2.6.8.orig/o/firstfile.c gcl-2.6.8/o/firstfile.c --- gcl-2.6.8.orig/o/firstfile.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/firstfile.c 2013-09-22 16:51:41.000000000 +0900 @@ -21,7 +21,6 @@ #include "config.h" -#ifdef _WIN32 /* See comments in lastfile.c. */ char my_begdata[] = "Beginning of Emacs initialized data"; char my_begbss[1]; /* Do not initialize this variable. */ @@ -33,4 +32,3 @@ extern int initialized; static int * dummy = &initialized; #endif -#endif diff -ru gcl-2.6.8.orig/o/lastfile.c gcl-2.6.8/o/lastfile.c --- gcl-2.6.8.orig/o/lastfile.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/lastfile.c 2013-09-22 16:51:41.000000000 +0900 @@ -40,7 +40,6 @@ char my_edata[] = "End of Emacs initialized data"; -#ifdef _WIN32 /* Help unexec locate the end of the .bss area used by Emacs (which isn't always a separate section in NT executables). */ char my_endbss[1]; @@ -49,4 +48,3 @@ of the bss area used by Emacs. */ static char _my_endbss[1]; char * my_endbss_static = _my_endbss; -#endif diff -ru gcl-2.6.8.orig/o/main.c gcl-2.6.8/o/main.c --- gcl-2.6.8.orig/o/main.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/main.c 2013-09-22 16:51:41.000000000 +0900 @@ -99,6 +99,9 @@ #ifdef _WIN32 unsigned int _dbegin = 0x10100000; #endif +#ifdef __CYGWIN__ +unsigned long _dbegin = 0; +#endif int cssize; diff -ru gcl-2.6.8.orig/o/ntheap.h gcl-2.6.8/o/ntheap.h --- gcl-2.6.8.orig/o/ntheap.h 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/ntheap.h 2013-09-22 16:51:41.000000000 +0900 @@ -60,7 +60,7 @@ extern int os_subtype; /* Emulation of Unix sbrk(). */ -extern void *sbrk (unsigned long size); +extern void *sbrk (ptrdiff_t size); /* Recreate the heap created during dumping. */ extern void recreate_heap (char *executable_path); diff -ru gcl-2.6.8.orig/o/pathname.d gcl-2.6.8/o/pathname.d --- gcl-2.6.8.orig/o/pathname.d 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/pathname.d 2013-09-22 16:51:41.000000000 +0900 @@ -25,6 +25,7 @@ This file contains those functions that interpret namestrings. */ +#include #include "include.h" @@ -394,7 +395,7 @@ #ifdef FIX_FILENAME {char buf[MAXPATHLEN]; if (i > MAXPATHLEN-1) i =MAXPATHLEN-1; - bcopy(token->st.st_self,buf,i); + memcpy(buf,token->st.st_self,i); buf[i]=0; FIX_FILENAME(x,buf); return (make_simple_string(buf)); diff -ru gcl-2.6.8.orig/o/run_process.c gcl-2.6.8/o/run_process.c --- gcl-2.6.8.orig/o/run_process.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/run_process.c 2013-09-22 16:51:41.000000000 +0900 @@ -384,7 +384,11 @@ FEerror("Connection Failed.",0); } pid = getpid(); +#ifdef __CYGWIN__ + if(fcntl(sock, F_SETOWN, pid) < 0) +#else if(ioctl(sock, SIOCSPGRP, (char *)&pid) < 0 ) +#endif { FEerror("Could not set process group of socket.",0); } diff -ru gcl-2.6.8.orig/o/unexnt.c gcl-2.6.8/o/unexnt.c --- gcl-2.6.8.orig/o/unexnt.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/unexnt.c 2013-09-22 16:51:41.000000000 +0900 @@ -959,7 +959,11 @@ unsigned long base = DBEGIN; /* 27MB */ /* unsigned long base = 0x01B00000; */ /* 27MB */ +#ifdef __CYGWIN__ + unsigned long end = base + (PAGESIZE*MAXPAGE); +#else unsigned long end = 2*PAGESIZE*MAXPAGE; /* 256MB */ +#endif void *ptr = NULL; #define NTHEAP_PROBE_BASE 0 @@ -991,7 +995,7 @@ /* Emulate Unix sbrk. */ void * -sbrk (unsigned long increment) +sbrk (ptrdiff_t increment) { void *result; long size = (long) increment; @@ -1069,6 +1073,11 @@ return result; } +#ifdef __CYGWIN__ +/* Emulate Unix getpagesize. */ +int getpagesize (void) { return 4096; } +#endif + /* Recreate the heap from the data that was dumped to the executable. EXECUTABLE_PATH tells us where to find the executable. */ void diff -ru gcl-2.6.8.orig/o/unixtime.c gcl-2.6.8/o/unixtime.c --- gcl-2.6.8.orig/o/unixtime.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/unixtime.c 2013-09-22 17:05:24.000000000 +0900 @@ -273,6 +273,12 @@ #elif defined NO_SYSTEM_TIME_ZONE return 0; +#elif defined __CYGWIN__ + struct tm gt,lt; + fixnum _t=0; + gmtime_r(&_t, >); + localtime_r(&_t, <); + return (lt.tm_mday == gt.tm_mday) ? -(lt.tm_hour) : (24 - lt.tm_hour); #else fixnum _t=time(0); return -localtime(&_t)->tm_gmtoff/3600; diff -ru gcl-2.6.8.orig/o/xdrfuns.c gcl-2.6.8/o/xdrfuns.c --- gcl-2.6.8.orig/o/xdrfuns.c 2013-07-12 00:28:16.000000000 +0900 +++ gcl-2.6.8/o/xdrfuns.c 2013-09-22 16:51:41.000000000 +0900 @@ -20,7 +20,11 @@ #ifdef AIX3 #include #endif +#ifdef __CYGWIN__ +#include +#else /* __CYGWIN__ */ #include +#endif /* __CYGWIN__ */ extern short aet_sizes[]; static object