commit f8bee183527654bfcb4da35ed5909a78a10a63a3
parent 34a7dcff6a99288737db249fbe5af6158a041a68
Author: a-ito <a-ito>
Date: Fri, 9 Nov 2001 04:59:17 +0000
Updates from 0.2.1 into 0.2.1-inu-1.5
Diffstat:
243 files changed, 32801 insertions(+), 21853 deletions(-)
diff --git a/Bonus/html2latex b/Bonus/html2latex
@@ -490,7 +490,7 @@ until f.eof?
print "\\begin{document}\n"
$in_document = TRUE
end
- # enviconment push
+ # environment push
if act[1].kind_of?(Hash) &&
(tok.tagname != "p" || tok.switch('align') != nil) then
intp.dup
diff --git a/Patches/alpha b/Patches/alpha
@@ -1,19 +0,0 @@
-*** gc/Makefile.orig Thu Jun 24 10:08:17 1999
---- gc/Makefile Thu Jun 24 10:08:54 1999
-***************
-*** 10,16 ****
- ABI_FLAG=
- CC=cc $(ABI_FLAG)
- CXX=CC $(ABI_FLAG)
-! AS=as $(ABI_FLAG)
- # The above doesn't work with gas, which doesn't run cpp.
- # Define AS as `gcc -c -x assembler-with-cpp' instead.
- # Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
---- 10,16 ----
- ABI_FLAG=
- CC=cc $(ABI_FLAG)
- CXX=CC $(ABI_FLAG)
-! AS=gcc -c -x assembler-with-cpp
- # The above doesn't work with gas, which doesn't run cpp.
- # Define AS as `gcc -c -x assembler-with-cpp' instead.
- # Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
diff --git a/Patches/armlinux b/Patches/armlinux
@@ -1,110 +0,0 @@
-From lars@junk.nocrew.org Tue Mar 7 04:44 EST 2000
-Return-Path: <lars@junk.nocrew.org>
-Received: from ei5sun.yz.yamagata-u.ac.jp (ei5sun.yz.yamagata-u.ac.jp [133.24.114.42])
- by ei5hp710.yz.yamagata-u.ac.jp (8.9.3/8.9.3) with ESMTP id EAA25953
- for <aito@ei5hp710.yz.yamagata-u.ac.jp>; Tue, 7 Mar 2000 04:44:51 -0500 (EST)
-Received: from junk.nocrew.org (mail@[212.73.17.42]) by ei5sun.yz.yamagata-u.ac.jp (8.8.0/3.5Wbeta) with ESMTP id SAA07952 for <aito@ei5sun.yz.yamagata-u.ac.jp>; Tue, 7 Mar 2000 18:54:43 +0900 (JST)
-Received: from lars by junk.nocrew.org with local (Exim 3.03 #1 (Debian))
- for aito@ei5sun.yz.yamagata-u.ac.jp
- id 12SGVE-0001rh-00; Tue, 07 Mar 2000 10:42:08 +0100
-To: aito@ei5sun.yz.yamagata-u.ac.jp
-Subject: ARMLinux patch
-From: lars brinkhoff <lars@nocrew.org>
-Date: 07 Mar 2000 10:42:08 +0100
-Message-ID: <85zosbjevj.fsf@junk.nocrew.org>
-Lines: 89
-User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5
-MIME-Version: 1.0
-Content-Type: text/plain; charset=us-ascii
-Sender: lars brinkhoff <lars@junk.nocrew.org>
-
-This patch is an attempt to make w3m version 0.1.6 work in ARMLinux.
-It seems to work well.
-
---- gc/gcconfig.h.org Wed Jan 12 05:23:37 2000
-+++ gc/gcconfig.h Sun Mar 5 14:24:52 2000
-@@ -151,6 +151,10 @@
- # define SPARC
- # define mach_type_known
- # endif
-+# if defined(LINUX) && (defined(__arm__) || defined(arm))
-+# define ARM
-+# define mach_type_known
-+# endif
- # if defined(__alpha) || defined(__alpha__)
- # define ALPHA
- # if !defined(LINUX)
-@@ -985,6 +989,39 @@
- # define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
- # define DATAEND (&_end)
- # define HEURISTIC2
-+# endif
-+
-+# ifdef ARM
-+# define MACH_TYPE "ARM"
-+# ifdef LINUX
-+# define OS_TYPE "LINUX"
-+# define HEURISTIC1
-+# define STACKBOTTOM ((ptr_t) 0xbffffffc)
-+# ifdef __ELF__
-+# define DYNAMIC_LOADING
-+# include <features.h>
-+# if defined(__GLIBC__) && __GLIBC__ >= 2
-+ extern int __data_start;
-+# define DATASTART ((ptr_t)(&__data_start))
-+# else
-+ extern char **__environ;
-+# define DATASTART ((ptr_t)(&__environ))
-+ /* hideous kludge: __environ is the first */
-+ /* word in crt0.o, and delimits the start */
-+ /* of the data segment, no matter which */
-+ /* ld options were passed through. */
-+ /* We could use _etext instead, but that */
-+ /* would include .rodata, which may */
-+ /* contain large read-only data tables */
-+ /* that we'd rather not scan. */
-+# endif
-+ extern int _end;
-+# define DATAEND (&_end)
-+# else
-+ ARMLinux non elf ?
-+# endif
-+# endif
-+# define ALIGNMENT 4
- # endif
-
- # ifndef STACK_GROWS_UP
-diff -ur gc/mach_dep.c w3m-0.1.6.lars/gc/mach_dep.c
---- gc/mach_dep.c.org Wed Jan 12 05:23:37 2000
-+++ gc/mach_dep.c Thu Jan 27 21:28:39 2000
-@@ -337,7 +337,7 @@
- /* other machines... */
- # if !(defined M68K) && !(defined VAX) && !(defined RT)
- # if !(defined SPARC) && !(defined I386) && !(defined NS32K)
--# if !defined(POWERPC) && !defined(UTS4)
-+# if !defined(POWERPC) && !defined(UTS4) && !defined(ARM)
- --> bad news <--
- # endif
- # endif
-diff -ur w3m/gc/os_dep.c w3m-0.1.6.lars/gc/os_dep.c
---- gc/os_dep.c.org Wed Jan 12 05:23:37 2000
-+++ gc/os_dep.c Thu Jan 27 21:37:27 2000
-@@ -72,7 +72,7 @@
- # define NEED_FIND_LIMIT
- # endif
-
--# if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA))
-+# if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA) || defined (ARM))
- # define NEED_FIND_LIMIT
- # endif
-
-@@ -139,7 +139,7 @@
- # define OPT_PROT_EXEC 0
- #endif
-
--#if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA))
-+#if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA) || defined(ARM))
- /* The I386 case can be handled without a search. The Alpha case */
- /* used to be handled differently as well, but the rules changed */
- /* for recent Linux versions. This seems to be the easiest way to */
-
diff --git a/Patches/ews4800 b/Patches/ews4800
@@ -1,34 +1,175 @@
---- XMakefile.orig Mon Mar 19 10:47:56 2001
-+++ XMakefile Mon Mar 19 21:03:34 2001
-@@ -65,7 +65,7 @@
- $(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o $(LIBS)
-
- gc/gc.a:
-- cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS)'
-+ cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS) -Dmips'
-
- install: $(TARGETS)
- -$(MKDIR) $(DESTDIR)$(BIN_DIR)
---- gc/Makefile.orig Tue Jan 4 14:46:50 2000
-+++ gc/Makefile Thu Mar 22 18:10:10 2001
-@@ -7,7 +7,7 @@
- # and runs some tests of collector and cords. Does not add cords or
- # c++ interface to gc.a
- # cord/de - builds dumb editor based on cords.
--ABI_FLAG=
-+ABI_FLAG=-Kconform_pic
- CC=cc $(ABI_FLAG)
- CXX=CC $(ABI_FLAG)
- AS=as $(ABI_FLAG)
---- gc/gcconfig.h.orig Tue Jun 6 14:39:29 2000
-+++ gc/gcconfig.h Mon Mar 19 21:02:51 2001
-@@ -64,7 +64,8 @@
- # endif
- # if defined(mips) || defined(__mips)
- # define MIPS
--# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
-+# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__) ||\
-+ defined(nec_ews)
- # define ULTRIX
- # else
- # if !defined(LINUX)
+diff -bcrN gc.org/doc/README.ews4800 gc/doc/README.ews4800
+*** gc.org/doc/README.ews4800 Thu Jan 1 09:00:00 1970
+--- gc/doc/README.ews4800 Wed Jul 25 17:38:57 2001
+***************
+*** 0 ****
+--- 1,75 ----
++ GC on EWS4800
++ -------------
++
++ 1. About EWS4800
++ EWS4800 is 32bit/64bit workstation.
++
++ Vender: NEC Corporation
++ OS: UX/4800 R9.* - R13.* (SystemV R4.2)
++ CPU: R4000, R4400, R10000 (MIPS)
++
++ 2. Compiler
++
++ 32bit:
++ Use ANSI C compiler.
++ CC = /usr/abiccs/bin/cc
++
++ 64bit:
++ Use 64bit ANSI C compiler.
++ CC = /usr/ccs64/bin/cc
++ AR = /usr/ccs64/bin/ar
++
++ 3. ELF file format
++ *** Caution: The following infomation is empirical. ***
++
++ 32bit:
++ ELF file has an unique format. (See a.out(4) and end(3C).)
++
++ &_start
++ : text segment
++ &etext
++ DATASTART
++ : data segment (initialized)
++ &edata
++ DATASTART2
++ : data segment (uninitialized)
++ &end
++
++ Here, DATASTART and DATASTART2 are macros of GC, and are defined as
++ the following equations. (See include/private/gcconfig.h.)
++ The algorithm for DATASTART is similar with the function
++ GC_SysVGetDataStart() in os_dep.c.
++
++ DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff)
++
++ Dynamically linked:
++ DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff
++
++ Statically linked:
++ DATASTART2 = &edata
++
++ GC has to check addresses both between DATASTART and &edata, and
++ between DATASTART2 and &end. If a program accesses between &etext
++ and DATASTART, or between &edata and DATASTART2, the segmentation
++ error occurs and the program stops.
++
++ If a program is statically linked, there is not a gap between
++ &edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used
++ for the detection.
++
++ 64bit:
++ ELF file has a simple format. (See end(3C).)
++
++ _ftext
++ : text segment
++ _etext
++ _fdata = DATASTART
++ : data segment (initialized)
++ _edata
++ _fbss
++ : data segment (uninitialized)
++ _end = DATAEND
++
++ --
++ Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
++
+diff -bcrN gc.org/include/private/gcconfig.h gc/include/private/gcconfig.h
+*** gc.org/include/private/gcconfig.h Sun Jul 1 06:29:27 2001
+--- gc/include/private/gcconfig.h Wed Jul 25 17:38:57 2001
+***************
+*** 75,83 ****
+ # endif
+ # define mach_type_known
+ # endif
+! # if defined(mips) || defined(__mips)
+ # define MIPS
+! # if !defined(LINUX)
+ # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
+ # define ULTRIX
+ # else
+--- 75,86 ----
+ # endif
+ # define mach_type_known
+ # endif
+! # if defined(mips) || defined(__mips) || defined(_mips)
+ # define MIPS
+! # if defined(nec_ews) || defined(_nec_ews)
+! # define EWS4800
+! # endif
+! # if !defined(LINUX) && !defined(EWS4800)
+ # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
+ # define ULTRIX
+ # else
+***************
+*** 1083,1088 ****
+--- 1086,1114 ----
+ /* instead. But some kernel versions seem to give the wrong */
+ /* value from /proc. */
+ # endif /* Linux */
++ # ifdef EWS4800
++ # define HEURISTIC2
++ # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
++ extern int _fdata[], _end[];
++ # define DATASTART ((ptr_t)_fdata)
++ # define DATAEND ((ptr_t)_end)
++ # define CPP_WORDSZ _MIPS_SZPTR
++ # define ALIGNMENT (_MIPS_SZPTR/8)
++ # else
++ extern int etext, edata, end;
++ extern int _DYNAMIC_LINKING, _gp;
++ # define DATASTART ((ptr_t)((((word)&etext + 0x3ffff) & ~0x3ffff) \
++ + ((word)&etext & 0xffff)))
++ # define DATAEND (&edata)
++ # define DATASTART2 (&_DYNAMIC_LINKING \
++ ? (ptr_t)(((word)&_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
++ : (ptr_t)&edata)
++ # define DATAEND2 (&end)
++ # define ALIGNMENT 4
++ # endif
++ # define OS_TYPE "EWS4800"
++ # define USE_GENERIC_PUSH_REGS 1
++ # endif
+ # ifdef ULTRIX
+ # define HEURISTIC2
+ # define DATASTART (ptr_t)0x10000000
+diff -bcrN gc.org/mach_dep.c gc/mach_dep.c
+*** gc.org/mach_dep.c Thu Jun 28 05:54:23 2001
+--- gc/mach_dep.c Wed Jul 25 17:38:57 2001
+***************
+*** 429,435 ****
+ *i = 0;
+ }
+ # if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
+! || defined(UTS4) || defined(LINUX)
+ (void) setjmp(regs);
+ # else
+ (void) _setjmp(regs);
+--- 429,435 ----
+ *i = 0;
+ }
+ # if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
+! || defined(UTS4) || defined(LINUX) || defined(EWS4800)
+ (void) setjmp(regs);
+ # else
+ (void) _setjmp(regs);
+diff -bcrN gc.org/os_dep.c gc/os_dep.c
+*** gc.org/os_dep.c Tue Jun 26 11:32:26 2001
+--- gc/os_dep.c Wed Jul 25 17:38:57 2001
+***************
+*** 1088,1093 ****
+--- 1088,1096 ----
+ GC_add_roots_inner(DATASTART, (char *)sbrk(0), FALSE);
+ # else
+ GC_add_roots_inner(DATASTART, (char *)(DATAEND), FALSE);
++ # if defined(DATASTART2)
++ GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), FALSE);
++ # endif
+ # endif
+ # endif
+ # if !defined(PCR) && (defined(NEXT) || defined(MACOSX))
diff --git a/Patches/hpux11 b/Patches/hpux11
@@ -1,25 +0,0 @@
-Install note for HP-UX
-
-If you are running HP-UX 11 or later on PA-RISC 2.0, you
-have to apply the following patch on GC library. This patch
-is contributed by Dave Eaton <dwe@arde.com>.
-
-If you want to use HP C compiler, answer
-
- Input your favorite C-compiler.
- (Default: cc) cc -Aa -D_HPUX_SOURCE
-
-If you use just 'cc' without options, you can't compile w3m.
-If you are using gcc, no option is needed.
-
-----------------------------------------------------------------------
---- gc/gcconfig.h.original Wed May 19 01:38:55 1999
-+++ gc/gcconfig.h Tue Jun 8 12:38:22 1999
-@@ -125,6 +125,7 @@
- # define mach_type_known
- # endif
- # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
-+ || defined(_PA_RISC2_0) \
- || defined(hppa) || defined(__hppa__)
- # define HP_PA
- # define mach_type_known
diff --git a/Patches/linux2.2sparc b/Patches/linux2.2sparc
@@ -1,10 +0,0 @@
---- gc/gcconfig.h.org
-+++ gc/gcconfig.h
-@@ -601,7 +601,7 @@
- extern int _end;
- # define DATAEND (&_end)
- # define SVR4
--# define STACKBOTTOM ((ptr_t) 0xf0000000)
-+# define STACKBOTTOM ((ptr_t) 0xeffff000)
- # endif
- # endif
diff --git a/Patches/macosx b/Patches/macosx
@@ -1,41 +0,0 @@
-Jeroen Scheerder <J.Scheerder@cwi.nl> (by way of Jeroen Scheerder)
-Subject: w3m 0.1.6 on Mac OS X
-Content-Type: text/plain; charset="us-ascii"
-
-Hi,
-
-I've compiled w3m successfully on Mac OS X (DP3). I'm including
-patches, mainly dealing with compiler complaints about possible use of
-uninitialized data.
-
-It compiles with one warning, still:
-
-url.c:799: warning: variable `p' might be clobbered by `longjmp' or
- `vfork'
-
-
-On a related note: I had to modify the makefile; there is no `m'
-library, and no `termcap' library, and they're not needed as well --
-but they will cause an ld failure, when present on the ld command line.
-
-Context diffs (against a 21/1/2000 0.1.6) are included, including the
-(trivial) patch to make Boehm gc compile.
-
-
-
-*** gc/gcconfig.h Mon Mar 6 12:16:04 2000
---- gc/gcconfig.h.org Wed Jan 12 04:23:37 2000
-***************
-*** 180,190 ****
- # define POWERPC
- # define mach_type_known
- # endif
-- # if defined(__APPLE__)
-- # define MACOSX
-- # define POWERPC
-- # define mach_type_known
-- # endif
- # if defined(NeXT) && defined(mc68000)
- # define M68K
- # define NEXT
---- 180,185 ----
diff --git a/Patches/macppc b/Patches/macppc
@@ -1,147 +0,0 @@
-Here is a patch to port GC library to NetBSD/macppc. If you are
-using NetBSD on PowerMac, apply this patch first.
-
-This patch is provided by K. Sunagawa (kei_sun@ba2.so-net.ne.jp).
-
-Index: gc/dyn_load.c
-===================================================================
-RCS file: /cvsroot/w3m/gc/dyn_load.c,v
-retrieving revision 1.1.1.2
-retrieving revision 1.2
-diff -u -u -r1.1.1.2 -r1.2
---- gc/dyn_load.c 1999/06/02 19:29:13 1.1.1.2
-+++ gc/dyn_load.c 1999/06/03 12:44:49 1.2
-@@ -48,7 +48,8 @@
- #if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
- !defined(MSWIN32) && !(defined(ALPHA) && defined(OSF1)) && \
- !defined(HP_PA) && !(defined(LINUX) && defined(__ELF__)) && \
-- !defined(RS6000) && !defined(SCO_ELF)
-+ !defined(RS6000) && !defined(SCO_ELF) && \
-+ !(defined(NETBSD) && defined(POWERPC))
- --> We only know how to find data segments of dynamic libraries for the
- --> above. Additional SVR4 variants might not be too
- --> hard to add.
-@@ -260,14 +261,22 @@
- # endif /* !USE_PROC ... */
- # endif /* SUNOS */
-
--#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
-+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
-+ (defined(NETBSD) && defined(POWERPC))
-
- /* Dynamic loading code for Linux running ELF. Somewhat tested on
- * Linux/x86, untested but hopefully should work on Linux/Alpha.
- * This code was derived from the Solaris/ELF support. Thanks to
- * whatever kind soul wrote that. - Patrick Bridges */
-
-+#if defined(NETBSD)
-+#include <sys/exec_elf.h>
-+#define DT_DEBUG 21
-+#define PT_LOAD 1
-+#define PF_W 0x2
-+#else
- #include <elf.h>
-+#endif
- #include <link.h>
-
- /* Newer versions of Linux/Alpha and Linux/x86 define this macro. We
-Index: gc/gcconfig.h
-===================================================================
-RCS file: /cvsroot/w3m/gc/gcconfig.h,v
-retrieving revision 1.1.1.2
-retrieving revision 1.2
-diff -u -u -r1.1.1.2 -r1.2
---- gc/gcconfig.h 1999/06/02 19:29:18 1.1.1.2
-+++ gc/gcconfig.h 1999/06/03 12:44:49 1.2
-@@ -48,6 +48,11 @@
- # define NETBSD
- # define mach_type_known
- # endif
-+# if defined(__NetBSD__) && defined(__powerpc__)
-+# define POWERPC
-+# define NETBSD
-+# define mach_type_known
-+# endif
- # if defined(vax)
- # define VAX
- # ifdef ultrix
-@@ -486,8 +491,8 @@
-
- # ifdef POWERPC
- # define MACH_TYPE "POWERPC"
--# define ALIGNMENT 2
- # ifdef MACOS
-+# define ALIGNMENT 2
- # ifndef __LOWMEM__
- # include <LowMem.h>
- # endif
-@@ -497,6 +502,7 @@
- # define DATAEND /* not needed */
- # endif
- # ifdef LINUX
-+# define ALIGNMENT 2
- # define OS_TYPE "LINUX"
- # define HEURISTIC1
- # undef STACK_GRAN
-@@ -504,6 +510,14 @@
- # define DATASTART GC_data_start
- extern int _end;
- # define DATAEND (&_end)
-+# endif
-+# ifdef NETBSD
-+# define ALIGNMENT 4
-+# define OS_TYPE "NETBSD"
-+# define HEURISTIC2
-+ extern char etext;
-+# define DATASTART GC_data_start
-+# define DYNAMIC_LOADING
- # endif
- # endif
-
-Index: gc/misc.c
-===================================================================
-RCS file: /cvsroot/w3m/gc/misc.c,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -u -r1.1.1.1 -r1.2
---- gc/misc.c 1999/06/02 19:23:56 1.1.1.1
-+++ gc/misc.c 1999/06/03 12:44:50 1.2
-@@ -433,6 +433,9 @@
- # if defined(LINUX) && defined(SPARC)
- GC_init_linuxsparc();
- # endif
-+# if defined(NETBSD) && defined(POWERPC)
-+ GC_init_netbsd_powerpc();
-+# endif
- # ifdef SOLARIS_THREADS
- GC_thr_init();
- /* We need dirty bits in order to find live stack sections. */
-Index: gc/os_dep.c
-===================================================================
-RCS file: /cvsroot/w3m/gc/os_dep.c,v
-retrieving revision 1.1.1.2
-retrieving revision 1.2
-diff -u -u -r1.1.1.2 -r1.2
---- gc/os_dep.c 1999/06/02 19:29:10 1.1.1.2
-+++ gc/os_dep.c 1999/06/03 12:44:50 1.2
-@@ -84,6 +84,19 @@
- # include <machine/trap.h>
- #endif
-
-+#if defined(NETBSD) && defined(POWERPC)
-+ ptr_t GC_data_start;
-+
-+ void GC_init_netbsd_powerpc()
-+ {
-+ extern ptr_t GC_find_limit();
-+ extern char **environ;
-+ /* This may need to be environ, without the underscore, for */
-+ /* some versions. */
-+ GC_data_start = GC_find_limit((ptr_t)&environ, FALSE);
-+ }
-+#endif
-+
- #ifdef AMIGA
- # include <proto/exec.h>
- # include <proto/dos.h>
-
diff --git a/Patches/mipsel b/Patches/mipsel
@@ -1,184 +0,0 @@
-diff -ur gc/gcconfig.h w3m/gc/gcconfig.h
---- gc/gcconfig.h Tue Jan 4 14:46:50 2000
-+++ gc/gcconfig.h Fri May 26 00:30:56 2000
-@@ -67,11 +67,13 @@
- # if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
- # define ULTRIX
- # else
--# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
--# define IRIX5 /* or IRIX 6.X */
--# else
--# define RISCOS /* or IRIX 4.X */
--# endif
-+# if !defined(LINUX)
-+# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
-+# define IRIX5 /* or IRIX 6.X */
-+# else
-+# define RISCOS /* or IRIX 4.X */
-+# endif
-+# endif
- # endif
- # define mach_type_known
- # endif
-@@ -836,49 +838,58 @@
-
- # ifdef MIPS
- # define MACH_TYPE "MIPS"
--# ifndef IRIX5
--# define DATASTART (ptr_t)0x10000000
-+# ifdef LINUX
-+# define OS_TYPE "LINUX"
-+ extern int __data_start;
-+# define DATASTART ((ptr_t)(&__data_start))
-+# define ALIGNMENT 4
-+# define USE_GENERIC_PUSH_REGS 1
-+# define STACKBOTTOM 0x80000000
-+# else /* LINUX */
-+# ifndef IRIX5
-+# define DATASTART (ptr_t)0x10000000
- /* Could probably be slightly higher since */
- /* startup code allocates lots of stuff. */
--# else
-- extern int _fdata;
--# define DATASTART ((ptr_t)(&_fdata))
--# ifdef USE_MMAP
--# define HEAP_START (ptr_t)0x30000000
- # else
--# define HEAP_START DATASTART
--# endif
-+ extern int _fdata;
-+# define DATASTART ((ptr_t)(&_fdata))
-+# ifdef USE_MMAP
-+# define HEAP_START (ptr_t)0x30000000
-+# else
-+# define HEAP_START DATASTART
-+# endif
- /* Lowest plausible heap address. */
- /* In the MMAP case, we map there. */
- /* In either case it is used to identify */
- /* heap sections so they're not */
- /* considered as roots. */
--# endif /* IRIX5 */
--# define HEURISTIC2
-+# endif /* IRIX5 */
-+# define HEURISTIC2
- /* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
--# ifdef ULTRIX
--# define OS_TYPE "ULTRIX"
--# define ALIGNMENT 4
--# endif
--# ifdef RISCOS
--# define OS_TYPE "RISCOS"
--# define ALIGNMENT 4 /* Required by hardware */
--# endif
--# ifdef IRIX5
--# define OS_TYPE "IRIX5"
--# define MPROTECT_VDB
--# ifdef _MIPS_SZPTR
--# define CPP_WORDSZ _MIPS_SZPTR
--# define ALIGNMENT (_MIPS_SZPTR/8)
--# if CPP_WORDSZ != 64
-+# ifdef ULTRIX
-+# define OS_TYPE "ULTRIX"
-+# define ALIGNMENT 4
-+# endif
-+# ifdef RISCOS
-+# define OS_TYPE "RISCOS"
-+# define ALIGNMENT 4 /* Required by hardware */
-+# endif
-+# ifdef IRIX5
-+# define OS_TYPE "IRIX5"
-+# define MPROTECT_VDB
-+# ifdef _MIPS_SZPTR
-+# define CPP_WORDSZ _MIPS_SZPTR
-+# define ALIGNMENT (_MIPS_SZPTR/8)
-+# if CPP_WORDSZ != 64
-+# define ALIGN_DOUBLE
-+# endif
-+# else
-+# define ALIGNMENT 4
- # define ALIGN_DOUBLE
- # endif
--# else
--# define ALIGNMENT 4
--# define ALIGN_DOUBLE
--# endif
--# define DYNAMIC_LOADING
--# endif
-+# define DYNAMIC_LOADING
-+# endif
-+# endif
- # endif
-
- # ifdef RS6000
-diff -ur gc/mach_dep.c w3m/gc/mach_dep.c
---- gc/mach_dep.c Tue Jan 4 14:46:50 2000
-+++ gc/mach_dep.c Fri May 26 00:34:11 2000
-@@ -74,6 +74,21 @@
- # ifdef RT
- register long TMP_SP; /* must be bound to r11 */
- # endif
-+# if defined(MIPS) && defined(LINUX)
-+# define call_push(x) asm("move $4," x ";"); asm("jal GC_push_one")
-+ call_push("$2");
-+ call_push("$3");
-+ call_push("$16");
-+ call_push("$17");
-+ call_push("$18");
-+ call_push("$19");
-+ call_push("$20");
-+ call_push("$21");
-+ call_push("$22");
-+ call_push("$23");
-+ call_push("$30");
-+# undef call_push
-+# endif /* MIPS && LINUX */
- # ifdef VAX
- /* VAX - generic code below does not work under 4.2 */
- /* r1 through r5 are caller save, and therefore */
-@@ -338,7 +353,9 @@
- # if !(defined M68K) && !(defined VAX) && !(defined RT)
- # if !(defined SPARC) && !(defined I386) && !(defined NS32K)
- # if !defined(POWERPC) && !defined(UTS4)
-+# if (!defined(MIPS) && !defined(LINUX))
- --> bad news <--
-+# endif
- # endif
- # endif
- # endif
-diff -ur gc/misc.c w3m/gc/misc.c
---- gc/misc.c Tue Jan 4 14:46:50 2000
-+++ gc/misc.c Fri May 26 00:52:59 2000
-@@ -433,7 +433,8 @@
- # ifdef MSWIN32
- GC_init_win32();
- # endif
--# if defined(LINUX) && (defined(POWERPC) || defined(ALPHA) || defined(SPARC))
-+# if defined(LINUX) && (defined(POWERPC) || defined(ALPHA) || \
-+ defined(SPARC) || defined(MIPS))
- GC_init_linux_data_start();
- # endif
- # ifdef SOLARIS_THREADS
-diff -ur gc/os_dep.c w3m/gc/os_dep.c
---- gc/os_dep.c Tue Jan 4 14:46:50 2000
-+++ gc/os_dep.c Fri May 26 00:37:07 2000
-@@ -72,7 +72,8 @@
- # define NEED_FIND_LIMIT
- # endif
-
--# if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA))
-+# if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || \
-+ defined(ALPHA) || defined(MIPS))
- # define NEED_FIND_LIMIT
- # endif
-
-@@ -139,7 +140,8 @@
- # define OPT_PROT_EXEC 0
- #endif
-
--#if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || defined(ALPHA))
-+#if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || \
-+ defined(ALPHA) || defined(MIPS))
- /* The I386 case can be handled without a search. The Alpha case */
- /* used to be handled differently as well, but the rules changed */
- /* for recent Linux versions. This seems to be the easiest way to */
diff --git a/Patches/newsos6 b/Patches/newsos6
@@ -1,27 +0,0 @@
-diff -ur gc/Makefile gc/Makefile
---- gc/Makefile Sat Jul 24 02:53:34 1999
-+++ gc/Makefile Tue Nov 30 14:29:50 1999
-@@ -7,7 +7,7 @@
- # and runs some tests of collector and cords. Does not add cords or
- # c++ interface to gc.a
- # cord/de - builds dumb editor based on cords.
--ABI_FLAG=
-+ABI_FLAG=-KPIC
- CC=cc $(ABI_FLAG)
- CXX=CC $(ABI_FLAG)
- AS=as $(ABI_FLAG)
-Only in gc: Makefile.back
-Only in gc: Makefile.orig
-diff -ur gc/gcconfig.h gc/gcconfig.h
---- gc/gcconfig.h Fri Jul 9 05:03:22 1999
-+++ gc/gcconfig.h Tue Nov 30 14:30:11 1999
-@@ -64,7 +64,8 @@
- # endif
- # if defined(mips) || defined(__mips)
- # define MIPS
--# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
-+# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__) ||\
-+ defined(nec_ews) || defined(__sony_news)
- # define ULTRIX
- # else
- # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
diff --git a/Patches/os2 b/Patches/os2
@@ -1,39 +0,0 @@
---- w3m-0.1.10/XMakefile Thu Jun 8 13:26:04 2000
-+++ w3m-0.1.10-6/XMakefile Sun Jun 11 16:37:18 2000
-@@ -8,7 +8,7 @@
- LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o hash.o tagtable.o
- LLOBJS=version.o
- ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o
--ALIB=libindep.a
-+ALIB=indep.a
- ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)
-
- TARGET=w3m$(EXT)
-@@ -31,13 +31,13 @@
- $(CC) $(CFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)
-
- $(ALIB): $(ALIBOBJS)
-- $(AR) rv $(ALIB) $(ALIBOBJS)
-+ $(AR) srv $(ALIB) $(ALIBOBJS)
- $(RANLIB) $(ALIB)
-
- $(OBJS): fm.h funcname1.h
-
- tagtable.c: html.h tagtable.tab mktable$(EXT)
-- ./mktable 100 tagtable.tab > tagtable.c
-+ mktable 100 tagtable.tab > tagtable.c
-
- func.o: funcname.c
- keybind.o: funcname2.h
---- w3m-0.1.10/gc/os_dep.c Tue Jan 4 14:46:50 2000
-+++ w3m-0.1.10-6/gc/os_dep.c Sun Jun 11 16:37:16 2000
-@@ -732,7 +732,9 @@
- if (!(flags & OBJWRITE)) continue;
- if (!(flags & OBJREAD)) continue;
- if (flags & OBJINVALID) {
-+#ifndef __EMX__
- GC_err_printf0("Object with invalid pages?\n");
-+#endif
- continue;
- }
- GC_add_roots_inner(O32_BASE(seg), O32_BASE(seg)+O32_SIZE(seg), FALSE);
diff --git a/XMakefile b/XMakefile
@@ -4,19 +4,20 @@ SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
form.o map.o frame.o rc.o menu.o mailcap.o\
func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
-LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c hash.c parsetagx.c\
+LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c parsetagx.c\
tagtable.c istream.c
-LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o hash.o parsetagx.o\
+LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o parsetagx.o\
tagtable.o istream.o
LLOBJS=version.o
-ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o
+ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o entity.o hash.o
ALIB=libindep.a
ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)
TARGET=w3m$(EXT)
BOOKMARKER=w3mbookmark$(EXT)
HELPER=w3mhelperpanel$(EXT)
-TARGETS=$(TARGET) $(BOOKMARKER) $(HELPER)
+INFLATE=inflate$(EXT)
+TARGETS=$(TARGET) $(EXT_TARGETS)
INCLUDES=-I.
@@ -39,7 +40,10 @@ $(ALIB): $(ALIBOBJS)
$(OBJS): fm.h funcname1.h
tagtable.c: html.h tagtable.tab mktable$(EXT)
- ./mktable 100 tagtable.tab > tagtable.c
+ ./mktable$(EXT) 100 tagtable.tab > tagtable.c
+
+# entity.h: html.h entity.tab mktable$(EXT)
+# ./mktable 100 entity.tab > entity.h
func.o: funcname.c
keybind.o: funcname2.h
@@ -47,7 +51,7 @@ keybind_lynx.o: funcname2.h
parsetagx.o: html.c
funcname.c: funcname.tab
- awk -f funcname0.awk funcname.tab > funcname.c
+ sort funcname.tab | awk -f funcname0.awk > funcname.c
funcname1.h: funcname.tab
awk -f funcname1.awk funcname.tab > funcname1.h
@@ -64,8 +68,14 @@ $(BOOKMARKER): w3mbookmark.o $(ALIB) $(GCTARGET)
$(HELPER): w3mhelperpanel.o $(ALIB) $(GCTARGET)
$(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o $(LIBS)
+$(INFLATE): inflate.o
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -o $(INFLATE) inflate.o $(ZLIB)
+
+inflate.o: inflate.c
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -c inflate.c
+
gc/gc.a:
- cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS)'
+ cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS) $(GC_CFLAGS)' SPECIALCFLAGS='-I./\$(srcdir)/include $(GC_CFLAGS)'
install: $(TARGETS)
-$(MKDIR) $(DESTDIR)$(BIN_DIR)
@@ -77,7 +87,7 @@ install: $(TARGETS)
$(INSTALL) -m 644 w3mhelp-lynx_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_en.html
$(INSTALL) -m 644 w3mhelp-lynx_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_ja.html
$(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
- for d in $(BOOKMARKER) $(HELPER); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
+ for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
(cd scripts; for i in *.cgi; do $(INSTALL2) -m 755 $$i $(DESTDIR)$(LIB_DIR)/$$i; done)
uninstall:
@@ -87,6 +97,9 @@ uninstall:
-$(RM) $(HELP_DIR)/w3mhelp-w3m_en.html
-$(RM) $(HELP_DIR)/w3mhelp-w3m_ja.html
-$(RM) $(HELP_DIR)/w3mhelp.html
+ -$(RM) $(LIB_DIR)/$(BOOKMARKER)
+ -$(RM) $(LIB_DIR)/$(HELPER)
+ -$(RM) $(LIB_DIR)/$(INFLATE)
clean: sweep
rm -f *.o *.a $(TARGETS) mktable$(EXT)
diff --git a/XMakefile.dist b/XMakefile.dist
@@ -1,22 +1,23 @@
SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
form.c map.c frame.c rc.c menu.c mailcap.c\
- func.c cookie.c history.c $(KEYBIND_SRC)
+ func.c cookie.c history.c backend.c $(KEYBIND_SRC)
OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
form.o map.o frame.o rc.o menu.o mailcap.o\
- func.o cookie.o history.o $(KEYBIND_OBJ)
-LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c hash.c parsetagx.c\
+ func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
+LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c parsetagx.c\
tagtable.c istream.c
-LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o hash.o parsetagx.o\
+LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o parsetagx.o\
tagtable.o istream.o
LLOBJS=version.o
-ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o
+ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o entity.o hash.o
ALIB=libindep.a
ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)
TARGET=w3m$(EXT)
BOOKMARKER=w3mbookmark$(EXT)
HELPER=w3mhelperpanel$(EXT)
-TARGETS=$(TARGET) $(BOOKMARKER) $(HELPER)
+INFLATE=inflate$(EXT)
+TARGETS=$(TARGET) $(EXT_TARGETS)
INCLUDES=-I.
@@ -41,13 +42,16 @@ $(OBJS): fm.h funcname1.h
tagtable.c: html.h tagtable.tab mktable$(EXT)
./mktable 100 tagtable.tab > tagtable.c
+# entity.h: html.h entity.tab mktable$(EXT)
+# ./mktable 100 entity.tab > entity.h
+
func.o: funcname.c
keybind.o: funcname2.h
keybind_lynx.o: funcname2.h
parsetagx.o: html.c
funcname.c: funcname.tab
- awk -f funcname0.awk funcname.tab > funcname.c
+ sort funcname.tab | awk -f funcname0.awk > funcname.c
funcname1.h: funcname.tab
awk -f funcname1.awk funcname.tab > funcname1.h
@@ -64,8 +68,14 @@ $(BOOKMARKER): w3mbookmark.o $(ALIB) $(GCTARGET)
$(HELPER): w3mhelperpanel.o $(ALIB) $(GCTARGET)
$(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o $(LIBS)
+$(INFLATE): inflate.o
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -o $(INFLATE) inflate.o $(ZLIB)
+
+inflate.o: inflate.c
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -c inflate.c
+
gc/gc.a:
- cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS)'
+ cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS) $(GC_CFLAGS)' SPECIALCFLAGS='-I./\$(srcdir)/include $(GC_CFLAGS)'
install: $(TARGETS)
-$(MKDIR) $(DESTDIR)$(BIN_DIR)
@@ -77,7 +87,7 @@ install: $(TARGETS)
$(INSTALL) -m 644 w3mhelp-lynx_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_en.html
$(INSTALL) -m 644 w3mhelp-lynx_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_ja.html
$(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
- for d in $(BOOKMARKER) $(HELPER); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
+ for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
(cd scripts; for i in *.cgi; do $(INSTALL2) -m 755 $$i $(DESTDIR)$(LIB_DIR)/$$i; done)
uninstall:
@@ -87,6 +97,9 @@ uninstall:
-$(RM) $(HELP_DIR)/w3mhelp-w3m_en.html
-$(RM) $(HELP_DIR)/w3mhelp-w3m_ja.html
-$(RM) $(HELP_DIR)/w3mhelp.html
+ -$(RM) $(LIB_DIR)/$(BOOKMARKER)
+ -$(RM) $(LIB_DIR)/$(HELPER)
+ -$(RM) $(LIB_DIR)/$(INFLATE)
clean: sweep
rm -f *.o *.a $(TARGETS) mktable$(EXT)
diff --git a/XXMakefile b/XXMakefile
@@ -4,20 +4,24 @@ BIN_DIR = /usr/local/bin
HELP_DIR = /usr/local/lib/w3m
LIB_DIR = /usr/local/lib/w3m
HELP_FILE = w3mhelp-w3m_ja.html
-SYS_LIBRARIES = -lgpm -lbsd -lnsl -ltermcap -L/usr/local/ssl/lib -lssl -lcrypto
+SYS_LIBRARIES = -lgpm -lbsd -lnsl -lncurses -L/usr/lib -L/usr/lib -L/usr/local/ssl/lib -L/usr/local/ssl/lib -lssl -lcrypto
LOCAL_LIBRARIES =
CC = gcc
-MYCFLAGS = -g -Wall -I./gc/include -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include
-GCCFLAGS = -g -Wall -I./gc/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS -DSILENT -DNO_DEBUGGING #-DNO_SIGNALS
+MYCFLAGS = -O -I./gc/include -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include
+GCCFLAGS = -O -I./gc/include -I./$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
KEYBIND_SRC = keybind.c
KEYBIND_OBJ = keybind.o
EXT=
MATHLIB=-lm
+Z_CFLAGS=-I/usr/include
+ZLIB=-L/usr/lib -lz
+EXT_TARGETS=$(BOOKMARKER) $(HELPER) $(INFLATE)
+GC_CFLAGS=
GCLIB=gc/gc.a
GCTARGET=gc/gc.a
RANLIB=ranlib
MKDIR=mkdir -p
-VERSION=0.2.1
+VERSION=0.2.1-inu-1.5
MODEL=Linux.i686-monster-ja
#else
SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
@@ -26,19 +30,20 @@ SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
OBJS=main.o file.o buffer.o display.o etc.o search.o linein.o table.o local.o\
form.o map.o frame.o rc.o menu.o mailcap.o\
func.o cookie.o history.o backend.o $(KEYBIND_OBJ)
-LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c hash.c parsetagx.c\
+LSRCS=terms.c conv.c url.c ftp.c anchor.c mimehead.c parsetagx.c\
tagtable.c istream.c
-LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o hash.o parsetagx.o\
+LOBJS=terms.o conv.o url.o ftp.o anchor.o mimehead.o parsetagx.o\
tagtable.o istream.o
LLOBJS=version.o
-ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o
+ALIBOBJS=Str.o indep.o regex.o textlist.o parsetag.o myctype.o entity.o hash.o
ALIB=libindep.a
ALLOBJS=$(OBJS) $(LOBJS) $(LLOBJS)
TARGET=w3m$(EXT)
BOOKMARKER=w3mbookmark$(EXT)
HELPER=w3mhelperpanel$(EXT)
-TARGETS=$(TARGET) $(BOOKMARKER) $(HELPER)
+INFLATE=inflate$(EXT)
+TARGETS=$(TARGET) $(EXT_TARGETS)
INCLUDES=-I.
@@ -61,7 +66,10 @@ $(ALIB): $(ALIBOBJS)
$(OBJS): fm.h funcname1.h
tagtable.c: html.h tagtable.tab mktable$(EXT)
- ./mktable 100 tagtable.tab > tagtable.c
+ ./mktable$(EXT) 100 tagtable.tab > tagtable.c
+
+# entity.h: html.h entity.tab mktable$(EXT)
+# ./mktable 100 entity.tab > entity.h
func.o: funcname.c
keybind.o: funcname2.h
@@ -69,7 +77,7 @@ keybind_lynx.o: funcname2.h
parsetagx.o: html.c
funcname.c: funcname.tab
- awk -f funcname0.awk funcname.tab > funcname.c
+ sort funcname.tab | awk -f funcname0.awk > funcname.c
funcname1.h: funcname.tab
awk -f funcname1.awk funcname.tab > funcname1.h
@@ -86,8 +94,14 @@ $(BOOKMARKER): w3mbookmark.o $(ALIB) $(GCTARGET)
$(HELPER): w3mhelperpanel.o $(ALIB) $(GCTARGET)
$(CC) $(CFLAGS) -o $(HELPER) w3mhelperpanel.o $(LIBS)
+$(INFLATE): inflate.o
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -o $(INFLATE) inflate.o $(ZLIB)
+
+inflate.o: inflate.c
+ $(CC) $(CFLAGS) $(Z_CFLAGS) -c inflate.c
+
gc/gc.a:
- cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS)'
+ cd gc; make CC='$(CC)' CFLAGS='$(GCCFLAGS) $(GC_CFLAGS)' SPECIALCFLAGS='-I./\$(srcdir)/include $(GC_CFLAGS)'
install: $(TARGETS)
-$(MKDIR) $(DESTDIR)$(BIN_DIR)
@@ -99,7 +113,7 @@ install: $(TARGETS)
$(INSTALL) -m 644 w3mhelp-lynx_en.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_en.html
$(INSTALL) -m 644 w3mhelp-lynx_ja.html $(DESTDIR)$(HELP_DIR)/w3mhelp-lynx_ja.html
$(INSTALL) -m 644 $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/w3mhelp.html
- for d in $(BOOKMARKER) $(HELPER); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
+ for d in $(EXT_TARGETS); do $(INSTALL) -m 755 $$d $(DESTDIR)$(LIB_DIR)/$$d; done
(cd scripts; for i in *.cgi; do $(INSTALL2) -m 755 $$i $(DESTDIR)$(LIB_DIR)/$$i; done)
uninstall:
@@ -109,6 +123,9 @@ uninstall:
-$(RM) $(HELP_DIR)/w3mhelp-w3m_en.html
-$(RM) $(HELP_DIR)/w3mhelp-w3m_ja.html
-$(RM) $(HELP_DIR)/w3mhelp.html
+ -$(RM) $(LIB_DIR)/$(BOOKMARKER)
+ -$(RM) $(LIB_DIR)/$(HELPER)
+ -$(RM) $(LIB_DIR)/$(INFLATE)
clean: sweep
rm -f *.o *.a $(TARGETS) mktable$(EXT)
diff --git a/anchor.c b/anchor.c
@@ -96,7 +96,6 @@ registerForm(Buffer * buf, FormList * flist, struct parsed_tag * tag, int line,
&a,
NULL,
line, pos);
- fi->anchor_num = buf->formitem->nanchor - 1;
return a;
}
@@ -358,7 +357,7 @@ putHmarker(HmarkerList * ml, int line, int pos, int seq)
}
if (ml->markmax == 0) {
ml->markmax = FIRST_MARKER_SIZE;
- ml->marks = New_N(BufferPoint, ml->markmax);
+ ml->marks = NewAtom_N(BufferPoint, ml->markmax);
#ifdef __CYGWIN__
bzero((char *) ml->marks, sizeof(BufferPoint) * ml->markmax);
#else /* not __CYGWIN__ */
@@ -418,3 +417,59 @@ closest_prev_anchor(AnchorList * a, Anchor * an, int x, int y)
}
return an;
}
+
+void
+addMultirowsForm(Buffer *buf, AnchorList *al)
+{
+ int i, j, k, col, ecol, pos;
+ Anchor a_form, *a;
+ FormItemList *fi;
+ Line *l, *ls;
+
+ if (al == NULL || al->nanchor == 0)
+ return;
+ for (i = 0; i < al->nanchor; i++) {
+ a_form = al->anchors[i];
+ al->anchors[i].rows = 1;
+ if (a_form.hseq < 0 || a_form.rows <= 1)
+ continue;
+ for (l = buf->firstLine; l != NULL; l = l->next) {
+ if (l->linenumber == a_form.y)
+ break;
+ }
+ if (! l)
+ continue;
+ if (a_form.y == a_form.start.line)
+ ls = l;
+ else {
+ for (ls = l; ls != NULL;
+ ls = (a_form.y < a_form.start.line) ? ls->next : ls->prev) {
+ if (ls->linenumber == a_form.start.line)
+ break;
+ }
+ if (! ls)
+ continue;
+ }
+ fi = (FormItemList *) a_form.url;
+ col = COLPOS(ls, a_form.start.pos);
+ ecol = COLPOS(ls, a_form.end.pos);
+ for (j = 0; l && j < a_form.rows; l = l->next, j++) {
+ pos = columnPos(l, col);
+ if (j == 0) {
+ buf->hmarklist->marks[a_form.hseq].line = l->linenumber;
+ buf->hmarklist->marks[a_form.hseq].pos = pos;
+ }
+ if (a_form.start.line == l->linenumber)
+ continue;
+ buf->formitem = putAnchor(buf->formitem, a_form.url,
+ a_form.target, &a, NULL, l->linenumber, pos);
+ a->hseq = a_form.hseq;
+ a->y = a_form.y;
+ a->end.pos = pos + ecol - col;
+ l->lineBuf[pos - 1] = '[';
+ l->lineBuf[a->end.pos] = ']';
+ for (k = pos; k < a->end.pos; k++)
+ l->propBuf[k] |= PE_FORM;
+ }
+ }
+}
diff --git a/backend.c b/backend.c
@@ -203,7 +203,7 @@ static void post( TextList *argv ){
url = p;
}
if( url ){
- request = newFormList( NULL, "post", charset, enctype, target, NULL );
+ request = newFormList( NULL, "post", charset, enctype, target, NULL, NULL );
request->body = body;
request->boundary = boundary;
request->length = ( length > 0 )? length : ( body ? strlen(body) : 0 );
@@ -246,11 +246,10 @@ static void show( TextList *argv ){
/* Command: quit */
static void quit( TextList *argv ){
- deleteFiles();
#ifdef USE_COOKIE
save_cookies();
#endif /* USE_COOKIE */
- exit(0);
+ w3m_exit(0);
}
@@ -298,13 +297,10 @@ static void call_command_function( char *str ){
/* Main function */
int backend( void ){
char *str;
- extern int w3m_dump; /* Declared in main.c. */
- w3m_dump = FALSE;
- w3m_halfdump = FALSE;
+ w3m_dump = 0;
if (COLS == 0) COLS = 80;
#ifdef MOUSE
- mouse_end();
use_mouse = FALSE;
#endif /* MOUSE */
diff --git a/buffer.c b/buffer.c
@@ -96,9 +96,11 @@ discardBuffer(Buffer * buf)
if (buf->real_scheme != SCM_LOCAL || buf->bufferprop & BP_FRAME)
unlink(buf->sourcefile);
}
+ if (buf->mailcap_source)
+ unlink(buf->mailcap_source);
while (buf->frameset) {
deleteFrameSet(buf->frameset);
- buf->frameset = popFrameTree(&(buf->frameQ), NULL, NULL);
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
}
@@ -202,7 +204,7 @@ writeBufferName(Buffer * buf, int n)
case SCM_LOCAL_CGI:
if (strcmp(buf->currentURL.file, "-")) {
Strcat_char(msg, ' ');
- Strcat_charp(msg, buf->filename);
+ Strcat_charp(msg, conv_from_system(buf->currentURL.real_file));
}
break;
case SCM_UNKNOWN:
@@ -476,7 +478,6 @@ selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar)
}
}
-
/*
* Reshape HTML buffer
*/
@@ -487,8 +488,10 @@ reshapeBuffer(Buffer * buf)
int top, linenum, cursorY, pos, currentColumn;
AnchorList *formitem;
+ if (buf->sourcefile == NULL)
+ return;
init_stream(&f, SCM_LOCAL, NULL);
- examineFile(buf->sourcefile, &f);
+ examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile, &f);
if (f.stream == NULL)
return;
@@ -505,7 +508,7 @@ reshapeBuffer(Buffer * buf)
clearBuffer(buf);
while (buf->frameset) {
deleteFrameSet(buf->frameset);
- buf->frameset = popFrameTree(&(buf->frameQ), NULL, NULL);
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
formitem = buf->formitem;
@@ -515,12 +518,20 @@ reshapeBuffer(Buffer * buf)
buf->formitem = NULL;
buf->width = INIT_BUFFER_WIDTH;
- loadHTMLstream(&f, buf, NULL, FALSE);
+#ifdef JP_CHARSET
+ UseContentCharset = FALSE;
+ UseAutoDetect = FALSE;
+#endif
+ if (! strcasecmp(buf->type, "text/html"))
+ loadHTMLBuffer(&f, buf);
+ else
+ loadBuffer(&f, buf);
UFclose(&f);
+#ifdef JP_CHARSET
+ UseContentCharset = TRUE;
+ UseAutoDetect = TRUE;
+#endif
- buf->topLine = buf->firstLine;
- buf->lastLine = buf->currentLine;
- buf->currentLine = buf->firstLine;
buf->height = LASTLINE + 1;
buf->topLine = lineSkip(buf, buf->topLine, top - 1, FALSE);
gotoLine(buf, linenum);
@@ -651,16 +662,16 @@ readBufferCache(Buffer *buf)
fread1(l->width, cache) ||
fread1(l->len, cache))
break;
- l->lineBuf = New_N(char, l->len + 1);
+ l->lineBuf = NewAtom_N(char, l->len + 1);
fread(l->lineBuf, 1, l->len, cache);
l->lineBuf[l->len] = '\0';
- l->propBuf = New_N(Lineprop, l->len);
+ l->propBuf = NewAtom_N(Lineprop, l->len);
fread(l->propBuf, sizeof(Lineprop), l->len, cache);
#ifdef ANSI_COLOR
if (fread1(colorflag, cache))
break;
if (colorflag) {
- l->colorBuf = New_N(Linecolor, l->len);
+ l->colorBuf = NewAtom_N(Linecolor, l->len);
fread(l->colorBuf, sizeof(Linecolor), l->len, cache);
} else {
l->colorBuf = NULL;
diff --git a/config.h b/config.h
@@ -54,12 +54,12 @@
/*
* Support NNTP
*/
-#define USE_NNTP
+#undef USE_NNTP
/*
* Support ANSI color escape sequences
*/
-#define ANSI_COLOR
+#undef ANSI_COLOR
/*
* Enable id attribute
@@ -77,11 +77,6 @@
#undef USE_EGD
/*
- * MENU_MAP enables w3m to show image map link with popup menu.
- */
-#define MENU_MAP
-
-/*
* Use Emacs-like key binding for file name completion
*/
#undef EMACS_LIKE_LINEEDIT
@@ -91,6 +86,16 @@
*/
#undef ENABLE_REMOVE_TRAILINGSPACES
+/*
+ * Move cursor to top line when going to label.
+ */
+#undef LABEL_TOPLINE
+
+/*
+ * Move cursor to top line when moving to next page.
+ */
+#undef NEXTPAGE_TOPLINE
+
/**********************************************************/
#ifdef makefile_parameter
@@ -98,25 +103,30 @@ BIN_DIR = /usr/local/bin
HELP_DIR = /usr/local/lib/w3m
LIB_DIR = /usr/local/lib/w3m
HELP_FILE = w3mhelp-w3m_ja.html
-SYS_LIBRARIES = -lgpm -lbsd -lnsl -ltermcap -L/usr/local/ssl/lib -lssl -lcrypto
+SYS_LIBRARIES = -lgpm -lbsd -lnsl -lncurses -L/usr/lib -L/usr/lib -L/usr/local/ssl/lib -L/usr/local/ssl/lib -lssl -lcrypto
LOCAL_LIBRARIES =
CC = gcc
-MYCFLAGS = -g -Wall -I./gc/include -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include
-GCCFLAGS = -g -Wall -I./gc/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS -DSILENT -DNO_DEBUGGING #-DNO_SIGNALS
+MYCFLAGS = -O -I./gc/include -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include
+GCCFLAGS = -O -I./gc/include -I./$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
KEYBIND_SRC = keybind.c
KEYBIND_OBJ = keybind.o
EXT=
MATHLIB=-lm
+Z_CFLAGS=-I/usr/include
+ZLIB=-L/usr/lib -lz
+EXT_TARGETS=$(BOOKMARKER) $(HELPER) $(INFLATE)
+GC_CFLAGS=
GCLIB=gc/gc.a
GCTARGET=gc/gc.a
RANLIB=ranlib
MKDIR=mkdir -p
-VERSION=0.2.1
+VERSION=0.2.1-inu-1.5
MODEL=Linux.i686-monster-ja
#else
#define DISPLAY_CODE 'E'
+#define SYSTEM_CODE 'E'
#define JA 0
#define EN 1
@@ -129,13 +139,13 @@ MODEL=Linux.i686-monster-ja
#define MENU
#define USE_COOKIE
#define USE_SSL
-#define USE_SSL_VERIFY
-#define FTPPASS_HOSTNAMEGEN
-#define SHOW_PARAMS
+#undef USE_SSL_VERIFY
+#undef FTPPASS_HOSTNAMEGEN
+#undef SHOW_PARAMS
#define DEF_EDITOR "/bin/vi"
#define DEF_MAILER "/bin/mail"
-#define DEF_EXT_BROWSER "/usr/X11R6/bin/netscape"
+#define DEF_EXT_BROWSER "/usr/bin/netscape"
#define LIB_DIR "/usr/local/lib/w3m"
#define HELP_DIR "/usr/local/lib/w3m"
@@ -153,10 +163,11 @@ MODEL=Linux.i686-monster-ja
#define USER_MAILCAP RC_DIR "/mailcap"
#define SYS_MAILCAP "/etc/mailcap"
#define USER_MIMETYPES "~/.mime.types"
-#define SYS_MIMETYPES "/usr/lib/mime.types"
+#define SYS_MIMETYPES "/usr/local/lib/mime.types"
#define DEF_SAVE_FILE "index.html"
+#undef USE_BINMODE_STREAM
#define TERMIOS
#define DIRENT
#define STRCASECMP
@@ -173,6 +184,8 @@ MODEL=Linux.i686-monster-ja
#define READLINK
#define HAVE_SETENV
#define HAVE_PUTENV
+#define HAVE_SRAND48
+#define HAVE_SRANDOM
#define READLINK
@@ -184,18 +197,37 @@ typedef void MySignalHandler;
#define SIGNAL_ARG int _dummy
#define SIGNAL_ARGLIST 0
#define SIGNAL_RETURN return
+#define HAVE_SETPGRP
+
/*
If you want to use IPv6, define this symbol.
*/
#undef INET6
+
#undef TABLE_EXPAND
#undef TABLE_NO_COMPACT
#define NOWRAP 1
-#define NEW_FORM 1
#define MATRIX 1
#undef NO_FLOAT_H
+#ifndef HAVE_SRAND48
+#ifdef HAVE_SRANDOM
+#define srand48 srandom
+#define lrand48 random
+#else /* HAVE_SRANDOM */
+#define USE_INCLUDED_SRAND48
+#endif /* HAVE_SRANDOM */
+#endif
+
+#if defined( __CYGWIN32__ ) && !defined( __CYGWIN__ )
+#define __CYGWIN__
+#endif
+
+#if defined( __CYGWIN__ ) || defined( __EMX__ )
+#define SUPPORT_DOS_DRIVE_PREFIX 1
+#endif
+
#endif /* makefile_parameter */
#endif /* _CONFIGURED_ */
diff --git a/configure b/configure
@@ -4,10 +4,17 @@
#
#
-sysname=`uname -s`
-sysversion=`uname -r`
+if ./which uname > /dev/null ; then
+ sysname=`uname -s`
+ sysversion=`uname -r`
+ platform=`uname -m`
+elif [ -f /usr/sony/bin/machine -a -f /etc/osversion ]; then
+ sysname='NEWS-OS'
+ sysversion=`sed 's/[^ ]* [^ ]* //' /etc/osversion`
+ platform=`/usr/sony/bin/machine`
+fi
+
host=`hostname`
-platform=`uname -m`
sysversion1=`echo $sysversion | awk -F. '{print $1}'`
sysversion2=`echo $sysversion | awk -F. '{print $2}'`
@@ -22,7 +29,7 @@ if [ -f config.param ] ; then
fi
fi
-echo "# Configuretion at $host" > config.param
+echo "# Configuration at $host" > config.param
# parameters:
@@ -63,6 +70,9 @@ do
-model=monster|--model=monster)
dmodel=5
;;
+ -model=custom|--model=custom)
+ dmodel=6
+ ;;
-code=*|--code=*)
def_dcode=`expr "$1" : "-*code=\(.*\)"`
;;
@@ -73,10 +83,10 @@ do
echo "-yes, -nonstop Set all parameters to the default"
echo "-prefix=DIR Specify prefix (default: /usr/local)"
echo "-lang=(en|ja) Specify default language"
- echo "-model=(baby|little|mouse|cookie|monster)"
+ echo "-model=(baby|little|mouse|cookie|monster|custom)"
echo " Specify default model"
echo "-code=(S|E|j|N|n|m)"
- echo " Specify derault kanji code"
+ echo " Specify default kanji code"
echo "-cflags=FLAGS Specify C flags"
echo "-help Display help"
exit 0
@@ -89,7 +99,7 @@ done
# version number: JMMAAA J: major MM: minor AAA: alpha
# Alpha number of non-alpha version is 255.
# version 4.14alpha1 => 414002
-mygcversion=500003
+mygcversion=600255
if [ -z "`echo -n aho | grep n`" ] ; then
Echo()
@@ -188,7 +198,7 @@ save_params() {
find_ssl() {
sslinclude=""
- for i1 in /usr /usr/local
+ for i1 in /usr /usr/local $prefix
do
for i2 in /openssl /ssl /
do
@@ -202,7 +212,7 @@ find_ssl() {
for i3 in lib/openssl lib
do
dirname=${i1}${i2}/${i3}
- for ext in a so
+ for ext in a $so_ext
do
if [ -f $dirname/libssl.$ext -o -f $dirname/libcrypto.$ext ]; then
if [ "$ssllib" = -L${dirname} ]; then
@@ -249,12 +259,8 @@ echo "% Hello $user. Let's start configuration process for w3m."
echo "% Please answer some questions."
echo "%"
-if [ -n "`echo $sysname | grep CYGWIN`" ]; then
- sysname="CYGWIN"
- extension='.exe'
-else
- extension=
-fi
+extension=
+use_binstream='#undef USE_BINMODE_STREAM'
topdir=$prefix
special_sys=''
@@ -262,11 +268,18 @@ case "$sysname" in
aix | AIX )
special_sys="#define AIX"
;;
- CYGWIN )
+ CYGWIN* )
+ sysname='CYGWIN'
special_sys="#define CYGWIN $sysversion1"
if [ $sysversion1 -eq 0 ]; then
- topdir=/cygnus/cygwin-b20/H-i586-cygwin32
+ topdir=/cygnus/cygwin-b20/H-i586-cygwin32
fi
+ extension='.exe'
+ use_binstream='#define USE_BINMODE_STREAM'
+ ;;
+ OS/2 )
+ extension='.exe'
+ use_binstream='#define USE_BINMODE_STREAM'
;;
NetBSD )
# Newer NetBSD system doesn't define 'unix' symbol anymore, but GC library
@@ -275,6 +288,17 @@ case "$sysname" in
;;
esac
+# determine shared object extension
+so_ext=so
+case "$sysname" in
+ HP-UX )
+ so_ext=sl
+ ;;
+ Darwin )
+ so_ext=dylib
+ ;;
+esac
+
if [ -z "$def_bindir" ]; then
def_bindir="$topdir/bin"
fi
@@ -368,8 +392,14 @@ if [ "$lang" = ja ]; then
break
done
echo "def_dcode=$ncode" >> config.param
+ if [ "$ncode" = "S" ]; then
+ scode=S
+ else
+ scode=E
+ fi
else
ncode=x
+ scode=x
fi
echo "Do you want to use Lynx-like key binding?"
@@ -435,7 +465,7 @@ else
def_use_nntp="#undef USE_NNTP"
fi
-echo "Do you want ANSI color escape sequences supprot?"
+echo "Do you want ANSI color escape sequences support?"
yesno ansi_color "$ansi_color" n
echo "ansi_color=$ansi_color" >> config.param
if [ "$ansi_color" = y ]; then
@@ -465,6 +495,7 @@ readanswer ans "$dmodel"
if [ -z "$ans" -a -n "$dmodel" ]; then
ans=$dmodel
fi
+dmodel_save="$dmodel"
dmodel=$ans
case "$ans" in
1)
@@ -514,6 +545,15 @@ case "$ans" in
customized=y
;;
6)
+ if [ "X$dmodel_save" = X6 ]
+ then
+ if [ "X$use_ssl" = Xy ]
+ then
+ find_ssl
+ fi
+ save_params
+ customized=n
+ fi
;;
*)
echo "Please input 1-6."
@@ -702,9 +742,9 @@ if [ -z "$dtermlib" ]; then
for lib in $TERM_LIBS
do
- for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib
+ for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib $prefix/lib
do
- if [ -f $libdir/lib$lib.a -o -f $libdir/lib$lib.so ] ; then
+ if [ -f $libdir/lib$lib.a -o -f $libdir/lib$lib.$so_ext ] ; then
# check if the lib works...
Echo "Terminal library -l$lib found at $libdir, "
if $cc $cflags -o _zmachdep _zmachdep.c -l$lib > /dev/null 2>&1
@@ -744,7 +784,7 @@ fi
use_gpm=""
gpmlib=""
if [ "$use_mouse" = y ]; then
- for libdir in /lib /usr/lib /usr/local/lib
+ for libdir in /lib /usr/lib /usr/local/lib $prefix/lib
do
if [ -f $libdir/libgpm.a -o -f $libdir/libgpm.so ]; then
echo "GPM library found."
@@ -778,9 +818,9 @@ case $sysname in
esac
for lib in $searchlibs
do
- for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib
+ for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib $prefix/lib
do
- if [ -f $libdir/lib$lib.a -o -f $libdir/lib$lib.so ] ; then
+ if [ -f $libdir/lib$lib.a -o -f $libdir/lib$lib.$so_ext ] ; then
extlib="$extlib -l$lib"
break
fi
@@ -793,18 +833,44 @@ if [ -n "$extlib" ]; then
echo "additional library found: $extlib"
fi
+## Search zlib
+zlib=
+for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib $prefix/lib ${HOME}/lib
+do
+ if [ -f $libdir/libz.a -o -f $libdir/libz.$so_ext ] ; then
+ echo "$libdir/libz found"
+ zlib="-L$libdir -lz"
+ break
+ fi
+done
+z_cflags=
+for inc in /usr/include /usr/local/include $prefix/include ${HOME}/include
+do
+ if [ -f $inc/zlib.h ]; then
+ echo "$inc/zlib.h found"
+ z_cflags="-I$inc"
+ break
+ fi
+done
+if [ -n "$zlib" -a -n "$z_cflags" ]; then
+ inflate='$(INFLATE)'
+else
+ echo "Warning: It seems you don't have zlib. Inflate cannot be installed."
+ inflate=
+fi
+
gclib=''
gcinclude=''
gctarget=''
-for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib ${HOME}/lib
+for libdir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib $prefix/lib ${HOME}/lib
do
- if [ -f $libdir/libgc.a -o -f $libdir/libgc.so ] ; then
+ if [ -f $libdir/libgc.a -o -f $libdir/libgc.$so_ext ] ; then
echo "$libdir/libgc found"
gclib="-L$libdir -lgc"
break
fi
done
-for inc in /usr/include /usr/include/gc /usr/local/include /usr/local/include/gc ${HOME}/include
+for inc in /usr/include /usr/include/gc /usr/local/include /usr/local/include/gc $prefix/include ${HOME}/include
do
if [ -f $inc/gc.h ]; then
echo "$inc/gc.h found"
@@ -840,8 +906,8 @@ EOF
echo "GC_version is $gcversion."
if [ $gcversion -lt $mygcversion ]; then
echo "GC library on your system seems to be old."
- Echo "Do you want to use GC library comes with w3m?[y] "
- read ans
+ echo "Do you want to use GC library comes with w3m?"
+ yesno ans y y
if [ "$ans" = 'n' -o "$ans" = 'N' ]; then
cflags="$cflags -I$gcinclude"
else
@@ -867,50 +933,19 @@ if [ -z "$gclib" -o -z "$gcinclude" ]; then
fi
# Apply patch.
+gc_cflags=''
if [ "$gclib" = "gc/gc.a" -a ! -f patch_done ]; then
patchfile=""
case "$platform:$sysname" in
- [Aa]lpha:Linux)
- patchfile=Patches/alpha ;;
- [Ss]parc:Linux|sun4*:Linux)
- if [ "$sysversion1" = 2 -a "$sysversion2" = 2 ]
- then
- patchfile=Patches/linux2.2sparc
- fi
- ;;
- ARM*:Linux|arm*:Linux)
- patchfile=Patches/armlinux
- ;;
- [mM]ips*:Linux|MIPS*:Linux)
- patchfile=Patches/mipsel
- ;;
- *:HP-UX)
- if [ "$sysversion2" = 11 ]
- then
- patchfile=Patches/hpux11
- fi
- ;;
- macppc:NetBSD)
- patchfile = Patches/macppc
- ;;
R3000:*System_V*|R4000:UNIX_SYSV|R*000:UNIX_SV)
# EWS-4800
patchfile=Patches/ews4800
+ gc_cflags=-Dmips
;;
- *:NEWS-OS)
- patchfile=Patches/newsos6
- ;;
- *:Rhapsody|*:"Mac OS")
- # MacOS X
- patchfile=Patches/macosx
- ;;
- *:OS/2)
- # OS/2
- patchfile=Patches/os2
esac
if [ -n "$patchfile" -a -f "$patchfile" ]; then
- patch -p0 < $patchfile
+ patch -lp0 < $patchfile
echo "dpatch='$patch'" >> config.param
touch patch_done
fi
@@ -933,7 +968,7 @@ echo "Checking machine dependency."
###### mime.types
MIME_TYPES=""
-for d in /usr/lib /usr/local/lib /usr/local/lib/mosaic /usr/local/mosaic /usr/local/netscape /usr/local/lib/netscape
+for d in /usr/lib /usr/local/lib $prefix/lib /usr/local/lib/mosaic /usr/local/mosaic /usr/local/netscape /usr/local/lib/netscape
do
if [ -f $d/mime.types ]; then
MIME_TYPES="$d/mime.types"
@@ -1247,6 +1282,40 @@ else
jmpbuf_def="#define JMP_BUF jmp_buf"
fi
+####### srand48
+cat > _zmachdep.c << EOF
+#include <stdlib.h>
+main()
+{
+ srand48(0);
+}
+EOF
+if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
+then
+ echo "You have srand48()."
+ srand48_flg="#define HAVE_SRAND48"
+else
+ echo "You don't have srand48()."
+ srand48_flg="#undef HAVE_SRAND48"
+fi
+
+####### srandom
+cat > _zmachdep.c << EOF
+#include <stdlib.h>
+main()
+{
+ srandom(0);
+}
+EOF
+if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
+then
+ echo "You have srandom()."
+ srandom_flg="#define HAVE_SRANDOM"
+else
+ echo "You don't have srandom()."
+ srandom_flg="#undef HAVE_SRANDOM"
+fi
+
####### fclose
cat > _zmachdep.c << EOF
#include <stdio.h>
@@ -1385,6 +1454,66 @@ else
no_float_h='#define NO_FLOAT_H 1'
fi
+####### setpgrp(pid, pgrp) or setpgrp() ?
+cat > _zmachdep.c << EOF
+#include <unistd.h>
+int main(){
+ int pid;
+ if((pid = fork()) == 0 )
+ setpgrp();
+}
+EOF
+if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
+then
+ echo "You have setpgrp()."
+ have_setpgrp='#define HAVE_SETPGRP'
+else
+ cat > _zmachdep.c << EOF
+#include <unistd.h>
+int main(){
+ int pid;
+ if((pid = fork()) == 0 )
+ setpgrp( 0, 0 );
+}
+EOF
+ if $cc $cflags -o _zmachdep _zmachdep.c $extlib > /dev/null 2>&1
+ then
+ echo "You have setpgrp( pid, pgrp )."
+ have_setpgrp='#define HAVE_SETPGRP'
+ setpgrp='#define setpgrp() setpgrp( 0, 0 )'
+ else
+ have_setpgrp=''
+ fi
+fi
+
+###### atexit/on_exit
+# cat > _zmachdep.c <<EOF
+# main()
+# {
+# atexit( sleep(1) );
+# }
+# EOF
+# if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
+# then
+# echo "You have atexit()."
+# atexit_flg="#define HAVE_ATEXIT"
+# else
+# cat > _zmachdep.c <<EOF
+# #include <stdio.h>
+# main()
+# {
+# on_exit( sleep(1), NULL );
+# }
+# EOF
+# if $cc $cflags -o _zmachdep _zmachdep.c > /dev/null 2>&1
+# then
+# echo "You have on_exit()."
+# atexit_flg="#define atexit(x) on_exit(x, NULL)"
+# else
+# echo "You don't have atexit()/on_exit()"
+# fi
+# fi
+
###### IPv6 support check
cat > _zmachdep.c <<EOF
#include <sys/types.h>
@@ -1398,7 +1527,9 @@ main()
}
EOF
ipv6="#undef INET6"
+v6_ss_family=""
v6lib=''
+
if $cc $cflags -o _zmachdep _zmachdep.c $extlib > /dev/null 2>&1
then
if ./_zmachdep; then
@@ -1421,7 +1552,7 @@ EOF
then
echo "You have getaddrinfo() in libc."
else
- for libdir in /usr/local/v6/lib /usr/local/lib /usr/lib
+ for libdir in /usr/local/v6/lib /usr/local/lib /usr/lib $prefix/lib
do
if [ -e $libdir/libinet6.a ]; then
if [ "$libdir" != "/usr/lib" ]; then
@@ -1446,6 +1577,40 @@ EOF
;;
esac
fi
+
+####### ss_family or __ss_family ?
+if [ "$ipv6" = "#define INET6" ]; then
+ cat > _zmachdep.c <<EOF
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+ struct sockaddr_storage ss;
+ int i = ss.ss_family;
+}
+EOF
+ if $cc $cflags -o _zmachdep _zmachdep.c $extlib > /dev/null 2>&1
+ then
+ echo "You have ss_family."
+ else
+ cat > _zmachdep.c <<EOF
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+ struct sockaddr_storage ss;
+ int i = ss.__ss_family;
+}
+EOF
+ if $cc $cflags -o _zmachdep _zmachdep.c $extlib > /dev/null 2>&1
+ then
+ echo "You have __ss_family."
+ ipv6_ss_family="#define ss_family __ss_family"
+ else
+ echo "You don't have ss_family."
+ ipv6="#undef INET6"
+ fi
+ fi
+fi
+
if [ "$ipv6" = "#undef INET6" ]; then
echo "You don't have IPv6 support."
else
@@ -1566,11 +1731,6 @@ $def_ansi_color
#undef USE_EGD
/*
- * MENU_MAP enables w3m to show image map link with popup menu.
- */
-#define MENU_MAP
-
-/*
* Use Emacs-like key binding for file name completion
*/
#undef EMACS_LIKE_LINEEDIT
@@ -1580,6 +1740,16 @@ $def_ansi_color
*/
#undef ENABLE_REMOVE_TRAILINGSPACES
+/*
+ * Move cursor to top line when going to label.
+ */
+#undef LABEL_TOPLINE
+
+/*
+ * Move cursor to top line when moving to next page.
+ */
+#undef NEXTPAGE_TOPLINE
+
/**********************************************************/
#ifdef makefile_parameter
@@ -1591,11 +1761,15 @@ SYS_LIBRARIES = $gpmlib $extlib $termlib $ssllib $v6lib
LOCAL_LIBRARIES = $ldflags
CC = $cc
MYCFLAGS = $cflags $bsdinclude $sslinclude
-GCCFLAGS = $cflags -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS -DSILENT -DNO_DEBUGGING #-DNO_SIGNALS
+GCCFLAGS = $cflags -I./\$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
KEYBIND_SRC = $keymap_file.c
KEYBIND_OBJ = $keymap_file.o
EXT=$extension
MATHLIB=$mathlib
+Z_CFLAGS=$z_cflags
+ZLIB=$zlib
+EXT_TARGETS=\$(BOOKMARKER) \$(HELPER) $inflate
+GC_CFLAGS=$gc_cflags
GCLIB=$gclib
GCTARGET=$gctarget
RANLIB=$ranlib_cmd
@@ -1606,6 +1780,7 @@ MODEL=$sysname.$platform-$modelname-$lang
$special_sys
#define DISPLAY_CODE '$ncode'
+#define SYSTEM_CODE '$scode'
#define JA 0
#define EN 1
@@ -1646,6 +1821,7 @@ $def_show_params
#define DEF_SAVE_FILE "index.html"
+$use_binstream
$term_if
$dir_if
$strcasecmp_flg
@@ -1662,6 +1838,8 @@ $getwd_flg
$readlink_flg
$setenv_flg
$putenv_flg
+$srand48_flg
+$srandom_flg
$readlink_flg
$fclose_dcl
$pclose_dcl
@@ -1673,18 +1851,37 @@ $sig_type
$sig_arg
$sig_arglist
$sig_return
+$have_setpgrp
+$setpgrp
/*
If you want to use IPv6, define this symbol.
*/
$ipv6
+$ipv6_ss_family
#undef TABLE_EXPAND
#undef TABLE_NO_COMPACT
#define NOWRAP 1
-#define NEW_FORM 1
#define MATRIX 1
$no_float_h
+#ifndef HAVE_SRAND48
+#ifdef HAVE_SRANDOM
+#define srand48 srandom
+#define lrand48 random
+#else /* HAVE_SRANDOM */
+#define USE_INCLUDED_SRAND48
+#endif /* HAVE_SRANDOM */
+#endif
+
+#if defined( __CYGWIN32__ ) && !defined( __CYGWIN__ )
+#define __CYGWIN__
+#endif
+
+#if defined( __CYGWIN__ ) || defined( __EMX__ )
+#define SUPPORT_DOS_DRIVE_PREFIX 1
+#endif
+
#endif /* makefile_parameter */
#endif /* _CONFIGURED_ */
@@ -1699,14 +1896,7 @@ perl=`./which perl`
if [ `expr "$perl" : 'not found'` != 0 ]; then
perl=/usr/local/bin/perl
fi
-if [ $sysname = CYGWIN ]; then
- cygwin=1
-else
- cygwin=0
-fi
sed -e "s;@PERL@;$perl;" \
- -e "s;@CYGWIN@;$cygwin;" \
scripts/dirlist.in > scripts/dirlist.cgi
-
echo 'Configuration done. Just type "make".'
diff --git a/conv.c b/conv.c
@@ -141,7 +141,7 @@ static void
n_impr(char s)
{
fprintf(stderr, "conv: option %c(0x%02x) is not implemented yet... sorry\n", s, s);
- exit(1);
+ w3m_exit(1);
}
Str
diff --git a/cookie.c b/cookie.c
@@ -552,7 +552,7 @@ cookie_list_panel(void)
Strcat_charp(src, "<ol>");
for (p = First_cookie, i = 0; p; p = p->next, i++) {
- tmp = htmlquote_str(parsedURL2Str(&p->url)->ptr);
+ tmp = html_quote(parsedURL2Str(&p->url)->ptr);
if (p->expires != (time_t) - 1) {
#ifdef HAVE_STRFTIME
strftime(tmp2, 80, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&p->expires));
@@ -590,20 +590,20 @@ cookie_list_panel(void)
Strcat_charp(src, "<table cellpadding=0>");
if (!(p->flag & COO_SECURE)) {
Strcat_charp(src, "<tr><td width=\"80\"><b>Cookie:</b></td><td>");
- Strcat_charp(src, htmlquote_str(make_cookie(p)->ptr));
+ Strcat_charp(src, html_quote(make_cookie(p)->ptr));
Strcat_charp(src, "</td></tr>");
}
if (p->comment) {
Strcat_charp(src, "<tr><td width=\"80\"><b>Comment:</b></td><td>");
- Strcat_charp(src, htmlquote_str(p->comment->ptr));
+ Strcat_charp(src, html_quote(p->comment->ptr));
Strcat_charp(src, "</td></tr>");
}
if (p->commentURL) {
Strcat_charp(src, "<tr><td width=\"80\"><b>CommentURL:</b></td><td>");
Strcat_charp(src, "<a href=\"");
- Strcat_charp(src, htmlquote_str(p->commentURL->ptr));
+ Strcat_charp(src, html_quote(p->commentURL->ptr));
Strcat_charp(src, "\">");
- Strcat_charp(src, htmlquote_str(p->commentURL->ptr));
+ Strcat_charp(src, html_quote(p->commentURL->ptr));
Strcat_charp(src, "</a>");
Strcat_charp(src, "</td></tr>");
}
@@ -619,17 +619,17 @@ cookie_list_panel(void)
Strcat_charp(src, "</td></tr><tr><td>");
if (p->domain) {
Strcat_charp(src, "<tr><td width=\"80\"><b>Domain:</b></td><td>");
- Strcat_charp(src, htmlquote_str(p->domain->ptr));
+ Strcat_charp(src, html_quote(p->domain->ptr));
Strcat_charp(src, "</td></tr>");
}
if (p->path) {
Strcat_charp(src, "<tr><td width=\"80\"><b>Path:</b></td><td>");
- Strcat_charp(src, htmlquote_str(p->path->ptr));
+ Strcat_charp(src, html_quote(p->path->ptr));
Strcat_charp(src, "</td></tr>");
}
if (p->portl) {
Strcat_charp(src, "<tr><td width=\"80\"><b>Port:</b></td><td>");
- Strcat_charp(src, htmlquote_str(portlist2str(p->portl)->ptr));
+ Strcat_charp(src, html_quote(portlist2str(p->portl)->ptr));
Strcat_charp(src, "</td></tr>");
}
Strcat_charp(src, "<tr><td width=\"80\"><b>Secure:</b></td><td>");
diff --git a/deflate.c b/deflate.c
@@ -0,0 +1,58 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <zlib.h>
+
+#undef BUFSIZE
+#define BUFSIZE 4096
+
+int
+main(int argc, char **argv)
+{
+ z_stream s;
+ FILE *f;
+ char inbuf[BUFSIZE], outbuf[BUFSIZE];
+ int status, flush;
+
+ if (argc > 1) {
+ f = fopen(argv[1], "rb");
+ if (! f)
+ exit(1);
+ } else
+ f = stdin;
+
+ s.zalloc = Z_NULL;
+ s.zfree = Z_NULL;
+ s.opaque = Z_NULL;
+ status = deflateInit(&s, Z_DEFAULT_COMPRESSION);
+ if (status != Z_OK)
+ exit(1);
+ s.avail_in = 0;
+ s.next_out = outbuf;
+ s.avail_out = sizeof(outbuf);
+ flush = Z_NO_FLUSH;
+ while (1) {
+ if (s.avail_in == 0) {
+ s.next_in = inbuf;
+ s.avail_in = fread(inbuf, 1, sizeof(inbuf), f);
+ if (s.avail_in < sizeof(inbuf))
+ flush = Z_FINISH;
+ }
+ status = deflate(&s, flush);
+ if (status == Z_STREAM_END) {
+ if (sizeof(outbuf) - s.avail_out)
+ fwrite(outbuf, 1, sizeof(outbuf) - s.avail_out, stdout);
+ break;
+ }
+ if (status != Z_OK)
+ exit(1);
+ if (s.avail_out == 0) {
+ fwrite(outbuf, 1, sizeof(outbuf), stdout);
+ s.next_out = outbuf;
+ s.avail_out = sizeof(outbuf);
+ }
+ }
+ deflateEnd(&s);
+ fclose(f);
+ return 0;
+}
diff --git a/dict.c b/dict.c
@@ -1,137 +0,0 @@
-
-/*
- * From g96p0935@mse.waseda.ac.jp Mon Jun 14 09:34:15 1999 Received: from
- * ei5sun.yz.yamagata-u.ac.jp (ei5sun.yz.yamagata-u.ac.jp [133.24.114.42])
- * by ei5nazha.yz.yamagata-u.ac.jp (8.9.3/8.9.3) with ESMTP id JAA20673 for
- * <aito@ei5nazha.yz.yamagata-u.ac.jp>; Mon, 14 Jun 1999 09:34:14 +0900
- * (JST) Received: from pandora.mse.waseda.ac.jp
- * (root@pandora.mse.waseda.ac.jp [133.9.5.9]) by
- * ei5sun.yz.yamagata-u.ac.jp (8.8.0/3.5Wbeta) with ESMTP id JAA23968 for
- * <aito@ei5sun.yz.yamagata-u.ac.jp>; Mon, 14 Jun 1999 09:35:30 +0900 (JST)
- * Received: from localhost (root@[133.9.85.55]) by pandora.mse.waseda.ac.jp
- * (8.9.1+3.0W/3.7W) with ESMTP id JAA18473; Mon, 14 Jun 1999 09:30:31 +0900
- * (JST) Message-Id: <199906140030.JAA18473@pandora.mse.waseda.ac.jp> To:
- * aito@ei5sun.yz.yamagata-u.ac.jp Subject: w3m:$B1QOB<-E58!:w5!G=Ec:\(B
- * Cc: g96p0935@mse.waseda.ac.jp From: Takashi Nishimoto
- * <g96p0935@mse.waseda.ac.jp> X-Mailer: Mew version 1.93 on Emacs 19.34 /
- * Mule 2.3 (SUETSUMUHANA) Mime-Version: 1.0 Content-Type: Text/Plain;
- * charset=iso-2022-jp Content-Transfer-Encoding: 7bit Date: Mon, 14 Jun
- * 1999 09:29:56 +0900 X-Dispatcher: imput version 980506 Lines: 150
- *
- * $B@>K\(B@$BAaBg$G$9!#(B
- *
- * Quick Hack $B$G(B w3m
- * $B$K1QOB<-E58!:w5!G=$HC18lC10L$N%+!<%=%k0\F0$r<BAu$7$^(B $B$7$?!#(B
- *
- * Unix $B$r;H$C$F$$$k$H!"1QJ8$rFI$`5!2q$,B?$$$G$9$M!#(B Emacs
- * $BFb$G$O%o%s%?%C%A$G1QOB<-E5$r8!:w$9$k(B sdic
- * $B$N$h$&$J%D!<%k$,$"$j$^(B
- * $B$9$,!"$A$g$C$H$7$?J8=q$rFI$`$@$1$K$$$A$$$A(B Emacs
- * $B$KFI$_9~$`$N$O$+$C$?(B $B$k$$$N$G!"$J$s$H$+(B w3m
- * $B$G$G$-$J$$$+$H;W$$!":n6H$KF'$_@Z$j$^$7$?!#(B
- *
- * $B$9$k$H0U30$K4JC1$K<BAu$G$-$^$7$?!#KM$O(B C
- * $B%W%m%0%i%`$N2~B$$O=i$a$F$G$9(B $B$,!"(B Emacs Lisp
- * $BJB$N<j7Z$5$G<BAu$G$-$?$3$H$K$O46F0$7$^$7$?!#(B
- *
- * dictword $B$,D4$Y$kC18l$rJ9$$$F8!:w$9$k4X?t$G!"(B dictwordat
- * $B$,%+!<%=%k0L(B
- * $BCV$NC18l$r8!:w$9$k4X?t$G$9!#%=!<%9$r8+$l$PL@$i$+$J$h$&$K8!:w$9$k30It%3(B
- * $B%^%s%I$O(B w3mdict $B$G$9!#(B Unix
- * $B$J$N$G!"IaCJ;H$C$F$$$k%3%^%s%I$X$N(B symlink $B$K$7$F$$$^$9!#(Bw
- * $B$K(B dictword$B!"(B W $B$K(B dictwordat $B$r3d$jEv$F$F$$$^(B
- * $B$9!#$^$?!"1&<j$GFI$a$k$h$&$K(B ; $B$K$b(B dictwordat
- * $B$r3d$jEv$F$F$$$^$9!#(B */
-#include "fm.h"
-#include <signal.h>
-
-#ifdef DICT
-
-#define DICTCMD "w3mdict "
-#define DICTBUFFERNAME "*dictionary*"
-/* char *DICTBUFFERNAME="*dictionary*"; */
-
-char *
-GetWord(char *word)
-{
- Line *l = Currentbuf->currentLine;
- char *lb = l->lineBuf;
- int i, b, e, pos = Currentbuf->pos;
-
- i = pos;
- while (!IS_ALPHA(lb[i]) && i >= 0)
- i--;
- pos = i;
- while (IS_ALPHA(lb[i]) && i >= 0)
- i--;
- i++;
- if (!IS_ALPHA(lb[i]))
- return NULL;
- b = i;
- i = pos;
- while (IS_ALPHA(lb[i]) && i <= l->len - 1)
- i++;
- e = i - 1;
- strncpy(word, &lb[b], e - b + 1);
- word[e - b + 1] = '\0';
- return word;
-}
-
-void
-execdict(char *word)
-{
- Buffer *buf;
- static char cmd[100], bufname[100];
- MySignalHandler(*prevtrap) ();
-
- if (word == NULL)
- return;
- strcpy(cmd, DICTCMD);
- strcat(cmd, word);
- buf = namedBuffer(Firstbuf, SHELLBUFFERNAME);
- if (buf != NULL)
- Firstbuf = deleteBuffer(Firstbuf, buf);
-
- if (cmd == NULL || *cmd == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
- prevtrap = signal(SIGINT, intTrap);
- crmode();
- buf = getshell(cmd);
-/* sprintf(bufname,"*dictionary(%s)*",word); */
-/* buf->buffername = bufname; */
- buf->buffername = DICTBUFFERNAME;
- buf->filename = word;
- signal(SIGINT, prevtrap);
- term_raw();
- if (buf == NULL) {
- disp_message("Execution failed", FALSE);
- }
- else if (buf->firstLine == NULL) {
- /* if the dictionary doesn't describe the word. */
- char msg[100];
- sprintf(msg, "Word \"%s\" Not Found", word);
- disp_message(msg, FALSE);
-
- }
- else {
- buf->nextBuffer = Firstbuf;
- Currentbuf = Firstbuf = buf;
- }
- displayBuffer(Currentbuf, B_FORCE_REDRAW);
-}
-
-void
-dictword(void)
-{
- execdict(inputStr("(dictionary)!", ""));
-}
-
-void
-dictwordat(void)
-{
- static char word[100];
- execdict(GetWord(word));
-}
-#endif /* DICT */
diff --git a/display.c b/display.c
@@ -148,20 +148,6 @@ fmTerm(void)
}
}
-void
-deleteFiles()
-{
- Buffer *buf;
- char *f;
- while (Firstbuf && Firstbuf != NO_BUFFER) {
- buf = Firstbuf->nextBuffer;
- discardBuffer(Firstbuf);
- Firstbuf = buf;
- }
- while ((f = popText(fileToDelete)) != NULL)
- unlink(f);
-}
-
/*
* Initialize routine.
@@ -171,12 +157,11 @@ fmInit(void)
{
if (!fmInitialized) {
initscr();
+#if defined( __CYGWIN__ ) && defined( JP_CHARSET )
+ init_win32_console_handle();
+#endif
term_raw();
term_noecho();
-#ifdef MOUSE
- if (use_mouse)
- mouse_init();
-#endif /* MOUSE */
}
fmInitialized = TRUE;
}
@@ -201,7 +186,7 @@ static Linecolor color_mode = 0;
static Buffer *save_current_buf = NULL;
#endif
-static int in_check_url = FALSE;
+int in_check_url = FALSE;
void
displayBuffer(Buffer * buf, int mode)
@@ -237,6 +222,11 @@ displayBuffer(Buffer * buf, int mode)
scroll(n);
}
else if (n < 0 && n > -LASTLINE) {
+#if defined(CYGWIN) && LANG == JA
+ move(LASTLINE + n + 1, 0);
+ clrtoeolx();
+ refresh();
+#endif /* defined(CYGWIN) && LANG == JA */
rscroll(-n);
}
redrawNLine(buf, n);
@@ -771,7 +761,7 @@ message_list_panel(void)
"<h1>List of error messages</h1><table cellpadding=0>\n");
if (message_list)
for (p = message_list->last ; p ; p = p->prev)
- Strcat_m_charp(tmp, "<tr><td><pre>", htmlquote_str(p->ptr), "</pre></td></tr>\n", NULL);
+ Strcat_m_charp(tmp, "<tr><td><pre>", html_quote(p->ptr), "</pre></td></tr>\n", NULL);
else
Strcat_charp(tmp, "<tr><td>(no message recorded)</td></tr>\n");
Strcat_charp(tmp, "</table></body></html>");
@@ -793,7 +783,7 @@ void
disp_message_nsec(char *s, int redraw_current, int sec, int purge, int mouse)
{
if (!fmInitialized) {
- fprintf(stderr, "%s\n", s);
+ fprintf(stderr, "%s\n", conv_to_system(s));
return;
}
if (Currentbuf != NULL)
@@ -828,14 +818,14 @@ disp_message_nomouse(char *s, int redraw_current)
#endif
void
-cursorUp(Buffer * buf)
+cursorUp(Buffer * buf, int n)
{
if (buf->firstLine == NULL)
return;
if (buf->cursorY > 0)
cursorUpDown(buf, -1);
else {
- buf->topLine = lineSkip(buf, buf->topLine, -(LASTLINE + 1) / 2, FALSE);
+ buf->topLine = lineSkip(buf, buf->topLine, - n, FALSE);
if (buf->currentLine->prev != NULL)
buf->currentLine = buf->currentLine->prev;
arrangeLine(buf);
@@ -843,14 +833,14 @@ cursorUp(Buffer * buf)
}
void
-cursorDown(Buffer * buf)
+cursorDown(Buffer * buf, int n)
{
if (buf->firstLine == NULL)
return;
if (buf->cursorY < LASTLINE - 1)
cursorUpDown(buf, 1);
else {
- buf->topLine = lineSkip(buf, buf->topLine, (LASTLINE + 1) / 2, FALSE);
+ buf->topLine = lineSkip(buf, buf->topLine, n, FALSE);
if (buf->currentLine->next != NULL)
buf->currentLine = buf->currentLine->next;
arrangeLine(buf);
@@ -870,7 +860,7 @@ cursorUpDown(Buffer * buf, int n)
}
void
-cursorRight(Buffer * buf)
+cursorRight(Buffer * buf, int n)
{
int i, delta = 1, cpos, vpos2;
Line *l = buf->currentLine;
@@ -907,15 +897,15 @@ cursorRight(Buffer * buf)
delta = 2;
#endif /* JP_CHARSET */
vpos2 = COLPOS(l, buf->pos + delta) - buf->currentColumn - 1;
- if (vpos2 >= COLS) {
- columnSkip(buf, (COLS / 2) + (vpos2 - COLS) - (vpos2 - COLS) % (COLS / 2));
+ if (vpos2 >= COLS && n) {
+ columnSkip(buf, n + (vpos2 - COLS) - (vpos2 - COLS) % n);
buf->visualpos = cpos - buf->currentColumn;
}
buf->cursorX = buf->visualpos;
}
void
-cursorLeft(Buffer * buf)
+cursorLeft(Buffer * buf, int n)
{
int i, delta = 1, cpos;
Line *l = buf->currentLine;
@@ -935,8 +925,8 @@ cursorLeft(Buffer * buf)
buf->pos = 0;
cpos = COLPOS(l, buf->pos);
buf->visualpos = cpos - buf->currentColumn;
- if (buf->visualpos < 0) {
- columnSkip(buf, -(COLS / 2) + buf->visualpos - buf->visualpos % (COLS / 2));
+ if (buf->visualpos < 0 && n) {
+ columnSkip(buf, - n + buf->visualpos - buf->visualpos % n);
buf->visualpos = cpos - buf->currentColumn;
}
buf->cursorX = buf->visualpos;
@@ -1042,19 +1032,19 @@ cursorXY(Buffer * buf, int x, int y)
if (buf->cursorX > x) {
while (buf->cursorX > x)
- cursorLeft(buf);
+ cursorLeft(buf, COLS / 2);
}
else if (buf->cursorX < x) {
while (buf->cursorX < x) {
oldX = buf->cursorX;
- cursorRight(buf);
+ cursorRight(buf, COLS / 2);
if (oldX == buf->cursorX)
break;
}
if (buf->cursorX > x)
- cursorLeft(buf);
+ cursorLeft(buf, COLS / 2);
}
}
diff --git a/doc-jp/HISTORY.kokb b/doc-jp/HISTORY.kokb
@@ -1,1220 +0,0 @@
-2001/1/25
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01667] Re: mailer %s
- Editor ¤¬ "vi %s" ¤Ê¤É¤Î¾ì¹ç¤Ë "vi file +10" ¤Ê¤É¤ÈŸ³«¤µ¤ì¤Æ¤·¤Þ¤¤¡¢
- ÌäÂ꤬¤¢¤Ã¤¿¤Î¤Ç¡¢Editor ¤ÎŸ³«¤ò¡¢
- ¡¦%s ¤¬¤¢¤ë¾ì¹ç
- * %d ¤¬¤¢¤ì¤Ð¡¢
- Sprintf(Editor, linenum, file) # ½çÈ֤ϸÇÄê
- * ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð
- Sprintf(Editor, file)
- ¡¦%s ¤¬¤Ê¤¤¾ì¹ç
- * %d ¤¬¤¢¤ì¤Ð¡¢
- Sprintf(Editor, linenum) file
- * "vi" ¤È¤¤¤¦Ê¸»úÎ󤬤¢¤ì¤Ð¡¢
- Sprintf("%s +%d", Editor, linenum) file
- * ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð
- Editor file
- ¤È¤·¤Æ¤ß¤Þ¤·¤¿¡£
-
-
-2001/1/24
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01661] Re: <head>
- security fix.
-
-
-2001/1/23
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦Â°ÀÃͤÎÃæ¤Î ", <, > & Åù¤¬¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¥Á¥§¥Ã¥¯¤¹¤ë
- ¤è¤¦¤Ë¤·¤¿.
- ¡¦Â°À¤ò»ý¤Æ¤Ê¤¤¥¿¥°¤Î, °À¤Î¥Á¥§¥Ã¥¯¤¬È´¤±¤Æ¤¤¤¿ÌäÂê¤Î½¤Àµ.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01663] replace addUniqHist with addHist in loadHistory()
-
-
-2001/1/22
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01617] Re: first body with -m (Re: w3m-m17n-0.7)
- üËö¤ò¥ê¥µ¥¤¥º¤·¤¿¾ì¹ç¤ÎÆ°ºî¤âƱ¤¸¤Ë¤·¤Þ¤·¤¿(ñ¤Ë˺¤ì¤Æ¤¤¤¿¤À¤±)¡£
- ¤Ä¤¤¤Ç¤Ë¡¢Â¿ÃʤΥե졼¥à¤Ç¹½À®¤µ¤ì¤Æ¤¤¤ë¥Ú¡¼¥¸¤Î»þ¡¢INFO('=') ¤Ç¤Î
- ¥Õ¥ì¡¼¥à¾ðÊó¤Îɽ¼¨¤¬¤ª¤«¤·¤«¤Ã¤¿¤Î¤Ç¤½¤Î½¤Àµ¤Ç¤¹¡£
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01621] NEXT_LINK and GOTO_LINE problem
- NEXT_LINK ¤È GOTO_LINE ¤Ç¤¹¤¬¡¢¼¡¤Î¥Ú¡¼¥¸¤ÎºÇ½é¤Î¹Ô¤Ë°ÜÆ°¤·¤¿¤È¤¤À¤±¡¢
- 1 ¥Ú¡¼¥¸Ê¬¥¹¥¯¥í¡¼¥ë¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01623] Re: (frame) http://www.securityfocus.com/
-Subject: [w3m-dev 01632] Re: (frame) http://www.securityfocus.com/
- frame fix.
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01624] Re: first body with -m
-From: Hironori Sakamoto <h-saka@udlew10.uldev.lsi.nec.co.jp>
-Subject: [w3m-dev 01625] Re: first body with -m
- pgFore, pgBack ¤Ç¡¢currentLine ¤¬²èÌ̳°¤È¤Ê¤ê¡¢¤«¤Ä¡¢°ì²èÌÌʬ
- ¥¹¥¯¥í¡¼¥ë¤Ç¤¤Ê¤«¤Ã¤¿¤È¤¤Ë¡¢º£¤Þ¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤¿Éôʬ¤È¿·¤·¤¯É½¼¨¤µ¤ì
- ¤¿Éôʬ¤Î´Ö¤Ë currentLine ¤ò»ý¤Ã¤Æ¤¯¤ë¤è¤¦¤Ê¥Ñ¥Ã¥Á¤ò½ñ¤¤¤Æ¤ß¤Þ¤·¤¿¡£
-
-From: Hironori Sakamoto <h-saka@udlew10.uldev.lsi.nec.co.jp>
-Subject: [w3m-dev 01635] Directory list
- local.c ¤Î directory list ¤òºîÀ®¤¹¤ëÉôʬ¤Ë¥Ð¥°¤¬¤¢¤ê¤Þ¤·¤¿¡£
-
-From: Hironori Sakamoto <h-saka@udlew10.uldev.lsi.nec.co.jp>
-Subject: [w3m-dev 01643] buffername
-Subject: [w3m-dev 01650] Re: buffername
- buffername (title) ¤Ë´Ø¤¹¤ë²þÎÉ(?)¤È½¤Àµ¤Ç¤¹¡£
- ¡¦displayLink ¤¬ ON ¤Î¾ì¹ç¤ËŤ¤ URL ¤òɽ¼¨¤¹¤ë»þ¤Ï buffername ¤ÎÊý¤ò
- ÀÚ¤ê¤Ä¤á¤ëÍͤˤ·¤Æ¤ß¤Þ¤·¤¿¡£
- ¡¦¤Ä¤¤¤Ç¤Ë displayBuffer() ¤Î¥³¡¼¥É¤ÎÀ°Íý¡£
- ¡¦HTML Ã椫¤é title ¤ò¼è¤ë¾ì¹ç¤ËËöÈø¤Î¶õÇòʸ»ú¤Ïºï½ü¤¹¤ëÍͤˤ·¤Þ¤·¤¿¡£
- ¡¦[w3m-dev 01503], [w3m-dev 01504] ¤Î·ï¤Î½¤Àµ
- buffername ¤Ï¾ï¤Ë cleaup_str ¤µ¤ì¤ÆÊÝ»ý¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
- ¤Ê¤ª¡¢¸½»þÅÀ¤Ç¤Ï¡¢SJIS ¤Î¥Õ¥¡¥¤¥ë̾¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤òÆɤà¤È¡¢
- buffername ¤ä URL ¤¬ SJIS ¤Ë¤Ê¤Ã¤Æ°¤µ¤ò¤¹¤ë¤³¤È¤¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£
-
-From: Hironori Sakamoto <h-saka@udlew10.uldev.lsi.nec.co.jp>
-Subject: [w3m-dev 01646] putAnchor
- HTML ¤Î¥µ¥¤¥º¤È®Å٤Υ٥ó¥Á¥Þ¡¼¥¯¤ò¤·¤Æ¤ß¤è¤¦¤È»×¤Ã¤Æ¡¢¤¤¤í¤¤¤í
- ¤ä¤Ã¤Æ¤ë¤È¡¢¤¢¤ë¥µ¥¤¥º¤«¤éµÞ·ã¤Ë®ÅÙ¤¬Äã²¼¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤·¤¿¡£
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01647] Re: first body with -m
- ºäº¬¤µ¤ó¤«¤é #label ¤Ä¤¤Î URL ¤ò»ý¤Ä¥Ð¥Ã¥Õ¥¡¤ò reload ¤¹¤ë¤È¡¢
- ¥«¡¼¥½¥ë°ÌÃÖ¤¬¤º¤ì¤Æ¤·¤Þ¤¦¾ì¹ç¤¬¤¢¤ë¤È¤Î»ØŦ¤¬¤¢¤ê¤Þ¤·¤¿¤Î¤Ç¡¢
- ½¤Àµ patch ¤Ç¤¹¡£
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01651] display column position with LINE_INFO
- LINE_INFO(Ctrl-g) ¤Ç¥«¥é¥à°ÌÃÖ¤â½ÐÎϤ¹¤ëÍͤˤ·¤Æ¤ß¤Þ¤·¤¿¡£
-
-
-2001/1/5
-
-From: Ryoji Kato <ryoji.kato@nrj.ericsson.se>
-Subject: [w3m-dev 01582] rfc2732 patch
- RFC2732 ¤Ëµ½Ò¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê URL Ãæ¤Î '[' ¤È ']' ¤Ç¤¯¤¯¤é¤ì¤¿
- literal IPv6 address ¤ò²ò¼á¤¹¤ë¡£
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01594] first body with -m (Re: w3m-m17n-0.7)
- "-m" ¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤ÆÆ°¤«¤·¤¿¤È¤¤Ë¡¢¥á¡¼¥ë¤Î¥Ø¥Ã¥À¤ÈËÜʸ¤Î´Ö¤Î
- ¶õ¹Ô¤Î½èÍý¤¬¤ª¤«¤·¤¤¤Ç¤¹¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01602] Re: first body with -m (Re: w3m-m17n-0.7)
- ...
- ¤É¤³¤«¤Ë¡¢
- buf->lastLine->linenumber - buf->topLine->linenumber < LASTLINE - 1
- ¤È¤¤¤¦Çû¤ê¤ò²Ã¤¨¤ë¤È¤¤¤¤¤Î¤«¤Ê¡£
- ¤È¤¤¤¦¤ï¤±¤Ç patch ¤òºî¤Ã¤Æ¤ß¤¿¤Î¤Ç¤¹¤¬¡¢¤Á¤ç¤Ã¤È¼«¿®Ìµ¤·¤Ç¤¹¡£
- ¤Ê¤ª¡¢pgFore, pgBack ¤Î¥«¡¼¥½¥ë°ÌÃÖ¤ÎÀßÄê¤ò¡¢¥¹¥¯¥í¡¼¥ë('J', 'K')
- ¤ÈƱ¤¸Æ°ºî¤Ë¤·¤Æ¤¤¤Þ¤¹¡£¤¹¤Ê¤ï¤Á ¡Ø¿ô SPC¡Ù¤È¡Ø¿ô J¡Ù ¤ÏƱ¤¸¡£
- vi ¤ÎÆ°ºî¤È¤Ï¤³¤Ã¤Á¤¬¹ç¤Ã¤Æ¤ë¤Ï¤º¤Ç¤¹¤¬¡¢¤É¤¦¤Ç¤·¤ç¤¦¡£
- ¤Ä¤¤¤Ç¤Ë¡¢reload, edit »þ¤Ë¥«¡¼¥½¥ë°ÌÃÖ¤òÊݸ¤¹¤ë¼ÂÁõ¤ò²þÎɤ·¤Æ¤¤¤Þ¤¹¡£
-
-
-2001/1/1
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01584] Re: attribute replacing in frames. (Re: some fixes)
- ¤â¤¦°ìÅÙ¡£frameÆâ¤Îtag½ñ¤´¹¤¨¤òñ½ã¤Ë¤·¤¿patch¤òÁ÷¤ê¤Þ¤¹¡£
-
-
-2000/12/27
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¥Õ¥¡¥¤¥ë¤Î½ª¤ï¤ê¤Ë¶õ¹Ô¤¬Í¾Ê¬¤ËÄɲ䵤ì¤ëÌäÂê¤Î½¤Àµ.
-
-
-2000/12/26
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01560] Re: long URL
- >> ²¬ÅĤǤ¹¡£
- >> PEEK ¤ä PEEK_LINK ¤Ç²èÌÌÉý¤è¤êŤ¤ URL ¤ò¸«¤é¤ì¤ë¤è¤¦¤Ë¡¢prefix ¤òÍøÍÑ
- >> ¤·¤Æ¼ÂÁõ¤·¤Æ¤ß¤Þ¤·¤¿¡£
- >> ËÜÅö¤Ï°ìÅÙ¤ËÁ´Éôɽ¼¨¤·¤¿¤«¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢²èÌÌÀ©¸æ¤Þ¤ï¤ê¤¬¤è¤¯¤ï¤«¤é¤Ê¤«¤Ã
- >> ¤¿¤Î¤Ç¡¢¤È¤ê¤¢¤¨¤ºÉ½¼¨¤·¤¿¤¤Éôʬ¤ò»ØÄꤹ¤ëÊýË¡¤ò¤È¤Ã¤Æ¤¤¤Þ¤¹¡£2c ¤ä 3u
- >> ¤ÈÆþÎϤ¹¤ë¤È¡¢»ØÄꤵ¤ì¤¿Éôʬ¤ËÂбþ¤¹¤ë¡¢URL ¤Î°ìÉô¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
- >> ¸æ°Õ¸«¡¢¸æ´¶ÁÛ¤ªÂÔ¤Á¤·¤Æ¤ª¤ê¤Þ¤¹¡£
- ¤³¤¦¤¤¤¦¤Î¤Ï¤É¤¦¤Ç¤·¤ç¤¦¡£
- Ϣ³¤·¤¿ 'u' ¤ä 'c' ¤Ç URL ¤¬°ìʸ»ú¤º¤Ä¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡£
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01570] Re: long URL
- ºäËܤµ¤ó> # ²¬ÅĤµ¤ó¤Î°Æ¤âÆþ¤ì¤Æ¤â¤¤¤¤¤«¤â¤·¤ì¤Þ¤»¤ó¡£
-
- ºäËܤµ¤ó¤Î [w3m-dev 1560] ¤«¤é¤Îº¹Ê¬¤òźÉÕ¤·¤Þ¤¹¡£Èó¾ï¤ËŤ¤ URL ¤Î¾ì
- ¹ç¤Ï͸ú¤«¤È»×¤¤¤Þ¤¹(¤¢¤Þ¤ê¼ûÍפϤʤµ¤½¤¦¤Ç¤¹¤¬)¡£
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01506] compile option of gc.a
- NO_DEBUGGING ¤òÉÕ¤±¤Æ gc.a ¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤È¡¢gc.a ¤ä w3m ¤Î¥Ð¥¤
- ¥Ê¥ê¥µ¥¤¥º¤¬Â¿¾¯¤Ç¤¹¤¬¾®¤µ¤¯¤Ê¤ê¤Þ¤¹¡£
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01509] Forward: Bug#79689: No way to view information on SSL certificates
- ¸½¥É¥¥å¥á¥ó¥È¤Î¾ðÊó¤òɽ¼¨('=')¤Ç¸«¤Æ¤â SSL¤Ë´Ø¤¹¤ë¾ÚÌÀ½ñ¾ðÊó¤ò
- ¤ß¤é¤ì¤Ê¤¤¤Î¤Ï³Î¤«¤ËÈᤷ¤¤¤Ê¤¡ ¤È»×¤Ã¤Æ¤¤¤¿¤Î¤Ç ŬÅö¤Ê¥Ñ¥Ã¥Á
- ¤Ä¤¯¤Ã¤Æ¤ß¤Þ¤·¤¿¡£(¤«¤Ê¤ê¤¤¤¤¤«¤²¤ó)
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01556] Re: ANSI color support (was Re: w3m-m17n-0.4)
- ANSI color support.
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01535] how to check wait3 in configure.
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01537] Re: how to check wait3 in configure.
- BSD/OS 3.1, SunOS 4.1.3 ¤Ç, configure ¤¬ wait3() ¤ò¸¡½Ð¤Ç¤¤Ê¤¤Ìä
- Âê¤Ø¤ÎÂнè.
-
-
-2000/12/25
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- <plaintext> ¤¬¤Þ¤È¤â¤ËÆ°¤¤¤Æ¤¤¤Ê¤«¤Ã¤¿ÌäÂê¤Î½¤Àµ.
-
-
-2000/12/22
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01555] Re: some fixes for <select>
- <option> ¤Ê¤·¤Î <select> ¤¬¤¢¤ë¤ÈÍî¤Á¤ëÍͤˤ·¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤·¤¿¤Î
- ¤Ç½¤Àµ¤Ç¤¹¡£
-
-
-2000/12/21
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦feed_table ¤Î¥È¡¼¥¯¥óʬ³ä½èÍý¤ò HTMLlineproc0 ¤Ç¹Ô¤Ê¤¦¤è¤¦¤ËÊѹ¹
- ¤·¤¿.
- ¡¦HTMLlineproc0 ¤Î¥Õ¥©¡¼¥à¤Î½èÍý¤â¥á¥¤¥ó¥ë¡¼¥×¤Ç¹Ô¤Ê¤¦¤è¤¦¤ËÊѹ¹¤·
- ¤¿.
- ¡¦table ¤Ç <xmp> ¤È </xmp> ¤Î´Ö¤Ë¤¢¤ë¥¿¥°¤¬¾Ã¤¨¤ë»ö¤¬¤¢¤ëÌäÂê¤Î½¤
- ˵.
- ¡¦¥Õ¥©¡¼¥à¤Î¥Ç¡¼¥¿¤ËÆâÉô¥³¡¼¥É¤¬´Þ¤Þ¤ì¤ë»ö¤¬¤¢¤ë¤Î¤Ç, ½¤Àµ.
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01536] Re: <P> in <DL>
-Subject: [w3m-dev 01544] Re: <P> in <DL>
- ÌäÂê¤Î¤¢¤ë HTML ¤Ç, °Û¾ï½ªÎ»¤¹¤ë»ö¤¬¤¢¤ëÌäÂê¤Ø¤ÎÂнè.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- <a>, <img_alt>, <b>, <u> Åù¤Î¥¿¥°¤¬ÊĤ¸¤Æ¤¤¤Ê¤¤¤È¤, ½ªÎ»¥¿¥°¤òÊä
- ´°¤¹¤ë¤è¤¦¤Ë¤·¤¿.
-
-
-2000/12/20
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- °Ê²¼¤Î¥Ð¥°¤ò¥Õ¥£¥¯¥¹¤·¤¿.
- ¡¦feed_table_tag ¤Î <dt> ¥¿¥°¤Î½èÍý¤¬¾¯¤·¤ª¤«¤·¤«¤Ã¤¿.
- ¡¦table Ãæ¤Ç¥¿¥°¤¬ÊĤ¸¤Æ¤¤¤Ê¤¤¾ì¹ç, °Û¾ï½ªÎ»¤¹¤ë»ö¤¬¤¢¤Ã¤¿.
- ¤Þ¤¿, <dt> ¥¿¥°Ä¾¸å¤Î <p> ¤Ï̵»ë¤¹¤ë¤è¤¦¤Ë¤·¤¿.
-
-From: Yamate Keiichirou <yamate@ebina.hitachi.co.jp>
-Subject: [w3m-dev 01530] returned at a morment.
- read_token ¤Î " ¤Ç°Ï¤Þ¤ì¤¿Â°ÀÃͤνèÍý¤Ç²þ¹Ô¤ò¥¹¥¥Ã¥×¤·¤Æ¤¤¤Ê¤«¤Ã
- ¤¿¥Ð¥°¤Î½¤Àµ.
-Subject: [w3m-dev 01531] coocie check in header from stdin.
- cat ¤á¡¼¤ë | w3m -m
- ¤È¤¹¤ë¤ÈÍî¤Á¤Þ¤¹¡£
-
-
-2000/12/17
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01513] Re: w3m-0.1.11-pre-kokb23
- frame.c ¤Ë¥Ð¥°¤È»×¤ï¤ì¤ë²Õ½ê¤¬¤¢¤ê¤Þ¤·¤¿¡£
-Subject: [w3m-dev 01515] some fixes for <select>
-Subject: [w3m-dev 01516] Re: some fixes for <select>
- <select>¡Á<option> ¤Ë´Ø¤·¤Æ´ö¤Ä¤«¤Î²þÎɤò¹Ô¤¤¤Þ¤·¤¿¡£
- ¡¦multiple °À¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤ä #undef MENU_SELECT ¤Î¾ì¹ç¤Ë
- <option> ¤Î value °À¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤È form ¤È¤·¤Æ¤Î
- Ãͤ¬Á÷¤é¤ì¤Ê¤¤¥Ð¥°¤Î½¤Àµ¡£
- ¡¦<option> ¤Î label °À¤Ø¤ÎÂбþ¡£
- ¡¦¥Ç¥Õ¥©¥ë¥È¤Î name °À¤ÎÃͤ¬ "default" ¤Ç¤¢¤ë¤Î¤ò <input> ¤Ê¤É¤Ë
- ¹ç¤ï¤»¤Æ "" ¤Ë¡£
- ¡¦<option> ¤Î label ¤¬ "" ¤Ç¤¢¤ë¾ì¹ç "???" ¤Ë¤Ê¤ë¤Î¤ò»ß¤á¤¿¡£
- # ¶õÇò¤Ç¤¢¤Ã¤ÆÍߤ·¤¤¾ì¹ç¤â¹Í¤¨¤é¤ì¤ë¡£
- ¡¦n_select >= MAX_SELECT ¤È¤Ê¤Ã¤¿¾ì¹ç¡¢#undef MENU_SELECT ¤Î¥³¡¼¥É¤ò
- »È¤¨¤ëÍͤˤ·¤¿¡£
- # MAX_SELECT = 100 ¤Ê¤Î¤Ç¤Þ¤ºÌµ°ÕÌ£
-
-
-2000/12/14
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01501] Re: w3m-0.1.11-pre-kokb23
- no menu ¤Î¤È¤¤Ë¤Ò¤È¤Ä¤À¤±¥³¥ó¥Ñ¥¤¥ë¥¨¥é¡¼¤¬½Ð¤Þ¤·¤¿¤Î¤Ç¡¢¤½¤Î½¤Àµ
- ¥Ñ¥Ã¥Á¤Ç¤¹¡£
-
-
-2000/12/13
-
-From: sekita-n@hera.im.uec.ac.jp (Nobutaka SEKITANI)
-Subject: [w3m-dev 01483] Patch to show image URL includes anchor
- ¥ê¥ó¥¯ÉÕ¤²èÁü¤ÎURL¤ò¸«¤ë¤È¤¡¢`u'¤Ç¤Ï¥ê¥ó¥¯¤ÎURL¤·¤«¸«¤é¤ì¤Þ¤»¤ó
- ¤Ç¤·¤¿¤¬¡¢¤³¤Î¥Ñ¥Ã¥Á¤ò»È¤¨¤Ð`i'¤Ç²èÁü¤½¤Î¤â¤Î¤ÎURL¤¬¸«¤é¤ì¤ë¤è¤¦¤Ë
- ¤Ê¤ê¤Þ¤¹¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01500] fix risky code in url.c
- url.c ¤Ë¤¢¤Ã¤¿´í¸±À¤Î¤¢¤ë¥³¡¼¥É¤ò½¤Àµ¤·¤Þ¤·¤¿¡£
- local.c ¤Ï¤ª¤Þ¤±¤Î½¤Àµ¤Ç¤¹¡£
-
-
-2000/12/12
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01491] bug ?
- file.c ¤Î°Ê²¼¤ÎÉôʬ¤Ç¤¹¤¬¡¢¤¿¤Ö¤ó¤³¤¦¤À¤È»×¤¤¤Þ¤¹¤¬¡£
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¥Ì¥ëʸ»ú¤ò´Þ¤àʸ»úÎó¤ËÂФ¹¤ë¸¡º÷¤¬¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿.
-
-From: Tsutomu Okada <okada@furuno.co.jp>
-Subject: [w3m-dev 01498] Re: null character
- ̵¸Â¥ë¡¼¥×¤Ë¤Ï¤Þ¤Ã¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£
-
-
-2000/12/11
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦StrmyISgets ¤Ç, ñÆȤΠ'\r' ¤¬²þ¹Ô¤Èǧ¼±¤µ¤ì¤Ê¤¤¥Ð¥°¤Î½¤Àµ.
- ¤Þ¤¿, ²þ¹Ô¥³¡¼¥É¤ä¥Ê¥ëʸ»ú¤ÎÊÑ´¹¤ò cleanup_line ¤ËʬΥ¤·¤¿.
- ¡¦¥Ú¡¼¥¸¥ã¥â¡¼¥É¤Ç, ¥Ê¥ëʸ»ú¤ò°·¤¨¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦base64 ¤ä quoted printable ¤Î¥Ç¥³¡¼¥É½èÍý¤ò convertline ¤«¤é
- istream.c ¤Ë°ÜÆ°.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01487] A string in <textarea> is broken after editing
- w3m-0.1.11-pre-kokb21 ¤Îº¢¤«¤é¤Ç¤¹¤¬¡¢<textarea> ¤ÎÃæ¤Îʸ»úÎó¤òÊÔ
- ½¸¤¹¤ë¤Èʸ»úÎóÃæ¤Ë ^` ¤ÎÍͤÊʸ»ú¤¬Æþ¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£
-Subject: [w3m-dev 01488] buffer overflow bugs
- ¥Ð¥Ã¥Õ¥¡¡¼¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤ò°ú¤µ¯¤³¤¹¶²¤ì¤Î¤¢¤ë°Ê²¼¤ÎÌäÂêÅÀ¤ò½¤Àµ¤·¤Þ¤·¤¿¡£
- * file.c ¤Î select_option[MAX_SELECT] ¤Îź»ú¤Î¥Á¥§¥Ã¥¯¤¬Ìµ¤«¤Ã¤¿¡£
- ¢ª n_select ¤È MAX_SELECT ¤òÈæ³Ó
- * file.c ¤Î textarea_str[MAX_TEXTAREA] ¤Îź»ú¤Î¥Á¥§¥Ã¥¯¤¬ÉÔ´°Á´¤À¤Ã¤¿¡£
- ¢ª n_textarea ¤È MAX_TEXTAREA ¤òÈæ³Ó
- * file.c ¤Î form_stack[FORMSTACK_SIZE] ¤Îź»ú¤Î¥Á¥§¥Ã¥¯¤¬Ìµ¤«¤Ã¤¿¡£
- ¢ª forms ¤Ë¹ç¤ï¤»¤Æ form_stack ¤â¥Ý¥¤¥ó¥¿¤È¤·¼«Æ°¿Ä¥¤¹¤ëÍͤˤ·¤¿¡£
- * doFileCopy(), doFileSave() ¤Î sprintf ¤ò»È¤Ã¤¿ msg[LINELEN] ¤Ø¤ÎÂåÆþ¡£
- ¢ª Str msg ¤È Sprintf() ¤ËÃÖ¤´¹¤¨¡£
- * local.c ¤Î dirBuffer() ¤Î sprintf ¤ò»È¤Ã¤¿ fbuf[1024] ¤Ø¤ÎÂåÆþ¡£
- ¢ª Str fbuf ¤ËÃÖ¤´¹¤¨¡£
-
-
-2000/12/9
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- maximum_table_width ¤Ç td, th ¥¿¥°¤Î width °ÀÃͤò¹Íθ¤¹¤ë¤è¤¦¤Ë
- Êѹ¹.
-
-
-2000/12/8
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01473] Re: internal tag and attribute check
- °ÊÁ°¡¢[w3m-dev 01446] ¤Ç¡¢
- >> frame »þ¤ËÄɲ䵤ì¤ë°À framename, referer, charset ¤Ê¤É¤Ï
- >> ÌäÂê¤Ê¤¤¤Î¤Ç¤·¤ç¤¦¤«¡£¸ú²ÌŪ¤Ë°ÍѤ¹¤ëÎã¤Ï»×¤¤ÉÕ¤¤Þ¤»¤ó¤¬¡¢
- ¤È½ñ¤¤Þ¤·¤¿¤¬¡¢<form charset=e> Åù¤Ç w3m ¤¬½ªÎ»¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
- accept-charset ¤âƱÍͤǤ¹¤Î¤Ç½¤Àµ¤·¤Þ¤·¤¿¡£
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦table ¥¿¥°¤Î hborder °À¤ÏÄ̾ï¤Ç¤â¼õ¤±ÉÕ¤±¤ë¤è¤¦¤ËÊѹ¹.
- ¡¦table ¥¿¥°¤Î border °À¤ËÃͤ¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤¤È¤¤Î°·¤¤¤ò¸µ¤ËÌá
- ¤·¤¿.
-
-From: sakane@d4.bsd.nes.nec.co.jp (Yoshinobu Sakane)
-Subject: [w3m-dev 01478] Option Setting Panel
- ²£Ä¹¤Î¥¦¥£¥ó¥É¥¦¤Ç Option Setting Panel ¤ò³«¤¯¤È¡¢´Ö±ä¤Ó¤·¤Æ
- º¸±¦¤ÎÂбþ¤¬¼è¤ê¤Å¤é¤¤¤Î¤Ç¡¢´Ö¤òµÍ¤á¤ë¥Ñ¥Ã¥Á¤Ç¤¹¡£
-
-
-2000/12/7
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦parse_tag ¤Ë gethtmlcmd ¤Îµ¡Ç½¤â»ý¤¿¤»¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦ºÇ½é¤Î parse_tag ¤ÇÆâÉô¥¿¥°¤ä°À¤ò¼õ¤±ÉÕ¤±¤Ê¤¤¤è¤¦¤Ë¤·¤¿.
- ¤Þ¤¿, ÆâÉô°À¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¤Ï, ¤½¤ÎÆâÉô°À¤ò´Þ¤Þ¤Ê¤¤¤è¤¦¤Ë¥¿¥°
- ¤òºî¤êľ¤¹¤è¤¦¤Ë¤·¤¿.
- ¡¦visible_length ¤Ç¤ÏÉÔÍפʥ¿¥°¤Î²òÀϤò»ß¤á¤¿.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01456] linein.c
- m17n ¤«¤é¤Î feed back ¤Ç¤¹¤¬¡¢linein.c ¤ò calcPosition() ¥Ù¡¼¥¹¤Ë
- ½ñ¤Ä¾¤·¤Þ¤·¤¿¡£½èÍý¤Ï display.c ¤È¤Û¤ÜƱÍͤǤ¹¡£
- Ť¤Ê¸»úÎóÃæ¤Ë¥¿¥Ö¤ä¥³¥ó¥È¥í¡¼¥ëʸ»ú¤¬¤¢¤Ã¤Æ¤âÀµ¤·¤¯¥«¡¼¥½¥ë¤¬
- Æ°¤¯¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È»×¤¤¤Þ¤¹¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01457] cursor position on sumbit form
- TAB¥¡¼¤Ç<input type="submit" ¡Á value="OK">¤Î¾å¤Ë¥«¡¼¥½¥ë¤ò°ÜÆ°¤µ
- ¤»¤¿¤È¤¤Î°ÌÃÖ¤¬¤º¤ì¤Æ¤¤¤¿ÌäÂê¤Ø¤ÎÂнè.
-
-
-2000/12/3
-
-From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-Subject: [w3m-dev 01449] Re: Directory of private header of gc library.
- popText (rpopText) ¤ÇºÇ¸å¤ÎÍ×ÁǤò¼è¤ê½Ð¤·¤¿¸å¤Ë¤³¤Î¥ê¥¹¥È¤Ë¥¢¥¯¥»
- ¥¹¤·¤è¤¦¤È¤¹¤ë¤È°Û¾ï½ªÎ»¤·¤Æ¤·¤Þ¤¦»ö¤¬¤¢¤ëÌäÂê¤ËÂФ¹¤ë½¤Àµ.
-
-
-2000/12/2
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¤Þ¤À, image map ¤¬»È¤¨¤Ê¤¤ÌäÂ꤬»Ä¤Ã¤Æ¤¤¤¿¤Î¤Ç½¤Àµ.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ÆâÉô¥Æ¡¼¥Ö¥ë (MYCTYPE_MAP) ¤Ë¤è¤Ã¤Æ, ʸ»ú¤òʬÎह¤ë¤è¤¦¤ËÊѹ¹.
- ´Á»ú, latin1, ascii, internal character ¤ÎȽÊÌ¤Ë¤Ï INTCTYPE_MAP ¤ò
- »È¤¦¤è¤¦¤ËÊѹ¹.
- # ·ë²Ì¤È¤·¤ÆɬÍ×̵¤¯¤Ê¤Ã¤¿ CTYPE_MAP ¤Ïºï½ü¤·¤¿.
-
-
-2000/12/1
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: Security hole in w3m (<input_alt type=file>)
- ¡¦HTMLlineproc1, HTMLtagproc1 Åù¤Î°ú¿ô¤Ë¥Õ¥é¥°¤ò»ý¤¿¤»¤Æ¡¢
- ³°Éô¤«¤éÆâÉô¥¿¥°¤ò»È¤¨¤Ê¤¤Íͤˤ·¤¿¡£
- ¡¦map.c ¤Ç `<', `>' Åù¤¬¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿½ê¤Î½¤Àµ¡£
-Subject: [w3m-dev 01432] Re: w3m-0.1.11-pre-kokb22 patch
- ¤Þ¤À¡¢½¤Àµ¤ÎÈ´¤«¤ê¤¬¤¢¤ê¤Þ¤·¤¿¡£patch ¤òÉÕ¤±¤Þ¤¹¡£
- ([w3m-dev 01431] ¤Ç¤Î²¬ÅĤµ¤ó¤Î»ØŦ¤Ø¤Î½¤Àµ¤âÆþ¤Ã¤Æ¤Þ¤¹)
-Subject: [w3m-dev 01437] Re: w3m-0.1.11-pre-kokb22 patch
- ¥»¥¥å¥ê¥Æ¥£´ØÏ¢¤Î½¤Àµ¤Ç image map ¤¬»È¤¨¤Ê¤¯¤Ê¤ëÌäÂê¤Ø¤ÎÂнè.
-
-From: sekita-n@hera.im.uec.ac.jp (Nobutaka SEKITANI)
-Subject: [w3m-dev 01415] Lineedit patch for kokb21
- Subject: [w3m-dev 00976] move & delete until /, &, or ?
- ¤ÇÅê¹Æ¤·¤¿URLÅùÆþÎϵ¡Ç½¤ò³ÈÄ¥¤¹¤ë¥Ñ¥Ã¥Á¤òw3m-0.1.11-pre-kokb21ÍѤË
- ½ñ¤Ä¾¤·¤Þ¤·¤¿¡£kokb20¤Ç¤â¥Ñ¥Ã¥Á¤ÏÀµ¾ï¤ËÅö¤Æ¤é¤ì¤Þ¤¹¡£
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ²¬ÅĤµ¤ó¤Î¥Ñ¥Ã¥Á [w3m-dev 01427] ¤ò»²¹Í¤Ë, HTML ¥Ð¥Ã¥Õ¥¡¤ÎʸËö¤Î¶õ
- Çò¤òºï½ü¤¹¤ë¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó (ENABLE_REMOVE_TRAILINGSPACES) ¤ò
- Äɲä·¤¿.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev-en 00301] Re: "w3m -h" outputs to stderr
- w3m -h ¤Î½ÐÎÏÀè¤ò stderr ¤«¤é stdout ¤ËÊѹ¹.
-
-From: sakane@d4.bsd.nes.nec.co.jp (Yoshinobu Sakane)
-Subject: [w3m-dev 01430] Re: w3m-0.1.11-pre-kokb22 patch
- EWS4800(/usr/abiccs/bin/cc) ¤Î¥³¥ó¥Ñ¥¤¥ë¥¨¥é¡¼¤Ø¤ÎÂнè.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦dumm_table ¥¿¥°¤Î id °À¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯¤ò²Ã¤¨¤¿.
- ¡¦form_int ¥¿¥°¤Î fid °À¤ÎÈÏ°Ï¥Á¥§¥Ã¥¯¤ò²Ã¤¨¤¿.
- ¡¦table ¥¹¥¿¥Ã¥¯¤Î¥ª¡¼¥Ð¥Õ¥í¡¼¤Î¥Á¥§¥Ã¥¯¤ò²Ã¤¨¤¿.
-
-
-2000/11/29
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01422] bpcmp in anchor.c
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01423] Re: bpcmp in anchor.c
- ¹â®²½¤Î¤¿¤á¤Î´ö¤Ä¤«¤Î½¤Àµ.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦checkType ¤Î¥Ð¥°¥Õ¥£¥¯¥¹¤ª¤è¤Ó¼ã´³¤Î¹â®²½.
- ¡¦´Á»ú¤ò 2 ¥Ð¥¤¥Èñ°Ì¤Ç°·¤¦¤è¤¦¤ËÊѹ¹.
-
-
-2000/11/28
-
-From: Takenobu Sugiyama <sugiyama@ae.advantest.co.jp>
-Subject: patch for cygwin
- cygwin ¤Ç¤Î ftp¥µ¥¤¥È¤«¤é¤Î download ¤Ç¤¹¤¬, °Ê²¼¤Î patch¤ÇÂнè¤Ç
- ¤¤Þ¤·¤¿. cygwin ¤Ç¤Ï, ¥Õ¥¡¥¤¥ë¤Î open/close¤ò binary ¥â¡¼¥É¤Ë¤·
- ¤Æ¤ª¤«¤Ê¤¤¤È, ¤¤¤í¤¤¤í¤ÈÌäÂ꤬¤¢¤ë¤è¤¦¤Ç¤¹.
-
-
-2000/11/27
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01401] Re: bugfix of display of control chars, merge of easy UTF-8 patch, etc.
- ¤³¤Î½¤Àµ¤ÎÄɲäǤ¹¤¬¡¢°ì¹Ô¤ÎºÇ¸å¤Ë¥³¥ó¥È¥í¡¼¥ëʸ»ú¤¬¤¢¤ë¤È²èÌÌ¥·¥Õ
- ¥ÈÎ̤¬Â¤é¤Ê¤¯¤Ê¤Ã¤Æ¡¢¤½¤Îʸ»ú¤òɽ¼¨¤Ç¤¤Ê¤¤¥Ð¥°¤Î½¤Àµ¤Ç¤¹¡£
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- table ¤Î¥ì¥ó¥À¥ê¥ó¥°¤Î¹â®²½.
-
-
-2000/11/25
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- table ¤Î¥«¥é¥àÉý¤¬ width °À¤Ç»ØÄꤷ¤¿¤â¤Î¤è¤ê¾®¤µ¤¯¤Ê¤ë»ö¤¬¤¢¤ë
- ÌäÂê¤Î½¤Àµ.
-
-
-2000/11/24
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¤Þ¤À¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ó¤Ç¤Ê¤¤¤È¤¤Ï, ¥×¥í¥°¥ì¥¹¥Ñ¡¼¤ËžÁ÷®ÅÙ¤òɽ¼¨
- ¤·¤Ê¤¤¤è¤¦¤ËÊѹ¹¤·¤¿.
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01385] Re: w3m-0.1.11-pre-kokb20 patch
- w3m-0111-utf8-kokb20 ¤Ç¤¹¤¬¡¢conv.c ¤Ç°ì²Õ½ê´Ö°ã¤¤¤È»×¤ï¤ì¤ë¤È¤³¤í
- ¤¬¤¢¤ê¤Þ¤·¤¿¤Î¤Ç¡¢¥Ñ¥Ã¥Á¤òźÉÕ¤·¤Þ¤¹¡£¤Ä¤¤¤Ç¤Ë¡¢¥¤¥ó¥Ç¥ó¥È¤ä¥³¥ó¥Ñ
- ¥¤¥ë»þ¤Î warning ¤Î½¤Àµ¤â°ìÉô¤·¤Æ¤¢¤ê¤Þ¤¹¡£
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ç¥ª¥×¥·¥ç¥óÀßÄê¤òÊѹ¹¤·¤¿¤È¤, proxy ¤ä cookie Åù
- Êѹ¹¤¬È¿±Ç¤µ¤ì¤Ê¤¤Éôʬ¤¬¤¢¤Ã¤¿ÌäÂê¤ËÂФ¹¤ë½¤Àµ.
- ¡¦¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤ò¥»¡¼¥Ö¤¹¤ë¤È¤, ¸µ¤Î¥Õ¥¡¥¤¥ë¤ò¾å½ñ¤¤·¤Æ¤·¤Þ¤¦
- »ö¤¬¤¢¤ëÌäÂê¤ËÂФ¹¤ë½¤Àµ.
-
-
-2000/11/23
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦StrStream ¤ËÂФ·¤Æ¤Ï, ¸µ¤Î Str ¤ò¤½¤Î¤Þ¤Þ¥Ð¥Ã¥Õ¥¡¤È¤·¤ÆÍøÍѤ¹¤ë¤è
- ¤¦¤ËÊѹ¹.
- ¡¦get_ctype ¤ò¥Þ¥¯¥í²½¤·, ¥Æ¡¼¥Ö¥ë¤ò»È¤Ã¤ÆȽÃǤ¹¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦menu.c ¤ËÊÖ¤êÃͤ¬Àë¸À¤È°ìÃפ·¤Æ¤¤¤Ê¤¤½ê¤¬¤¢¤Ã¤¿¤Î¤Ç½¤Àµ.
-
-
-2000/11/22
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¼ç¤Ë¹â®²½¤Î¤¿¤á¤ÎÊѹ¹¤Ç¤¹.
- ¡¦¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß»þ¤Ë¼«Á°¤Ç¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤ò¹Ô¤Ê¤¦¤è¤¦¤Ë¤·¤¿.
- ¡¦conv.c ¤Î´Ø¿ô¤ò Str ¥Ù¡¼¥¹¤ËÊѹ¹.
- ²Äǽ¤Ê¸Â¤êʸ»úÎó¤Î¥³¥Ô¡¼¤ò¹Ô¤Ê¤ï¤Ê¤¤¤è¤¦¤Ë¤·¤¿.
- ¡¦checkType ¤Î¹â®²½.
- ¡¦¥«¡¼¥½¥ë¾å¤Ëʸ»ú¤¬Ìµ¤¤¤È¤ cursorRight ¤ÎÆ°ºî¤ËÌäÂ꤬¤¢¤Ã¤¿¤Î¤Ç,
- ½¤Àµ¤·¤¿.
- ¤Þ¤¿°ì¹Ô¤¬ LINELEN ¤ò±Û¤¨¤¿¤È¤¤Ë, calcPosition ¤ÇÇÛÎó¤Î³°¤ò¥¢¥¯
- ¥»¥¹¤¹¤ë²ÄǽÀ¤¬¤¢¤ë¤Î¤Ç¥µ¥¤¥º¤òÊѹ¹.
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01372] w3m sometimes uses the wrong mailcap entry
- http://bugs.debian.org/77679
- ¤Ç¤¹¤¬¡¢mime type ¤ÎȽÃǤ¬ substring match ¤Ë¤Ê¤Ã¤Æ¤ë¤«¤é¤À¤È
- »×¤¤¤Þ¤¹¡£¤³¤ì¤Çľ¤ë¤ó¤¸¤ã¤Ê¤¤¤Ç¤·¤ç¤¦¤«
-
-
-2000/11/20
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- Ãæ¿È¤Î̵¤¤ table ¤¬ table ¤ÎÃæ¤Ë¤¢¤ë¤È¤¤Ë, ³°¤Î table ¤¬Êø¤ì¤ëÌä
- Âê¤Ø¤ÎÂнè.
-
-
-2000/11/19
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- gc6 Âбþ.
-
-
-2000/11/18
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦¥Ð¥Ã¥Õ¥¡ÆâÉô¤Î¶õÇòʸ»ú¤ò 0x80-0x9f ¤Ë³äÅö¤Æ¤ë¤è¤¦¤ËÊѹ¹¤·¤¿.
- ¡¦ÆüËܸìÈǤǤâ, ¥Ð¥Ã¥Õ¥¡Æâ¤Ç¤Ï ¤Ï 0xa0 ¤Çɽ¤ï¤¹¤Ë¤·¤¿.
- ¡¦ºäËܤµ¤ó¤Î´Ê°× UTF-8 ÈǤΠUTF-8 ¤È¤Ï´Ø·¸Ìµ¤¤Éôʬ¤Î¥³¡¼¥É¤ò¥Þ¡¼¥¸
- ¤·¤¿.
- ¤Þ¤¿¥Ç¥Ð¥Ã¥°¤Î¤È¤¤ËÊØÍø¤Ê¤Î¤Ç, ÆâÉô¥³¡¼¥É¤òʸ½ñ¥³¡¼¥É¤Ë»ØÄꤹ¤ë
- »ö¤¬¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦É½¼¨ÉÔ²ÄǽÎΰè (0x80-0xa0) ¤Ë¤¢¤ëʸ»ú¤Ï \xxx ¤Î·Á¤Çɽ¼¨¤¹¤ë¤è¤¦
- ¤Ë¤·¤¿.
- ´ØÏ¢¤·¤Æ, ²èÌÌ¥·¥Õ¥È»þ¤Ë, ¥³¥ó¥È¥í¡¼¥ëʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤Èɽ¼¨¤¬
- Íð¤ì¤ë¥Ð¥°¤¬¤¢¤Ã¤¿¤Î¤Ç½¤Àµ¤·¤¿.
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01354] minimize when #undef USE_GOPHER or USE_NNTP
- #undef USE_GOPHER ¤ä #undef USE_NNTP ¤È¤·¤¿¤È¤¤Ë¡¢´ØÏ¢¤¹¤ë¥³¡¼¥É¤¬¤Ç
- ¤¤ë¤À¤±¾¯¤Ê¤¯¤Ê¤ë¤è¤¦¤ËÊѹ¹¤·¤Æ¤ß¤Þ¤·¤¿¡£
-
-
-2000/11/16
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- °Û¾ï¤Ê¼ÂÂλ²¾È¤Ç getescapechar ¤¬ÊѤÏÃͤòÊÖ¤¹»ö¤¬¤¢¤ëÌäÂê¤Ø¤ÎÂнè.
-
-
-2000/11/15
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦table ¤ÎÏȤ¬Êø¤ì¤ë»ö¤¬¤¢¤ë¥Ð¥°¤Î½¤Àµ.
- ¡¦DEL ʸ»ú¤òÀÞ¤êÊÖ¤·²Äǽ¤Ê¶õÇòʸ»ú¤È¤·¤Æ°·¤¦¤è¤¦¤ËÊѹ¹¤·, ¥Ð¥Ã¥Õ¥¡
- ÆâÉô¤Î¶õÇòʸ»ú¤ò ¤«¤é DEL ¤ËÊѹ¹.
-
-From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-Subject: [w3m-dev 01338] Re: Lynx patch for character encoding in form
-Subject: [w3m-dev 01342] Re: Lynx patch for character encoding in form
- form ¥¿¥°¤Î accept-charset °À¤ò¼õ¤±ÉÕ¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿.
-
-
-2000/11/14
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦¥¯¥©¡¼¥È¤¹¤ë¤Î¤ò˺¤ì¤Æ¤¤¤ë¤È»×¤ï¤ì¤ëÉôʬ¤ò½¤Àµ.
- ¡¦cleanup_str, htmlquote_str ¤Ï, ¤â¤· (¥¢¥ó) ¥¯¥©¡¼¥È¤¹¤ëɬÍפ¬Ìµ
- ¤±¤ì¤Ð, ¸µ¤Îʸ»úÎó¤ò¤½¤Î¤Þ¤ÞÊÖ¤¹¤è¤¦¤Ë¤·¤¿.
-
-
-2000/11/10
-
-From: ÅÏîµ¾¡Ç· <katsuyuki_1.watanabe@toppan.co.jp>
-Subject: [w3m-dev 01336] patch for Cygwin 1.1.x
- Cygwin 1.1.x (¤ª¤½¤é¤¯ 1.1.3 °Ê¹ß) ¸þ¤±¤Î¥Ñ¥Ã¥Á¤òºîÀ®¤·¤Þ¤·¤¿¡£
- Cygwin 1.x °Ê¹ß¤Î´Ä¶¤Ë¤ª¤¤¤Æ¡¢
- ¡¦É¸½à¤Î¥¤¥ó¥¹¥È¡¼¥ë¥Ñ¥¹¤ò /cygnus/cygwin-b20/H-i586-cygwin32
- °Ê²¼¤ØÊѹ¹¤·¤Ê¤¤
- ¡¦T_as,T_ae,T_ac ¤ò¶õ¤Ë¤¹¤ë¤Î¤ò¤ä¤á¤¿
-
-
-2000/11/8
-
-From: Jan Nieuwenhuizen <janneke@gnu.org>
-Subject: [w3m-dev-en 00189] [PATCH] w3m menu <select> search
- Enable to search within popup menu.
-
-
-2000/11/7
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01331] Re: form TEXT:
- ¸¡º÷ʸ»úÎó¤È¥Õ¥©¡¼¥àÆþÎÏʸ»úÎó¤Î¥Ò¥¹¥È¥ê¤Î°ìËܲ½.
-
-
-2000/11/4
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¥»¥ëÉý¤¬²èÌÌÉý¤ò±Û¤¨¤ë¤È¤, ¥»¥ë¤ÎÃæ¿È¤Ï²èÌÌÉý¤ÇÀ°·Á¤¹¤ë¤è¤¦¤Ë¤·¤¿.
-
-
-2000/11/2
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01313] Re: SCM_NNTP
- MARK_URL ¤Ç nntp: ¤â¥Þ¥Ã¥Á¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿¡£Àµµ¬É½¸½¤Ï gopher:
- ¤Î¤â¤Î¤ò¥³¥Ô¡¼¤·¤¿¤À¤±¤Ç¤¹¡£
-
-
-2000/10/31
-
-From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-Subject: [w3m-dev 01310] Re: option select (Re: w3mmee-0.1.11p10)
- gc¥é¥¤¥Ö¥é¥ê¤Î¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òdisp_message_nsec¤òÄ̤·¤Æ½ÐÎϤ¹¤ë
- ¤è¤¦¤Ë¤·¤¿.
-
-
-2000/10/30
-
-From: sakane@d4.bsd.nes.nec.co.jp (Yoshinobu Sakane)
-Subject: [w3m-dev 01294] mouse no effect on blank page.
- mouse¤¢¤ê¤Îw3m ¤Çblank¤Ê¥Ú¥¤¥¸¤òɽ¼¨¤·¤Æ¤¤¤ë»þ¡¢mouse¥Ü¥¿¥ó
- ¤¬¸ú¤«¤Ê¤¤(Ãæ¥Ü¥¿¥ó¤ÇÌá¤ì¤Ê¤¤¤Î¤¬¥Ä¥é¥¤)¤Î¤Ç½¤Àµ¤·¤Æ¤ß¤Þ¤·¤¿¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01295] Re: mouse no effect on blank page.
- ¼ÂºÝ¤ËÍî¤Á¤¿¤ï¤±¤Ç¤Ï¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢¤³¤¦¤·¤Æ¤ª¤¯Êý¤¬°ÂÁ´¤Ç¤¹¤Í¡£
-
-From: SASAKI Takeshi <sasaki@ct.sakura.ne.jp>
-Subject: [w3m-dev 01297] Re: backword search bug report
- [w3m-dev 01296] ¤ÇÊó¹ð¤µ¤ì¤Æ¤¤¤ë, ¼¡¤ÎÌäÂê¤ËÂФ¹¤ëÂнè.
- > Êó¹ð¤À¤±¤Ê¤ó¤Ç¤¹¤¬¡¢"aaaa" ¤ä "¤¢¤¢¤¢¤¢" ¤Î¤è¤¦¤ÊƱ¤¸Ê¸»ú¤¬Ï¢Â³¤·¤Æ¤¤
- > ¤ë¤È¤¤Ë "a" ¤ä "¤¢" ¤Ç backword search ¤¹¤ë¤È¡¢¥«¡¼¥½¥ë°ÌÃÖ¤¬ 1 ʸ»ú
- > Èô¤ó¤Ç¤·¤Þ¤¦¤è¤¦¤Ç¤¹¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01298] Re: backword search bug report
- backword search ¤Ç wrapped search ¤¬Í¸ú¤Î»þ¡¢¸½ºß¤Î¹Ô¤Î¸åÊý¤ò¸¡º÷
- ¤Ç¤¤Ê¤¤¥Ð¥°¤òľ¤·¤Þ¤·¤¿¡£
-Subject: [w3m-dev 01299] Re: backword search bug report
- ÆüËܸì¤ò¸¡º÷¤¹¤ë¤È¤¤Ë 2byteÌܤȼ¡¤Îʸ»ú¤Î 1byteÌܤȤǥޥåÁ¤¹¤ëÌä
- Âê¤È¡¢ little endian ¤Ç¤ÏÀµµ¬É½¸½ [¤¢-¤ó] ¤¬Àµ¤·¤¯µ¡Ç½¤·¤Ê¤¤ÌäÂê¡¢
- ±Ñ¸ìÈÇ¤Ç¤Ï latin1 ¤¬¾å¼ê¤¯¸¡º÷¤Ç¤¤Ê¤«¤Ã¤¿(¤Ç¤¢¤í¤¦)ÌäÂê¤òľ¤·¤Þ¤·¤¿¡£
-
-
-2000/10/29
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦LESSOPEN ¤ò»ÈÍѤ¹¤ë¤«¤É¤¦¤«¤ò Option Setting Panel ¤ÇÁªÂò¤¹¤ë¤è
- ¤¦¤Ë¤·¤¿ (default ¤Ï»ÈÍѤ·¤Ê¤¤).
- ¡¦°µ½Ì¥Õ¥¡¥¤¥ë¿Ä¥¸å¤Î¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºî¤ë¤È¤¤Î³ÈÄ¥»Ò¤ò, ¸µ¤Î
- ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò (.Z, .gz, .bz2) ¤ò½ü¤¤¤¿Éôʬ¤«¤é·è¤á¤ë¤è¤¦¤ËÊÑ
- ¹¹¤·¤¿.
- ¡¦gunzip_stream, save2tmp, visible_length ¤Î¹â®²½.
-
-
-2000/10/28
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¥³¥ó¥Ñ¥¤¥ë»þ, ¥Õ¥¡¥¤¥ë̾Êä´°Ãæ¤Î¥¡¼³äÅö¤Æ¤ò Emacs-like ¤Ë¤Ç¤¤ë¤è
- ¤¦¤Ë¤·¤¿.
- (config.h ¤Ç #define EMACS_LIKE_LINEEDIT ¤Ë¤·¤Þ¤¹)
- ¤Þ¤¿, Êä´°¸õÊä°ìÍ÷»þ¤Ë¥Ð¥Ã¥¯¥¹¥¯¥í¡¼¥ë¤ò²Äǽ¤Ë¤·¤¿.
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01284] Re: improvement of filename input
- ¡¦URLÆþÎÏ»þ(U)¤Ç¤Ï file:/ ¤«¤é»Ï¤á¤ë¾ì¹ç¤Î¤ß¥Õ¥¡¥¤¥ë̾Êä´°¤ò͸ú
- ¤Ë¤·¤Þ¤·¤¿¡£
- (URL ²òÀϤλÅÍ;夳¤ì°Ê³°¤Ç¤Ï³Î¼Â¤Ë local-file ¤Ë¤Ê¤é¤Ê¤¤¤¿¤á)
- ¡¦²¬Éô¤µ¤ó¤Î¥¢¥É¥Ð¥¤¥¹¤Ë¤è¤ê CTRL-D ¤Ç¤Î°ìÍ÷ɽ¼¨¤Ï¡¢
- ʸ»úÎó¤ÎºÇ¸å¤Ë¥«¡¼¥½¥ë¤¬¤¢¤ë¾ì¹ç¤Ë¸ÂÄꤷ¤Þ¤·¤¿¡£
-
-From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-Subject: [w3m-dev 01280] Stop to prepend rc_dir to full path.
- rcFile()¤ò¡¢¥Õ¥ë¥Ñ¥¹¤Ë¤Ïrc_dir¤òÉÕ¤±¤Ê¤¤¤è¤¦¤¹¤ë¥Ñ¥Ã¥Á¤Ç¤¹¡£
-
-
-2000/10/27
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01269] Re: SCM_NNTP
- [w3m-dev 1258] ¤ÇºäËܤµ¤ó¤¬»ØŦ¤µ¤ì¤Æ¤¤¤¿¤È¤³¤í¤ò½¤Àµ¤·¤Æ¤ß¤Þ¤·¤¿¡£¥Ñ¥Ã
- ¥Á¤òźÉÕ¤·¤Þ¤¹¡£»ä¤Î´Ä¶¤Ç¤Ï¡¢¤³¤Î½¤Àµ¤ò¤·¤Ê¤¤¤È news:<Message-ID> ¤¬
- Æ°¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
-Subject: [w3m-dev 01273] Re: SCM_NNTP
- url.c ¤ò½¤Àµ¤·¤Æ¡¢#undef USE_GOPHER ¤ä #undef USE_NNTP ¤Î¤È¤¤Ë¤Ï
- gopther: ¤ä news: ¤¬Æ°ºî¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£¤Þ¤¿¡¢nntp: ¤âÆ°ºî¤·¤Ê¤¤
- ¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
- ²Ã¤¨¤Æ¡¢GOTO URL ¤Ç mailto: ¤òÆþÎϤ·¤¿¤È¤¤ËÆ°ºî¤¹¤ë¤è¤¦¤ËÊѹ¹¤·¤Æ¤ß¤Þ
- ¤·¤¿¡£¤Ä¤¤¤Ç¤Ë¡¢¥³¥á¥ó¥È¤Î´Ö°ã¤¤¤âľ¤·¤Æ¤¢¤ê¤Þ¤¹¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01258] improvement of filename input
- ºÇ²¼¹Ô¤Ç¥Õ¥¡¥¤¥ë̾¤òÆþÎϤ¹¤ë»þ¤Î¶¯²½¤ò¹Ô¤¤¤Þ¤·¤¿¡£
- ¡¦Ctrl-D ¤ÇÊä´°¸õÊä¤Î°ìÍ÷¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
- ²èÌ̤ËÆþ¤êÀÚ¤é¤Ê¤¤»þ¤ÏϢ³¤·¤¿ Ctrl-D ¤Ç¼¡¤Î¸õÊä¤Î°ìÍ÷¤¬½Ð¤Þ¤¹¡£
- # ʸ»ú¤Îºï½ü¤Ï BackSpace ¤« Del ¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£
- ¡¦URL ÆþÎÏ»þ(GOTO)¤Çʸ»úÎó¤¬ file:/, file:/// ¤ä file://localhost/ ¤«¤é
- »Ï¤Þ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë̾¤òÊä´°¤¹¤ëÍͤˤ·¤Þ¤·¤¿¡£(²¼ÄŤµ¤ó¤«¤é¤ÎÍ×˾)
- # http: ¤ä ftp: ¤Ï²¿¤â¤·¤Þ¤»¤ó¡£¥Ò¥¹¥È¥ê¤«¤é¤ÎÊä´°¤Ç¤âÌÌÇò¤¤¤±¤É¡£
- ¡¦URL ¤ò¥Ò¥¹¥È¥ê¤ËÊݸ¤¹¤ë¾ì¹ç¤Ë password Éôʬ¤Ïºï½ü¤¹¤ëÍͤ˽¤Àµ¤·¤Þ¤·¤¿¡£
- ¤Ê¤ª¡¢°ÊÁ°¤«¤é¤¢¤ë undocument ¤Êµ¡Ç½¤Ç¤¹¤¬¡¢¸¡º÷ʸ»ú¤ÎÆþÎϤʤɤξì¹ç¤Ç¤â¡¢
- Ctrl-X ¤Ç TAB(Ctrl-I) ¤Ç¤Î ¥Õ¥¡¥¤¥ë̾Êä´°¤¬Í¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01277] Accept-Encoding: gzip (Re: some wishlists)
- Accept-Encoding: gzip, compress
- ¤ò¥ê¥¯¥¨¥¹¥È¥Ø¥Ã¥À¤ËÉÕ¤±¤ë¤è¤¦¤Ë¤·¤¿.
-Subject: [w3m-dev 01275] Re: squeeze multiple blank lines option ( http://bugs.debian.org/75527 )
- ¤È¤ê¤¢¤¨¤º #ifdef DEBIAN ¤Ç
- squeeze multiple blank line ¤Ï -s
- üËöʸ»ú¥³¡¼¥É»ØÄê¤Î -s/-e/-j ¤Ï¥Ê¥·¡£¤«¤ï¤ê¤Ë -o kanjicode={S,E,J} ¤ò»È¤¦
- ¤³¤È¤Ë¤·¤Æ¤ª¤¤Þ¤¹¡£
-Subject: [w3m-dev 01274] Re: SCM_NNTP
- ¤»¤Ã¤«¤¯¤Ê¤Î¤Ç nntp: ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤ß¤Þ¤·¤¿
-Subject: [w3m-dev 01276] URL in w3m -v
- LANG=EN (¤È¤¤¤¦¤« undef JP_CHARSET)¤Î»þ¤Î visual mode ¤Ç»È¤ï¤ì¤Æ¤ë URL
- ¤¬Àµ¤·¤¯¤Ê¤¤¤è¤¦¤Ç¤¹¡£
-
-
-2000/10/26
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- mailcap ¤È mime.type ¥Õ¥¡¥¤¥ë¤Î¾ì½ê¤ò Option Setting Panel ¤ÇÀßÄê
- ²Äǽ¤Ë¤·¤¿.
-
-
-2000/10/25
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01247] Re: buffer selection menu
- ¥á¥Ë¥å¡¼´ØÏ¢¤Î patch ¤ª¤è¤Ó»ÅÍÍÊѹ¹ [w3m-dev 01227], [w3m-dev 01228],
- [w3m-dev 01229], [w3m-dev 01237], [w3m-dev 01238] ¤ò¤Þ¤È¤á¤Þ¤·¤¿¡£
- ¡¦Select ¥á¥Ë¥å¡¼¤Ç¤Î¾Ãµî(¥¡¼¤Ï 'D')
- ¡¦Select ¥á¥Ë¥å¡¼¤Ç¤Î¥³¥á¥ó¥È¤Îɽ¼¨
- ¨--- SPC for select / D for delete buffer ---¨
- ¨±¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨¬¨°
- ¡¦¥á¥Ë¥å¡¼¤«¤é¤Î¥³¥Þ¥ó¥É¼Â¹Ô¤òµö²Ä¡£
-
-
-2000/10/24
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦ ¥¯¥Ã¥¡¼¤ÎÀßÄê¤Ç, `.' ¤ÏÁ´¤Æ¤Î¥É¥á¥¤¥ó¤òɽ¤ï¤¹¤è¤¦¤Ë¤·¤¿.
- ¡¦ bm2menu.pl ¤ò CVS ¤Ë add ¤¹¤ë¤Î¤ò˺¤ì¤Æ¤¤¤¿¤Î¤Ç, ÄɲÃ.
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01240] Re: w3m-0.1.11-pre-kokb17 patch
- ¤È¤ê¤¢¤¨¤º¥³¥ó¥Ñ¥¤¥ë»þ¤Ë incompatible pointer type ¤È¤¤¤ï¤ì¤¿¤È¤³
- ¤í¤Î½¤Àµ¥Ñ¥Ã¥Á¤òźÉÕ¤·¤Þ¤¹¡£
-
-
-2000/10/23
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦ ¥ª¥×¥·¥ç¥óÀßÄê¥Ñ¥Í¥ë¤Ç, ¥¯¥Ã¥¡¼¤ò¼õ¤±ÉÕ¤±¤ë (¼õ¤±ÉÕ¤±¤Ê¤¤) ¥É
- ¥á¥¤¥ó¤òÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿.
- ¤Þ¤¿, ¥¯¥Ã¥¡¼ÀßÄê¤ò°ì¤Ä¤Î¥»¥¯¥·¥ç¥ó¤È¤·¤ÆʬΥ¤·¤¿.
- ¡¦ frame ¤Î reload ¤ÎºÝ, ¥×¥í¥¯¥·¤Î¥¥ã¥Ã¥·¥å¤¬¹¹¿·¤µ¤ì¤Æ¤¤¤Ê¤«¤Ã
- ¤¿ÌäÂê¤Ø¤ÎÂнè.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01211] Re: a small change to linein.c
-Subject: [w3m-dev 01214] Re: a small change to linein.c
- Ť¤Ê¸»úÎó¤òÊÔ½¸¤¹¤ëºÝ, Á´¤Æ¤Îʸ»úÎó¤¬É½¼¨¤µ¤ì¤Ê¤¤»ö¤¬¤¢¤ëÌäÂê¤Ø¤Î
- Âнè.
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01216] error message for invalid keymap
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01220] Re: error message for invalid keymap
- keymap ¤ËÌäÂ꤬¤¢¤Ã¤¿¤È¤¤Ë, ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ò½Ð¤¹¤è¤¦¤Ë½¤Àµ.
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01217] keymap.lynx example could be better.
- keymap.lynx ¤Î¹¹¿·.
-
-
-2000/10/20
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- cookie ¤Î¼è¤ê°·¤¤¤Ë´Ø¤·¤Æ´ö¤Ä¤«¤Î½¤Àµ¤ò²Ã¤¨¤¿.
- ¡¦ version 1 cookie ¤ËÂФ¹¤ë°·¤¤¤ò
- http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-state-man-mec-12.txt
- ¤Ë½àµò¤¹¤ë¤è¤¦¤ËÊѹ¹.
- Netscape-style cookie ¤Î¥ê¥¯¥¨¥¹¥È¥Ø¥Ã¥À¤Ë, Cookie2 ¤òÄɲÃ.
- ¡¦ [w3m-dev-en 00190] patch ¤ËÂФ¹¤ë´ö¤Ä¤«¤ÎÊѹ¹.
-
-
-2000/10/19
-
-From: "Ambrose Li [EDP]" <acli@mingpaoxpress.com>
-Subject: [w3m-dev-en 00136] version 0 cookies and some odds and ends
-Subject: [w3m-dev-en 00191] sorry, the last patch was not made properly
-Subject: [w3m-dev-en 00190] w3m-0.1.10 patch (mostly version 0 cookie handling)
- I've hacked up a big mess (patch) against w3m-0.1.9 primarily
- involving version 0 cookies. To my dismay, it seems that most
- servers out there still want version 0 cookies and version 0
- cookie handling behaviour, and w3m's cookie handling is too
- strict for version 0, causing some sites (notably my.yahoo.co.jp)
- not to work.
-
-2000/10/18
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ʸ»úÉý¤òÀßÄê²Äǽ¤Ë¤·¤¿.
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01208] '#', '?' in ftp:/....
- ftp:/ ¤Ç¥Õ¥¡¥¤¥ë̾¤Ë '#' ¤¬Æþ¤Ã¤Æ¤¤¤ë¤È¥¢¥¯¥»¥¹¤Ç¤¤Ê¤¤ÌäÂê¤Ø¤ÎÂÐ
- ½è.
-
-From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-Subject: [w3m-dev 01209] http_response_code and ``Location:'' header
- ¡ÖLocation:¡×¥Ø¥Ã¥À¤¬¤¢¤ë¤È¡¢Ìµ¾ò·ï¤Ë¤½¤ì¤Ë½¾¤¦¤è¤¦¤Ë¤Ê¤Ã¤Æ¤Þ¤¹¤¬¡¢
- http_response_code¤ò¸«¤Æ301¡Á303¤Î»þ¤À¤±½¾¤¦¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿¡£
-
-
-2000/10/17
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- local CGI ¤Ç, ¥¾¥ó¥Ó¤¬¤Ç¤¤ëÌäÂê¤Ø¤ÎÂнè.
-
-
-2000/10/16
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- table Ãæ¤Ç <textarea> ¤¬ÊĤ¸¤Æ¤Ê¤¤»þ, ½ªÎ»¤Ç¤¤Ê¤¯¤Ê¤ëÌäÂê¤Ø¤ÎÂнè.
- ([w3m-dev 00959] ¤ÎÂåÂØ°Æ).
- <select> ¤Î°·¤¤¤Ë½à¤¸¤ë¤è¤¦¤Ë¤·¤¿.
-
-From: maeda@tokyo.pm.org
-Subject: [w3m-dev 00990] auth password input
- ²¿¤ËÂФ¹¤ë¥Ñ¥¹¥ï¡¼¥É¤Ê¤Î¤«¤ï¤«¤é¤Ê¤¤¤Î¤Ç¡¢°Ê²¼¤Î¤è¤¦¤Ê
- ¥Ñ¥Ã¥Á¤òÅö¤Æ¤Þ¤·¤¿¡£sleep(2)¤ÏŤ¹¤®¤ë¤«¤â¡£
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01193] Re: frame bug?
- ¥Õ¥ì¡¼¥à¤Î¤¢¤ë¥Ú¡¼¥¸¤ò±ýÍ褷¤Æ¤¤¤ë¤È¤, Íî¤Á¤ë»ö¤¬¤¢¤ëÌäÂê¤Ø¤ÎÂнè.
-
-
-2000/10/13
-
-From: SASAKI Takeshi <sasaki@ct.sakura.ne.jp>
-Subject: [w3m-dev 00928] misdetection of IPv6 support on CYGWIN 1.1.2
- CYGWIN 1.1.2°Ê¹ß¤Ç, ¸í¤Ã¤Æ IPv6 ¥µ¥Ý¡¼¥È¤ò¸¡½Ð¤·¤Æ¤·¤Þ¤¦ÌäÂê¤Ø¤ÎÂÐ
- ½è.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01170] Re: cursor position after RELOAD, EDIT
- ¡¦cache ¥Õ¥¡¥¤¥ë¤¬»Ä¤ë¤³¤È¤¬¤¢¤ë¥Ð¥°¤Î½¤Àµ.
- ¤½¤Î¾
- ¡¦¥Ç¥£¥ì¥¯¥È¥ê¥ê¥¹¥È¤Î URL ¤¬ /$LIB/dirlis.cgi¡Ä ¤È³Ê¹¥°¤«¤Ã¤¿¤Î¤Ç¡¢
- ¸µ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤½¤Î¤â¤Î¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
- dirlist.in ¤òÊѹ¹¤·¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢configure ¤òºÆ¼Â¹Ô¤¹¤ë¤«¡¢
- cp dirlist.in dirlist.cgi ¤È¤·¤Æ @PERL@ ¤È @CYGWIN@ ¤ò½ñ¤´¹¤¨¤Æ¤¯¤À¤µ¤¤¡£
- ¡¦keymap ¤Ç°ú¿ô¤òµ½Ò¤Ç¤¤ë³ÈÄ¥¤ò°Ê²¼¤Î´Ø¿ô¤ËŬÍѤ·¤Þ¤·¤¿¡£
- LOAD ¡Ä ¥Õ¥¡¥¤¥ë̾
- EXTERN, EXTERN_LINK ¡Ä ³°Éô¥Ö¥é¥¦¥¶Ì¾
- (w3m-control: ¤«¤é¤Ï»È¤¨¤Þ¤»¤ó)
- EXEC_SHELL, READ_SHELL, PIPE_SHELL ¡Ä shell¥³¥Þ¥ó¥É
- (w3m-control: ¤«¤é¤Ï»È¤¨¤Þ¤»¤ó)
- SAVE, SAVE_IMAGE, SAVE_LINK, SAVE_SCREEN ¡Ä ¥Õ¥¡¥¤¥ë̾(pipe ¥³¥Þ¥ó¥É)
- (w3m-control: ¤«¤é¤Ï»È¤¨¤Þ¤»¤ó)
-
-
-2000/10/11
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦É¸½àÆþÎϤ«¤é¤Î¥Ð¥Ã¥Õ¥¡¤ËÆɤ߹þ¤à¤È¤, MAN_PN ¤ò¸«¤Æ¥Ð¥Ã¥Õ¥¡Ì¾¤ò·è¤á
- ¤ë¤è¤¦¤Ë¤·¤¿.
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01156] Re: w3m-0.1.11-pre-kokb15
- ¡¦mydirname ¤Î¥Ð¥°½¤Àµ¤È´Ø¿ôÀë¸À¤ÎÄɲÃ
- ¡¦SERVER_NAME ¤òÀßÄꤹ¤ë¤è¤¦¤ËÊѹ¹
- ¡¦[w3m-dev-en 00234] ¤ò»²¹Í¤Ë GATEWAY_INTERFACE ¤òÀßÄꤹ¤ë¤è¤¦¤ËÊѹ¹
- ¡¦current working directory ¤òÊѹ¹¤·¤Æ popen ¤¹¤ë¡¢¤è¤ê¤Þ¤È¤â¤Ê¼ÂÁõ
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01158] some bugs fix when RELOAD, EDIT
-Subject: [w3m-dev 01164] cursor position after RELOAD, EDIT
- ¡¦local CGI ¤È¤·¤Æ¸Æ¤Ó½Ð¤·¤¿ file:... ¤ò EDIT ¤Ç¤¤ë¥Ð¥°¤ò½¤Àµ¤·¤Þ¤·¤¿¡£
- # currentURL.scheme ¤Ç¤Ï¤Ê¤¯ real_scheme ¤ò»È¤¦¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
- ¡¦HTML ¤ò¥½¡¼¥¹É½¼¨¾õÂÖ¤«¤é RELOAD, EDIT ¤·¤¿¸å¤Ë¤Ï
- ¥½¡¼¥¹É½¼¨¾õÂ֤ˤʤë¤è¤¦¤Ë¤·¤Þ¤·¤¿(°ìÉôÉÔ¶ñ¹ç¤¬¤¢¤ê¤Þ¤·¤¿)¡£
- ¡¦µÕ¤Ë plain text ¥Õ¥¡¥¤¥ë¤ò HTML ɽ¼¨¤·¤Æ¤¤¤ë¾õÂÖ¤«¤é RELOAD, EDIT
- ¤·¤¿¸å¤Ë¤Ï HTML ɽ¼¨¾õÂ֤ˤʤë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
- ¡¦RELOAD, EDIT ¸å¤Î¥«¡¼¥½¥ë°ÌÃÖ¤ò RELOAD, EDIT Á°¤ÈƱ¤¸¤Ë¤Ê¤ë¤è¤¦¤Ë
- ¤·¤Þ¤·¤¿¡£
-
-
-2000/10/10
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01166] Re: cell width in table
- table ´Ø·¸¤Î¥Ð¥°¥Õ¥£¥¯¥¹¤Ç¤¹.
- ¡¦ ²èÌÌÉý¤¬½½Ê¬¤¢¤ë¤Ë¤â´Ø¤ï¤é¤º, ʸ¤¬ÅÓÃæ¤ÇÀÞ¤êÊÖ¤µ¤ì¤Æ¤·¤Þ¤¦ÌäÂê¤Î½¤Àµ.
- ¡¦ table ¤Ç <wbr> ¤¬¸ú¤«¤Ê¤¤»ö¤¬¤¢¤ëÌäÂê¤Î½¤Àµ.
- ¡¦ feed_table_tag() ¤Î½èÍý¤Î¶¦Ä̲½.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01155] history of data for <input type=text>
- ¤Õ¤È»×¤¤½Ð¤·¤Æ <input type=text> ¤ÇÆþÎϤ·¤¿¥Ç¡¼¥¿¤â¥Ò¥¹¥È¥ê¤ò
- é¤ì¤ëÍͤˤ·¤Æ¤ß¤Þ¤·¤¿¡£
- ¸¡º÷¥µ¡¼¥Ó¥¹¤òÅϤêÊ⤯»þ¤Ê¤É¤ËÊØÍø¤È»×¤¤¤Þ¤¹¡£
-
-
-2000/10/9
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01150] Some bug fixes
- [w3m-dev 00956] unknown scheme in frame
- [w3m-dev 00975] goto link from frame page
- ¤ÇÊó¹ð¤µ¤ì¤¿ÌäÂê¤Î½¤Àµ.
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01145] buffer overflow in linein.c
- inputLineHist(linein.c) ¤Ç¥Ç¥Õ¥©¥ë¥Èʸ»úÎó¤¬ 256 ʸ»ú°Ê¾å¤Î¾ì¹ç¤Ë
- strProp ¤¬Îΰ賰¥¢¥¯¥»¥¹¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤·¤¿¤Î¤Ç¡¢¤½¤Î½¤Àµ patch ¤Ç¤¹¡£
- ¤Þ¤¿Ê¸»úÎóŤÎÀ©¸ÂÃͤò 1024 ¤Ë¤·¤Þ¤·¤¿¡£
-
-
-2000/10/8
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01136] function argument in keymap
-Subject: [w3m-dev 01139] Re: function argument in keymap
- Ĺ¤é¤¯½ÉÂê¤Ë¤Ê¤Ã¤Æ¤¿ ~/.w3m/keymap ¤Ç¤Î´Ø¿ô¤Î°ú¿ô»ØÄê¤ò²Äǽ¤Ë¤·¤Þ¤·¤¿¡£
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 01143] image map with popup menu
- image map ¤ò popup menu ¤ò»È¤Ã¤Æ <option> ¤ÎÍͤËɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿¡£
- config.h ¤Ç #define MENU_MAP ¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 00971] Re: segmentation fault with http:
- URL ¤È¤·¤Æ http: ¤ä http:/ ¤òÆþÎϤ¹¤ë¤ÈÍî¤Á¤Æ¤·¤Þ¤¦¤Î¤Ç½¤Àµ¤·¤Þ¤·¤¿¡£
-
-
-2000/10/07
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01134] w3m in xterm horribly confused by Japanese in title (fr
- http://bugs.debian.org/w3m ¤ÇÊó¹ð¤µ¤ì¤Æ¤¤¤ë, ±Ñ¸ìÈǤÇÆüËܸ쥿¥¤¥È¥ë¤Î
- ¤¢¤ë¥Ú¡¼¥¸¤ò¸«¤¿¤È¤¤Ë, w3m ¤¬È¯¶¸¤¹¤ë»ö¤¬¤¢¤ëÌäÂê¤ËÂФ¹¤ë¥Ð¥°¥Õ¥£¥¯¥¹
- ¤Ç¤¹.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01127] SIGINT signal in ftp session (Re: my w3m support page)
- ftp ¤ÎºÝ¤Ë SIGINT ¤¬È¯À¸¤¹¤ë¤ÈÍî¤Á¤ë¥Ð¥°¤Î½¤Àµ.
-
-
-2000/10/06
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- ¡¦ table ¤Î recalc_width() ¤Î wmin ¤ÎºÇÂçÃͤò 0.05 ¤ËÊѹ¹.
- ¡¦ ³°Éô¥³¥Þ¥ó¥É¤Î½ÐÎϥХåե¡¤Î filename, basename, type ¤òÊѹ¹.
- ¡¦ http ¤È local file °Ê³°¤Î°µ½Ì¥Ç¡¼¥¿¤ò¿Ä¹¤¹¤ë¤Î¤Ë, °ìö¥Æ¥ó¥Ý¥é¥ê
- ¥Õ¥¡¥¤¥ë¤ËÍî¤È¤¹¤è¤¦¤Ë¤·¤¿.
- ¡¦ ¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë̾¤òÀ¸À®¤¹¤ëÊýË¡¤ÎÊѹ¹.
- ¡¦ mailcap ¤Î edit= ¤ò²ò¼á¤¹¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦ URLFile ¤Î½é´ü²½¤¬ÉÔ´°Á´¤À¤Ã¤¿ÌäÂê¤Î½¤Àµ.
- ¡¦ »Ä¤Ã¤Æ¤¤¤¿Èó¸ø¼°¥Ñ¥Ã¥Á¤Î¥´¥ß¤Îºï½ü.
-
-
-2000/10/05
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- -dump, -source_dump ¥ª¥×¥·¥ç¥ó¤Î²þÁ±, frame Ãæ¤Î <meta> ¥¿¥°¤ò̵»ë
- ¤¹¤ë¤è¤¦¤Ë¤¿.
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 00930] HTML-quote in w3mbookmark.c
- "¥Ö¥Ã¥¯¥Þ¡¼¥¯¤ÎÅÐÏ¿" ¤Ç URL ¤ä Title ¤¬ HTML-quote ¤µ¤ì¤Æ¤¤¤Ê¤¤¤Î¤ò
- ½¤Àµ¤·¤Þ¤·¤¿¡£
-
-From: hsaka@mth.biglobe.ne.jp (Hironori Sakamoto)
-Subject: [w3m-dev 00972] better display of progress bar ?
- 2Mb ¤Î¥Õ¥¡¥¤¥ë¤òÆɤó¤Ç¤¤¤ë»þ¤Ë¡¢¤º¤Ã¤È 0/2Mb ¤Ë¤Ê¤Ã¤ÆÈᤷ¤«¤Ã¤¿¤Î¤Ç¡¢
- ¥×¥í¥°¥ì¥¹¥Ð¡¼¤Îɽ¼¨¤ò %.0f (%.1f) ¤«¤é %.3g ¤Ë¤·¤Æ¤ß¤¿¤ó¤Ç¤¹¤¬¡¢
- ¤É¤ó¤Ê¤â¤ó¤Ç¤·¤ç¤¦¡£
-
-
-2000/10/05
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
- textlist ¤ËÂФ¹¤ë null pointer ¥Á¥§¥Ã¥¯¤ò²Ã¤¨¤¿.
-
-From: Fumitoshi UKAI <ukai@debian.or.jp>
-Subject: [w3m-dev 01100] space in URL
-
- * http://bugs.debian.org/60825 ¤È http://bugs.debian.org/67466
-
- form ¤ò submit ¤¹¤ë»þ¤Ë value ¤·¤« form_quote() ¤·¤Æ¤Þ¤»¤ó¤¬
- name ¤ÎÊý¤â form_quote() ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
-
- * http://bugs.debian.org/66887
-
- Goto URL: ¤ÇÀèƬ¤Ë space ¤¬Æþ¤ë¤È current¤«¤é¤ÎÁêÂа·¤¤¤Ë¤Ê¤ë¤Î¤ò
- ¤ä¤á¤Æ¤Û¤·¤¤¤È¤¤¤¦Êó¹ð¡£¤¿¤·¤«¤Ë cut & paste ¤¹¤ë¤È¤¤Ë¤Ê¤ê¤¬¤Á¤Ê¤Î¤Ç
- (¤Ä¤¤¤Ç¤Ê¤Î¤Ç¸å¤í¤Î¶õÇò¤âºï½ü)
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01111] bug of conv.c
- UTF-8 ¤Ê¥Ú¡¼¥¸(Shift_JIS ¤È¸íǧ¤µ¤ì¤ë)¤Ç w3m ¤Îɽ¼¨¤¬Íð¤ì¤ë
- (¥³¥ó¥È¥í¡¼¥ë¥·¡¼¥±¥ó¥¹¤¬Ï³¤ì¤ë)¤³¤È¤¬¤¢¤Ã¤¿¤Î¤ÇÄ´¤Ù¤Æ¤ß¤¿¤È¤³¤í¡¢
- conv.c ¤¬¥Ð¥°¤Ã¤Æ¤Þ¤·¤¿¡£Ã±½ã¥ß¥¹¤Ç¤¹¡£¤¹¤ß¤Þ¤»¤óm(_o_)m
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01113] bug fix (content charset)
- content charset ¤ÎÀßÄêÉô¤Ç¥Ð¥°¤Ã¤Æ¤Þ¤·¤¿¤Î¤Ç¡¢½¤Àµ patch ¤Ç¤¹¡£
-
-
-2000/10/02
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01112] Re: mailcap test= directive
- mailcap ¤Î°·¤¤¤ò³ÈÄ¥¤·¤Þ¤·¤¿.
- ¡¦ %s °Ê³°¤Ë, %t (content-type name) ¤ò»È¤¨¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¡¦ nametemplate ¥ª¥×¥·¥ç¥ó¤¬Í¸ú¤Ë¤Ê¤ê¤Þ¤·¤¿.
- ¡¦ %s ¤¬Ìµ¤¤¾ì¹ç¤Ï, ɸ½àÆþÎϤò %s ¤Ë¥ê¥À¥¤¥ì¥¯¥È¤·¤Æ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹
- ¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¥·¥§¥ë¤Î¹½Ê¸¤È¤·¤Æ¥Ü¡¼¥ó¥·¥§¥ë¤ò²¾Äꤷ¤Æ¤¤¤ë¤Î¤Ç, OS/2 Åù¤Ç¤Ï¤³¤Î
- ¤Þ¤Þ¤Ç¤ÏÂÌÌܤ«¤â¤·¤ì¤Þ¤»¤ó.
- ¡¦ needsterminal ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï, ¥Õ¥©¥¢¥°¥é¥ó¥É¤Ç¥³¥Þ¥ó¥É¤ò¼Â
- ¹Ô¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¡¦ copiousoutput ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï, ¥³¥Þ¥ó¥É¤Î¼Â¹Ô·ë²Ì¤ò¥Ð¥Ã¥Õ¥¡
- ¤ËÆɤ߹þ¤à¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¡¦ RFC 1524 ¤Ë¤Ï̵¤¤¤Î¤Ç¤¹¤¬, ¥³¥Þ¥ó¥É¤Î¼Â¹Ô·ë²Ì¤ò text/html ¤È¤·¤Æ
- ¥Ð¥Ã¥Õ¥¡¤ËÆɤ߹þ¤à¤¿¤á¤Î¥ª¥×¥·¥ç¥ó htmloutput ¤òÄɲä·¤Þ¤·¤¿.
- ¤³¤ì¤Ï, ºäËܤµ¤ó¤¬ [w3m-dev 01079] ¤ÇÄó°Æ¤µ¤ì¤Æ¤¤¤¿¤â¤Î¤ÎÂåÂذƤÎ
- ¤Ä¤â¤ê¤Ç¤¹.
- ¤Þ¤À¥Æ¥¹¥È¤·¤Æ¤Þ¤»¤ó¤¬, ¤Á¤ã¤ó¤ÈÆ°¤¤¤Æ¤¤¤ì¤Ð
-
- application/excel; xlHtml %s | lv -Iu8 -Oej; htmloutput
-
- ¤È¤¹¤ì¤Ð, lv ¤Î¼Â¹Ô·ë²Ì¤¬ html ¤È¤·¤Æ w3m ¤Î¥Ð¥Ã¥Õ¥¡¤Ëɽ¼¨¤µ¤ì¤ë
- ¤Ï¤º¤Ç¤¹.
- Ʊ¤¸ content-type ¤Î¥¨¥ó¥È¥ê¤¬Ê£¿ô¤¢¤ë¾ì¹ç, htmloutput ¥ª¥×¥·¥ç¥ó
- ¤¬¤¢¤ë¤â¤Î¤òÍ¥À褹¤ë¤è¤¦¤Ë¤·¤Æ¤¢¤ë¤Î¤Ç, ¾¤Î¥×¥í¥°¥é¥à¤È mailcap
- ¤ò¶¦Í¤·¤Æ¤âÌäÂê̵¤¤¤È»×¤¤¤Þ¤¹.
- ¤·¤«¤·, RFC 1524 ¤Ë½àµò¤·¤Æ¤Ê¤¤¤Î¤Ï³Î¤«¤Ê¤Î¤Ç, ¸æ°Õ¸«¤ªÂÔ¤Á¤·¤Æ¤Þ
- ¤¹.
- ¡¦ (gunzip_stream() ¤Ë¤è¤ë) °µ½Ì¥Õ¥¡¥¤¥ë¤Î±ÜÍ÷¤¬ ftp ¤ËÂФ·¤Æ¤â»È¤¨
- ¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¿ʬ [w3m-dev 01078] ¤Î¥Ð¥°¤À¤È»×¤¤¤Þ¤¹¤¬, http ¤ËÂФ·¤Æ, °µ½Ì¤·
- ¤¿¥Æ¥¥¹¥È¥Ç¡¼¥¿¤Î±ÜÍ÷¤¬¤Ç¤¤Ê¤¯¤Ê¤Ã¤Æ¤¿¤Î¤Ç, ½¤Àµ¤·¤Þ¤·¤¿.
-
-
-2000/09/28
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01097] gunzip_stream problem
- °µ½Ì¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ó¤Ç¤ëÅÓÃæ¤Ç, INT ¥·¥°¥Ê¥ë¤¬È¯À¸¤·¤¿¤È¤¤ÎÆ°ºî
- ¤¬ÊѤʤΤÇ, ½¤Àµ¤·¤Þ¤·¤¿.
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01092] CONFIG_FILE
- config.h ¤Î CONFIG_FILE ¤òÊѹ¹¤·¤Æ¤âÈ¿±Ç¤µ¤ì¤Ê¤¤¤Ê¤È»×¤Ã¤¿¤é¡¢
- ¤¤¤Ä¤Î¤Þ¤Ë¤«¥Ï¡¼¥É¥³¡¼¥Ç¥£¥ó¥°¤ËÌá¤Ã¤Æ¤Þ¤·¤¿¡£
- ¤½¤Î½¤Àµ¤Ç¤¹¡£
-
-
-2000/09/17
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01078] treatment of content type
- document type ¤Î°·¤¤¤Î²þÎɤò¹Ô¤Ê¤¤¤Þ¤·¤¿.
- ¡¦ examineFile ¤Ë¤ª¤±¤ë, lessopen_stream ¤È gunzip_stream ¤ÎÍ¥Àè½ç°Ì
- ¤òÊѹ¹¤·¤Þ¤·¤¿.
- ¡¦ lessopen_stream ¤Î½èÍý¸å¤Ï, plain text ¤È¤·¤Æ°·¤¦¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¡¦ lessopen_stream ¤Ï, document type ¤¬ text/* ¤Ç¤¢¤ë¤«, ³°Éô¥Ó¥å¡¼¥¢
- ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¤ß»È¤¦¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¤Þ¤¿, text/html °Ê³°¤Î, text/* ·¿¤Ï w3m ÆâÉô¤Ç½èÍý¤¹¤ë¤è¤¦¤Ë¤·¤Þ
- ¤·¤¿.
- ¡¦ page_info_panel ¤Çɽ¼¨¤µ¤ì¤ë document type ¤Ï, examineFile ¤Ç½èÍý
- ¤µ¤ì¤ëÁ°¤ÎÃͤò»È¤¦¤è¤¦¤Ë¤·¤Þ¤·¤¿.
- ¡¦ ³°Éô¥Ó¥å¡¼¥¢¤ò¥Ð¥Ã¥¯¥°¥é¥ó¥É¤ÇÆ°¤«¤¹¤È¤, ¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ë
- ">/dev/null 2>&1 &" ¤òÉÕ¤±¤Æ¤ß¤Þ¤·¤¿.
-
-
-2000/09/13
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01053] Re: Location: in local cgi.
- [w3m-dev 01051] ¤Î¥Ñ¥Ã¥Á¤Ç¤Ï¡¢w3m -m ¤Ç Location: ¤Î¥Ø¥Ã¥À¤Î¤¢¤ëʸ¾Ï¤ò
- ¸«¤ë¤ÈÈô¤ó¤Ç¤¤¤Ã¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢local CGI ¤Î¤È¤¤Î¤ß Location: ¤ò»²¾È¤¹
- ¤ë¤è¤¦¤ËÊѹ¹¤·¤Þ¤·¤¿¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01065] map key '0'
- keymap ¤¬¤é¤ß¤Î½¤Àµ¤Ç¤¹¡£
- ¡¦Ã±ÆȤΠ'0' ¤ò¥¡¼¥Þ¥Ã¥×²Äǽ¤Ë¤·¤Þ¤·¤¿¡£
- ¡Ø10 j¡Ù¤È¤«¤Ï°ÊÁ°Ä̤ê¤Ç¤¹¡£
- ¡¦¡ØESC ¤¢¡Ù¤Ê¤É ESC ¤Î¸å¤Ë 0x80-0xff ¤Îʸ»ú¤òÆþÎϤ¹¤ë¤È
- ÇÛÎó³°¥¢¥¯¥»¥¹¤ò¤¹¤ë²ÄǽÀ¤¬¤¢¤Ã¤¿¤â¤Î¤ò½¤Àµ¡£
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 01066] 104japan
- frame Ãæ¤Î form ¤Îʸ»ú¥³¡¼¥É¤ÎÊÑ´¹¤¬¾å¼ê¤¯½èÍý¤Ç¤¤Æ¤¤¤Ê¤¤¤è¤¦
- ¤Ç¤¹¤Î¤Ç¡¢½¤Àµ¤·¤Þ¤·¤¿¡£
-
-
-2000/09/07
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01058] <dt>, <dd>, <blockquote> (Re: <ol> etc.)
- ¡¦ <blockquote> ¤ÎÁ°¸å¤Î¶õ¹Ô¤Ï¾ï¤ËÆþ¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦ <dt>, <dd> ¥¿¥°Ä¾¸å¤Î <p> ¥¿¥°¤ò̵»ë¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿.
-
-
-2000/09/04
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01052] cellpadding, cellspacing, vspace, etc.
- ¶õÇò¤ä¶õ¹Ô¤Ë´Ø¤¹¤ë, ¼¡¤Î¤è¤¦¤Ê¤¤¤¯¤Ä¤«¤ÎÊѹ¹¤ò¹Ô¤Ê¤¤¤Þ¤·¤¿.
- ¡¦ ;ʬ¤Ê¥»¥ë¤¬½ÐÍè¤ë¤Î¤òËɤ°¤¿¤á¤Ë, <tr> ¤ä <td> ¤Î³°¤Ë¤¢¤ë
- <a name="..."></a> ¤ä, <font> Åù¤Ï¼¡¤Î¥»¥ë¤ËÆþ¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦ <table> ¤Î cellspacing °À¤Î²ò¼á¤ò´Ö°ã¤Ã¤Æ¤¤¤¿¤Î¤Ç, ½¤Àµ¤·¤¿.
- vspace °À¤â²ò¼á¤Ç¤¤ë¤è¤¦¤Ë¤·¤¿.
- ¡¦ ¶õ¹Ô¤ÎȽÄê¾ò·ï¤òÊѹ¹¤·¤¿.
- ¡¦ </p> ¥¿¥°¤Ç¶õ¹Ô¤¬Æþ¤ë¤è¤¦¤Ë¤·¤¿.
-
-
-2000/08/17
-
-From: Tsutomu Okada (²¬ÅÄ ÊÙ) <okada@furuno.co.jp>
-Subject: [w3m-dev 01018] sqrt DOMAIN error in table.c
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01019] Re: sqrt DOMAIN error in table.c
- º¬¹æ¤ÎÃæ¿È¤¬Éé¤Ë¤Ê¤ë¾ì¹ç¤¬¤¢¤ëÌäÂê¤Î½¤Àµ.
-
-
-2000/08/15
-
-From: satodai@dog.intcul.tohoku.ac.jp (Dai Sato)
-Subject: [w3m-dev 01017] value of input tag in option panel
- aito Ï¢ÍíÄ¢¡Êhttp://ei5nazha.yz.yamagata-u.ac.jp/BBS/spool/log.html¡Ë
- ¤Ë½Ð¤Æ¤¿ÌäÂê¤Ç¤¹¡£option ²èÌ̤γ°Éô editor ¤Ê¤É¤Ë '"' ¤¬´Þ¤Þ¤ì¤ë
- ¥³¥Þ¥ó¥É¤¬»ØÄꤵ¤ì¤ë¤È¡¤ºÆÅÙ option ²èÌ̤ò¸Æ¤Ó½Ð¤·¤¿»þ¤Ë '"' °Ê¹ß¤¬
- ɽ¼¨¤µ¤ì¤Ê¤¯¤Ê¤ë¤È¸À¤¦ÌäÂê¡£
-
-
-2000/08/06
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01016] Table geometry calculation
- table ¤Î¥¸¥ª¥á¥È¥ê¡¼·×»»¤Ç¼Â¿ô¤òÀ°¿ô¤Ë´Ý¤á¤ë¼ê½ç¤òÊѹ¹¤·¤Æ, table Éý¤Î
- »ØÄêÃͤÈËÜÅö¤ÎÉý¤Îº¹¤¬²Äǽ¤Ê¸Â¤ê¾®¤µ¤¯¤Ê¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿.
-
-
-2000/07/26
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01006] initialize PRNG of openssl 0.9.5 or later
- ¥Ð¡¼¥¸¥ç¥ó 0.9.5 °Ê¹ß¤Î openssl ¥é¥¤¥Ö¥é¥ê¤Ç, ¥é¥ó¥À¥à¥Ç¥Ð¥¤¥¹
- (/dev/urandom) ¤¬Â¸ºß¤·¤Ê¤¤´Ä¶¤Ç¤â SSL ¤¬»È¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤¿.
-
-
-2000/07/21
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01004] unused socket is not closed.
- C-c (SIGINT) ¤Ç¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤òÃæÃǤ·¤¿¤È¤, socket ¤¬¥¯¥í¡¼¥º¤µ¤ì
- ¤Æ¤¤¤Ê¤¤¾ì¹ç¤¬¤¢¤ë¤è¤¦¤Ç¤¹.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01005] table caption problem
- </caption> ¤ò˺¤ì¤Æ¤¤¤¿¤È¤¤Ë w3m ¤¬½ªÎ»¤·¤Ê¤¯¤Ê¤ëÌäÂê¤ÎÌäÂê¤Î½¤Àµ.
-
-
-2000/07/19
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 00966] ssl and proxy authorization
- authorization ¤òɬÍפȤ¹¤ë¾ì¹ç¤Î HTTP proxy ¥µ¡¼¥Ð¤Î SSL ¥È¥ó¥Í¥ê
- ¥ó¥°¤ËÌäÂ꤬¤¢¤Ã¤¿¤Î¤Ç½¤Àµ.
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 01003] Some bug fixes for table
- table ¤Î¥¸¥ª¥á¥È¥ê·×»»¤Î¤¤¤¯¤Ä¤«¤ÎÌäÂê¤ËÂФ¹¤ë½¤Àµ.
-
-
-2000/07/16
-
-From: SASAKI Takeshi <sasaki@ct.sakura.ne.jp>
-Subject: [w3m-dev 00999] Re: bookmark
- ¥Ö¥Ã¥¯¥Þ¡¼¥¯¤¬ÅÐÏ¿¤Ç¤¤Ê¤¤¾ì¹ç¤¬¤¢¤ëÌäÂê¤Î½¤Àµ.
-
-
-2000/06/18
-
-From: Okabe Katsuya <okabek@guitar.ocn.ne.jp>
-Subject: [w3m-dev 00934] clear_buffer bug
- clear_buffer ¤¬ TRUE ¤Î¤È¤, selBuf() ¤Ç²èÌ̤¬¾Ã¤¨¤Æ¤·¤Þ¤¦ÌäÂê¤ËÂФ¹¤ë
- ¥Ð¥°¥Õ¥£¥¯¥¹¤Ç¤¹.
-
-
-2000/06/17
-
-From: SASAKI Takeshi <sasaki@ct.sakura.ne.jp>
-Subject: [w3m-dev 00929] ftp.c patch
- USER ¥³¥Þ¥ó¥É¤ËÂФ·¤Æ 230 ¤¬Ê֤äƤ¤¿¾ì¹ç¤Ë¤ÏÀ®¸ù¤·¤¿¤â¤Î¤È
- ¤ß¤Ê¤¹ patch ¤òºîÀ®¤·¤Þ¤·¤¿¡£°Ê²¼¤ËźÉÕ¤·¤Þ¤¹¡£
-
-
-2000/06/16
-
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 00923] some bug fixes
- ¡¦ #undef JP_CHARSET ¤Î¾ì¹ç¤Ë file.c ¤¬ make ¤Ç¤¤Ê¤¯¤Ê¤Ã¤Æ¤¤¤¿
- ¥Ð¥°(»ä¤Î¥ß¥¹¤Ç¤·¤¿_o_)¤Î½¤Àµ¤È¡¢
- ¡¦ buffer.c ¤Î '=' ¤¬ '==' ¤Ë¤Ê¤Ã¤Æ¤¤¤¿¤â¤Î¤Î½¤Àµ¤Ç¤¹¡£
-
-From: Kazuhiko Izawa <izawa@nucef.tokai.jaeri.go.jp>
-Subject: [w3m-dev 00924] Re: w3m-0.1.11pre
-From: Hironori Sakamoto <h-saka@lsi.nec.co.jp>
-Subject: [w3m-dev 00925] Re: w3m-0.1.11pre
- file://localhost/foo ¤Î·Á¼°¤Î URL ¤Ë¥¢¥¯¥»¥¹¤·¤è¤¦¤È¤·¤¿¤È¤°Û¾ï½ª
- λ¤·¤Æ¤·¤Þ¤¦ÌäÂê¤Î½¤Àµ.
diff --git a/doc-jp/MANUAL.html b/doc-jp/MANUAL.html
@@ -48,8 +48,6 @@ w3m
<dd>text/plain ¤Îʸ½ñ¤òɽ¼¨¤¹¤ë¾ì¹ç¡¤½Å¤ÍÂǤÁ¤Ë¤è¤ë¶¯Ä´Ê¸»ú¤òɽ¼¨¤·¤Ê¤¤¡¥
¤³¤Î¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤Ê¤¤¾ì¹ç¡¤``A^H_''¤ÏA¤Î¥¢¥ó¥À¡¼¥é¥¤¥ó¤È¤·¤Æɽ¼¨¤µ¤ì¡¤
``A^HA''¤ÏA¤Î¥Ü¡¼¥ë¥É¤È¤·¤Æɽ¼¨¤µ¤ì¤ë¡¥
-<dt>-S
-<dd>text/plain ¤Îʸ½ñ¤òɽ¼¨¤¹¤ë¾ì¹ç¡¤Ê£¿ô¤Î¶õ¹Ô¤ò1¤Ä¤Ë¤Þ¤È¤á¤Æɽ¼¨¤¹¤ë¡¥
<dt>-l ¹Ô¿ô
<dd>ɸ½àÆþÎϤÎÆâÍƤòɽ¼¨¤¹¤ë¤È¤¤ËÊݸ¤µ¤ì¤ëºÇÂç¹Ô¿ô¤ò»ØÄꤹ
¤ë¡¥¥Ç¥Õ¥©¥ë¥È¤Ï 10000¡¥
@@ -59,6 +57,8 @@ w3m
<dd>EUC ¥³¡¼¥É¤Çɽ¼¨¤¹¤ë¡¥
<dt>-j
<dd>JIS(ISO-2022-JP) ¥³¡¼¥É¤Çɽ¼¨¤¹¤ë¡¥
+<dt>-I e|s
+<dd>ÆþÎÏʸ½ñ¤Îʸ»ú¥³¡¼¥É¤ò»ØÄꤹ¤ë¡¥
<dt>-T ¥¿¥¤¥×
<dd>ɽ¼¨¤¹¤ëʸ½ñ¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡¥¤³¤Î»ØÄ꤬¤Ê¤¤¾ì¹ç¡¤¥Õ¥¡¥¤¥ë
̾¤Î³ÈÄ¥»Ò¤Ë¤è¤Ã¤Æ¼«Æ°È½Ê̤µ¤ì¤ë¡¥È½Ê̤Ǥ¤Ê¤¤¾ì¹ç¤Ï text/plain
@@ -77,6 +77,8 @@ HTML
<dd>Internet message ¥â¡¼¥É¤Çɽ¼¨¤¹¤ë¡¥Internet message¥â¡¼¥É¤Î¾ì¹ç¡¤
¥Ø¥Ã¥À¤ÎÆâÍƤò¸«¤Æ¡¤Content-Type: ¤¬¤¢¤ì¤Ð¤½¤ì¤ò»²¹Í¤Ë¤¹¤ë¡¥ÅŻҥ᡼¥ë¤ä
¥Í¥Ã¥È¥Ë¥å¡¼¥¹¤Îµ»ö¤òÆɤà¤È¤¤ËÊØÍø¡¥
+<dt>-v
+<dd>¥¹¥¿¡¼¥È¥¢¥Ã¥×¥Ú¡¼¥¸¤òɽ¼¨¤¹¤ë¡¥
<dt>-B
<dd>Bookmark ¤òɽ¼¨¤¹¤ë¡¥
<dt>-bookmark file
@@ -95,6 +97,8 @@ HTML
<dd>¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¡¥
<dt>-no-proxy
<dd>¥×¥í¥¥·¤òÍøÍѤ·¤Ê¤¤¡¥
+<dt>-pauth user:pass
+<dd>¥×¥í¥¥·Ç§¾ÚÍѤΥ桼¥¶Ì¾¤È¥Ñ¥¹¥ï¡¼¥É¤ò»ØÄꤹ¤ë¡¥
<dt>-no-mouse
<dd>¥Þ¥¦¥¹¤òÍøÍѤ·¤Ê¤¤¡¥
<dt>-cookie
@@ -115,6 +119,16 @@ HTML
´Á»ú¥³¡¼¥ÉÊÑ´¹¤â¤µ¤ì¤Ê¤¤¡¥
<dt>-dump_head
<dd>URL¤Ë¥¢¥¯¥»¥¹¤·¡¤¥Ø¥Ã¥À¾ðÊó¤ò½ÐÎϤ¹¤ë¡¥
+<dt>-dump_both
+<dd>URL¤Ë¥¢¥¯¥»¥¹¤·¡¤¥Ø¥Ã¥À¾ðÊó¤ÈHTML¥½¡¼¥¹¤ò½ÐÎϤ¹¤ë¡¥
+<dt>-dump_extra
+<dd>URL¤Ë¥¢¥¯¥»¥¹¤·¡¤³ÈÄ¥¾ðÊó¤È¥Ø¥Ã¥À¾ðÊó¤ÈHTML¥½¡¼¥¹¤ò½ÐÎϤ¹¤ë¡¥
+<dt>-post file
+<dd>¥Õ¥¡¥¤¥ë¤ÎÆâÍƤòPOST¤¹¤ë¡¥
+<dt>-header string
+<dd>HTTPÍ×µá¥Ø¥Ã¥À¤òÄɲ乤롥
+<dt>-config file
+<dd>config¤Î¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ë¡¥
</dl>
<hr>
@@ -154,16 +168,20 @@ HTMLʸ
<TR><TD>k,C-p,¾åÌð°õ¥¡¼<TD>¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>J<TD>²èÌ̤ò1¹Ô¾å¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
<TR><TD>K<TD>²èÌ̤ò1¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
+<TR><TD>^,C-a<TD>¹ÔƬ¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>$,C-e<TD>¹ÔËö¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>w<TD>¼¡¤Îñ¸ì¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>W<TD>Á°¤Îñ¸ì¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>><TD>²èÌÌÁ´ÂΤò±¦¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤòº¸¤Ë¤º¤é¤¹)
<TR><TD><<TD>²èÌÌÁ´ÂΤòº¸¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤò±¦¤Ë¤º¤é¤¹)
<TR><TD>.<TD>²èÌÌÁ´ÂΤò1ʸ»ú±¦¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤòº¸¤Ë¤º¤é¤¹)
<TR><TD>,<TD>²èÌÌÁ´ÂΤò1ʸ»úº¸¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤò±¦¤Ë¤º¤é¤¹)
-<TR><TD>g<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó¾å¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
-<TR><TD>G<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>g,M-<<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó¾å¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>G,M-><TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>ESC g<TD>²èÌ̲¼¤Ç¹ÔÈÖ¹æ¤òÆþÎϤ·¡¤¤½¤³¤Ç»ØÄꤷ¤¿¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
¤³¤³¤Ç $ ¤òÆþÎϤ¹¤ë¤È¡¤ºÇ½ª¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>Z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>TAB<TD>¼¡¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>C-u, ESC TAB<TD>Á°¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>[<TD>ºÇ½é¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
@@ -175,6 +193,7 @@ HTMLʸ
<TR><TD WIDTH=100>RET<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤Îʸ½ñ¤òÆɤߤ³¤ß¤Þ¤¹¡¥
<TR><TD>a, ESC RET<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤Îʸ½ñ¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>u<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>i<TD>¥ê¥ó¥¯¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿²èÁü¤Ø¤ÎURL¤Îɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>I<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤ËÂбþ¤¹¤ë²èÁü¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>ESC I<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹
²èÁü¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
@@ -184,6 +203,8 @@ HTMLʸ
Æɤó¤Ç¤¤¤ë¤È¤¤Ë¤â͸ú¤Ç¤¹¡¥
<TR><TD>c<TD>¸½ºß¤Îʸ½ñ¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>=<TD>¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>C-g<TD>¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>C-h<TD>URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>F<TD><FRAMESET>¤ò´Þ¤àʸ½ñ¤òɽ¼¨¤·¤Æ¤¤¤ë¤È¤¤Ë¡¤<FRAME>
¥¿¥°¤Î»Ø¤¹Ê£¿ô¤Îʸ½ñ¤ò1¤Ä¤Îʸ½ñ¤ËÊÑ´¹¤·¤Æɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>M<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ú¡¼¥¸¤ò¡¤³°Éô¥Ö¥é¥¦¥¶¤ò»È¤Ã¤Æɽ¼¨¤·¤Þ¤¹¡¥
@@ -207,6 +228,7 @@ HTMLʸ
<TR><TD>s<TD>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹¡¥
<TR><TD>E<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤¬¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤ò¥¨¥Ç¥£¥¿
¤ÇÊÔ½¸¤·¤Þ¤¹¡¥¥¨¥Ç¥£¥¿¤ò½ªÎ»¤·¤¿¸å¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
+<TR><TD>C-l<TD>²èÌ̤òºÆÉÁ²è¤·¤Þ¤¹¡¥
<TR><TD>R<TD>¥Ð¥Ã¥Õ¥¡¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
<TR><TD>S<TD>¥Ð¥Ã¥Õ¥¡¤Îɽ¼¨ÆâÍƤò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>ESC s<TD>HTML¤Î¥½¡¼¥¹¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥v ¤Ç¥½¡¼¥¹¤òɽ¼¨¤·¤Æ S ¤Ç
@@ -238,6 +260,7 @@ HTMLʸ
<TR><TD>?,C-r<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
<TR><TD>n<TD>¼¡¤ò¸¡º÷¤·¤Þ¤¹¡¥
<TR><TD>N<TD>Á°¤ò¸¡º÷¤·¤Þ¤¹¡¥
+<TR><TD>C-w<TD>ÀÞ¤êÊÖ¤·¸¡º÷¥â¡¼¥É¤òÀڤ괹¤¨¤Þ¤¹¡¥
</table>
<H3>¥Þ¡¼¥¯Áàºî</H3>
@@ -283,22 +306,27 @@ HTMLʸ
LynxÉ÷¥¡¼¥Ð¥¤¥ó¥É¤Ç¥³¥ó¥Ñ¥¤¥ë¤·¤¿¾ì¹ç¤Î»È¤¤¤«¤¿¤Ç¤¹¡¥
<H3>¥Ú¡¼¥¸/¥«¡¼¥½¥ë°ÜÆ°</H3>
<table>
-<TR><TD>SPC,C-v<TD>¼¡¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
-<TR><TD>b,ESC v<TD>Á°¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>SPC,C-v,+<TD>¼¡¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>b,ESC v,-<TD>Á°¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>l<TD>¥«¡¼¥½¥ë¤ò±¦¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>h<TD>¥«¡¼¥½¥ë¤òº¸¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>j<TD>¥«¡¼¥½¥ë¤ò²¼¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>k<TD>¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>J<TD>²èÌ̤ò1¹Ô¾å¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
<TR><TD>K<TD>²èÌ̤ò1¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
+<TR><TD>^<TD>¹ÔƬ¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>$<TD>¹ÔËö¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>><TD>²èÌÌÁ´ÂΤò±¦¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤòº¸¤Ë¤º¤é¤¹)
<TR><TD><<TD>²èÌÌÁ´ÂΤòº¸¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤò±¦¤Ë¤º¤é¤¹)
<TR><TD>C-a<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó¾å¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>C-e<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>G<TD>²èÌ̲¼¤Ç¹ÔÈÖ¹æ¤òÆþÎϤ·¡¤¤½¤³¤Ç»ØÄꤷ¤¿¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
¤³¤³¤Ç $ ¤òÆþÎϤ¹¤ë¤È¡¤ºÇ½ª¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>Z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>TAB, C-n, ²¼Ìð°õ<TD>¼¡¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>ESC TAB, C-p, ¾åÌð°õ<TD>Á°¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>C-g<TD>¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨¤·¤Þ¤¹¡¥
</table>
<H3>¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯Áàºî</H3>
@@ -314,6 +342,7 @@ Lynx
<TR><TD>ESC :<TD>Message-IDÉ÷¤Îʸ»úÎó¤ò¡¤news: ¤Î¥ê¥ó¥¯¤Ë¤·¤Þ¤¹¡¥¤³¤Îµ¡Ç½¤Ï¡¤HTML¤Ç¤Ê¤¤Ê¸½ñ¤òÆɤó¤Ç¤¤¤ë¤È¤¤Ë¤â͸ú¤Ç¤¹¡¥
<TR><TD>c<TD>¸½ºß¤Îʸ½ñ¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>=<TD>¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>C-h<TD>URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>F<TD><FRAMESET>¤ò´Þ¤àʸ½ñ¤òɽ¼¨¤·¤Æ¤¤¤ë¤È¤¤Ë¡¤<FRAME>
¥¿¥°¤Î»Ø¤¹Ê£¿ô¤Îʸ½ñ¤ò1¤Ä¤Îʸ½ñ¤ËÊÑ´¹¤·¤Æɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>M<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ú¡¼¥¸¤ò¡¤³°Éô¥Ö¥é¥¦¥¶¤ò»È¤Ã¤Æɽ¼¨¤·¤Þ¤¹¡¥
@@ -334,8 +363,9 @@ Lynx
<table>
<TR><TD WIDTH=100>B, C-b, º¸Ìð°õ<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤òºï½ü¤·¡¤°ì¤ÄÁ°¤Î¥Ð¥Ã¥Õ¥¡¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>\<TD>HTML¤Î¥½¡¼¥¹¤òɽ¼¨¤·¤Þ¤¹¡¥
-<TR><TD>s, C-h<TD>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹¡¥
+<TR><TD>s<TD>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹¡¥
<TR><TD>E<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤¬¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤ò¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤Þ¤¹¡¥¥¨¥Ç¥£¥¿¤ò½ªÎ»¤·¤¿¸å¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
+<TR><TD>C-l, C-w<TD>²èÌ̤òºÆÉÁ²è¤·¤Þ¤¹¡¥
<TR><TD>R, C-r<TD>¥Ð¥Ã¥Õ¥¡¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
<TR><TD>S, p<TD>¥Ð¥Ã¥Õ¥¡¤Îɽ¼¨ÆâÍƤò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>ESC s<TD>HTML¤Î¥½¡¼¥¹¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥v ¤Ç¥½¡¼¥¹¤òɽ¼¨¤·¤Æ S ¤Ç
@@ -363,16 +393,16 @@ Lynx
<H3>¸¡º÷</H3>
<table>
-<TR><TD WIDTH=100>/<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ëËöÈø¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
-<TR><TD>?<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
+<TR><TD WIDTH=100>/,C-s<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ëËöÈø¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
<TR><TD>n<TD>¼¡¤ò¸¡º÷¤·¤Þ¤¹¡¥
+<TR><TD>w<TD>ÀÞ¤êÊÖ¤·¸¡º÷¥â¡¼¥É¤òÀڤ괹¤¨¤Þ¤¹¡¥
</table>
<H3>¥Þ¡¼¥¯Áàºî</H3>
<table>
<TR><TD WIDTH=100>C-SPC<TD>¥Þ¡¼¥¯¤òÀßÄê¡¿²ò½ü¤·¤Þ¤¹¡¥¥Þ¡¼¥¯¤Ïȿžɽ¼¨¤µ¤ì¤Þ¤¹¡¥
-<TR><TD>ESC p<TD>°ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
-<TR><TD>ESC n<TD>°ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>P<TD>°ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>N<TD>°ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>"<TD>Àµµ¬É½¸½¤Ç»ØÄꤵ¤ì¤¿Ê¸»úÎó¤òÁ´¤Æ¥Þ¡¼¥¯¤·¤Þ¤¹¡¥
</table>
diff --git a/doc-jp/README b/doc-jp/README
@@ -81,8 +81,6 @@ OS/2
¤Î¤Ç¡¤¥â¥Î¥¯¥íÍѤ˥³¥ó¥Ñ¥¤¥ë¤·¤¿Êý¤¬Îɤ¤¤Ç¤·¤ç¤¦¡¥
Windows
README.cygwin ¤ò¤´¤é¤ó¤¯¤À¤µ¤¤¡¥
-MS-DOS
- README.dj¤ò¤´¤é¤ó¤¯¤À¤µ¤¤¡£
3. Ãøºî¸¢
diff --git a/doc-jp/README.func b/doc-jp/README.func
@@ -6,10 +6,11 @@ BOOKMARK
CENTER_H ¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹
CENTER_V ¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹
COOKIE ¥¯¥Ã¥¡¼°ìÍ÷¤òɽ¼¨¤·¤Þ¤¹
+DELETE_PREVBUF Á°¤Î¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤·¤Þ¤¹(¼ç¤Ë local-CGI ÍÑ)
DICT_WORD ÆþÎϤ·¤¿Ã±¸ì¤ò¼½ñ¥³¥Þ¥ó¥É¤ÇÄ´¤Ù¤Þ¤¹
DICT_WORD_AT ¥«¡¼¥½¥ë°ÌÃÖ¤Îñ¸ì¤ò¼½ñ¥³¥Þ¥ó¥É¤ÇÄ´¤Ù¤Þ¤¹
DOWN ²èÌ̤ò1¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹
-DOWN_LOAD HTML¤Î¥½¡¼¥¹¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹
+DOWNLOAD HTML¤Î¥½¡¼¥¹¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹
EDIT ¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤Þ¤¹
EDIT_SCREEN ¸½ºßɽ¼¨¤µ¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤ò¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤Þ¤¹
END ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹
@@ -22,13 +23,16 @@ GOTO URL
GOTO_LINE ²èÌ̲¼¤Ç¹ÔÈÖ¹æ¤òÆþÎϤ·¡¤¤½¤³¤Ç»ØÄꤷ¤¿¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹
GOTO_LINK ¥ê¥ó¥¯¤¬»Ø¤¹Àè¤Îʸ½ñ¤òÆɤߤ³¤ß¤Þ¤¹
HELP ¥Ø¥ë¥×¥Õ¥¡¥¤¥ë¤òɽ¼¨¤·¤Þ¤¹
-HISTPRY URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹
+HISTORY URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹
INFO ¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹
+INIT_MAILCAP mailcap ¤òºÆÆɤ߹þ¤ß¤·¤Þ¤¹(¼ç¤Ë local-CGI ÍÑ)
INTERRUPT ʸ½ñ¤ÎÆɤ߹þ¤ß¤òÃæÃǤ·¤Þ¤¹
LEFT ²èÌÌÁ´ÂΤò1ʸ»úº¸¤Ë¤º¤é¤·¤Þ¤¹
LINE_BEGIN ¹ÔƬ¤Ë°ÜÆ°¤·¤Þ¤¹
LINE_END ¹ÔËö¤Ë°ÜÆ°¤·¤Þ¤¹
-LINE_INFO ¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹
+LINE_INFO ¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨¤·¤Þ¤¹
+LINK_BEGIN ºÇ½é¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
+LINK_END ºÇ¸å¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
LOAD ¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Æ³«¤¤Þ¤¹
MAIN_MENU ¥á¥Ë¥å¡¼¤òΩ¤Á¾å¤²¤Þ¤¹
MARK ¥Þ¡¼¥¯¤òÀßÄê¡¿²ò½ü¤·¤Þ¤¹
@@ -36,20 +40,32 @@ MARK_MID Message-ID
MARK_URL URLÉ÷¤Îʸ»úÎó¤ò¥ê¥ó¥¯¤Ë¤·¤Þ¤¹
MENU ¥á¥Ë¥å¡¼¤òΩ¤Á¾å¤²¤Þ¤¹
MOUSE_TOGGLE ¥Þ¥¦¥¹¤Î͸ú/̵¸ú¤ò¥È¥°¥ë¤¹¤ë
-MOVE_DOWN ¥«¡¼¥½¥ë¤ò²¼¤Ë°ÜÆ°¤·¤Þ¤¹
-MOVE_LEFT ¥«¡¼¥½¥ë¤òº¸¤Ë°ÜÆ°¤·¤Þ¤¹
-MOVE_RIGHT ¥«¡¼¥½¥ë¤ò±¦¤Ë°ÜÆ°¤·¤Þ¤¹
-MOVE_UP ¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹
+MOVE_DOWN ¥«¡¼¥½¥ë¤ò²¼¤Ë°ÜÆ°¤·¤Þ¤¹(²þ¥Ú¡¼¥¸»þ¤Ë¤ÏȾ¥Ú¡¼¥¸¥¹¥¯¥í¡¼¥ë)
+MOVE_DOWN1 ¥«¡¼¥½¥ë¤ò²¼¤Ë°ÜÆ°¤·¤Þ¤¹(²þ¥Ú¡¼¥¸»þ¤Ë¤Ï£±¹Ô¥¹¥¯¥í¡¼¥ë)
+MOVE_LEFT ¥«¡¼¥½¥ë¤òº¸¤Ë°ÜÆ°¤·¤Þ¤¹(º¸Ã¼¤Î¾ì¹ç¤Ë¤ÏȾ²èÌÌʬ¥·¥Õ¥È)
+MOVE_LEFT1 ¥«¡¼¥½¥ë¤òº¸¤Ë°ÜÆ°¤·¤Þ¤¹(º¸Ã¼¤Î¾ì¹ç¤Ë¤Ï£±Ê¸»úʬ¥·¥Õ¥È)
+MOVE_RIGHT ¥«¡¼¥½¥ë¤ò±¦¤Ë°ÜÆ°¤·¤Þ¤¹(±¦Ã¼¤Î¾ì¹ç¤Ë¤ÏȾ²èÌÌʬ¥·¥Õ¥È)
+MOVE_RIGHT1 ¥«¡¼¥½¥ë¤ò±¦¤Ë°ÜÆ°¤·¤Þ¤¹(±¦Ã¼¤Î¾ì¹ç¤Ë¤Ï£±Ê¸»úʬ¥·¥Õ¥È)
+MOVE_UP ¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹(²þ¥Ú¡¼¥¸»þ¤Ë¤ÏȾ¥Ú¡¼¥¸¥¹¥¯¥í¡¼¥ë)
+MOVE_UP1 ¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹(²þ¥Ú¡¼¥¸»þ¤Ë¤Ï£±¹Ô¥¹¥¯¥í¡¼¥ë)
+MSGS ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Î°ìÍ÷¤Îɽ¼¨
+NEXT_DOWN ¥«¡¼¥½¥ë¤Î²¼Â¦¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
+NEXT_LEFT ¥«¡¼¥½¥ë¤Îº¸Â¦¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
+NEXT_LEFT_UP ¥«¡¼¥½¥ë¤Îº¸Â¦(̵¤±¤ì¤ÐÁ°¤Î¹Ô°ÊÁ°)¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
NEXT_LINK ¼¡¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
NEXT_MARK °ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
NEXT_PAGE ¼¡¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹
+NEXT_RIGHT ¥«¡¼¥½¥ë¤Î±¦Â¦¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
+NEXT_RIGHT_DOWN ¥«¡¼¥½¥ë¤Î±¦Â¦(̵¤±¤ì¤Ð¼¡¹Ô°Ê¹ß)¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
+NEXT_UP ¥«¡¼¥½¥ë¤Î¾å¦¤Ë¤¢¤ë¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
NEXT_WORD ¼¡¤Îñ¸ì¤Ë°ÜÆ°¤·¤Þ¤¹
NOTHING ²¿¤â¤·¤Þ¤»¤ó
NULL ²¿¤â¤·¤Þ¤»¤ó
OPTIONS ¥ª¥×¥·¥ç¥óÀßÄê¥Ñ¥Í¥ë¤òɽ¼¨¤·¤Þ¤¹
PEEK ¸½ºß¤Îʸ½ñ¤ÎURL¤òɽ¼¨¤·¤Þ¤¹
-PEEK_LINK ¥ê¥ó¥¯¤¬»Ø¤¹Àè¤ÎURL¤òɽ¼¨¤·¤Þ¤¹
PEEK_IMG ¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤ò´Þ¤à²èÁü¤½¤Î¤â¤Î¤ÎURL¤òɽ¼¨¤·¤Þ¤¹
+PEEK_LINK ¥ê¥ó¥¯¤¬»Ø¤¹Àè¤ÎURL¤òɽ¼¨¤·¤Þ¤¹
+PIPE_BUF ¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤò¥Ñ¥¤¥×¤ËÅϤ·¤Þ¤¹
PIPE_SHELL ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¡¤·ë²Ì¤òÆɤߤ³¤ß¤Ê¤¬¤éɽ¼¨¤·¤Þ¤¹
PREV_LINK Á°¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
PREV_MARK °ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹
@@ -72,12 +88,16 @@ SEARCH_FORE
SEARCH_NEXT ¼¡¤ò¸¡º÷¤·¤Þ¤¹
SEARCH_PREV Á°¤ò¸¡º÷¤·¤Þ¤¹
SELECT ¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹
+SELECT_MENU ¥Ð¥Ã¥Õ¥¡ÁªÂò¥á¥Ë¥å¡¼¤òΩ¤Á¾å¤²¤Þ¤¹
+SETENV ´Ä¶ÊÑ¿ô¤òÀßÄꤷ¤Þ¤¹
+SET_OPTION ¥ª¥×¥·¥ç¥ó¤òÀßÄꤷ¤Þ¤¹
SHELL ¥·¥§¥ë¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Þ¤¹
SHIFT_LEFT ²èÌÌÁ´ÂΤòº¸¤Ë¤º¤é¤·¤Þ¤¹
SHIFT_RIGHT ²èÌÌÁ´ÂΤò±¦¤Ë¤º¤é¤·¤Þ¤¹
SOURCE HTML¤Î¥½¡¼¥¹¤òɽ¼¨¤·¤Þ¤¹
SUSPEND ¥µ¥¹¥Ú¥ó¥É
UP ²èÌ̤ò1¹Ô¾å¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹
+VERSION w3m ¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤·¤Þ¤¹
VIEW HTML¤Î¥½¡¼¥¹¤òɽ¼¨¤·¤Þ¤¹
VIEW_BOOKMARK ¥Ö¥Ã¥¯¥Þ¡¼¥¯¤òÆɤ߹þ¤ß¤Þ¤¹
VIEW_IMAGE ¥ê¥ó¥¯¤ËÂбþ¤¹¤ë²èÁü¤òɽ¼¨¤·¤Þ¤¹
diff --git a/doc-jp/README.mailcap b/doc-jp/README.mailcap
@@ -28,11 +28,13 @@ mailcap
LESSOPEN ¥³¥Þ¥ó¥É¤Ç¤Ç¤¤ë»ö¤Ï, ÂçÉôʬ¤³¤ì¤ÇÃÖ¤´¹¤¨¤ë»ö¤¬¤Ç¤¤Þ¤¹. ¤½¤Î¤¿¤á
LESSOPEN ¤ÎÍøÍѤϥª¥×¥·¥ç¥ó°·¤¤¤Ë¤Ê¤ê¤Þ¤·¤¿.
- w3m ¤Î³ÈÄ¥¥Õ¥£¡¼¥ë¥É¤È¤·¤Æ, htmloutput ¤¬¤¢¤ê¤Þ¤¹. copiousoutput ¤ÈƱÍͤ˥³
- ¥Þ¥ó¥É¤Î¼Â¹Ô·ë²Ì¤¬¥Ð¥Ã¥Õ¥¡¤ËÆɤ߹þ¤Þ¤ì¤Þ¤¹¤¬, HTML ¤È¤·¤Æ¥ì¥ó¥À¥ê¥ó¥°¤¹¤ë½ê
- ¤¬°Û¤Ê¤ê¤Þ¤¹. ¤³¤Îµ¡Ç½¤ò»È¤¦¾ì¹ç¤Ï, w3m ÍѤΠmailcap ¥Õ¥¡¥¤¥ë¤òÊ̤ËÍÑ°Õ¤¹¤ë
- ¤«, ¾¤Î¥Ö¥é¥¦¥¶ÍÑ¤Ë htmloutput ¤ò´Þ¤Þ¤Ê¤¤¥¨¥ó¥È¥ê¤òÁ°¤ËÃÖ¤¤¤Æ¤ª¤¯¤ÈÎɤ¤¤«
- ¤â¤·¤ì¤Þ¤»¤ó.
+ w3m ¤Î³ÈÄ¥¥Õ¥£¡¼¥ë¥É¤È¤·¤Æ, x-htmloutput ¤¬¤¢¤ê¤Þ¤¹. copiousoutput ¤ÈƱÍͤË
+ ¥³¥Þ¥ó¥É¤Î¼Â¹Ô·ë²Ì¤¬¥Ð¥Ã¥Õ¥¡¤ËÆɤ߹þ¤Þ¤ì¤Þ¤¹¤¬, HTML ¤È¤·¤Æ¥ì¥ó¥À¥ê¥ó¥°¤¹¤ë
+ ½ê¤¬°Û¤Ê¤ê¤Þ¤¹. ¤³¤Îµ¡Ç½¤ò»È¤¦¾ì¹ç¤Ï, w3m ÍѤΠmailcap ¥Õ¥¡¥¤¥ë¤òÊ̤ËÍÑ°Õ¤¹
+ ¤ë¤«, ¾¤Î¥Ö¥é¥¦¥¶ÍÑ¤Ë x-htmloutput ¤ò´Þ¤Þ¤Ê¤¤¥¨¥ó¥È¥ê¤òÁ°¤ËÃÖ¤¤¤Æ¤ª¤¯¤ÈÎÉ
+ ¤¤¤«¤â¤·¤ì¤Þ¤»¤ó.
+ (2001/08/01) ºäËÜ
+ htmloutput ¢ª x-htmloutput
¡¦ nametemplate= ¤Ï³°Éô¥³¥Þ¥ó¥É¤ËÅϤ¹¥Õ¥¡¥¤¥ë̾¤Î³ÈÄ¥»Ò¤ò»ØÄꤷ¤Þ¤¹.
¥Æ¥ó¥Ý¥é¥ê¥Õ¥¡¥¤¥ë¤òºî¤ë¤È¤, Ä̾︵¤Î URL ¤Î³ÈÄ¥»Ò¤¬¥Õ¥¡¥¤¥ë̾¤ËÉÕ¤±¤é¤ì¤Þ
diff --git a/doc-jp/keymap.default b/doc-jp/keymap.default
@@ -26,7 +26,9 @@ keymap C-n MOVE_DOWN
keymap C-p MOVE_UP
keymap C-r SEARCH_BACK
keymap C-s SEARCH
+keymap C-u PREV_LINK
keymap C-v NEXT_PAGE
+keymap C-w WRAP_TOGGLE
keymap C-z SUSPEND
keymap SPC NEXT_PAGE
@@ -52,6 +54,7 @@ keymap I VIEW_IMAGE
keymap J UP
keymap K DOWN
keymap M EXTERN
+keymap N SEARCH_PREV
keymap Q EXIT
keymap R RELOAD
keymap S SAVE_SCREEN
@@ -59,6 +62,8 @@ keymap U GOTO
keymap V LOAD
keymap W PREV_WORD
keymap Z CENTER_H
+keymap [ LINK_BEGIN
+keymap ] LINK_END
keymap \^ LINE_BEGIN
keymap a SAVE_LINK
keymap b PREV_PAGE
@@ -72,7 +77,7 @@ keymap l MOVE_RIGHT
keymap n SEARCH_NEXT
keymap o OPTIONS
keymap q QUIT
-keymap s SELECT
+keymap s SELECT_MENU
keymap u PEEK_LINK
keymap v VIEW
keymap w NEXT_WORD
diff --git a/doc-jp/keymap.lynx b/doc-jp/keymap.lynx
@@ -12,9 +12,10 @@
keymap C-@ MARK
keymap C-a BEGIN
-keymap C-b PREV_PAGE
+keymap C-b BACK
keymap C-e END
-keymap C-f NEXT_PAGE
+keymap C-f GOTO_LINK
+keymap C-g LINE_INFO
keymap C-h HISTORY
keymap TAB NEXT_LINK
keymap C-j GOTO_LINK
@@ -51,6 +52,7 @@ keymap H HELP
keymap I VIEW_IMAGE
keymap J UP
keymap K DOWN
+keymap M EXTERN
keymap N NEXT_MARK
keymap P PREV_MARK
keymap Q EXIT
@@ -64,7 +66,7 @@ keymap \^ LINE_BEGIN
keymap a ADD_BOOKMARK
keymap b PREV_PAGE
keymap c PEEK
-keymap d SAVE
+keymap d SAVE_LINK
keymap g GOTO
keymap h MOVE_LEFT
keymap i PEEK_IMG
@@ -75,9 +77,10 @@ keymap n SEARCH_NEXT
keymap o OPTIONS
keymap p SAVE_SCREEN
keymap q QUIT
-keymap s SELECT
+keymap s SELECT_MENU
keymap u PEEK_LINK
keymap v BOOKMARK
+keymap w WRAP_TOGGLE
keymap z CENTER_V
keymap M-TAB PREV_LINK
@@ -86,6 +89,7 @@ keymap M-C-m SAVE_LINK
keymap M-: MARK_MID
keymap M-I SAVE_IMAGE
+keymap M-M EXTERN_LINK
keymap M-a ADD_BOOKMARK
keymap M-b BOOKMARK
keymap M-e EDIT_SCREEN
diff --git a/doc-jp/w3m.1 b/doc-jp/w3m.1
@@ -48,6 +48,9 @@ EUC
.B \-j
JIS (ISO-2022-JP)¥³¡¼¥É¤Çɽ¼¨¤¹¤ë¡¥
.TP
+.BI \-I\ e|s
+ÆþÎÏʸ½ñ¤Îʸ»ú¥³¡¼¥É¤ò»ØÄꤹ¤ë¡¥
+.TP
.BI \-T\ ¥¿¥¤¥×
ɽ¼¨¤¹¤ëʸ½ñ¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡¥¤³¤Î»ØÄ꤬¤Ê¤¤¾ì¹ç¡¤¥Õ¥¡¥¤¥ë̾¤Î³ÈÄ¥»Ò¤Ë¤è¤Ã¤Æ
¼«Æ°È½Ê̤µ¤ì¤ë¡¥È½Ê̤Ǥ¤Ê¤¤¾ì¹ç¤Ïtext/plain¤È¤ß¤Ê¤µ¤ì¤ë¡¥
@@ -100,6 +103,9 @@ Bookmark
.B \-no\-proxy
¥×¥í¥¥·¤òÍøÍѤ·¤Ê¤¤¡¥
.TP
+.BI \-pauth\ user:pass
+¥×¥í¥¥·Ç§¾ÚÍѤΥ桼¥¶Ì¾¤È¥Ñ¥¹¥ï¡¼¥É¤ò»ØÄꤹ¤ë¡¥
+.TP
.B \-no\-mouse
¥Þ¥¦¥¹¤òÍøÍѤ·¤Ê¤¤¡¥
.TP
@@ -130,6 +136,21 @@ URL
.TP
.B \-dump_head
URL¤Ë¥¢¥¯¥»¥¹¤·¡¤¥Ø¥Ã¥À¾ðÊó¤ò½ÐÎϤ¹¤ë¡¥
+.TP
+.B \-dump_both
+URL¤Ë¥¢¥¯¥»¥¹¤·¡¤¥Ø¥Ã¥À¾ðÊó¤ÈHTML¥½¡¼¥¹¤ò½ÐÎϤ¹¤ë¡¥
+.TP
+.B \-dump_extra
+URL¤Ë¥¢¥¯¥»¥¹¤·¡¤³ÈÄ¥¾ðÊó¤È¥Ø¥Ã¥À¾ðÊó¤ÈHTML¥½¡¼¥¹¤ò½ÐÎϤ¹¤ë¡¥
+.TP
+.BI \-post\ file
+¥Õ¥¡¥¤¥ë¤ÎÆâÍƤòPOST¤¹¤ë¡¥
+.TP
+.BI \-header\ string
+HTTPÍ×µá¥Ø¥Ã¥À¤òÄɲ乤롥
+.TP
+.BI \-config\ file
+config¤Î¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ë¡¥
.SS ʸ½ñ¤Îɽ¼¨ÆâÍÆ
HTMLʸ½ñ¤òɽ¼¨¤·¤Æ¤¤¤ë¤È¤¤Ë¤Ï¡¤¼¡¤Î¤è¤¦¤Êɽ¼¨¤Ë¤Ê¤ê¤Þ¤¹¡¥
.in +8n
@@ -195,6 +216,12 @@ FORM
.B K
²èÌ̤ò1¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
.TP
+.B ^
+¹ÔƬ¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
+.B $
+¹ÔËö¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
.B w
¼¡¤Îñ¸ì¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
@@ -213,10 +240,10 @@ FORM
.B ", "
²èÌÌÁ´ÂΤò1ʸ»úº¸¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤò±¦¤Ë¤º¤é¤¹)
.TP
-.B g
+.B g, M-<
ʸ½ñ¤Î¤¤¤Á¤Ð¤ó¾å¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
-.B G
+.B G, M->
ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
.B "ESC g"
@@ -225,11 +252,23 @@ FORM
.$
¤òÆþÎϤ¹¤ë¤È¡¤ºÇ½ª¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
+.B Z
+¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
+.B z
+¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
.B TAB
¼¡¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
.B C-u, "ESC TAB"
Á°¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
+.B [
+ºÇ½é¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+.TP
+.B ]
+ºÇ¸å¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.SS ¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯Áàºî
.TP
.B RET
@@ -241,6 +280,9 @@ FORM
.B u
¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
.TP
+.B i
+¥ê¥ó¥¯¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿²èÁü¤Ø¤ÎURL¤Îɽ¼¨¤·¤Þ¤¹¡¥
+.TP
.B I
¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤ËÂбþ¤¹¤ë²èÁü¤òɽ¼¨¤·¤Þ¤¹¡¥
.TP
@@ -261,6 +303,12 @@ Message-ID
.B =
¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡¥
.TP
+.B C-g
+¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨¤·¤Þ¤¹¡¥
+.TP
+.B C-h
+URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹¡¥
+.TP
.B F
<FRAMESET>¤ò´Þ¤àʸ½ñ¤òɽ¼¨¤·¤Æ¤¤¤ë¤È¤¤Ë¡¤<FRAME>¥¿¥°¤Î»Ø¤¹Ê£¿ô¤Îʸ½ñ¤ò1¤Ä¤Î
ʸ½ñ¤ËÊÑ´¹¤·¤Æɽ¼¨¤·¤Þ¤¹¡¥
@@ -303,6 +351,9 @@ HTML
¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤¬¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤ò¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤Þ
¤¹¡¥¥¨¥Ç¥£¥¿¤ò½ªÎ»¤·¤¿¸å¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
.TP
+.B C-l
+²èÌ̤òºÆÉÁ²è¤·¤Þ¤¹¡¥
+.TP
.B R
¥Ð¥Ã¥Õ¥¡¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
.TP
@@ -355,15 +406,21 @@ HTML
.TP
.B n
¼¡¤ò¸¡º÷¤·¤Þ¤¹¡¥
+.TP
+.B N
+Á°¤ò¸¡º÷¤·¤Þ¤¹¡¥
+.TP
+.B C-w
+ÀÞ¤êÊÖ¤·¸¡º÷¥â¡¼¥É¤òÀڤ괹¤¨¤Þ¤¹¡¥
.SS ¥Þ¡¼¥¯Áàºî
.TP
.B C-SPC
¥Þ¡¼¥¯¤òÀßÄê¡¿²ò½ü¤·¤Þ¤¹¡¥¥Þ¡¼¥¯¤Ïȿžɽ¼¨¤µ¤ì¤Þ¤¹¡¥
.TP
-.B P
+.B "ESC p"
°ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
-.B N
+.B "ESC n"
°ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
.TP
.B "\""
@@ -379,6 +436,9 @@ HTML
.B o
¥ª¥×¥·¥ç¥óÀßÄê¥Ñ¥Í¥ë¤òɽ¼¨¤·¤Þ¤¹¡¥
.TP
+.B C-k
+¥¯¥Ã¥¡¼°ìÍ÷¤òɽ¼¨¤·¤Þ¤¹¡¥
+.TP
.B C-c
ʸ½ñ¤ÎÆɤ߹þ¤ß¤òÃæÃǤ·¤Þ¤¹¡¥
.TP
diff --git a/doc/FAQ.html b/doc/FAQ.html
@@ -256,7 +256,7 @@ with Ctrl-u. What to do?</h3>
<i>Up to <a href="#index">index</a></i>
</div>
<br>
-<u><h2><a name="other">Miscellanous</a></h2></u>
+<u><h2><a name="other">Miscellaneous</a></h2></u>
<br>
<dl>
<dt><h3>What is w3m's configuration file?</h3>
diff --git a/doc/MANUAL.html b/doc/MANUAL.html
@@ -52,8 +52,6 @@ Options are as follows:
<dd>When displaying text/plain document, prohibit emphasis using backspace.
If you don't specify this option,
``A^H_'' is interpreted as underlined character and ``A^HA'' as a bold character.
-<dt>-S
-<dd>When displaying text/plain document, squeeze blank lines.
<dt>-l number
<dd>Specify line number preserved internally when reading text/plain document
fron standard input. Default is 10000.
@@ -80,8 +78,10 @@ Display HTML source
</pre>
<dt>-m
<dd>Display document with Internet message mode.
-With this option, w3m determines document type from header infomation.
+With this option, w3m determines document type from header information.
It is useful when reading E-mail or NetNews messages.
+<dt>-v
+<dd>visual startup mode.
<dt>-B
<dd>Show the bookmark.
<dt>-bookmark file
@@ -91,7 +91,7 @@ It is useful when reading E-mail or NetNews messages.
<dt>-F
<dd>Automatically render frame.
<dt>-S
-<dd>Sqeeze blank lines.
+<dd>Squeeze blank lines.
<dt>-X
<dd>Upon exit, do not display preserved screen.
<dt>-W
@@ -120,12 +120,22 @@ with -cols option.
<dd>Read document specified by URL and dump the source.
<dt>-dump_head
<dd>Read document specified by URL and dump headers.
+<dt>-dump_both
+<dd>Read document specified by URL and dump headers and the source.
+<dt>-dump_extra
+<dd>Read document specified by URL and dump extra informations, headers and the source.
+<dt>-post file
+<dd>use POST method with file content.
+<dt>-header string
+<dd>insert string as a header.
<dt>-no-proxy
<dd>Don't use proxy server.
<dt>-no-graph
<dd>Don't use graphic character to draw frames.
<dt>-no-mouse
<dd>Don't activate mouse.
+<dt>-config file
+<dd>specify config file.
</dl>
<hr>
@@ -163,17 +173,21 @@ bindings, see <a href="#Key:lynx">the Lynx-like key binding</a>.
<TR><TD>k,C-p<TD>Cursor up
<TR><TD>J<TD>Roll up one line
<TR><TD>K<TD>Roll down one line
+<TR><TD>^,C-a<TD>Go to the beginning of line
+<TR><TD>$,C-e<TD>Go to the end of line
<TR><TD>w<TD>Go to next word
<TR><TD>W<TD>Go to previous word
<TR><TD>><TD>Shift screen right
<TR><TD><<TD>Shift screen left
<TR><TD>.<TD>Shift screen one column right
<TR><TD>,<TD>Shift screen one column left
-<TR><TD>g<TD>Go to the first line
-<TR><TD>G<TD>Go to the last line
+<TR><TD>g,M-<<TD>Go to the first line
+<TR><TD>G,M-><TD>Go to the last line
<TR><TD>ESC g<TD>Go to specified line
+<TR><TD>Z<TD>Move to the center line
+<TR><TD>z<TD>Move to the center column
<TR><TD>TAB<TD>Move to next hyperlink
-<TR><TD>ESC TAB<TD>Move to previous hyperlink
+<TR><TD>C-u,ESC TAB<TD>Move to previous hyperlink
<TR><TD>[<TD>Move to the first hyperlink
<TR><TD>]<TD>Move to the last hyperlink
</table>
@@ -183,12 +197,15 @@ bindings, see <a href="#Key:lynx">the Lynx-like key binding</a>.
<TR><TD WIDTH=100>RET<TD>Follow hyperlink
<TR><TD>a, ESC RET<TD>Save link to file
<TR><TD>u<TD>Peek link URL
+<TR><TD>i<TD>Peek image URL
<TR><TD>I<TD>View inline image
<TR><TD>ESC I<TD>Save inline image to file
<TR><TD>:<TD>Mark URL-like strings as anchors
<TR><TD>ESC :<TD>Mark Message-ID-like strings as news anchors
<TR><TD>c<TD>Peek current URL
-<TR><TD>=<TD>Display infomation about current document
+<TR><TD>=<TD>Display information about current document
+<TR><TD>C-g<TD>Show current line number
+<TR><TD>C-h<TD>View history of URL
<TR><TD>F<TD>Render frame
<TR><TD>M<TD>Browse current document using external browser
(use 2M and 3M to invoke second and third browser)
@@ -210,6 +227,7 @@ bindings, see <a href="#Key:lynx">the Lynx-like key binding</a>.
<TR><TD>v<TD>View HTML source
<TR><TD>s<TD>Select buffer
<TR><TD>E<TD>Edit buffer source
+<TR><TD>C-l<TD>Redraw screen
<TR><TD>R<TD>Reload buffer
<TR><TD>S<TD>Save buffer
<TR><TD>ESC s<TD>Save source
@@ -236,6 +254,7 @@ bindings, see <a href="#Key:lynx">the Lynx-like key binding</a>.
<TR><TD>?,C-r<TD>Search backward
<TR><TD>n<TD>Search next
<TR><TD>N<TD>Search previous
+<TR><TD>C-w<TD>Toggle wrap search mode
</table>
<H3>Mark operation</H3>
@@ -251,6 +270,7 @@ bindings, see <a href="#Key:lynx">the Lynx-like key binding</a>.
<TR><TD WIDTH=100>!<TD>Execute shell command
<TR><TD>H<TD>Help (load this file)
<TR><TD>o<TD>Set option
+<TR><TD>C-k<TD>Show cookie jar
<TR><TD>C-c<TD>Stop
<TR><TD>C-z<TD>Suspend
<TR><TD>q<TD>Quit (with confirmation, if you like)
@@ -282,21 +302,26 @@ you can use the following key binding.
<H3>Page/Cursor motion</H3>
<table>
-<TR><TD WIDTH=100>SPC,C-v<TD>Forward page
-<TR><TD>b,ESC v<TD>Previous page
+<TR><TD WIDTH=100>SPC,C-v,+<TD>Forward page
+<TR><TD>b,ESC v,-<TD>Previous page
<TR><TD>l<TD>Cursor right
<TR><TD>h<TD>Cursor left
<TR><TD>j<TD>Cursor down
<TR><TD>k<TD>Cursor up
<TR><TD>J<TD>Roll up one line
<TR><TD>K<TD>Roll down one line
+<TR><TD>^<TD>Go to the beginning of line
+<TR><TD>$<TD>Go to the end of line
<TR><TD>><TD>Shift screen right
<TR><TD><<TD>Shift screen left
-<TR><TD>.<TD>Shift screen one column right
-<TR><TD>,<TD>Shift screen one column left
+<TR><TD>C-a<TD>Go to the first line
+<TR><TD>C-e<TD>Go to the last line
<TR><TD>G<TD>Go to the specified line
+<TR><TD>Z<TD>Move to the center line
+<TR><TD>z<TD>Move to the center column
<TR><TD>TAB,C-n,Down arrow<TD>Move to next hyperlink
<TR><TD>ESC TAB,C-p,Up arrow<TD>Move to previous link
+<TR><TD>C-g<TD>Show current page position
</table>
@@ -305,12 +330,14 @@ you can use the following key binding.
<TR><TD WIDTH=100>RET, C-f, Right arrow<TD>Follow hyperlink
<TR><TD>d, ESC RET<TD>Save link to file
<TR><TD>u<TD>Peek link URL
+<TR><TD>i<TD>Peek image URL
<TR><TD>I<TD>View inline image
<TR><TD>ESC I<TD>Save inline image to file
<TR><TD>:<TD>Mark URL-like strings as anchors
<TR><TD>ESC :<TD>Mark Message-ID-like strings as news anchors
<TR><TD>c<TD>Peek current URL
-<TR><TD>=<TD>Display infomation about current document
+<TR><TD>=<TD>Display information about current document
+<TR><TD>C-h<TD>View history of URL
<TR><TD>F<TD>Render frame
<TR><TD>M<TD>Browse current document using external browser
(use 2M and 3M to invoke second and third browser)
@@ -332,6 +359,7 @@ you can use the following key binding.
<TR><TD>\<TD>View HTML source
<TR><TD>s, C-h<TD>Select buffer
<TR><TD>E<TD>Edit buffer source
+<TR><TD>C-l, C-w<TD>Redraw screen
<TR><TD>R, C-r<TD>Reload buffer
<TR><TD>S, p<TD>Save buffer
<TR><TD>ESC s<TD>Save source
@@ -354,24 +382,25 @@ you can use the following key binding.
<H2>Search</H2>
<table>
-<TR><TD WIDTH=100>/<TD>Search forward
-<TR><TD>?<TD>Search backward
+<TR><TD WIDTH=100>/, C-s<TD>Search forward
<TR><TD>n<TD>Search next
+<TR><TD>w<TD>Toggle wrap search mode
</table>
<H2>Mark operation</H2>
<table>
<TR><TD WIDTH=100>C-SPC<TD>Set/unset mark
-<TR><TD>ESC p<TD>Go to previous mark
-<TR><TD>ESC n<TD>Go to next mark
+<TR><TD>P<TD>Go to previous mark
+<TR><TD>N<TD>Go to next mark
<TR><TD>"<TD>Mark by regular expression
</table>
<H2>Miscellany</H2>
<table>
<TR><TD WIDTH=100>!<TD>Execute shell command
-<TR><TD>H<TD>Help (load this file)
+<TR><TD>H, ?<TD>Help (load this file)
<TR><TD>o<TD>Set option
+<TR><TD>C-k<TD>Show cookie jar
<TR><TD>C-c<TD>Stop
<TR><TD>C-z<TD>Suspend
<TR><TD>q<TD>Quit (with confirmation, if you like)
diff --git a/doc/README b/doc/README
@@ -18,7 +18,7 @@ used as a text-mode WWW browser.
Current problems are:
-* Resize behaviour is imcomplete.
+* Resize behaviour is incomplete.
* It can't show images inline. (It seems to be impossible as far as using
xterm)
* It doesn't decode MIME-body of the document.
diff --git a/doc/README.func b/doc/README.func
@@ -6,10 +6,11 @@ BOOKMARK Read bookmark
CENTER_H Move to the center line
CENTER_V Move to the center column
COOKIE View cookie list
-DELETE_PREVBUF Delete previous buffer
+DELETE_PREVBUF Delete previous buffer (mainly for local-CGI)
DICT_WORD Execute dictionary command (see README.dict)
+DICT_WORD_AT Execute dictionary command for word at cursor
DOWN Scroll down one line
-DOWN_LOAD Save HTML source
+DOWNLOAD Save HTML source
EDIT Edit current document
EDIT_SCREEN Edit currently rendered document
END Go to the last line
@@ -25,31 +26,46 @@ HELP View help
HISTORY View history of URL
INFO View info of current document
INTERRUPT Stop loading document
-INIT_MAILCAP Reread mailcap
+INIT_MAILCAP Reread mailcap (mainly for local-CGI)
LEFT Shift screen one column
LINE_BEGIN Go to the beginning of line
LINE_END Go to the end of line
LINE_INFO Show current line number
+LINK_BEGIN Go to the first link
+LINK_END Go to the last link
LOAD Load local file
MAIN_MENU Popup menu
MARK Set/unset mark
MARK_MID Mark Message-ID-like strings as anchors
MARK_URL Mark URL-like strings as anchors
MENU Popup menu
-MOVE_DOWN Move cursor down
-MOVE_LEFT Move cursor left
-MOVE_RIGHT Move cursor right
-MOVE_UP Move cursor up
+MOUSE_TOGGLE Toggle activity of mouse
+MOVE_DOWN Move cursor down (a half screen scroll at the end of screen)
+MOVE_DOWN1 Move cursor down (1 line scroll at the end of screen)
+MOVE_LEFT Move cursor left (a half screen shift at the left edge)
+MOVE_LEFT1 Move cursor left (1 columns shift at the left edge)
+MOVE_RIGHT Move cursor right (a half screen shift at the right edge)
+MOVE_RIGHT1 Move cursor right (1 columns shift at the right edge)
+MOVE_UP Move cursor up (a half screen scroll at the top of screen)
+MOVE_UP1 Move cursor up (1 line scrol at the top of screen)
+MSGS Display error messages
+NEXT_DOWN Move to next downward link
+NEXT_LEFT Move to next left link
+NEXT_LEFT_UP Move to next left (or upward) link
NEXT_LINK Move to next link
NEXT_MARK Move to next word
NEXT_PAGE Move to next page
+NEXT_RIGHT Move to next right link
+NEXT_RIGHT_DOWN Move to next right (or downward) link
+NEXT_UP Move to next upward link
NEXT_WORD Move to next word
NOTHING Do nothing
NULL Do nothing
OPTIONS Option setting panel
PEEK Peek current URL
-PEEK_LINK Peek link URL
PEEK_IMG Peek image URL
+PEEK_LINK Peek link URL
+PIPE_BUF Send rendered document to pipe
PIPE_SHELL Execute shell command and browse
PREV_LINK Move to previous link
PREV_MARK Move to previous mark
@@ -72,14 +88,18 @@ SEARCH_FORE Search forward
SEARCH_NEXT Search next regexp
SEARCH_PREV Search previous regexp
SELECT Go to buffer selection panel
+SELECT_MENU Popup buffer selection menu
+SETENV Set environment variable
+SET_OPTION Set option
SHELL Execute shell command
SHIFT_LEFT Shift screen left
SHIFT_RIGHT Shift screen right
SOURCE View HTML source
SUSPEND Stop loading document
UP Scroll up one line
+VERSION Display version of w3m
VIEW View HTML source
VIEW_BOOKMARK View bookmark
VIEW_IMAGE View image
WHEREIS Search forward
-WRAP_TOGGLE Toggle wrap search mode
+WRAP_TOGGLE Toggle wrap search mode
diff --git a/doc/STORY.html b/doc/STORY.html
@@ -101,7 +101,7 @@ read the research log. Then I decided to implement a table renderer
into w3m.
<P>
I didn't intend to write a perfect table renderer because tables
-I used was not very complicated. However, imcomplete table rendering
+I used was not very complicated. However, incomplete table rendering
made the display of table-layout pages horrible. I realized that
it required almost-perfect table renderer
to do well both in `rendering (real) table' and `fine display of
diff --git a/doc/keymap.default b/doc/keymap.default
@@ -26,7 +26,9 @@ keymap C-n MOVE_DOWN
keymap C-p MOVE_UP
keymap C-r SEARCH_BACK
keymap C-s SEARCH
+keymap C-u PREV_LINK
keymap C-v NEXT_PAGE
+keymap C-w WRAP_TOGGLE
keymap C-z SUSPEND
keymap SPC NEXT_PAGE
@@ -52,6 +54,7 @@ keymap I VIEW_IMAGE
keymap J UP
keymap K DOWN
keymap M EXTERN
+keymap N SEARCH_PREV
keymap Q EXIT
keymap R RELOAD
keymap S SAVE_SCREEN
@@ -59,6 +62,8 @@ keymap U GOTO
keymap V LOAD
keymap W PREV_WORD
keymap Z CENTER_H
+keymap [ LINK_BEGIN
+keymap ] LINK_END
keymap \^ LINE_BEGIN
keymap a SAVE_LINK
keymap b PREV_PAGE
@@ -72,7 +77,7 @@ keymap l MOVE_RIGHT
keymap n SEARCH_NEXT
keymap o OPTIONS
keymap q QUIT
-keymap s SELECT
+keymap s SELECT_MENU
keymap u PEEK_LINK
keymap v VIEW
keymap w NEXT_WORD
diff --git a/doc/keymap.lynx b/doc/keymap.lynx
@@ -12,9 +12,10 @@
keymap C-@ MARK
keymap C-a BEGIN
-keymap C-b PREV_PAGE
+keymap C-b BACK
keymap C-e END
-keymap C-f NEXT_PAGE
+keymap C-f GOTO_LINK
+keymap C-g LINE_INFO
keymap C-h HISTORY
keymap TAB NEXT_LINK
keymap C-j GOTO_LINK
@@ -51,6 +52,7 @@ keymap H HELP
keymap I VIEW_IMAGE
keymap J UP
keymap K DOWN
+keymap M EXTERN
keymap N NEXT_MARK
keymap P PREV_MARK
keymap Q EXIT
@@ -64,7 +66,7 @@ keymap \^ LINE_BEGIN
keymap a ADD_BOOKMARK
keymap b PREV_PAGE
keymap c PEEK
-keymap d SAVE
+keymap d SAVE_LINK
keymap g GOTO
keymap h MOVE_LEFT
keymap i PEEK_IMG
@@ -75,9 +77,10 @@ keymap n SEARCH_NEXT
keymap o OPTIONS
keymap p SAVE_SCREEN
keymap q QUIT
-keymap s SELECT
+keymap s SELECT_MENU
keymap u PEEK_LINK
keymap v BOOKMARK
+keymap w WRAP_TOGGLE
keymap z CENTER_V
keymap M-TAB PREV_LINK
@@ -86,6 +89,7 @@ keymap M-C-m SAVE_LINK
keymap M-: MARK_MID
keymap M-I SAVE_IMAGE
+keymap M-M EXTERN_LINK
keymap M-a ADD_BOOKMARK
keymap M-b BOOKMARK
keymap M-e EDIT_SCREEN
diff --git a/doc/w3m.1 b/doc/w3m.1
@@ -65,12 +65,18 @@ EUC-JP
.B -B
load bookmark
.TP
+.B -bookmark file
+specify bookmark file
+.TP
.B -T type
specify content-type
.TP
.B -m
internet message mode
.TP
+.B -v
+visual startup mode
+.TP
.B -M
monochrome display
.TP
@@ -90,9 +96,51 @@ Larger values will make tables narrower.
.B -dump_source
dump page source into stdout
.TP
+.B -dump_head
+dump response of HEAD request into stdout
+.TP
+.B -dump_both
+dump HEAD and source into stdout
+.TP
+.B -dump_extra
+dump HEAD, source, and extra information into stdout
+.TP
+.B -post file
+use POST method with file content
+.TP
+.B -header string
+insert string as a header
+.TP
.B +<num>
goto <num> line
.TP
+.B -num
+show line number
+.TP
+.B -no-proxy
+don't use proxy
+.TP
+.B -no-mouse
+don't use mouse
+.TP
+.B -pauth user:pass
+proxy authentication
+.TP
+.B -S
+squeeze multiple blank lines
+.TP
+.B -W
+toggle wrap search mode
+.TP
+.B -X
+don't use termcap init/deinit
+.TP
+.B -o opt=value
+assign value to config option
+.TP
+.B -config file
+specify config file
+.TP
.B -debug
DO NOT USE
.SH EXAMPLES
@@ -113,7 +161,7 @@ $ cat foo.html | w3m -dump -T text/html >foo.txt
This is the
.I
w3m
-990604 Release.
+0.2.1 Release.
.PP
Additional information about
.I
diff --git a/entity.c b/entity.c
@@ -0,0 +1,135 @@
+
+#include "fm.h"
+#include <stdio.h>
+#include "indep.h"
+#include "Str.h"
+#include "gc.h"
+
+typedef struct {
+ short ucs;
+ char *ptr;
+} entity_map;
+
+#ifdef JP_CHARSET
+#include "ucs_eucjp.h"
+
+static char *latin1_eucjp_map[ 96 ] =
+{
+ NBSP, "!", "¡ñ", "¡ò", "CUR","¡ï", "|", "¡ø", /* 32- 39 */
+ "¡¯", "(C)","-a", "¢ã", "¢Ì", "-", "(R)","¡±", /* 40- 47 */
+ "¡ë", "¡Þ", "^2", "^3", "'", "¦Ì", "¢ù", "¡¦", /* 48- 55 */
+ ",", "^1", "-o", "¢ä", "1/4","1/2","3/4","?", /* 56- 63 */
+ "A`", "A'", "A^", "A~", "A:", "¢ò", "AE","C,", /* 64- 71 */
+ "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
+ "D-", "N~", "O`", "O'", "O^", "O~", "Oe", "¡ß", /* 80- 87 */
+ "¦Õ", "U`", "U'", "U^", "U:", "Y'", "th", "ss", /* 88- 95 */
+ "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
+ "e`", "e'", "e^", "e:", "i`", "i'", "i^", "i:", /* 104-111 */
+ "d-", "n~", "o`", "o'", "o^", "o~", "oe", "¡à", /* 112-119 */
+ "¦Õ", "u`", "u'", "u^", "u:", "y'", "th", "y:" /* 120-127 */
+};
+
+#else
+#ifdef __EMX__
+/*
+ * Character conversion table
+ * ( to code page 850 from iso-8859-1 )
+ *
+ * Following character constants are in code page 850.
+ */
+static char *latin1_cp850_map[ 96 ] = {
+ NBSP, "\255", "\275", "\234", "\317", "\276", "\335", "\365",
+ "\371", "\270", "\246", "\256", "\252", "\360", "\251", "\356",
+ "\370", "\361", "\375", "\374", "\357", "\346", "\364", "\372",
+ "\367", "\373", "\247", "\257", "\254", "\253", "\363", "\250",
+ "\267", "\265", "\266", "\307", "\216", "\217", "\222", "\200",
+ "\324", "\220", "\322", "\323", "\336", "\326", "\327", "\330",
+ "\321", "\245", "\343", "\340", "\342", "\345", "\231", "\236",
+ "\235", "\353", "\351", "\352", "\232", "\355", "\350", "\341",
+ "\205", "\240", "\203", "\306", "\204", "\206", "\221", "\207",
+ "\212", "\202", "\210", "\211", "\215", "\241", "\214", "\213",
+ "\320", "\244", "\225", "\242", "\223", "\344", "\224", "\366",
+ "\233", "\227", "\243", "\226", "\201", "\354", "\347", "\230"
+};
+#endif
+#endif
+#include "ucs_latin1.h"
+
+static char *latin1_ascii_map[ 96 ] =
+{
+ NBSP, "!", "-c-","-L-","CUR","=Y=","|", "S:", /* 32- 39 */
+ "\"", "(C)","-a", "<<", "NOT","-", "(R)","¡±", /* 40- 47 */
+ "DEG","+-", "^2", "^3", "'", "u", "P:", ".", /* 48- 55 */
+ ",", "^1", "-o", ">>", "1/4","1/2","3/4","?", /* 56- 63 */
+ "A`", "A'", "A^", "A~", "A:", "AA", "AE", "C,", /* 64- 71 */
+ "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
+ "D-", "N~", "O`", "O'", "O^", "O~", "Oe", "x", /* 80- 87 */
+ "O/", "U`", "U'", "U^", "U:", "Y'", "th", "ss", /* 88- 95 */
+ "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
+ "e`", "e'", "e^", "e:", "i`", "i'", "i^", "i:", /* 104-111 */
+ "d-", "n~", "o`", "o'", "o^", "o~", "oe", "-:", /* 112-119 */
+ "o/", "u`", "u'", "u^", "u:", "y'", "th", "y:" /* 120-127 */
+};
+
+char UseAltEntity = FALSE;
+
+static int
+map_cmp(const void *a, const void *b)
+{
+ return *(int *)a - ((entity_map *)b)->ucs;
+}
+
+static char *
+map_search(int c, entity_map *map, size_t n)
+{
+ entity_map *m;
+
+ m = (entity_map *)bsearch((void *)&c, (void *)map, n,
+ sizeof(entity_map), map_cmp);
+ return m ? m->ptr : NULL;
+}
+
+char *
+conv_entity(int c)
+{
+ static char buf[] = {0, 0};
+ char *p;
+
+ if (c < 0) /* error */
+ return "?";
+ if (c < 0x80) { /* US-ASCII */
+ buf[0] = (char)c;
+ return buf;
+ }
+ if (c < 0xa0) /* C1 */
+ return "?";
+ if (c == 0xa0) /* NBSP */
+ return NBSP;
+ if (c < 0x100) { /* Latin 1 (ISO-8859-1) */
+ if (UseAltEntity)
+ return latin1_ascii_map[c - 0xa0];
+#ifdef JP_CHARSET
+ return latin1_eucjp_map[c - 0xa0];
+#else
+#ifdef __EMX__
+ if (CodePage == 850)
+ return latin1_cp850_map[c - 0xa0];
+#endif
+ buf[0] = (char)c;
+ return buf;
+#endif
+ }
+ /* Unicode */
+#ifdef JP_CHARSET
+ if (! UseAltEntity) {
+ p = map_search(c, ucs_eucjp_map,
+ sizeof(ucs_eucjp_map) / sizeof(entity_map));
+ return p ? p : "?";
+ }
+#endif
+ p = map_search(c, ucs_latin1_map,
+ sizeof(ucs_latin1_map) / sizeof(entity_map));
+ if (p && *p & 0x80) /* ISO-8859-1 */
+ return conv_entity((int)(*p & 0xff));
+ return p ? p : "?";
+}
diff --git a/entity.h b/entity.h
@@ -0,0 +1,365 @@
+#include "hash.h"
+static HashItem_si MyHashItem[] = {
+ /* 0 */ {"otimes",0x2297,&MyHashItem[1]},
+ /* 1 */ {"laquo",0xAB,NULL},
+ /* 2 */ {"cap",0x2229,&MyHashItem[3]},
+ /* 3 */ {"dArr",0x21D3,&MyHashItem[4]},
+ /* 4 */ {"euml",0xEB,NULL},
+ /* 5 */ {"sum",0x2211,&MyHashItem[6]},
+ /* 6 */ {"Ocirc",0xD4,NULL},
+ /* 7 */ {"dagger",0x2020,&MyHashItem[8]},
+ /* 8 */ {"Scaron",0x0160,&MyHashItem[9]},
+ /* 9 */ {"Omicron",0x039F,&MyHashItem[10]},
+ /* 10 */ {"brvbar",0xA6,NULL},
+ /* 11 */ {"Eta",0x0397,&MyHashItem[12]},
+ /* 12 */ {"iacute",0xED,&MyHashItem[13]},
+ /* 13 */ {"aelig",0xE6,&MyHashItem[14]},
+ /* 14 */ {"Ugrave",0xD9,&MyHashItem[15]},
+ /* 15 */ {"deg",0xB0,NULL},
+ /* 16 */ {"Yuml",0x0178,&MyHashItem[17]},
+ /* 17 */ {"sup",0x2283,&MyHashItem[18]},
+ /* 18 */ {"middot",0xB7,NULL},
+ /* 19 */ {"ge",0x2265,&MyHashItem[20]},
+ /* 20 */ {"alefsym",0x2135,&MyHashItem[21]},
+ /* 21 */ {"sigma",0x03C3,&MyHashItem[22]},
+ /* 22 */ {"aring",0xE5,&MyHashItem[23]},
+ /* 23 */ {"Icirc",0xCE,NULL},
+ /* 24 */ {"and",0x2227,&MyHashItem[25]},
+ /* 25 */ {"weierp",0x2118,&MyHashItem[26]},
+ /* 26 */ {"frac12",0xBD,NULL},
+ /* 27 */ {"radic",0x221A,&MyHashItem[28]},
+ /* 28 */ {"chi",0x03C7,&MyHashItem[29]},
+ /* 29 */ {"zeta",0x03B6,&MyHashItem[30]},
+ /* 30 */ {"Theta",0x0398,&MyHashItem[31]},
+ /* 31 */ {"Atilde",0xC3,&MyHashItem[32]},
+ /* 32 */ {"para",0xB6,NULL},
+ /* 33 */ {"frac14",0xBC,&MyHashItem[34]},
+ /* 34 */ {"cedil",0xB8,&MyHashItem[35]},
+ /* 35 */ {"quot",0x22,NULL},
+ /* 36 */ {"ang",0x2220,&MyHashItem[37]},
+ /* 37 */ {"ucirc",0xFB,NULL},
+ /* 38 */ {"supe",0x2287,&MyHashItem[39]},
+ /* 39 */ {"iota",0x03B9,&MyHashItem[40]},
+ /* 40 */ {"Ograve",0xD2,NULL},
+ /* 41 */ {"rArr",0x21D2,&MyHashItem[42]},
+ /* 42 */ {"Auml",0xC4,&MyHashItem[43]},
+ /* 43 */ {"frac34",0xBE,&MyHashItem[44]},
+ /* 44 */ {"nbsp",0xA0,NULL},
+ /* 45 */ {"euro",0x20AC,&MyHashItem[46]},
+ /* 46 */ {"ocirc",0xF4,NULL},
+ /* 47 */ {"equiv",0x2261,&MyHashItem[48]},
+ /* 48 */ {"upsilon",0x03C5,&MyHashItem[49]},
+ /* 49 */ {"sigmaf",0x03C2,&MyHashItem[50]},
+ /* 50 */ {"ETH",0xD0,NULL},
+ /* 51 */ {"le",0x2264,&MyHashItem[52]},
+ /* 52 */ {"beta",0x03B2,&MyHashItem[53]},
+ /* 53 */ {"yacute",0xFD,&MyHashItem[54]},
+ /* 54 */ {"egrave",0xE8,NULL},
+ /* 55 */ {"lowast",0x2217,&MyHashItem[56]},
+ /* 56 */ {"real",0x211C,&MyHashItem[57]},
+ /* 57 */ {"amp",0x26,NULL},
+ /* 58 */ {"icirc",0xEE,&MyHashItem[59]},
+ /* 59 */ {"micro",0xB5,NULL},
+ /* 60 */ {"isin",0x2208,&MyHashItem[61]},
+ /* 61 */ {"curren",0xA4,NULL},
+ /* 62 */ {"rdquo",0x201D,&MyHashItem[63]},
+ /* 63 */ {"sbquo",0x201A,&MyHashItem[64]},
+ /* 64 */ {"ne",0x2260,&MyHashItem[65]},
+ /* 65 */ {"theta",0x03B8,&MyHashItem[66]},
+ /* 66 */ {"Igrave",0xCC,NULL},
+ /* 67 */ {"gt",0x3E,NULL},
+ /* 68 */ {"hearts",0x2665,&MyHashItem[69]},
+ /* 69 */ {"rang",0x232A,NULL},
+ /* 70 */ {"rfloor",0x230B,NULL},
+ /* 71 */ {"ldquo",0x201C,&MyHashItem[72]},
+ /* 72 */ {"ni",0x220B,&MyHashItem[73]},
+ /* 73 */ {"Ntilde",0xD1,&MyHashItem[74]},
+ /* 74 */ {"Aacute",0xC1,NULL},
+ /* 75 */ {"crarr",0x21B5,&MyHashItem[76]},
+ /* 76 */ {"Ouml",0xD6,&MyHashItem[77]},
+ /* 77 */ {"GT",0x3E,NULL},
+ /* 78 */ {"clubs",0x2663,NULL},
+ /* 79 */ {"scaron",0x0161,&MyHashItem[80]},
+ /* 80 */ {"part",0x2202,NULL},
+ /* 81 */ {"tilde",0x02DC,&MyHashItem[82]},
+ /* 82 */ {"oelig",0x0153,&MyHashItem[83]},
+ /* 83 */ {"pi",0x03C0,&MyHashItem[84]},
+ /* 84 */ {"ugrave",0xF9,NULL},
+ /* 85 */ {"darr",0x2193,&MyHashItem[86]},
+ /* 86 */ {"uuml",0xFC,&MyHashItem[87]},
+ /* 87 */ {"QUOT",0x22,NULL},
+ /* 88 */ {"Prime",0x2033,NULL},
+ /* 89 */ {"zwj",0x200D,&MyHashItem[90]},
+ /* 90 */ {"lfloor",0x230A,&MyHashItem[91]},
+ /* 91 */ {"notin",0x2209,&MyHashItem[92]},
+ /* 92 */ {"cent",0xA2,&MyHashItem[93]},
+ /* 93 */ {"lt",0x3C,NULL},
+ /* 94 */ {"eta",0x03B7,&MyHashItem[95]},
+ /* 95 */ {"Phi",0x03A6,&MyHashItem[96]},
+ /* 96 */ {"atilde",0xE3,NULL},
+ /* 97 */ {"hArr",0x21D4,&MyHashItem[98]},
+ /* 98 */ {"iuml",0xEF,&MyHashItem[99]},
+ /* 99 */ {"NBSP",0xA0,NULL},
+ /* 100 */ {"mu",0x03BC,NULL},
+ /* 101 */ {"or",0x2228,&MyHashItem[102]},
+ /* 102 */ {"plusmn",0xB1,&MyHashItem[103]},
+ /* 103 */ {"LT",0x3C,NULL},
+ /* 104 */ {"nu",0x03BD,&MyHashItem[105]},
+ /* 105 */ {"ograve",0xF2,&MyHashItem[106]},
+ /* 106 */ {"AElig",0xC6,NULL},
+ /* 107 */ {"rceil",0x2309,&MyHashItem[108]},
+ /* 108 */ {"uArr",0x21D1,&MyHashItem[109]},
+ /* 109 */ {"sect",0xA7,NULL},
+ /* 110 */ {"circ",0x02C6,NULL},
+ /* 111 */ {"perp",0x22A5,&MyHashItem[112]},
+ /* 112 */ {"eth",0xF0,NULL},
+ /* 113 */ {"rsquo",0x2019,&MyHashItem[114]},
+ /* 114 */ {"nabla",0x2207,NULL},
+ /* 115 */ {"lceil",0x2308,&MyHashItem[116]},
+ /* 116 */ {"cup",0x222A,&MyHashItem[117]},
+ /* 117 */ {"exist",0x2203,&MyHashItem[118]},
+ /* 118 */ {"rarr",0x2192,&MyHashItem[119]},
+ /* 119 */ {"upsih",0x03D2,NULL},
+ /* 120 */ {"prime",0x2032,&MyHashItem[121]},
+ /* 121 */ {"Omega",0x03A9,&MyHashItem[122]},
+ /* 122 */ {"Ecirc",0xCA,NULL},
+ /* 123 */ {"Epsilon",0x0395,NULL},
+ /* 124 */ {"lsquo",0x2018,&MyHashItem[125]},
+ /* 125 */ {"xi",0x03BE,&MyHashItem[126]},
+ /* 126 */ {"Lambda",0x039B,&MyHashItem[127]},
+ /* 127 */ {"Kappa",0x039A,&MyHashItem[128]},
+ /* 128 */ {"divide",0xF7,&MyHashItem[129]},
+ /* 129 */ {"igrave",0xEC,&MyHashItem[130]},
+ /* 130 */ {"acute",0xB4,NULL},
+ /* 131 */ {"Euml",0xCB,&MyHashItem[132]},
+ /* 132 */ {"ordf",0xAA,NULL},
+ /* 133 */ {"image",0x2111,&MyHashItem[134]},
+ /* 134 */ {"Tau",0x03A4,&MyHashItem[135]},
+ /* 135 */ {"Rho",0x03A1,NULL},
+ /* 136 */ {"ntilde",0xF1,&MyHashItem[137]},
+ /* 137 */ {"aacute",0xE1,&MyHashItem[138]},
+ /* 138 */ {"times",0xD7,NULL},
+ /* 139 */ {"omicron",0x03BF,NULL},
+ /* 140 */ {"oplus",0x2295,&MyHashItem[141]},
+ /* 141 */ {"Zeta",0x0396,&MyHashItem[142]},
+ /* 142 */ {"Eacute",0xC9,&MyHashItem[143]},
+ /* 143 */ {"ordm",0xBA,NULL},
+ /* 144 */ {"Oslash",0xD8,&MyHashItem[145]},
+ /* 145 */ {"Ccedil",0xC7,&MyHashItem[146]},
+ /* 146 */ {"iquest",0xBF,NULL},
+ /* 147 */ {"omega",0x03C9,&MyHashItem[148]},
+ /* 148 */ {"Psi",0x03A8,&MyHashItem[149]},
+ /* 149 */ {"ecirc",0xEA,NULL},
+ /* 150 */ {"int",0x222B,NULL},
+ /* 151 */ {"trade",0x2122,&MyHashItem[152]},
+ /* 152 */ {"kappa",0x03BA,&MyHashItem[153]},
+ /* 153 */ {"Iota",0x0399,&MyHashItem[154]},
+ /* 154 */ {"Delta",0x0394,&MyHashItem[155]},
+ /* 155 */ {"Alpha",0x0391,&MyHashItem[156]},
+ /* 156 */ {"Otilde",0xD5,NULL},
+ /* 157 */ {"sdot",0x22C5,NULL},
+ /* 158 */ {"cong",0x2245,NULL},
+ /* 159 */ {"rsaquo",0x203A,&MyHashItem[160]},
+ /* 160 */ {"OElig",0x0152,&MyHashItem[161]},
+ /* 161 */ {"diams",0x2666,&MyHashItem[162]},
+ /* 162 */ {"phi",0x03C6,&MyHashItem[163]},
+ /* 163 */ {"Beta",0x0392,&MyHashItem[164]},
+ /* 164 */ {"szlig",0xDF,&MyHashItem[165]},
+ /* 165 */ {"sup1",0xB9,&MyHashItem[166]},
+ /* 166 */ {"reg",0xAE,NULL},
+ /* 167 */ {"harr",0x2194,&MyHashItem[168]},
+ /* 168 */ {"hellip",0x2026,&MyHashItem[169]},
+ /* 169 */ {"yuml",0xFF,&MyHashItem[170]},
+ /* 170 */ {"sup2",0xB2,NULL},
+ /* 171 */ {"Gamma",0x0393,&MyHashItem[172]},
+ /* 172 */ {"sup3",0xB3,NULL},
+ /* 173 */ {"forall",0x2200,NULL},
+ /* 174 */ {"bdquo",0x201E,&MyHashItem[175]},
+ /* 175 */ {"spades",0x2660,&MyHashItem[176]},
+ /* 176 */ {"Pi",0x03A0,&MyHashItem[177]},
+ /* 177 */ {"Uacute",0xDA,&MyHashItem[178]},
+ /* 178 */ {"Agrave",0xC0,NULL},
+ /* 179 */ {"permil",0x2030,&MyHashItem[180]},
+ /* 180 */ {"mdash",0x2014,&MyHashItem[181]},
+ /* 181 */ {"lArr",0x21D0,&MyHashItem[182]},
+ /* 182 */ {"uarr",0x2191,NULL},
+ /* 183 */ {"Upsilon",0x03A5,&MyHashItem[184]},
+ /* 184 */ {"pound",0xA3,NULL},
+ /* 185 */ {"lsaquo",0x2039,&MyHashItem[186]},
+ /* 186 */ {"lrm",0x200E,&MyHashItem[187]},
+ /* 187 */ {"lambda",0x03BB,&MyHashItem[188]},
+ /* 188 */ {"delta",0x03B4,&MyHashItem[189]},
+ /* 189 */ {"alpha",0x03B1,NULL},
+ /* 190 */ {"frasl",0x2044,&MyHashItem[191]},
+ /* 191 */ {"thorn",0xFE,&MyHashItem[192]},
+ /* 192 */ {"auml",0xE4,NULL},
+ /* 193 */ {"Mu",0x039C,NULL},
+ /* 194 */ {"nsub",0x2284,&MyHashItem[195]},
+ /* 195 */ {"macr",0xAF,NULL},
+ /* 196 */ {"minus",0x2212,&MyHashItem[197]},
+ /* 197 */ {"Nu",0x039D,&MyHashItem[198]},
+ /* 198 */ {"Oacute",0xD3,NULL},
+ /* 199 */ {"prod",0x220F,&MyHashItem[200]},
+ /* 200 */ {"Uuml",0xDC,&MyHashItem[201]},
+ /* 201 */ {"iexcl",0xA1,NULL},
+ /* 202 */ {"lang",0x2329,&MyHashItem[203]},
+ /* 203 */ {"tau",0x03C4,&MyHashItem[204]},
+ /* 204 */ {"rho",0x03C1,&MyHashItem[205]},
+ /* 205 */ {"gamma",0x03B3,NULL},
+ /* 206 */ {"loz",0x25CA,&MyHashItem[207]},
+ /* 207 */ {"bull",0x2022,&MyHashItem[208]},
+ /* 208 */ {"piv",0x03D6,NULL},
+ /* 209 */ {"eacute",0xE9,NULL},
+ /* 210 */ {"zwnj",0x200C,&MyHashItem[211]},
+ /* 211 */ {"oslash",0xF8,&MyHashItem[212]},
+ /* 212 */ {"ccedil",0xE7,&MyHashItem[213]},
+ /* 213 */ {"THORN",0xDE,&MyHashItem[214]},
+ /* 214 */ {"Iuml",0xCF,&MyHashItem[215]},
+ /* 215 */ {"not",0xAC,NULL},
+ /* 216 */ {"sim",0x223C,&MyHashItem[217]},
+ /* 217 */ {"thetasym",0x03D1,&MyHashItem[218]},
+ /* 218 */ {"Acirc",0xC2,NULL},
+ /* 219 */ {"Dagger",0x2021,&MyHashItem[220]},
+ /* 220 */ {"fnof",0x0192,NULL},
+ /* 221 */ {"rlm",0x200F,&MyHashItem[222]},
+ /* 222 */ {"oline",0x203E,&MyHashItem[223]},
+ /* 223 */ {"Chi",0x03A7,&MyHashItem[224]},
+ /* 224 */ {"Xi",0x039E,&MyHashItem[225]},
+ /* 225 */ {"otilde",0xF5,&MyHashItem[226]},
+ /* 226 */ {"Iacute",0xCD,&MyHashItem[227]},
+ /* 227 */ {"copy",0xA9,NULL},
+ /* 228 */ {"ndash",0x2013,&MyHashItem[229]},
+ /* 229 */ {"ouml",0xF6,NULL},
+ /* 230 */ {"psi",0x03C8,NULL},
+ /* 231 */ {"sube",0x2286,NULL},
+ /* 232 */ {"emsp",0x2003,&MyHashItem[233]},
+ /* 233 */ {"asymp",0x2248,&MyHashItem[234]},
+ /* 234 */ {"prop",0x221D,NULL},
+ /* 235 */ {"infin",0x221E,NULL},
+ /* 236 */ {"empty",0x2205,&MyHashItem[237]},
+ /* 237 */ {"uacute",0xFA,&MyHashItem[238]},
+ /* 238 */ {"agrave",0xE0,&MyHashItem[239]},
+ /* 239 */ {"shy",0xAD,NULL},
+ /* 240 */ {"ensp",0x2002,NULL},
+ /* 241 */ {"acirc",0xE2,NULL},
+ /* 242 */ {"sub",0x2282,&MyHashItem[243]},
+ /* 243 */ {"epsilon",0x03B5,NULL},
+ /* 244 */ {"Yacute",0xDD,&MyHashItem[245]},
+ /* 245 */ {"Egrave",0xC8,NULL},
+ /* 246 */ {"there4",0x2234,&MyHashItem[247]},
+ /* 247 */ {"larr",0x2190,&MyHashItem[248]},
+ /* 248 */ {"uml",0xA8,&MyHashItem[249]},
+ /* 249 */ {"AMP",0x26,NULL},
+ /* 250 */ {"Sigma",0x03A3,&MyHashItem[251]},
+ /* 251 */ {"Aring",0xC5,NULL},
+ /* 252 */ {"yen",0xA5,NULL},
+ /* 253 */ {"oacute",0xF3,&MyHashItem[254]},
+ /* 254 */ {"raquo",0xBB,NULL},
+ /* 255 */ {"thinsp",0x2009,NULL},
+ /* 256 */ {"Ucirc",0xDB,NULL},
+};
+
+static HashItem_si *MyHashItemTbl[] = {
+ NULL,
+ &MyHashItem[0],
+ &MyHashItem[2],
+ &MyHashItem[5],
+ &MyHashItem[7],
+ &MyHashItem[11],
+ &MyHashItem[16],
+ &MyHashItem[19],
+ &MyHashItem[24],
+ &MyHashItem[27],
+ &MyHashItem[33],
+ &MyHashItem[36],
+ NULL,
+ &MyHashItem[38],
+ &MyHashItem[41],
+ &MyHashItem[45],
+ &MyHashItem[47],
+ &MyHashItem[51],
+ &MyHashItem[55],
+ &MyHashItem[58],
+ &MyHashItem[60],
+ &MyHashItem[62],
+ &MyHashItem[67],
+ &MyHashItem[68],
+ &MyHashItem[70],
+ &MyHashItem[71],
+ &MyHashItem[75],
+ &MyHashItem[78],
+ &MyHashItem[79],
+ &MyHashItem[81],
+ &MyHashItem[85],
+ &MyHashItem[88],
+ &MyHashItem[89],
+ &MyHashItem[94],
+ &MyHashItem[97],
+ &MyHashItem[100],
+ &MyHashItem[101],
+ &MyHashItem[104],
+ &MyHashItem[107],
+ &MyHashItem[110],
+ &MyHashItem[111],
+ &MyHashItem[113],
+ &MyHashItem[115],
+ &MyHashItem[120],
+ &MyHashItem[123],
+ &MyHashItem[124],
+ &MyHashItem[131],
+ &MyHashItem[133],
+ NULL,
+ &MyHashItem[136],
+ NULL,
+ NULL,
+ &MyHashItem[139],
+ &MyHashItem[140],
+ &MyHashItem[144],
+ &MyHashItem[147],
+ &MyHashItem[150],
+ &MyHashItem[151],
+ &MyHashItem[157],
+ &MyHashItem[158],
+ NULL,
+ &MyHashItem[159],
+ &MyHashItem[167],
+ &MyHashItem[171],
+ &MyHashItem[173],
+ &MyHashItem[174],
+ &MyHashItem[179],
+ NULL,
+ &MyHashItem[183],
+ &MyHashItem[185],
+ &MyHashItem[190],
+ &MyHashItem[193],
+ &MyHashItem[194],
+ &MyHashItem[196],
+ &MyHashItem[199],
+ &MyHashItem[202],
+ &MyHashItem[206],
+ &MyHashItem[209],
+ &MyHashItem[210],
+ &MyHashItem[216],
+ &MyHashItem[219],
+ &MyHashItem[221],
+ &MyHashItem[228],
+ &MyHashItem[230],
+ NULL,
+ &MyHashItem[231],
+ &MyHashItem[232],
+ NULL,
+ &MyHashItem[235],
+ &MyHashItem[236],
+ &MyHashItem[240],
+ &MyHashItem[241],
+ &MyHashItem[242],
+ &MyHashItem[244],
+ &MyHashItem[246],
+ &MyHashItem[250],
+ &MyHashItem[252],
+ &MyHashItem[253],
+ &MyHashItem[255],
+ &MyHashItem[256],
+};
+
+Hash_si entity = {100, MyHashItemTbl};
diff --git a/entity.tab b/entity.tab
@@ -0,0 +1,258 @@
+%%
+lt 0x3C
+LT 0x3C
+gt 0x3E
+GT 0x3E
+amp 0x26
+AMP 0x26
+quot 0x22
+QUOT 0x22
+nbsp 0xA0
+NBSP 0xA0
+iexcl 0xA1
+cent 0xA2
+pound 0xA3
+curren 0xA4
+yen 0xA5
+brvbar 0xA6
+sect 0xA7
+uml 0xA8
+copy 0xA9
+ordf 0xAA
+laquo 0xAB
+not 0xAC
+shy 0xAD
+reg 0xAE
+macr 0xAF
+deg 0xB0
+plusmn 0xB1
+sup2 0xB2
+sup3 0xB3
+acute 0xB4
+micro 0xB5
+para 0xB6
+middot 0xB7
+cedil 0xB8
+sup1 0xB9
+ordm 0xBA
+raquo 0xBB
+frac14 0xBC
+frac12 0xBD
+frac34 0xBE
+iquest 0xBF
+Agrave 0xC0
+Aacute 0xC1
+Acirc 0xC2
+Atilde 0xC3
+Auml 0xC4
+Aring 0xC5
+AElig 0xC6
+Ccedil 0xC7
+Egrave 0xC8
+Eacute 0xC9
+Ecirc 0xCA
+Euml 0xCB
+Igrave 0xCC
+Iacute 0xCD
+Icirc 0xCE
+Iuml 0xCF
+ETH 0xD0
+Ntilde 0xD1
+Ograve 0xD2
+Oacute 0xD3
+Ocirc 0xD4
+Otilde 0xD5
+Ouml 0xD6
+times 0xD7
+Oslash 0xD8
+Ugrave 0xD9
+Uacute 0xDA
+Ucirc 0xDB
+Uuml 0xDC
+Yacute 0xDD
+THORN 0xDE
+szlig 0xDF
+agrave 0xE0
+aacute 0xE1
+acirc 0xE2
+atilde 0xE3
+auml 0xE4
+aring 0xE5
+aelig 0xE6
+ccedil 0xE7
+egrave 0xE8
+eacute 0xE9
+ecirc 0xEA
+euml 0xEB
+igrave 0xEC
+iacute 0xED
+icirc 0xEE
+iuml 0xEF
+eth 0xF0
+ntilde 0xF1
+ograve 0xF2
+oacute 0xF3
+ocirc 0xF4
+otilde 0xF5
+ouml 0xF6
+divide 0xF7
+oslash 0xF8
+ugrave 0xF9
+uacute 0xFA
+ucirc 0xFB
+uuml 0xFC
+yacute 0xFD
+thorn 0xFE
+yuml 0xFF
+fnof 0x0192
+Alpha 0x0391
+Beta 0x0392
+Gamma 0x0393
+Delta 0x0394
+Epsilon 0x0395
+Zeta 0x0396
+Eta 0x0397
+Theta 0x0398
+Iota 0x0399
+Kappa 0x039A
+Lambda 0x039B
+Mu 0x039C
+Nu 0x039D
+Xi 0x039E
+Omicron 0x039F
+Pi 0x03A0
+Rho 0x03A1
+Sigma 0x03A3
+Tau 0x03A4
+Upsilon 0x03A5
+Phi 0x03A6
+Chi 0x03A7
+Psi 0x03A8
+Omega 0x03A9
+alpha 0x03B1
+beta 0x03B2
+gamma 0x03B3
+delta 0x03B4
+epsilon 0x03B5
+zeta 0x03B6
+eta 0x03B7
+theta 0x03B8
+iota 0x03B9
+kappa 0x03BA
+lambda 0x03BB
+mu 0x03BC
+nu 0x03BD
+xi 0x03BE
+omicron 0x03BF
+pi 0x03C0
+rho 0x03C1
+sigmaf 0x03C2
+sigma 0x03C3
+tau 0x03C4
+upsilon 0x03C5
+phi 0x03C6
+chi 0x03C7
+psi 0x03C8
+omega 0x03C9
+thetasym 0x03D1
+upsih 0x03D2
+piv 0x03D6
+bull 0x2022
+hellip 0x2026
+prime 0x2032
+Prime 0x2033
+oline 0x203E
+frasl 0x2044
+weierp 0x2118
+image 0x2111
+real 0x211C
+trade 0x2122
+alefsym 0x2135
+larr 0x2190
+uarr 0x2191
+rarr 0x2192
+darr 0x2193
+harr 0x2194
+crarr 0x21B5
+lArr 0x21D0
+uArr 0x21D1
+rArr 0x21D2
+dArr 0x21D3
+hArr 0x21D4
+forall 0x2200
+part 0x2202
+exist 0x2203
+empty 0x2205
+nabla 0x2207
+isin 0x2208
+notin 0x2209
+ni 0x220B
+prod 0x220F
+sum 0x2211
+minus 0x2212
+lowast 0x2217
+radic 0x221A
+prop 0x221D
+infin 0x221E
+ang 0x2220
+and 0x2227
+or 0x2228
+cap 0x2229
+cup 0x222A
+int 0x222B
+there4 0x2234
+sim 0x223C
+cong 0x2245
+asymp 0x2248
+ne 0x2260
+equiv 0x2261
+le 0x2264
+ge 0x2265
+sub 0x2282
+sup 0x2283
+nsub 0x2284
+sube 0x2286
+supe 0x2287
+oplus 0x2295
+otimes 0x2297
+perp 0x22A5
+sdot 0x22C5
+lceil 0x2308
+rceil 0x2309
+lfloor 0x230A
+rfloor 0x230B
+lang 0x2329
+rang 0x232A
+loz 0x25CA
+spades 0x2660
+clubs 0x2663
+hearts 0x2665
+diams 0x2666
+OElig 0x0152
+oelig 0x0153
+Scaron 0x0160
+scaron 0x0161
+Yuml 0x0178
+circ 0x02C6
+tilde 0x02DC
+ensp 0x2002
+emsp 0x2003
+thinsp 0x2009
+zwnj 0x200C
+zwj 0x200D
+lrm 0x200E
+rlm 0x200F
+ndash 0x2013
+mdash 0x2014
+lsquo 0x2018
+rsquo 0x2019
+sbquo 0x201A
+ldquo 0x201C
+rdquo 0x201D
+bdquo 0x201E
+dagger 0x2020
+Dagger 0x2021
+permil 0x2030
+lsaquo 0x2039
+rsaquo 0x203A
+euro 0x20AC
diff --git a/etc.c b/etc.c
@@ -15,6 +15,7 @@
#include <sys/types.h>
#include <time.h>
#include <sys/wait.h>
+#include <signal.h>
#ifdef __WATT32__
#define read(a,b,c) read_s(a,b,c)
@@ -123,9 +124,11 @@ lineSkip(Buffer * buf, Line * line, int offset, int last)
Line *l;
l = currentLineSkip(buf, line, offset, last);
+#ifndef NEXTPAGE_TOPLINE
for (i = (LASTLINE - 1) - (buf->lastLine->linenumber - l->linenumber);
i > 0 && l->prev != NULL;
i--, l = l->prev);
+#endif
return l;
}
@@ -663,6 +666,29 @@ bzero(void *ptr, int len)
}
#endif /* NOBCOPY */
+#ifdef USE_INCLUDED_SRAND48
+static unsigned long R1 = 0x1234abcd;
+static unsigned long R2 = 0x330e;
+#define A1 0x5deec
+#define A2 0xe66d
+#define C 0xb
+
+void
+srand48(long seed)
+{
+ R1 = (unsigned long)seed;
+ R2 = 0x330e;
+}
+
+long
+lrand48(void)
+{
+ R1 = (A1 * R1 << 16) + A1 * R2 + A2 * R1 + ((A2 * R2 + C) >> 16);
+ R2 = (A2 * R2 + C) & 0xffff;
+ return (long)(R1 >> 1);
+}
+#endif
+
char *
mybasename(char *s)
{
@@ -1123,36 +1149,32 @@ romanAlphabet(int n)
return r;
}
-Str
-quoteShell(char *string)
-{
- Str str = Strnew();
-
- while (*string != '\0') {
- if (!IS_ALNUM(*string) && *string != '_' && *string != '.' &&
- *string != ':' && *string != '/')
- Strcat_char(str, '\\');
- Strcat_char(str, *(string++));
- }
- return str;
-}
-
void
mySystem(char *command, int background)
{
-#ifdef __EMX__ /* jsawa */
if (background){
+#ifndef HAVE_SETPGRP
Str cmd = Strnew_charp("start /f ");
Strcat_charp(cmd, command);
system(cmd->ptr);
- }else
- system(command);
#else
- Str cmd = Strnew_charp(command);
- if (background)
- cmd = Sprintf("(%s) >/dev/null 2>&1 &", cmd->ptr);
- system(cmd->ptr);
+ int pid;
+ flush_tty();
+ if ((pid = fork()) == 0) {
+#ifdef SIGCHLD
+ signal(SIGCHLD, SIG_IGN);
#endif
+ setpgrp();
+ close_tty();
+ fclose(stdout);
+ fclose(stderr);
+ execl("/bin/sh", "sh", "-c", command, NULL);
+ exit(127);
+ }
+#endif
+ }
+ else
+ system(command);
}
char *
@@ -1189,6 +1211,37 @@ expandName(char *name)
return extpath->ptr;
}
+char *
+file_to_url(char *file)
+{
+ Str tmp;
+#if defined( __CYGWIN__ ) || defined( __EMX__ )
+ char *drive = NULL;
+#endif
+
+ file = expandName(file);
+#if defined( __CYGWIN__ ) || defined( __EMX__ )
+ if (IS_ALPHA(file[0]) && file[1] == ':') {
+ drive = allocStr(file, 2);
+ file += 2;
+ } else
+#endif
+ if (file[0] != '/') {
+ tmp = Strnew_charp(CurrentDir);
+ if (Strlastchar(tmp) != '/')
+ Strcat_char(tmp, '/');
+ Strcat_charp(tmp, file);
+ file = tmp->ptr;
+ }
+ tmp = Strnew_charp("file://");
+#if defined( __CYGWIN__ ) || defined( __EMX__ )
+ if (drive)
+ Strcat_charp(tmp, drive);
+#endif
+ Strcat_charp(tmp, file_quote(cleanupName(file)));
+ return tmp->ptr;
+}
+
static char *tmpf_base[MAX_TMPF_TYPE] =
{
"tmp", "src", "frame", "cache"
diff --git a/file.c b/file.c
@@ -59,27 +59,29 @@ static int cur_option_selected;
static int cur_status;
#ifdef MENU_SELECT
/* menu based <select> */
-FormSelectOption select_option[MAX_SELECT];
+FormSelectOption *select_option;
+static int max_select = MAX_SELECT;
static int n_select;
static int cur_option_maxwidth;
#endif /* MENU_SELECT */
static Str cur_textarea;
-Str textarea_str[MAX_TEXTAREA];
+Str *textarea_str;
static int cur_textarea_size;
static int cur_textarea_rows;
+static int cur_textarea_readonly;
static int n_textarea;
+static int ignore_nl_textarea;
+static int max_textarea = MAX_TEXTAREA;
static int http_response_code;
#ifdef JP_CHARSET
static char content_charset = '\0';
+static char meta_charset = '\0';
static char guess_charset(char *p);
-#ifdef NEW_FORM
-static char check_charset(char *p);
-static char check_accept_charset(char *p);
-#endif
-char DocumentCode = '\0';
+static char check_charset(char *s);
+static char check_accept_charset(char *s);
#endif
static Str save_line = NULL;
@@ -101,16 +103,12 @@ static struct link_stack *link_stack = NULL;
#define Str_news_endline(s) ((s)->ptr[0]=='.'&&((s)->ptr[1]=='\n'||(s)->ptr[1]=='\r'||(s)->ptr[1]=='\0'))
#endif /* USE_NNTP */
-#ifdef NEW_FORM
#define INITIAL_FORM_SIZE 10
static FormList **forms;
static int *form_stack;
static int form_max = 0;
static int forms_size = 0;
#define cur_form_id ((form_sp >= 0)? form_stack[form_sp] : -1)
-#else /* not NEW_FORM */
-static FormList *form_stack[FORMSTACK_SIZE];
-#endif /* not NEW_FORM */
static int form_sp = 0;
static int current_content_length;
@@ -131,7 +129,7 @@ char *ullevel[MAX_UL_LEVEL] =
NBSP "*", NBSP "+", NBSP "o", NBSP "#", NBSP "@", NBSP "-",
NBSP "=", "**", "--"
};
-#define HR_RULE "\212"
+#define HR_RULE "-"
#define HR_RULE_WIDTH 1
#endif /* not KANJI_SYMBOLS */
@@ -176,7 +174,8 @@ int
currentLn(Buffer * buf)
{
if (buf->currentLine)
- return buf->currentLine->real_linenumber + 1;
+/* return buf->currentLine->real_linenumber + 1; */
+ return buf->currentLine->linenumber + 1;
else
return 1;
}
@@ -194,7 +193,7 @@ loadSomething(URLFile * f,
buf->filename = path;
if (buf->buffername == NULL || buf->buffername[0] == '\0')
- buf->buffername = lastFileName(path);
+ buf->buffername = conv_from_system(lastFileName(path));
if (buf->currentURL.scheme == SCM_UNKNOWN)
buf->currentURL.scheme = f->scheme;
buf->real_scheme = f->scheme;
@@ -359,8 +358,11 @@ convertLine(URLFile * uf, Str line, char *code, int mode)
{
#ifdef JP_CHARSET
char ic;
- if ((ic = checkShiftCode(line, *code)) != '\0')
- line = conv_str(line, (*code = ic), InnerCode);
+ if ((ic = checkShiftCode(line, *code)) != '\0') {
+ if (UseAutoDetect)
+ *code = ic;
+ line = conv_str(line, *code, InnerCode);
+ }
#endif /* JP_CHARSET */
cleanup_line(line, mode);
#ifdef USE_NNTP
@@ -382,11 +384,13 @@ loadFile(char *path)
if (uf.stream == NULL)
return NULL;
current_content_length = 0;
+#ifdef JP_CHARSET
+ content_charset = '\0';
+#endif
return loadSomething(&uf, path, loadBuffer, NULL);
}
-#ifdef USE_COOKIE
-static int
+int
matchattr(char *p, char *attr, int len, Str * value)
{
int quoted;
@@ -423,7 +427,6 @@ matchattr(char *p, char *attr, int len, Str * value)
}
return 0;
}
-#endif /* USE_COOKIE */
void
readHeader(URLFile * uf,
@@ -439,7 +442,6 @@ readHeader(URLFile * uf,
#ifdef JP_CHARSET
char code = DocumentCode, ic;
#endif
- extern int w3m_dump_head;
headerlist = newBuf->document_header = newTextList();
if (uf->scheme == SCM_HTTP
@@ -476,7 +478,7 @@ readHeader(URLFile * uf,
break;
/* last header */
}
- else if (!w3m_dump_head) {
+ else if (!(w3m_dump & DUMP_HEAD)) {
if (lineBuf2) {
Strcat(lineBuf2, tmp);
}
@@ -490,8 +492,11 @@ readHeader(URLFile * uf,
continue;
lineBuf2 = decodeMIME(lineBuf2->ptr);
#ifdef JP_CHARSET
- if ((ic = checkShiftCode(lineBuf2, code)) != '\0')
- lineBuf2 = conv_str(lineBuf2, (code = ic), InnerCode);
+ if ((ic = checkShiftCode(lineBuf2, code)) != '\0') {
+ if (UseAutoDetect)
+ code = ic;
+ lineBuf2 = conv_str(lineBuf2, code, InnerCode);
+ }
#endif /* JP_CHARSET */
/* separated with line and stored */
tmp = Strnew_size(lineBuf2->length);
@@ -540,6 +545,9 @@ readHeader(URLFile * uf,
uf->encoding = ENC_BASE64;
else if (!strncasecmp(p, "quoted-printable", 16))
uf->encoding = ENC_QUOTE;
+ else if (!strncasecmp(p, "uuencode", 8) ||
+ !strncasecmp(p, "x-uuencode", 10))
+ uf->encoding = ENC_UUENCODE;
else
uf->encoding = ENC_7BIT;
}
@@ -664,7 +672,7 @@ readHeader(URLFile * uf,
if (msg->length > COLS - 4)
Strshrink(msg, msg->length - (COLS - 4));
term_raw();
- ans = inputStr(msg->ptr, FALSE);
+ ans = inputChar(msg->ptr);
}
if (ans == NULL || tolower(*ans) != 'y' ||
(err = add_cookie(pu, name, value, expires, domain, path,
@@ -748,7 +756,6 @@ checkContentType(Buffer * buf)
while (*p && *p != ';' && !IS_SPACE(*p))
Strcat_char(r, *p++);
#ifdef JP_CHARSET
- content_charset = '\0';
if ((p = strcasestr(p, "charset")) != NULL) {
p += 7;
SKIP_BLANKS(p);
@@ -830,18 +837,31 @@ getAuthCookie(char *realm, char *auth_header, TextList * extra_header, ParsedURL
term_raw();
if ((pp = inputStr(Sprintf("Username for %s: ", realm)->ptr, NULL)) == NULL)
return NULL;
- uname = Strnew_charp(pp);
+ uname = Str_conv_to_system(Strnew_charp(pp));
if ((pp = inputLine(Sprintf("Password for %s: ", realm)->ptr, NULL, IN_PASSWORD)) == NULL)
return NULL;
- pwd = Strnew_charp(pp);
+ pwd = Str_conv_to_system(Strnew_charp(pp));
term_cbreak();
}
else {
- printf("Username: ");
+ int proxy = !strncasecmp( "Proxy-Authorization:", auth_header, auth_header_len );
+
+ /*
+ * If post file is specified as '-', stdin is closed at this point.
+ * In this case, w3m cannot read username from stdin.
+ * So exit with error message.
+ * (This is same behavior as lwp-request.)
+ */
+ if (feof(stdin) || ferror (stdin)) {
+ fprintf(stderr, "w3m: Authorization required for %s\n", realm);
+ exit(1);
+ }
+
+ printf(proxy ? "Proxy Username for %s: " : "Username for %s: ", realm);
fflush(stdout);
uname = Strfgets(stdin);
Strchop(uname);
- pwd = Strnew_charp((char *) getpass("Password: "));
+ pwd = Strnew_charp((char *) getpass(proxy ? "Proxy Password: " : "Password: "));
}
Strcat_char(uname, ':');
Strcat(uname, pwd);
@@ -855,6 +875,14 @@ getAuthCookie(char *realm, char *auth_header, TextList * extra_header, ParsedURL
return ss;
}
+static int
+same_url_p(ParsedURL *pu1, ParsedURL *pu2)
+{
+ return (pu1->scheme == pu2->scheme && pu1->port == pu2->port &&
+ (pu1->host ? pu2->host ? !strcasecmp(pu1->host, pu2->host) : 0 : 1) &&
+ (pu1->file ? pu2->file ? !strcmp(pu1->file, pu2->file) : 0 : 1));
+}
+
/*
* loadGeneralFile: load file to buffer
*/
@@ -862,7 +890,9 @@ Buffer *
loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormList * request)
{
URLFile f, *of = NULL;
- ParsedURL pu;
+ ParsedURL pu, * volatile puv = NULL;
+ int volatile nredir = 0;
+ int volatile nredir_size = 0;
Buffer *b = NULL, *(*proc) ();
char *tpath;
char *t, *p, *real_type = NULL;
@@ -877,7 +907,6 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
unsigned char status = HTST_NORMAL;
URLOption url_option;
Str tmp;
- extern int w3m_dump, w3m_dump_source;
tpath = path;
prevtrap = NULL;
@@ -919,24 +948,24 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
case SCM_LOCAL:
{
struct stat st;
- if (stat(pu.file, &st) < 0)
+ if (stat(pu.real_file, &st) < 0)
return NULL;
if (S_ISDIR(st.st_mode)) {
if (UseExternalDirBuffer) {
Str tmp = Strnew_charp(DirBufferCommand);
- Strcat_m_charp(tmp, "?",
+ Strcat_m_charp(tmp, "?dir=",
pu.file,
"#current",
NULL);
b = loadGeneralFile(tmp->ptr, NULL, NO_REFERER, 0, NULL);
if (b != NULL && b != NO_BUFFER) {
copyParsedURL(&b->currentURL, &pu);
- b->filename = b->currentURL.file;
+ b->filename = b->currentURL.real_file;
}
return b;
}
else {
- b = dirBuffer(pu.file);
+ b = dirBuffer(pu.real_file);
if (b == NULL)
return NULL;
t = "text/html";
@@ -968,6 +997,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
searchHeader = TRUE;
searchHeader_through = FALSE;
}
+ if (header_string) header_string = NULL;
if (fmInitialized) {
prevtrap = signal(SIGINT, KeyAbort);
term_cbreak();
@@ -1002,17 +1032,37 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
t = "text/plain";
if (http_response_code >= 301 && http_response_code <= 303 && (p = checkHeader(t_buf, "Location:")) != NULL) {
/* document moved */
- tmp = Strnew_charp(p);
- Strchop(tmp);
- tpath = tmp->ptr;
- request = NULL;
- UFclose(&f);
- add_auth_cookie_flag = 0;
- current = New(ParsedURL);
- copyParsedURL(current, &pu);
- t_buf->bufferprop |= BP_REDIRECTED;
- status = HTST_NORMAL;
- goto load_doc;
+ if (nredir >= FollowRedirection) {
+ tmp = Sprintf("Number of redirections exceeded %d at %s", FollowRedirection, parsedURL2Str(&pu)->ptr);
+ disp_err_message(tmp->ptr, FALSE);
+ }
+ else if (nredir_size > 0 &&
+ (same_url_p(&pu, &puv[(nredir - 1) % nredir_size]) ||
+ (!(nredir % 2) && same_url_p(&pu, &puv[(nredir / 2) % nredir_size])))) {
+ tmp = Sprintf("Redirection loop detected (%s)", parsedURL2Str(&pu)->ptr);
+ disp_err_message(tmp->ptr, FALSE);
+ }
+ else {
+ if (!puv) {
+ nredir_size = FollowRedirection / 2 + 1;
+ puv = New_N(ParsedURL, nredir_size);
+ memset(puv, 0, sizeof(ParsedURL) * nredir_size);
+ }
+
+ copyParsedURL(&puv[nredir % nredir_size], &pu);
+ ++nredir;
+ tmp = Strnew_charp(p);
+ Strchop(tmp);
+ tpath = tmp->ptr;
+ request = NULL;
+ UFclose(&f);
+ add_auth_cookie_flag = 0;
+ current = New(ParsedURL);
+ copyParsedURL(current, &pu);
+ t_buf->bufferprop |= BP_REDIRECTED;
+ status = HTST_NORMAL;
+ goto load_doc;
+ }
}
if ((p = checkHeader(t_buf, "WWW-Authenticate:")) != NULL &&
http_response_code == 401) {
@@ -1099,11 +1149,14 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (f.compression != CMP_NOCOMPRESS) {
char *t1 = uncompressed_file_type(pu.file, NULL);
real_type = f.guess_type;
+/*
if (t1 && strncasecmp(t1, "application/", 12) == 0) {
f.compression = CMP_NOCOMPRESS;
t = real_type;
}
- else if (t1)
+ else
+*/
+ if (t1)
t = t1;
else
t = real_type;
@@ -1114,6 +1167,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
real_type = "text/plain";
t = real_type;
}
+/*
if (!strncasecmp(t, "application/", 12)) {
char *tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
current_content_length = 0;
@@ -1124,10 +1178,11 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
term_raw();
signal(SIGINT, prevtrap);
}
- doFileMove(tmpf, guess_save_name(pu.file));
+ doFileMove(tmpf, guess_save_name(t_buf, pu.file));
}
return NO_BUFFER;
}
+*/
}
else if (searchHeader) {
t_buf = newBuffer(INIT_BUFFER_WIDTH);
@@ -1169,18 +1224,25 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (do_download) {
/* download only */
+ char *file;
if (fmInitialized) {
term_raw();
signal(SIGINT, prevtrap);
}
- doFileSave(f, guess_save_name(pu.file));
+ if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
+ f.stream = newEncodedStream(f.stream, f.encoding);
+ if (pu.scheme == SCM_LOCAL)
+ file = conv_from_system(guess_save_name(NULL, pu.real_file));
+ else
+ file = guess_save_name(t_buf, pu.file);
+ doFileSave(f, file);
UFclose(&f);
return NO_BUFFER;
}
if (f.compression != CMP_NOCOMPRESS) {
- if (!w3m_dump_source &&
- (w3m_dump || is_text_type(t) || searchExtViewer(t))) {
+ if (!(w3m_dump & DUMP_SOURCE) &&
+ (w3m_dump & ~DUMP_FRAME || is_text_type(t) || searchExtViewer(t))) {
gunzip_stream(&f);
uncompressed_file_type(pu.file, &f.ext);
}
@@ -1200,8 +1262,9 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
}
#endif /* USE_GOPHER */
else if (w3m_backend) ;
- else if (!w3m_dump || is_dump_text_type(t)) {
- if (!do_download && doExternal(f, pu.file, t, &b, t_buf)) {
+ else if (!(w3m_dump & ~DUMP_FRAME) || is_dump_text_type(t)) {
+ if (!do_download && doExternal(f,
+ pu.real_file ? pu.real_file : pu.file, t, &b, t_buf)) {
if (b && b != NO_BUFFER) {
b->real_scheme = f.scheme;
b->real_type = real_type;
@@ -1222,10 +1285,13 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
}
if (pu.scheme == SCM_LOCAL) {
UFclose(&f);
- doFileCopy(pu.file, guess_save_name(pu.file));
+ doFileCopy(pu.real_file,
+ conv_from_system(guess_save_name(NULL, pu.real_file)));
}
else {
- doFileSave(f, guess_save_name(pu.file));
+ if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
+ f.stream = newEncodedStream(f.stream, f.encoding);
+ doFileSave(f, guess_save_name(t_buf, pu.file));
UFclose(&f);
}
return NO_BUFFER;
@@ -1247,7 +1313,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
t_buf->ssl_certificate = s->ptr;
}
#endif
- b = loadSomething(&f, pu.file, proc, t_buf);
+ b = loadSomething(&f, pu.real_file ? pu.real_file : pu.file, proc, t_buf);
UFclose(&f);
if (b) {
b->real_scheme = f.scheme;
@@ -1255,7 +1321,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
loaded:
if (b->currentURL.host == NULL && b->currentURL.file == NULL)
copyParsedURL(&b->currentURL, &pu);
- if (!strcmp(t, "text/html"))
+ if (!strcasecmp(t, "text/html"))
b->type = "text/html";
else if (w3m_backend) {
Str s = Strnew_charp(t);
@@ -1273,6 +1339,11 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
#endif /* not JP_CHARSET */
if (a != NULL) {
gotoLine(b, a->start.line);
+#ifdef LABEL_TOPLINE
+ b->topLine = lineSkip(b, b->topLine,
+ b->currentLine->linenumber - b->topLine->linenumber,
+ FALSE);
+#endif
b->pos = a->start.pos;
arrangeCursor(b);
}
@@ -1285,6 +1356,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
}
}
}
+ if (header_string) header_string = NULL;
if (fmInitialized) {
term_raw();
signal(SIGINT, prevtrap);
@@ -1430,6 +1502,8 @@ set_breakpoint(struct readbuffer *obuf, int tag_length)
#ifdef FORMAT_NICE
obuf->bp.flag &= ~RB_FILL;
#endif /* FORMAT_NICE */
+ obuf->bp.top_margin = obuf->top_margin;
+ obuf->bp.bottom_margin = obuf->bottom_margin;
if (!obuf->bp.init_flag)
return;
@@ -1457,6 +1531,8 @@ back_to_breakpoint(struct readbuffer *obuf)
obuf->in_under = obuf->bp.in_under;
obuf->prev_ctype = obuf->bp.prev_ctype;
obuf->pos = obuf->bp.pos;
+ obuf->top_margin = obuf->bp.top_margin;
+ obuf->bottom_margin = obuf->bp.bottom_margin;
if (obuf->flag & RB_NOBR)
obuf->nobr_level = obuf->bp.nobr_level;
}
@@ -1593,14 +1669,16 @@ proc_mchar(struct readbuffer *obuf, int pre_mode,
}
void
-push_render_image(Str str, int width, struct html_feed_environ *h_env)
+push_render_image(Str str, int width, int limit, struct html_feed_environ *h_env)
{
struct readbuffer *obuf = h_env->obuf;
int indent = h_env->envs[h_env->envc].indent;
+ push_spaces(obuf, 1, (limit - width) / 2);
push_str(obuf, width, str, PC_ASCII);
+ push_spaces(obuf, 1, (limit - width + 1) / 2);
if (width > 0)
- flushline(h_env, obuf, indent, 0, h_env->limit);
+ flushline(h_env, obuf, indent, 0, h_env->limit);
}
static int
@@ -1760,6 +1838,26 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
if (obuf->in_under && !hidden_under)
Strcat_charp(line, "</u>");
+ if (obuf->top_margin > 0) {
+ int i;
+ struct html_feed_environ h;
+ struct readbuffer o;
+ struct environment e[1];
+
+ init_henv(&h, &o, e, 1, NULL, width, indent);
+ o.line = Strnew_size(width + 20);
+ o.pos = obuf->pos;
+ o.flag = obuf->flag;
+ o.top_margin = -1;
+ o.bottom_margin = -1;
+ Strcat_charp(o.line, "<pre_int>");
+ for (i = 0; i < o.pos; i++)
+ Strcat_char(o.line, ' ');
+ Strcat_charp(o.line, "</pre_int>");
+ for (i = 0; i < obuf->top_margin; i++)
+ flushline(h_env, &o, indent, force, width);
+ }
+
if (force == 1 || obuf->flag & RB_NFLUSHED) {
TextLine *lbuf = newTextLine(line, obuf->pos);
if (RB_GET_ALIGN(obuf) == RB_CENTER) {
@@ -1870,8 +1968,33 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
pass = tmp2;
}
}
+
+ if (obuf->bottom_margin > 0) {
+ int i;
+ struct html_feed_environ h;
+ struct readbuffer o;
+ struct environment e[1];
+
+ init_henv(&h, &o, e, 1, NULL, width, indent);
+ o.line = Strnew_size(width + 20);
+ o.pos = obuf->pos;
+ o.flag = obuf->flag;
+ o.top_margin = -1;
+ o.bottom_margin = -1;
+ Strcat_charp(o.line, "<pre_int>");
+ for (i = 0; i < o.pos; i++)
+ Strcat_char(o.line, ' ');
+ Strcat_charp(o.line, "</pre_int>");
+ for (i = 0; i < obuf->bottom_margin; i++)
+ flushline(h_env, &o, indent, force, width);
+ }
+ if (obuf->top_margin < 0 || obuf->bottom_margin < 0)
+ return;
+
obuf->line = Strnew_size(256);
obuf->pos = 0;
+ obuf->top_margin = 0;
+ obuf->bottom_margin = 0;
obuf->prevchar = ' ';
obuf->bp.init_flag = 1;
obuf->flag &= ~RB_NFLUSHED;
@@ -1886,17 +2009,17 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
if (obuf->anchor_hseq > 0)
obuf->anchor_hseq = -obuf->anchor_hseq;
tmp = Sprintf("<A HSEQ=\"%d\" HREF=\"", obuf->anchor_hseq);
- Strcat_charp(tmp, htmlquote_str(obuf->anchor->ptr));
+ Strcat_charp(tmp, html_quote(obuf->anchor->ptr));
if (obuf->anchor_target) {
Strcat_charp(tmp, "\" TARGET=\"");
- Strcat_charp(tmp, htmlquote_str(obuf->anchor_target->ptr));
+ Strcat_charp(tmp, html_quote(obuf->anchor_target->ptr));
}
Strcat_charp(tmp, "\">");
push_tag(obuf, tmp->ptr, HTML_A);
}
if (!hidden_img && obuf->img_alt) {
Str tmp = Strnew_charp("<IMG_ALT SRC=\"");
- Strcat_charp(tmp, htmlquote_str(obuf->img_alt->ptr));
+ Strcat_charp(tmp, html_quote(obuf->img_alt->ptr));
Strcat_charp(tmp, "\">");
push_tag(obuf, tmp->ptr, HTML_IMG_ALT);
}
@@ -2072,23 +2195,15 @@ process_img(struct parsed_tag * tag)
tmp = Strnew_size(128);
if (r) {
r2 = strchr(r, '#');
-#ifdef NEW_FORM
s = "<form_int method=internal action=map>";
process_form(parse_tag(&s, TRUE));
Strcat(tmp, Sprintf("<pre_int><input_alt fid=\"%d\" "
"type=hidden name=link value=\"",
cur_form_id));
- Strcat_charp(tmp, htmlquote_str((r2) ? r2 + 1 : r));
+ Strcat_charp(tmp, html_quote((r2) ? r2 + 1 : r));
Strcat(tmp, Sprintf("\"><input_alt hseq=\"%d\" fid=\"%d\" "
"type=submit no_effect=true>",
cur_hseq++, cur_form_id));
-#else /* not NEW_FORM */
- Strcat_charp(tmp, "<form_int method=internal action=map>"
- "<pre_int><input_alt type=hidden name=link value=\"");
- Strcat_charp(tmp, htmlquote_str((r2) ? r2 + 1 : r));
- Strcat(tmp, Sprintf("\"><input_alt hseq=\"%d\" type=submit "
- "no_effect=true>", cur_hseq++));
-#endif /* not NEW_FORM */
}
if (q != NULL && *q == '\0' && ignore_null_img_alt)
q = NULL;
@@ -2096,10 +2211,10 @@ process_img(struct parsed_tag * tag)
Strcat_charp(tmp, "<img_alt src=\"");
else
Strcat_charp(tmp, "<nobr><img_alt src=\"");
- Strcat_charp(tmp, htmlquote_str(p));
+ Strcat_charp(tmp, html_quote(p));
Strcat_charp(tmp, "\">");
if (q != NULL) {
- Strcat_charp(tmp, htmlquote_str(q));
+ Strcat_charp(tmp, html_quote(q));
Strcat_charp(tmp, "</img_alt> ");
goto img_end2;
}
@@ -2125,7 +2240,7 @@ process_img(struct parsed_tag * tag)
if (w > 200 && i < 13) {
/* must be a horizontal line */
#ifndef KANJI_SYMBOLS
- Strcat_charp(tmp, "<_RULE>");
+ Strcat_charp(tmp, "<_RULE TYPE=10>");
#endif /* not KANJI_SYMBOLS */
w /= pixel_per_char;
for (i = 0; i < w - (HR_RULE_WIDTH - 1); i += HR_RULE_WIDTH)
@@ -2160,12 +2275,8 @@ process_img(struct parsed_tag * tag)
Strcat_charp(tmp, "</nobr>");
img_end2:
if (r) {
-#ifdef NEW_FORM
Strcat_charp(tmp, "</input_alt></pre_int>");
process_n_form();
-#else /* not NEW_FORM */
- Strcat_charp(tmp, "</input_alt></pre_int></form_int>");
-#endif /* not NEW_FORM */
}
return tmp;
}
@@ -2187,7 +2298,7 @@ process_anchor(struct parsed_tag * tag, char *tagbuf)
Str
process_input(struct parsed_tag * tag)
{
- int i, w, v, x, y;
+ int i, w, v, x, y, z;
char *q , *p, *r, *p2;
Str tmp;
char *qq = "";
@@ -2207,6 +2318,7 @@ process_input(struct parsed_tag * tag)
parsedtag_get_value(tag, ATTR_ALT, &p2);
x = parsedtag_exists(tag, ATTR_CHECKED);
y = parsedtag_exists(tag, ATTR_ACCEPT);
+ z = parsedtag_exists(tag, ATTR_READONLY);
v = formtype(p);
if (v == FORM_UNKNOWN)
@@ -2223,7 +2335,7 @@ process_input(struct parsed_tag * tag)
q = "RESET";
break;
/* if no VALUE attribute is specified in * <INPUT
- * TYPE=CHECHBOX> tag, then the value "on" is used * as a
+ * TYPE=CHECKBOX> tag, then the value "on" is used * as a
* default value. It is not a part of HTML4.0 * specification,
* but an imitation of Netscape * behaviour. */
case FORM_INPUT_CHECKBOX:
@@ -2234,7 +2346,7 @@ process_input(struct parsed_tag * tag)
if (v == FORM_INPUT_FILE)
q = NULL;
if (q) {
- qq = htmlquote_str(q);
+ qq = html_quote(q);
qlen = strlen(q);
}
@@ -2249,20 +2361,16 @@ process_input(struct parsed_tag * tag)
case FORM_INPUT_RADIO:
Strcat_char(tmp, '(');
}
-#ifdef NEW_FORM
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s "
"name=\"%s\" width=%d maxlength=%d value=\"%s\"",
cur_hseq++, cur_form_id,
- p, htmlquote_str(r), w, i, qq));
-#else /* not NEW_FORM */
- Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" type=%s "
- "name=\"%s\" width=%d maxlength=%d value=\"%s\"",
- cur_hseq++, p, htmlquote_str(r), w, i, qq));
-#endif /* not NEW_FORM */
+ p, html_quote(r), w, i, qq));
if (x)
Strcat_charp(tmp, " checked");
if (y)
Strcat_charp(tmp, " accept");
+ if (z)
+ Strcat_charp(tmp, " readonly");
Strcat_char(tmp, '>');
if (v == FORM_INPUT_HIDDEN)
@@ -2304,7 +2412,7 @@ process_input(struct parsed_tag * tag)
case FORM_INPUT_SUBMIT:
case FORM_INPUT_BUTTON:
if (p2) {
- Strcat_charp(tmp, htmlquote_str(p2));
+ Strcat_charp(tmp, html_quote(p2));
i = strlen(p2);
}
else {
@@ -2363,17 +2471,15 @@ process_select(struct parsed_tag * tag)
select_is_multiple = parsedtag_exists(tag, ATTR_MULTIPLE);
#ifdef MENU_SELECT
- if (!select_is_multiple && n_select < MAX_SELECT) {
-#ifdef NEW_FORM
+ if (!select_is_multiple) {
select_str = Sprintf("<pre_int>[<input_alt hseq=\"%d\" "
"fid=\"%d\" type=select name=\"%s\" selectnumber=%d",
- cur_hseq++, cur_form_id, htmlquote_str(p), n_select);
-#else /* not NEW_FORM */
- select_str = Sprintf("<pre_int><input_alt hseq=\"%d\" "
- "type=select name=\"%s\" selectnumber=%d",
- cur_hseq++, htmlquote_str(p), n_select);
-#endif /* not NEW_FORM */
+ cur_hseq++, cur_form_id, html_quote(p), n_select);
Strcat_charp(select_str, ">");
+ if (n_select == max_select) {
+ max_select *= 2;
+ select_option = New_Reuse(FormSelectOption, select_option, max_select);
+ }
select_option[n_select].first = NULL;
select_option[n_select].last = NULL;
cur_option_maxwidth = 0;
@@ -2392,16 +2498,14 @@ process_n_select(void)
return NULL;
process_option();
#ifdef MENU_SELECT
- if (!select_is_multiple && n_select < MAX_SELECT) {
- if (select_option[n_select].first)
- Strcat(select_str, textfieldrep(chooseSelectOption(
- select_option[n_select].first, CHOOSE_OPTION),
- cur_option_maxwidth));
+ if (!select_is_multiple) {
+ if (select_option[n_select].first) {
+ FormItemList sitem;
+ chooseSelectOption(&sitem, select_option[n_select].first);
+ Strcat(select_str, textfieldrep(sitem.label, cur_option_maxwidth));
+ }
Strcat_charp(select_str, "</input_alt>]</pre_int>");
n_select++;
- if (n_select == MAX_SELECT) {
- disp_err_message("Too many select in one page", FALSE);
- }
} else
#endif /* MENU_SELECT */
Strcat_charp(select_str, "<br>");
@@ -2489,7 +2593,7 @@ process_option(void)
if (cur_option_label == NULL)
cur_option_label = cur_option;
#ifdef MENU_SELECT
- if (!select_is_multiple && n_select < MAX_SELECT) {
+ if (!select_is_multiple) {
if (cur_option_label->length > cur_option_maxwidth)
cur_option_maxwidth = cur_option_label->length;
addSelectOption(&select_option[n_select],
@@ -2499,7 +2603,6 @@ process_option(void)
return;
}
#endif /* MENU_SELECT */
-#ifdef NEW_FORM
if (!select_is_multiple) {
begin_char = '(';
end_char = ')';
@@ -2507,22 +2610,15 @@ process_option(void)
Strcat(select_str, Sprintf("<br><pre_int>%c<input_alt hseq=\"%d\" "
"fid=\"%d\" type=%s name=\"%s\" value=\"%s\"",
begin_char, cur_hseq++, cur_form_id,
-#else /* not NEW_FORM */
- Strcat(select_str, Sprintf("<br><pre_int><input_alt hseq=\"%d\" "
- "type=%s name=\"%s\" value=\"%s\"",
- cur_hseq++,
-#endif /* not NEW_FORM */
select_is_multiple ? "checkbox" : "radio",
- htmlquote_str(cur_select->ptr),
- htmlquote_str(cur_option_value->ptr)));
+ html_quote(cur_select->ptr),
+ html_quote(cur_option_value->ptr)));
if (cur_option_selected)
Strcat_charp(select_str, " checked>*</input_alt>");
else
Strcat_charp(select_str, "> </input_alt>");
-#ifdef NEW_FORM
Strcat_char(select_str, end_char);
-#endif /* not NEW_FORM */
- Strcat_charp(select_str, htmlquote_str(cur_option_label->ptr));
+ Strcat_charp(select_str, html_quote(cur_option_label->ptr));
Strcat_charp(select_str, "</pre_int>");
n_selectitem++;
}
@@ -2530,25 +2626,32 @@ process_option(void)
Str
process_textarea(struct parsed_tag * tag, int width)
{
- char *p, *q, *r;
-
- p = "40";
- parsedtag_get_value(tag, ATTR_COLS, &p);
- q = "";
- parsedtag_get_value(tag, ATTR_NAME, &q);
- r = "10";
- parsedtag_get_value(tag, ATTR_ROWS, &r);
- cur_textarea = Strnew_charp(q);
- cur_textarea_size = atoi(p);
- if (p[strlen(p) - 1] == '%') {
- cur_textarea_size = width * cur_textarea_size / 100 - 2;
- }
- if (cur_textarea_size <= 0)
- cur_textarea_size = 40;
+ char *p;
- cur_textarea_rows = atoi(r);
- if (n_textarea < MAX_TEXTAREA)
- textarea_str[n_textarea] = Strnew();
+ p = "";
+ parsedtag_get_value(tag, ATTR_NAME, &p);
+ cur_textarea = Strnew_charp(p);
+ cur_textarea_size = 20;
+ if (parsedtag_get_value(tag, ATTR_COLS, &p)) {
+ cur_textarea_size = atoi(p);
+ if (p[strlen(p) - 1] == '%')
+ cur_textarea_size = width * cur_textarea_size / 100 - 2;
+ if (cur_textarea_size <= 0)
+ cur_textarea_size = 20;
+ }
+ cur_textarea_rows = 1;
+ if (parsedtag_get_value(tag, ATTR_ROWS, &p)) {
+ cur_textarea_rows = atoi(p);
+ if (cur_textarea_rows <= 0)
+ cur_textarea_rows = 1;
+ }
+ cur_textarea_readonly = parsedtag_exists(tag, ATTR_READONLY);
+ if (n_textarea >= max_textarea) {
+ max_textarea *= 2;
+ textarea_str = New_Reuse(Str, textarea_str, max_textarea);
+ }
+ textarea_str[n_textarea] = Strnew();
+ ignore_nl_textarea = TRUE;
return NULL;
}
@@ -2557,29 +2660,27 @@ Str
process_n_textarea(void)
{
Str tmp;
+ int i;
- if (cur_textarea == NULL || n_textarea >= MAX_TEXTAREA)
+ if (cur_textarea == NULL)
return NULL;
-#ifdef NEW_FORM
- tmp = Sprintf("<pre_int>[<input_alt hseq=\"%d\" fid=\"%d\" type=textarea "
- "name=\"%s\" size=%d rows=%d textareanumber=%d><u>",
- cur_hseq++, cur_form_id, htmlquote_str(cur_textarea->ptr),
- cur_textarea_size, cur_textarea_rows, n_textarea);
-#else /* not NEW_FORM */
- tmp = Sprintf("<pre_int>[<input_alt hseq=\"%d\" type=textarea "
- "name=\"%s\" size=%d rows=%d textareanumber=%d><u>",
- cur_hseq++, htmlquote_str(cur_textarea->ptr),
- cur_textarea_size, cur_textarea_rows, n_textarea);
-#endif /* not NEW_FORM */
- Strcat(tmp, textfieldrep(textarea_str[n_textarea], cur_textarea_size));
- Strcat_charp(tmp, "</u></input_alt>]</pre_int>");
+ tmp = Strnew();
+ Strcat(tmp, Sprintf("<pre_int>[<input_alt hseq=\"%d\" fid=\"%d\" "
+ "type=textarea name=\"%s\" size=%d rows=%d "
+ "top_margin=%d textareanumber=%d",
+ cur_hseq, cur_form_id,
+ html_quote(cur_textarea->ptr),
+ cur_textarea_size, cur_textarea_rows,
+ cur_textarea_rows - 1, n_textarea));
+ if (cur_textarea_readonly)
+ Strcat_charp(tmp, " readonly");
+ Strcat_charp(tmp, "><u>");
+ for (i = 0; i < cur_textarea_size; i++)
+ Strcat_char(tmp, ' ');
+ Strcat_charp(tmp, "</u></input_alt>]</pre_int>\n");
+ cur_hseq++;
n_textarea++;
- if (n_textarea == MAX_TEXTAREA) {
- disp_err_message("Too many textarea in one page", FALSE);
- }
- else
- textarea_str[n_textarea] = Strnew();
cur_textarea = NULL;
return tmp;
@@ -2588,17 +2689,23 @@ process_n_textarea(void)
void
feed_textarea(char *str)
{
- if (n_textarea < MAX_TEXTAREA) {
- while (*str) {
- if (*str == '&')
- Strcat_charp(textarea_str[n_textarea], getescapecmd(&str));
- else if (*str == '\n') {
- Strcat_charp(textarea_str[n_textarea], "\r\n");
- str++;
- }
- else
- Strcat_char(textarea_str[n_textarea], *(str++));
- }
+ if (cur_textarea == NULL)
+ return;
+ if (ignore_nl_textarea) {
+ if (*str == '\r')
+ str++;
+ if (*str == '\n')
+ str++;
+ }
+ ignore_nl_textarea = FALSE;
+ while (*str) {
+ if (*str == '&')
+ Strcat_charp(textarea_str[n_textarea], getescapecmd(&str));
+ else if (*str == '\n') {
+ Strcat_charp(textarea_str[n_textarea], "\r\n");
+ str++;
+ } else if (*str != '\r')
+ Strcat_char(textarea_str[n_textarea], *(str++));
}
}
@@ -2629,7 +2736,7 @@ process_hr(struct parsed_tag *tag, int width, int indent_width)
break;
}
#ifndef KANJI_SYMBOLS
- Strcat_charp(tmp, "<_RULE>");
+ Strcat_charp(tmp, "<_RULE TYPE=10>");
#endif /* not KANJI_SYMBOLS */
w -= HR_RULE_WIDTH - 1;
if (w <= 0)
@@ -2644,9 +2751,8 @@ process_hr(struct parsed_tag *tag, int width, int indent_width)
return tmp;
}
-#ifdef NEW_FORM
#ifdef JP_CHARSET
-char
+static char
check_charset(char *s)
{
switch (*s) {
@@ -2663,7 +2769,7 @@ check_charset(char *s)
return 0;
}
-char
+static char
check_accept_charset(char *s)
{
char *e;
@@ -2684,12 +2790,12 @@ check_accept_charset(char *s)
}
return 0;
}
-#endif
+#endif /* JP_CHARSET */
Str
process_form(struct parsed_tag *tag)
{
- char *p, *q, *r, *s, *tg;
+ char *p, *q, *r, *s, *tg, *n;
char cs = 0;
p = "get";
@@ -2702,17 +2808,19 @@ process_form(struct parsed_tag *tag)
cs = check_accept_charset(r);
if (! cs && parsedtag_get_value(tag, ATTR_CHARSET, &r))
cs = check_charset(r);
-#endif
+#endif /*JP_CHARSET */
s = NULL;
parsedtag_get_value(tag, ATTR_ENCTYPE, &s);
tg = NULL;
parsedtag_get_value(tag, ATTR_TARGET, &tg);
+ n = NULL;
+ parsedtag_get_value(tag, ATTR_NAME, &n);
form_max++;
form_sp++;
if (forms_size == 0) {
forms_size = INITIAL_FORM_SIZE;
forms = New_N(FormList *, forms_size);
- form_stack = New_N(int, forms_size);
+ form_stack = NewAtom_N(int, forms_size);
}
else if (forms_size <= form_max) {
forms_size += form_max;
@@ -2720,7 +2828,7 @@ process_form(struct parsed_tag *tag)
form_stack = New_Reuse(int, form_stack, forms_size);
}
forms[form_max] =
- newFormList(q, p, &cs, s, tg, (form_max > 0) ? forms[form_max - 1] : NULL);
+ newFormList(q, p, &cs, s, tg, n, (form_max > 0) ? forms[form_max - 1] : NULL);
form_stack[form_sp] = form_max;
return NULL;
@@ -2733,7 +2841,6 @@ process_n_form(void)
form_sp--;
return NULL;
}
-#endif /* NEW_FORM */
static void
clear_ignore_p_flag(int cmd, struct readbuffer *obuf)
@@ -2795,9 +2902,9 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag)
return;
if (framename)
idtag = Sprintf("<_id id=\"%s\" framename=\"%s\">",
- htmlquote_str(id), htmlquote_str(framename));
+ html_quote(id), html_quote(framename));
else
- idtag = Sprintf("<_id id=\"%s\">", htmlquote_str(id));
+ idtag = Sprintf("<_id id=\"%s\">", html_quote(id));
push_tag(obuf, idtag->ptr, HTML_NOP);
}
#endif /* ID_EXT */
@@ -2970,8 +3077,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
if (cmd == HTML_UL)
envs[h_env->envc].type = ul_type(tag, 0);
- if (cmd == HTML_BLQ)
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
return 1;
case HTML_N_UL:
case HTML_N_OL:
@@ -3129,13 +3235,13 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
append_tags(obuf);
tmp = Strnew_charp(obuf->line->ptr);
Strremovetrailingspaces(tmp);
- h_env->title = cleanup_str(tmp->ptr);
+ h_env->title = html_unquote(tmp->ptr);
obuf->line = save_line;
obuf->prevchar = save_prevchar;
back_to_breakpoint(obuf);
tmp = Strnew_m_charp(
"<title_alt title=\"",
- htmlquote_str(h_env->title),
+ html_quote(h_env->title),
"\">",
NULL);
push_tag(obuf, tmp->ptr, HTML_TITLE_ALT);
@@ -3156,11 +3262,11 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
parsedtag_get_value(tag, ATTR_SRC, &q);
parsedtag_get_value(tag, ATTR_NAME, &r);
if (q) {
- q = htmlquote_str(q);
+ q = html_quote(q);
push_tag(obuf, Sprintf("<a hseq=\"%d\" href=\"%s\">",
cur_hseq++, q)->ptr, HTML_A);
if (r)
- q = htmlquote_str(r);
+ q = html_quote(r);
push_charp(obuf, strlen(q), q, PC_ASCII);
push_tag(obuf, "</a>", HTML_N_A);
}
@@ -3292,6 +3398,18 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->img_alt = NULL;
}
return 1;
+ case HTML_INPUT_ALT:
+ i = 0;
+ if (parsedtag_get_value(tag, ATTR_TOP_MARGIN, &i)) {
+ if (i > obuf->top_margin)
+ obuf->top_margin = i;
+ }
+ i = 0;
+ if (parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &i)) {
+ if (i > obuf->bottom_margin)
+ obuf->bottom_margin = i;
+ }
+ return 0;
case HTML_TABLE:
obuf->table_level++;
if (obuf->table_level >= MAX_TABLE)
@@ -3371,20 +3489,13 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
RB_RESTORE_FLAG(obuf);
return 1;
case HTML_FORM:
-#ifdef NEW_FORM
case HTML_FORM_INT:
process_form(tag);
return 1;
-#endif /* NEW_FORM */
case HTML_N_FORM:
-#ifdef NEW_FORM
case HTML_N_FORM_INT:
process_n_form();
return 1;
-#else /* not NEW_FORM */
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
- return 0;
-#endif /* not NEW_FORM */
case HTML_INPUT:
tmp = process_input(tag);
if (tmp)
@@ -3416,9 +3527,9 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
parsedtag_get_value(tag, ATTR_PROMPT, &p);
parsedtag_get_value(tag, ATTR_ACTION, &q);
tmp = Strnew_m_charp("<form method=get action=\"",
- htmlquote_str(q),
+ html_quote(q),
"\">",
- htmlquote_str(p),
+ html_quote(p),
"<input type=text name=\"\" accept></form>",
NULL);
HTMLlineproc1(tmp->ptr, h_env);
@@ -3435,7 +3546,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (*q == '=') {
q++;
SKIP_BLANKS(q);
- content_charset = guess_charset(q);
+ meta_charset = guess_charset(q);
}
}
else
@@ -3469,7 +3580,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
q++;
}
if (s_tmp) {
- q = htmlquote_str(s_tmp->ptr);
+ q = html_quote(s_tmp->ptr);
tmp = Sprintf("Refresh (%d sec) <a hseq=\"%d\" href=\"%s\">%s</a>",
refresh, cur_hseq++, q, q);
push_str(obuf, s_tmp->length, tmp, PC_ASCII);
@@ -3507,7 +3618,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (view_unseenobject) {
if (parsedtag_get_value(tag, ATTR_SRC, &p)) {
Str s;
- q = htmlquote_str(p);
+ q = html_quote(p);
s = Sprintf("<A HREF=\"%s\">bgsound(%s)</A>", q, q);
HTMLlineproc1(s->ptr, h_env);
}
@@ -3517,7 +3628,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (view_unseenobject) {
if (parsedtag_get_value(tag, ATTR_SRC, &p)) {
Str s;
- q = htmlquote_str(p);
+ q = html_quote(p);
s = Sprintf("<A HREF=\"%s\">embed(%s)</A>", q, q);
HTMLlineproc1(s->ptr, h_env);
}
@@ -3527,7 +3638,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (view_unseenobject) {
if (parsedtag_get_value(tag, ATTR_ARCHIVE, &p)) {
Str s;
- q = htmlquote_str(p);
+ q = html_quote(p);
s = Sprintf("<A HREF=\"%s\">applet archive(%s)</A>", q, q);
HTMLlineproc1(s->ptr, h_env);
}
@@ -3539,7 +3650,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (view_unseenobject) {
if (parsedtag_get_value(tag, ATTR_BACKGROUND, &p)) {
Str s;
- q = htmlquote_str(p);
+ q = html_quote(p);
s = Sprintf("<IMG SRC=\"%s\" ALT=\"bg image(%s)\"><BR>",
q, q);
HTMLlineproc1(s->ptr, h_env);
@@ -3579,9 +3690,6 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
Anchor *a_href = NULL, *a_img = NULL, *a_form = NULL;
char outc[LINELEN];
char *p, *q, *r, *str;
-#ifndef NEW_FORM
- char cs;
-#endif
Lineprop outp[LINELEN], mode, effect;
int pos;
int nlines;
@@ -3594,15 +3702,16 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
int hseq;
Str line;
char *endp;
+#ifndef KANJI_SYMBOLS
+ char rule;
+#endif
if (w3m_debug)
debug = fopen("zzzerr", "a");
effect = 0;
nlines = 0;
-#ifdef NEW_FORM
buf->formlist = (form_max >= 0) ? forms[form_max] : NULL;
-#endif /* NEW_FORM */
while ((line = feed()) != NULL) {
if (w3m_debug) {
Strfputs(line, debug);
@@ -3626,8 +3735,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
while (str < endp && pos < LINELEN) {
mode = get_mctype(str);
#ifndef KANJI_SYMBOLS
- if (effect & PC_RULE && IS_INTSPACE(*str)) {
- PPUSH(PC_ASCII | effect, *str);
+ if (effect & PC_RULE && *str != '<') {
+ PPUSH(PC_ASCII | effect, rule | 0x80);
str++;
} else
#endif
@@ -3686,21 +3795,30 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
break;
case HTML_A:
if (renderFrameSet &&
- parsedtag_get_value(tag, ATTR_FRAMENAME, &p) &&
- (!idFrame || strcmp(idFrame->body->name, p))) {
- idFrame = search_frame(renderFrameSet, p);
- if (idFrame && idFrame->body->attr != F_BODY)
- idFrame = NULL;
+ parsedtag_get_value(tag, ATTR_FRAMENAME, &p)) {
+ p = url_quote_conv(p, buf->document_code);
+ if (!idFrame || strcmp(idFrame->body->name, p)) {
+ idFrame = search_frame(renderFrameSet, p);
+ if (idFrame && idFrame->body->attr != F_BODY)
+ idFrame = NULL;
+ }
}
p = r = NULL;
q = buf->baseTarget;
hseq = 0;
id = NULL;
- if (parsedtag_get_value(tag, ATTR_NAME, &id))
+ if (parsedtag_get_value(tag, ATTR_NAME, &id)) {
+ id = url_quote_conv(id, buf->document_code);
registerName(buf, id, currentLn(buf), pos);
- parsedtag_get_value(tag, ATTR_HREF, &p);
- parsedtag_get_value(tag, ATTR_TARGET, &q);
- parsedtag_get_value(tag, ATTR_REFERER, &r);
+ }
+ if (parsedtag_get_value(tag, ATTR_HREF, &p)) {
+ p = remove_space(p);
+ p = url_quote_conv(p, buf->document_code);
+ }
+ if (parsedtag_get_value(tag, ATTR_TARGET, &q))
+ q = url_quote_conv(q, buf->document_code);
+ if (parsedtag_get_value(tag, ATTR_REFERER, &r))
+ r = url_quote_conv(r, buf->document_code);
parsedtag_get_value(tag, ATTR_HSEQ, &hseq);
if (hseq > 0)
buf->hmarklist =
@@ -3735,6 +3853,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
break;
case HTML_IMG_ALT:
if (parsedtag_get_value(tag, ATTR_SRC, &p)) {
+ p = remove_space(p);
+ p = url_quote_conv(p, buf->document_code);
a_img = registerImg(buf, p,
currentLn(buf), pos);
}
@@ -3751,28 +3871,17 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
case HTML_INPUT_ALT:
{
FormList *form;
-#ifdef NEW_FORM
+ int top = 0, bottom = 0;
int form_id = -1;
-#endif /* NEW_FORM */
-#ifndef NEW_FORM
- if (form_sp < 0)
- break; /* outside of <form>..</form> */
-#endif /* not NEW_FORM */
hseq = 0;
parsedtag_get_value(tag, ATTR_HSEQ, &hseq);
-#ifdef NEW_FORM
parsedtag_get_value(tag, ATTR_FID, &form_id);
-#endif
-#ifdef NEW_FORM
+ parsedtag_get_value(tag, ATTR_TOP_MARGIN, &top);
+ parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &bottom);
if (form_id < 0 || form_id > form_max || forms == NULL)
break; /* outside of <form>..</form> */
form = forms[form_id];
-#else /* not NEW_FORM */
- if (form_sp >= FORMSTACK_SIZE)
- break;
- form = form_stack[form_sp];
-#endif /* not NEW_FORM */
if (hseq > 0) {
int hpos = pos;
if (*str == '[')
@@ -3784,7 +3893,9 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
form->target = buf->baseTarget;
a_form = registerForm(buf, form, tag, currentLn(buf), pos);
if (a_form) {
- a_form->hseq = hseq - 1;
+ a_form->hseq = hseq - 1;
+ a_form->y = currentLn(buf) - top;
+ a_form->rows = 1 + top + bottom;
if (!parsedtag_exists(tag, ATTR_NO_EFFECT))
effect |= PE_FORM;
break;
@@ -3801,32 +3912,6 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
}
a_form = NULL;
break;
-#ifndef NEW_FORM
- case HTML_FORM:
- case HTML_FORM_INT:
- form_sp++;
- if (form_sp >= FORMSTACK_SIZE)
- break;
- p = "get";
- q = "/";
- s = NULL;
- cs = 0;
- parsedtag_get_value(tag, ATTR_METHOD, &p);
- parsedtag_get_value(tag, ATTR_ACTION, &q);
-#ifdef JP_CHARSET
- if (parsedtag_get_value(tag, ATTR_CHARSET, &r))
- cs = check_charset(r);
-#endif
- parsedtag_get_value(tag, ATTR_ENCTYPE, &s);
- buf->formlist = newFormList(q, p, &cs, s, buf->formlist);
- form_stack[form_sp] = buf->formlist;
- break;
- case HTML_N_FORM:
- case HTML_N_FORM_INT:
- if (form_sp >= 0)
- form_sp--;
- break;
-#endif /* not NEW_FORM */
case HTML_MAP:
if (parsedtag_get_value(tag, ATTR_NAME, &p)) {
MapList *m = New(MapList);
@@ -3845,6 +3930,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
* <map>..</map> */
break;
if (parsedtag_get_value(tag, ATTR_HREF, &p)) {
+ p = remove_space(p);
+ p = url_quote_conv(p, buf->document_code);
pushText(buf->maplist->urls, p);
if (parsedtag_get_value(tag, ATTR_ALT, &q))
pushText(buf->maplist->alts, q);
@@ -3864,7 +3951,7 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
buf->frameset = frameset_s[frameset_sp];
}
else
- pushFrameTree(&(buf->frameQ), frameset_s[frameset_sp], 0, 0);
+ pushFrameTree(&(buf->frameQ), frameset_s[frameset_sp], NULL);
}
else
addFrameSetElement(frameset_s[frameset_sp - 1],
@@ -3878,25 +3965,30 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
if (frameset_sp >= 0 && frameset_sp < FRAMESTACK_SIZE) {
union frameset_element element;
- element.body = newFrame(tag, baseURL(buf));
+ element.body = newFrame(tag, buf);
addFrameSetElement(frameset_s[frameset_sp], element);
}
break;
case HTML_BASE:
if (parsedtag_get_value(tag, ATTR_HREF, &p)) {
+ p = remove_space(p);
+ p = url_quote_conv(p, buf->document_code);
if (!buf->baseURL)
buf->baseURL = New(ParsedURL);
parseURL(p, buf->baseURL, NULL);
}
- parsedtag_get_value(tag, ATTR_TARGET, &buf->baseTarget);
+ if (parsedtag_get_value(tag, ATTR_TARGET, &p))
+ buf->baseTarget = url_quote_conv(p, buf->document_code);
break;
case HTML_TITLE_ALT:
if (parsedtag_get_value(tag, ATTR_TITLE, &p))
- buf->buffername = cleanup_str(p);
+ buf->buffername = html_unquote(p);
break;
#ifndef KANJI_SYMBOLS
case HTML_RULE:
effect |= PC_RULE;
+ if (parsedtag_get_value(tag, ATTR_TYPE, &p))
+ rule = (char)atoi(p);
break;
case HTML_N_RULE:
effect &= ~PC_RULE;
@@ -3905,14 +3997,18 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
}
#ifdef ID_EXT
id = NULL;
- if (parsedtag_get_value(tag, ATTR_ID, &id))
+ if (parsedtag_get_value(tag, ATTR_ID, &id)) {
+ id = url_quote_conv(id, buf->document_code);
registerName(buf, id, currentLn(buf), pos);
+ }
if (renderFrameSet &&
- parsedtag_get_value(tag, ATTR_FRAMENAME, &p) &&
- (!idFrame || strcmp(idFrame->body->name, p))) {
- idFrame = search_frame(renderFrameSet, p);
- if (idFrame && idFrame->body->attr != F_BODY)
- idFrame = NULL;
+ parsedtag_get_value(tag, ATTR_FRAMENAME, &p)) {
+ p = url_quote_conv(p, buf->document_code);
+ if (!idFrame || strcmp(idFrame->body->name, p)) {
+ idFrame = search_frame(renderFrameSet, p);
+ if (idFrame && idFrame->body->attr != F_BODY)
+ idFrame = NULL;
+ }
}
if (id && idFrame)
idFrame->body->nameList =
@@ -3938,6 +4034,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
}
if (w3m_debug)
fclose(debug);
+ if (n_textarea)
+ addMultirowsForm(buf, buf->formitem);
}
void
@@ -3974,16 +4072,17 @@ proc_escape(struct readbuffer *obuf, char **str_return)
char *str = *str_return, *estr;
int ech = getescapechar(str_return);
int width, n_add = *str_return - str;
- Lineprop mode = IS_CNTRL(ech) ? PC_CTRL : PC_ASCII;
+ Lineprop mode;
- if (!ech) {
+ if (ech < 0) {
*str_return = str;
proc_mchar(obuf, obuf->flag & RB_SPECIAL, 1, str_return, PC_ASCII);
return;
}
+ mode = IS_CNTRL(ech) ? PC_CTRL : PC_ASCII;
check_breakpoint(obuf, obuf->flag & RB_SPECIAL, ech);
- estr = conv_latin1(ech);
+ estr = conv_entity(ech);
width = strlen(estr);
if (width == 1 && ech == (unsigned char) *estr &&
ech != '&' && ech != '<' && ech != '>')
@@ -3999,7 +4098,7 @@ static int
need_flushline(struct html_feed_environ *h_env, struct readbuffer *obuf,
Lineprop mode)
{
- char ch = Strlastchar(obuf->line);
+ char ch;
if (obuf->flag & RB_PRE_INT) {
if (obuf->pos > h_env->limit)
@@ -4008,6 +4107,7 @@ need_flushline(struct html_feed_environ *h_env, struct readbuffer *obuf,
return 0;
}
+ ch = Strlastchar(obuf->line);
/* if (ch == ' ' && obuf->tag_sp > 0) */
if (ch == ' ')
return 0;
@@ -4040,7 +4140,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
struct readbuffer *obuf = h_env->obuf;
int indent, delta;
struct parsed_tag *tag;
- Str tokbuf = Strnew();
+ Str tokbuf;
struct table *tbl = NULL;
struct table_mode *tbl_mode;
int tbl_width;
@@ -4067,6 +4167,8 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
return;
}
+ tokbuf = Strnew();
+
table_start:
if (obuf->table_level >= 0) {
int level = min(obuf->table_level, MAX_TABLE - 1);
@@ -4120,6 +4222,12 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
if (ST_IS_REAL_TAG(obuf->status))
Strcat_char(h_env->tagbuf, ' ');
}
+ if ((obuf->flag & RB_IGNORE) &&
+ ! TAG_IS(h_env->tagbuf->ptr, obuf->ignore_tag->ptr,
+ obuf->ignore_tag->length - 1))
+ /* within ignored tag, such as *
+ * <script>..</script>, don't process tag. */
+ obuf->status = R_ST_NORMAL;
continue;
}
is_tag = TRUE;
@@ -4263,9 +4371,21 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
mode = get_mctype(str);
delta = get_mclen(mode);
if (obuf->flag & (RB_SPECIAL & ~RB_NOBR)) {
- if (*str != '\n')
+ char ch = *str;
+ if (! (obuf->flag & RB_PLAINMODE) && (*str == '&')) {
+ char *p = str;
+ int ech = getescapechar(&p);
+ if (ech == '\n' || ech == '\r') {
+ ch = '\n';
+ str = p - 1;
+ } else if (ech == '\t') {
+ ch = '\t';
+ str = p - 1;
+ }
+ }
+ if (ch != '\n')
obuf->flag &= ~RB_IGNORE_P;
- if (*str == '\n') {
+ if (ch == '\n') {
str++;
if (obuf->flag & RB_IGNORE_P) {
obuf->flag &= ~RB_IGNORE_P;
@@ -4276,14 +4396,14 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
else
flushline(h_env, obuf, h_env->envs[h_env->envc].indent, 1, h_env->limit);
}
- else if (*str == '\t') {
+ else if (ch == '\t') {
do {
PUSH(' ');
} while (obuf->pos % Tabstop != 0);
str++;
}
else if (obuf->flag & RB_PLAINMODE) {
- char *p = htmlquote_char(*str);
+ char *p = html_quote_char(*str);
if (p) {
push_charp(obuf, 1, p, PC_ASCII);
str++;
@@ -4416,7 +4536,7 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
l->next = NULL;
if (pos > 0) {
l->lineBuf = allocStr(line, pos);
- l->propBuf = New_N(Lineprop, pos);
+ l->propBuf = NewAtom_N(Lineprop, pos);
bcopy((void *) prop, (void *) l->propBuf, pos * sizeof(Lineprop));
}
else {
@@ -4425,7 +4545,7 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
}
#ifdef ANSI_COLOR
if (pos > 0 && color) {
- l->colorBuf = New_N(Linecolor, pos);
+ l->colorBuf = NewAtom_N(Linecolor, pos);
bcopy((void *) color, (void *) l->colorBuf, pos * sizeof(Linecolor));
} else {
l->colorBuf = NULL;
@@ -4447,7 +4567,8 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
buf->firstLine = l;
l->linenumber = ++buf->allLine;
if (nlines < 0) {
- l->real_linenumber = l->linenumber;
+/* l->real_linenumber = l->linenumber; */
+ l->real_linenumber = 0;
}
else {
l->real_linenumber = nlines;
@@ -4466,7 +4587,8 @@ loadHTMLBuffer(URLFile * f, Buffer * newBuf)
if (newBuf == NULL)
newBuf = newBuffer(INIT_BUFFER_WIDTH);
- if (newBuf->sourcefile == NULL && f->scheme != SCM_LOCAL) {
+ if (newBuf->sourcefile == NULL &&
+ (f->scheme != SCM_LOCAL || newBuf->mailcap)) {
tmp = tmpfname(TMPF_SRC, ".html");
src = fopen(tmp->ptr, "w");
if (src)
@@ -4478,6 +4600,8 @@ loadHTMLBuffer(URLFile * f, Buffer * newBuf)
newBuf->topLine = newBuf->firstLine;
newBuf->lastLine = newBuf->currentLine;
newBuf->currentLine = newBuf->firstLine;
+ if (n_textarea)
+ formResetBuffer(newBuf, newBuf->formitem);
if (src)
fclose(src);
@@ -4528,7 +4652,7 @@ showProgress(int *linelen, int *trbyte)
{
int i, j, rate, duration, eta, pos;
static time_t last_time, start_time;
- time_t cur_time = time(0);
+ time_t cur_time;
Str messages;
char *fmtrbyte, *fmrate;
@@ -4537,6 +4661,7 @@ showProgress(int *linelen, int *trbyte)
if (current_content_length > 0) {
double ratio;
+ cur_time = time(0);
if (cur_time == last_time)
return;
last_time = cur_time;
@@ -4584,6 +4709,7 @@ showProgress(int *linelen, int *trbyte)
refresh();
}
else if (*linelen > 1000) {
+ cur_time = time(0);
if (cur_time == last_time)
return;
last_time = cur_time;
@@ -4599,10 +4725,10 @@ showProgress(int *linelen, int *trbyte)
duration = cur_time - start_time;
if (duration) {
fmrate = convert_size(*trbyte / duration, 1);
- messages = Sprintf("%7s loaded %7s/s\n", fmtrbyte, fmrate);
+ messages = Sprintf("%7s loaded %7s/s", fmtrbyte, fmrate);
}
else {
- messages = Sprintf("%7s loaded\n", fmtrbyte);
+ messages = Sprintf("%7s loaded", fmtrbyte);
}
message(messages->ptr, 0, 0);
refresh();
@@ -4634,6 +4760,8 @@ init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf,
obuf->prev_ctype = PC_ASCII;
obuf->tag_sp = 0;
obuf->fontstat_sp = 0;
+ obuf->top_margin = 0;
+ obuf->bottom_margin = 0;
obuf->bp.init_flag = 1;
set_breakpoint(obuf, 0);
@@ -4702,17 +4830,18 @@ loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
n_textarea = 0;
cur_textarea = NULL;
+ max_textarea = MAX_TEXTAREA;
+ textarea_str = New_N(Str,max_textarea);
#ifdef MENU_SELECT
n_select = 0;
+ max_select = MAX_SELECT;
+ select_option = New_N(FormSelectOption,max_select);
#endif /* MENU_SELECT */
cur_select = NULL;
form_sp = -1;
-#ifdef NEW_FORM
form_max = -1;
forms_size = 0;
forms = NULL;
-#endif /* NEW_FORM */
-
cur_hseq = 1;
if (w3m_halfload) {
@@ -4739,11 +4868,11 @@ loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
#ifdef JP_CHARSET
if (newBuf != NULL && newBuf->document_code != '\0')
code = newBuf->document_code;
- else if (content_charset != '\0')
+ else if (content_charset != '\0' && UseContentCharset)
code = content_charset;
else
code = DocumentCode;
- content_charset = '\0';
+ meta_charset = '\0';
#endif
#if 0
do_blankline(&htmlenv1, &obuf, 0, 0, htmlenv1.limit);
@@ -4757,9 +4886,10 @@ loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
linelen += lineBuf2->length;
showProgress(&linelen, &trbyte);
#ifdef JP_CHARSET
- if (content_charset != '\0') { /* <META> */
- code = content_charset;
- content_charset = '\0';
+ if (meta_charset != '\0') { /* <META> */
+ if (content_charset == '\0' && UseContentCharset)
+ code = meta_charset;
+ meta_charset = '\0';
}
#endif
if (!internal)
@@ -4794,10 +4924,11 @@ loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
term_raw();
signal(SIGINT, prevtrap);
}
- HTMLlineproc2(newBuf, htmlenv1.buf);
#ifdef JP_CHARSET
newBuf->document_code = code;
+ content_charset = '\0';
#endif /* JP_CHARSET */
+ HTMLlineproc2(newBuf, htmlenv1.buf);
}
/*
@@ -4809,6 +4940,8 @@ loadHTMLString(Str page)
URLFile f;
MySignalHandler(*prevtrap) ();
Buffer *newBuf;
+ Str tmp;
+ FILE *src = NULL;
newBuf = newBuffer(INIT_BUFFER_WIDTH);
if (SETJMP(AbortLoading) != 0) {
@@ -4821,8 +4954,15 @@ loadHTMLString(Str page)
prevtrap = signal(SIGINT, KeyAbort);
term_cbreak();
}
+ if (w3m_dump & DUMP_FRAME) {
+ tmp = tmpfname(TMPF_SRC, ".html");
+ pushText(fileToDelete, tmp->ptr);
+ src = fopen(tmp->ptr, "w");
+ if (src)
+ newBuf->sourcefile = tmp->ptr;
+ }
- loadHTMLstream(&f, newBuf, NULL, TRUE);
+ loadHTMLstream(&f, newBuf, src, TRUE);
if (fmInitialized) {
term_raw();
@@ -4834,6 +4974,10 @@ loadHTMLString(Str page)
#ifdef JP_CHARSET
newBuf->document_code = InnerCode;
#endif /* JP_CHARSET */
+ if (n_textarea)
+ formResetBuffer(newBuf, newBuf->formitem);
+ if (src)
+ fclose(src);
return newBuf;
}
@@ -4861,7 +5005,7 @@ loadGopherDir(URLFile * uf, Buffer * newBuf)
#ifdef JP_CHARSET
if (newBuf->document_code != '\0')
code = newBuf->document_code;
- else if (content_charset != '\0')
+ else if (content_charset != '\0' && UseContentCharset)
code = content_charset;
else
code = DocumentCode;
@@ -4874,8 +5018,11 @@ loadGopherDir(URLFile * uf, Buffer * newBuf)
(lbuf->ptr[1] == '\n' || lbuf->ptr[1] == '\r'))
break;
#ifdef JP_CHARSET
- if ((ic = checkShiftCode(lbuf, code)) != '\0')
- lbuf = conv_str(lbuf, (code = ic), InnerCode);
+ if ((ic = checkShiftCode(lbuf, code)) != '\0') {
+ if (UseAutoDetect)
+ code = ic;
+ lbuf = conv_str(lbuf, code, InnerCode);
+ }
#endif /* JP_CHARSET */
cleanup_line(lbuf, HTML_MODE);
@@ -4929,6 +5076,9 @@ loadGopherDir(URLFile * uf, Buffer * newBuf)
Strcat_charp(lbuf, name->ptr + 1);
pushTextLine(tl, newTextLine(lbuf, visible_length(lbuf->ptr)));
}
+#ifdef JP_CHARSET
+ newBuf->document_code = code;
+#endif /* JP_CHARSET */
HTMLlineproc2(newBuf, tl);
newBuf->topLine = newBuf->firstLine;
newBuf->lastLine = newBuf->currentLine;
@@ -4968,7 +5118,8 @@ loadBuffer(URLFile * uf, Buffer * newBuf)
term_cbreak();
}
- if (newBuf->sourcefile == NULL && uf->scheme != SCM_LOCAL) {
+ if (newBuf->sourcefile == NULL &&
+ (uf->scheme != SCM_LOCAL || newBuf->mailcap)) {
tmpf = tmpfname(TMPF_SRC, NULL);
src = fopen(tmpf->ptr, "w");
if (src)
@@ -4977,7 +5128,7 @@ loadBuffer(URLFile * uf, Buffer * newBuf)
#ifdef JP_CHARSET
if (newBuf->document_code != '\0')
code = newBuf->document_code;
- else if (content_charset != '\0')
+ else if (content_charset != '\0' && UseContentCharset)
code = content_charset;
else
code = DocumentCode;
@@ -5032,6 +5183,7 @@ loadBuffer(URLFile * uf, Buffer * newBuf)
term_raw();
}
newBuf->topLine = newBuf->firstLine;
+ newBuf->lastLine = newBuf->currentLine;
newBuf->currentLine = newBuf->firstLine;
newBuf->trbyte = trbyte + linelen;
#ifdef JP_CHARSET
@@ -5100,7 +5252,7 @@ saveBufferDelNum(Buffer * buf, FILE * f, int del)
else
#endif
tmp = Strnew_charp_n(l->lineBuf, l->len);
- if (del && (p = strchr(tmp->ptr, ':')) != NULL)
+ if (del && l->real_linenumber && (p = strchr(tmp->ptr, ':')) != NULL)
Strdelete(tmp, 0, p - tmp->ptr + 1);
#ifdef JP_CHARSET
tmp = conv_str(tmp, InnerCode, DisplayCode);
@@ -5144,11 +5296,11 @@ Buffer *
getshell(char *cmd)
{
Buffer *buf;
- Str bn;
+
buf = loadcmdout(cmd, loadBuffer, NULL);
buf->filename = cmd;
- bn = Sprintf("%s %s", SHELLBUFFERNAME, cmd);
- buf->buffername = bn->ptr;
+ buf->buffername = Sprintf("%s %s", SHELLBUFFERNAME,
+ conv_from_system(cmd))->ptr;
return buf;
}
@@ -5160,7 +5312,6 @@ getpipe(char *cmd)
{
FILE *f, *popen(const char *, const char *);
Buffer *buf;
- Str bn;
if (cmd == NULL || *cmd == '\0')
return NULL;
@@ -5170,8 +5321,8 @@ getpipe(char *cmd)
buf = newBuffer(INIT_BUFFER_WIDTH);
buf->pagerSource = newFileStream(f, (void (*)()) pclose);
buf->filename = cmd;
- bn = Sprintf("%s %s", PIPEBUFFERNAME, cmd);
- buf->buffername = bn->ptr;
+ buf->buffername = Sprintf("%s %s", PIPEBUFFERNAME,
+ conv_from_system(cmd))->ptr;
buf->bufferprop |= BP_PIPE;
return buf;
}
@@ -5189,6 +5340,8 @@ openPagerBuffer(InputStream stream, Buffer * buf)
buf->buffername = getenv("MAN_PN");
if (buf->buffername == NULL)
buf->buffername = PIPEBUFFERNAME;
+ else
+ buf->buffername = conv_from_system(buf->buffername);
buf->bufferprop |= BP_PIPE;
#ifdef JP_CHARSET
buf->document_code = DocumentCode;
@@ -5227,25 +5380,29 @@ openGeneralPagerBuffer(InputStream stream)
t = DefaultType;
DefaultType = NULL;
}
- if (!strcmp(t, "text/html")) {
+ if (!strcasecmp(t, "text/html")) {
buf = loadHTMLBuffer(&uf, t_buf);
buf->type = "text/html";
}
else if (is_plain_text_type(t)) {
+ if (IStype(stream) != IST_ENCODED)
+ stream = newEncodedStream(stream, uf.encoding);
buf = openPagerBuffer(stream, t_buf);
buf->type = "text/plain";
}
else {
if (doExternal(uf, "-", t, &buf, t_buf)) {
- ;
+ if (buf == NULL || buf == NO_BUFFER)
+ return buf;
}
else { /* unknown type is regarded as text/plain */
+ if (IStype(stream) != IST_ENCODED)
+ stream = newEncodedStream(stream, uf.encoding);
buf = openPagerBuffer(stream, t_buf);
buf->type = "text/plain";
}
}
buf->real_type = t;
- buf->encoding = uf.encoding;
buf->currentURL.scheme = SCM_LOCAL;
buf->currentURL.file = "-";
return buf;
@@ -5294,7 +5451,7 @@ getNextPage(Buffer * buf, int plen)
/* Assume that `cmd == buf->filename' */
if (buf->filename)
buf->buffername = Sprintf("%s %s",
- CPIPEBUFFERNAME, buf->filename)->ptr;
+ CPIPEBUFFERNAME, conv_from_system(buf->filename))->ptr;
else if (getenv("MAN_PN") == NULL)
buf->buffername = CPIPEBUFFERNAME;
buf->bufferprop |= BP_CLOSE;
@@ -5330,11 +5487,11 @@ getNextPage(Buffer * buf, int plen)
len = lineBuf2->length;
l = New(Line);
l->lineBuf = lineBuf2->ptr;
- l->propBuf = New_N(Lineprop, len);
+ l->propBuf = NewAtom_N(Lineprop, len);
bcopy((void *) propBuffer, (void *) l->propBuf, len * sizeof(Lineprop));
#ifdef ANSI_COLOR
if (check_color) {
- l->colorBuf = New_N(Linecolor, len);
+ l->colorBuf = NewAtom_N(Linecolor, len);
bcopy((void *) colorBuffer, (void *) l->colorBuf, len * sizeof(Linecolor));
} else {
l->colorBuf = NULL;
@@ -5343,13 +5500,17 @@ getNextPage(Buffer * buf, int plen)
l->len = len;
l->width = -1;
l->prev = pl;
+/*
if (squeezeBlankLine) {
+*/
l->real_linenumber = nlines;
l->linenumber = (pl == NULL ? nlines : pl->linenumber + 1);
+/*
}
else {
l->real_linenumber = l->linenumber = nlines;
}
+*/
if (pl == NULL) {
pl = l;
buf->firstLine = buf->topLine = buf->currentLine = l;
@@ -5469,6 +5630,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
struct mailcap *mcap;
int stat;
Buffer *buf = NULL;
+ char *header;
if (!(mcap = searchExtViewer(type)))
return 0;
@@ -5476,7 +5638,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
tmpf = tmpfname(TMPF_DFL, NULL);
if (mcap->nametemplate) {
- Str tmp = unquote_mailcap(mcap->nametemplate, NULL, tmpf->ptr, NULL);
+ Str tmp = unquote_mailcap(mcap->nametemplate, NULL, tmpf->ptr, NULL, NULL);
if (Strncmp(tmpf, tmp, tmpf->length) == 0) {
tmpf = tmp;
goto _save;
@@ -5486,29 +5648,40 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
Strcat_charp(tmpf, uf.ext);
}
_save:
+ if (IStype(uf.stream) != IST_ENCODED)
+ uf.stream = newEncodedStream(uf.stream, uf.encoding);
if (save2tmp(uf, tmpf->ptr) < 0)
return 0;
- command = unquote_mailcap(mcap->viewer, type, tmpf->ptr, &stat);
+ header = checkHeader(defaultbuf, "Content-Type:");
+ if (header)
+ header = conv_to_system(header);
+ command = unquote_mailcap(mcap->viewer, type, tmpf->ptr, header, &stat);
#ifndef __EMX__
if (!(stat & MCSTAT_REPNAME)) {
- Str tmp = Sprintf("(%s) < %s", command->ptr, tmpf->ptr);
+ Str tmp = Sprintf("(%s) < %s", command->ptr, shell_quote(tmpf->ptr));
command = tmp;
}
#endif
if (mcap->flags & (MAILCAP_HTMLOUTPUT|MAILCAP_COPIOUSOUTPUT)) {
if (defaultbuf == NULL)
defaultbuf = newBuffer(INIT_BUFFER_WIDTH);
- defaultbuf->sourcefile = tmpf->ptr;
+ defaultbuf->mailcap = mcap;
}
if (mcap->flags & MAILCAP_HTMLOUTPUT) {
buf = loadcmdout(command->ptr, loadHTMLBuffer, defaultbuf);
- if (buf)
+ if (buf && buf != NO_BUFFER) {
buf->type = "text/html";
+ buf->mailcap_source = buf->sourcefile;
+ buf->sourcefile = tmpf->ptr;
+ }
}
else if (mcap->flags & MAILCAP_COPIOUSOUTPUT) {
buf = loadcmdout(command->ptr, loadBuffer, defaultbuf);
- if (buf)
+ if (buf && buf != NO_BUFFER) {
buf->type = "text/plain";
+ buf->mailcap_source = buf->sourcefile;
+ buf->sourcefile = tmpf->ptr;
+ }
}
else {
if (mcap->flags & MAILCAP_NEEDSTERMINAL || !BackgroundExtViewer) {
@@ -5525,8 +5698,9 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
if (buf && buf != NO_BUFFER) {
buf->filename = path;
if (buf->buffername == NULL || buf->buffername[0] == '\0')
- buf->buffername = lastFileName(path);
+ buf->buffername = conv_from_system(lastFileName(path));
buf->edit = mcap->edit;
+ buf->mailcap = mcap;
}
*bufp = buf;
pushText(fileToDelete, tmpf->ptr);
@@ -5586,6 +5760,7 @@ doFileCopy(char *tmpf, char *defstr)
defstr, IN_COMMAND, SaveHist);
if (p == NULL || *p == '\0')
return;
+ p = conv_to_system(p);
}
if (*p != '|' || !PermitSaveToPipe) {
p = expandName(p);
@@ -5653,6 +5828,7 @@ doFileSave(URLFile uf, char *defstr)
defstr, IN_FILENAME, SaveHist);
if (p == NULL || *p == '\0')
return;
+ p = conv_to_system(p);
}
if (checkOverWrite(p) < 0)
return;
@@ -5732,7 +5908,7 @@ checkOverWrite(char *path)
if (stat(path, &st) < 0)
return 0;
if (fmInitialized) {
- ans = inputStr("File exists. Overwrite? (y or n)", "");
+ ans = inputChar("File exists. Overwrite? (y or n)");
}
else {
printf("File exists. Overwrite? (y or n)");
@@ -5744,41 +5920,20 @@ checkOverWrite(char *path)
return -1;
}
-static void
-sig_chld(int signo)
-{
- int stat;
-#ifdef HAVE_WAITPID
- pid_t pid;
-
- while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) {
- ;
- }
-#elif HAVE_WAIT3
- int pid;
-
- while ((pid = wait3(&stat, WNOHANG, NULL)) > 0) {
- ;
- }
-#else
- wait(&stat);
-#endif
- return;
-}
-
#ifdef __EMX__
#define GUNZIP_CMD "gzip"
#define BUNZIP2_CMD "bzip2"
+#define INFLATE_CMD libFile("inflate.exe")
#else /* not __EMX__ */
#define GUNZIP_CMD "gunzip"
#define BUNZIP2_CMD "bunzip2"
+#define INFLATE_CMD libFile("inflate")
#endif /* not __EMX__ */
-#define INFLATE_CMD "inflate"
#define GUNZIP_NAME "gunzip"
#define BUNZIP2_NAME "bunzip2"
#define INFLATE_NAME "inflate"
-void
+static void
gunzip_stream(URLFile *uf)
{
int pid1;
@@ -5787,6 +5942,10 @@ gunzip_stream(URLFile *uf)
char *expand_name = GUNZIP_NAME;
char *tmpf = NULL;
+ if (IStype(uf->stream) != IST_ENCODED) {
+ uf->stream = newEncodedStream(uf->stream, uf->encoding);
+ uf->encoding = ENC_7BIT;
+ }
switch (uf->compression) {
case CMP_COMPRESS:
case CMP_GZIP:
@@ -5815,14 +5974,14 @@ gunzip_stream(URLFile *uf)
UFclose(uf);
return;
}
+/*
if (uf->scheme != SCM_FTP)
+*/
UFclose(uf);
+ uf->scheme = SCM_LOCAL;
pushText(fileToDelete, tmpf);
}
-#ifdef SIGCHLD
- signal(SIGCHLD, sig_chld);
-#endif
flush_tty();
/* fd1[0]: read, fd1[1]: write */
if ((pid1 = fork()) == 0) {
@@ -5844,9 +6003,6 @@ gunzip_stream(URLFile *uf)
/* child */
int pid2;
int fd2[2];
-#ifdef SIGCHLD
- signal(SIGCHLD, sig_chld);
-#endif
if (fmInitialized) {
close_tty();
fmInitialized = FALSE;
@@ -5932,7 +6088,7 @@ reloadBuffer(Buffer * buf)
buf->pagerSource != NULL)
return;
init_stream(&uf, SCM_UNKNOWN, NULL);
- examineFile(buf->sourcefile, &uf);
+ examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile, &uf);
if (uf.stream == NULL)
return;
is_redisplay = TRUE;
@@ -5974,8 +6130,8 @@ guess_charset(char *p)
}
#endif
-char *
-guess_save_name(char *file)
+static char *
+guess_filename(char *file)
{
char *p = NULL, *s;
@@ -5996,6 +6152,28 @@ guess_save_name(char *file)
return s;
}
+char *
+guess_save_name(Buffer *buf, char *path)
+{
+ if (buf && buf->document_header) {
+ Str name = NULL;
+ char *p, *q;
+ if ((p = checkHeader(buf, "Content-Disposition:")) != NULL &&
+ (q = strcasestr(p, "filename")) != NULL &&
+ (q == p || IS_SPACE(*(q-1)) || *(q-1) == ';')) {
+ if (matchattr(q, "filename", 8, &name))
+ return name->ptr;
+ }
+ if ((p = checkHeader(buf, "Content-Type:")) != NULL &&
+ (q = strcasestr(p, "name")) != NULL &&
+ (q == p || IS_SPACE(*(q-1)) || *(q-1) == ';')) {
+ if (matchattr(q, "name", 4, &name))
+ return name->ptr;
+ }
+ }
+ return guess_filename(path);
+}
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* tab-width: 8 */
diff --git a/fm.h b/fm.h
@@ -20,6 +20,7 @@
#ifdef MENU
#define MENU_SELECT
+#define MENU_MAP
#endif /* MENU */
#ifndef COLOR
@@ -212,6 +213,7 @@ extern int REV_LB[];
#define IN_PASSWORD 0x40
#define IN_COMMAND 0x80
#define IN_URL 0x100
+#define IN_CHAR 0x200
/*
* Macros.
@@ -222,6 +224,7 @@ extern int REV_LB[];
#define inputStrHist(p,d,h) inputLineHist(p,d,IN_STRING,h)
#define inputFilename(p,d) inputLine(p,d,IN_FILENAME)
#define inputFilenameHist(p,d,h) inputLineHist(p,d,IN_FILENAME,h)
+#define inputChar(p) inputLine(p,"",IN_CHAR)
#define free(x) GC_free(x) /* let GC do it. */
@@ -289,6 +292,8 @@ typedef struct _anchor {
BufferPoint start;
BufferPoint end;
int hseq;
+ short y;
+ short rows;
} Anchor;
#define NO_REFERER ((char*)-1)
@@ -320,7 +325,6 @@ typedef struct _Buffer {
short height;
char *type;
char *real_type;
- char encoding;
int allLine;
short bufferprop;
short currentColumn;
@@ -354,6 +358,9 @@ typedef struct _Buffer {
FormItemList *form_submit;
char *savecache;
char *edit;
+ struct mailcap *mailcap;
+ char *mailcap_source;
+ char search_header;
#ifdef USE_SSL
char *ssl_certificate;
#endif
@@ -384,6 +391,8 @@ typedef struct {
short nobr_level;
Lineprop prev_ctype;
char init_flag;
+ short top_margin;
+ short bottom_margin;
} Breakpoint;
struct readbuffer {
@@ -409,6 +418,8 @@ struct readbuffer {
Breakpoint bp;
struct cmdtable *tag_stack[TAG_STACK_SIZE];
int tag_sp;
+ short top_margin;
+ short bottom_margin;
};
#define in_bold fontstat[0]
@@ -590,7 +601,8 @@ typedef struct http_request {
extern int LINES, COLS;
#if defined(CYGWIN) && LANG == JA
-#define LASTLINE (LINES-2)
+extern int isWinConsole;
+#define LASTLINE (LINES-(isWinConsole ? 2 : 1))
#else /* not defined(CYGWIN) && LANG == JA */
#define LASTLINE (LINES-1)
#endif /* not defined(CYGWIN) && LANG == JA */
@@ -607,6 +619,8 @@ global char *DefaultType init(NULL);
global char RenderFrame init(FALSE);
global char TargetSelf init(FALSE);
global char PermitSaveToPipe init(FALSE);
+global char DecodeCTE init(FALSE);
+global char ArgvIsURL init(FALSE);
global char fmInitialized init(FALSE);
@@ -637,6 +651,7 @@ global int DNS_order init(0);
extern int ai_family_order_table[3][3]; /* XXX */
#endif /* INET6 */
global TextList *NO_proxy_domains;
+global char NoCache init(FALSE);
global int Do_not_use_proxy init(FALSE);
global int Do_not_use_ti_te init(FALSE);
@@ -657,9 +672,18 @@ extern char *ullevel[];
extern char *version;
+#define DUMP_BUFFER 0x01
+#define DUMP_HEAD 0x02
+#define DUMP_SOURCE 0x04
+#define DUMP_EXTRA 0x08
+#define DUMP_HALFDUMP 0x10
+#define DUMP_FRAME 0x20
global int w3m_debug;
-global int w3m_halfdump init(FALSE);
+global int w3m_dump init(0);
+#define w3m_halfdump (w3m_dump & DUMP_HALFDUMP)
global int w3m_halfload init(FALSE);
+global Str header_string init(NULL);
+global int override_content_type init(FALSE);
#ifdef COLOR
global int useColor init(TRUE);
@@ -732,14 +756,29 @@ global int SaveURLHist init(TRUE);
#endif /* USE_HISTORY */
global int multicolList init(FALSE);
+global char DisplayCode init(DISPLAY_CODE);
#ifdef JP_CHARSET
-extern char DisplayCode;
-extern char DocumentCode;
+global char SystemCode init(SYSTEM_CODE);
+global char DocumentCode init(0);
+global char UseContentCharset init(TRUE);
+global char UseAutoDetect init(TRUE);
+#define Str_conv_from_system(x) conv_str((x), SystemCode, InnerCode)
+#define Str_conv_to_system(x) conv_str((x), InnerCode, SystemCode)
+#define conv_from_system(x) conv((x), SystemCode, InnerCode)->ptr
+#define conv_to_system(x) conv((x), InnerCode, SystemCode)->ptr
+#define url_quote_conv(x,c) url_quote(conv((x), InnerCode, (c))->ptr)
+#else
+#define Str_conv_from_system(x) (x)
+#define Str_conv_to_system(x) (x)
+#define conv_from_system(x) (x)
+#define conv_to_system(x) (x)
+#define url_quote_conv(x,c) url_quote(x)
#endif /* JP_CHARSET */
#ifndef KANJI_SYMBOLS
global int no_graphic_char init(FALSE);
extern char alt_rule[];
#endif /* not KANJI_SYMBOLS */
+extern char UseAltEntity;
global char *rc_dir;
global int rc_dir_is_tmp init(FALSE);
@@ -751,7 +790,7 @@ global int reverse_mouse init(FALSE);
#ifdef USE_COOKIE
global int default_use_cookie init(TRUE);
-global int use_cookie init(TRUE);
+global int use_cookie init(FALSE);
global int accept_cookie init(FALSE);
global int accept_bad_cookie init(FALSE);
global char *cookie_reject_domains init(NULL);
@@ -799,10 +838,14 @@ global int use_lessopen init(FALSE);
#define get_wctype(wc) (is~wckanji(wc)?PC_ASCII:GET_PCTYPE(wc))
#endif
+global int FollowRedirection init(10);
+
global int w3m_backend init(FALSE);
global Str backend_halfdump_str;
global TextList *backend_batch_commands init(NULL);
int backend( void );
+extern void deleteFiles(void);
+void w3m_exit( int i );
/*
* Externals
diff --git a/form.c b/form.c
@@ -16,9 +16,9 @@
#define lstat stat
#endif /* __EMX__ */
-extern Str textarea_str[];
+extern Str *textarea_str;
#ifdef MENU_SELECT
-extern FormSelectOption select_option[];
+extern FormSelectOption *select_option;
#include "menu.h"
#endif /* MENU_SELECT */
@@ -43,7 +43,7 @@ struct {
};
struct form_list *
-newFormList(char *action, char *method, char *charset, char *enctype, char *target, struct form_list *_next)
+newFormList(char *action, char *method, char *charset, char *enctype, char *target, char *name, struct form_list *_next)
{
struct form_list *l;
Str a = Strnew_charp(action);
@@ -75,6 +75,7 @@ newFormList(char *action, char *method, char *charset, char *enctype, char *targ
l->charset = c;
l->enctype = e;
l->target = target;
+ l->name = name;
l->next = _next;
l->nitems = 0;
l->body = NULL;
@@ -100,10 +101,11 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
item->type = FORM_UNKNOWN;
item->size = -1;
item->rows = 0;
- item->checked = 0;
+ item->checked = item->init_checked = 0;
item->accept = 0;
item->name = NULL;
- item->value = NULL;
+ item->value = item->init_value = NULL;
+ item->readonly = 0;
if (parsedtag_get_value(tag, ATTR_TYPE, &p)) {
item->type = formtype(p);
if (item->size < 0 &&
@@ -115,13 +117,14 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
if (parsedtag_get_value(tag, ATTR_NAME, &p))
item->name = Strnew_charp(p);
if (parsedtag_get_value(tag, ATTR_VALUE, &p))
- item->value = Strnew_charp(p);
- item->checked = parsedtag_exists(tag, ATTR_CHECKED);
+ item->value = item->init_value = Strnew_charp(p);
+ item->checked = item->init_checked = parsedtag_exists(tag, ATTR_CHECKED);
item->accept = parsedtag_exists(tag, ATTR_ACCEPT);
parsedtag_get_value(tag, ATTR_SIZE, &item->size);
parsedtag_get_value(tag, ATTR_MAXLENGTH, &item->maxlength);
+ item->readonly = parsedtag_exists(tag, ATTR_READONLY);
if (parsedtag_get_value(tag, ATTR_TEXTAREANUMBER, &i))
- item->value = textarea_str[i];
+ item->value = item->init_value = textarea_str[i];
#ifdef MENU_SELECT
if (parsedtag_get_value(tag, ATTR_SELECTNUMBER, &i))
item->select_option = select_option[i].first;
@@ -134,8 +137,10 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
}
#ifdef MENU_SELECT
if (item->type == FORM_SELECT) {
- item->value = chooseSelectOption(item->select_option, CHOOSE_VALUE);
- item->label = chooseSelectOption(item->select_option, CHOOSE_OPTION);
+ chooseSelectOption(item, item->select_option);
+ item->init_selected = item->selected;
+ item->init_value = item->value;
+ item->init_label = item->label;
}
#endif /* MENU_SELECT */
if (item->type == FORM_INPUT_FILE && item->value && item->value->length) {
@@ -196,25 +201,24 @@ formtype(char *typestr)
}
void
-form_recheck_radio(FormItemList * fi, void *data, void (*update_hook) (FormItemList *, void *))
+formRecheckRadio(Anchor *a, Buffer *buf, FormItemList * fi)
{
- Str tmp;
+ int i;
+ Anchor *a2;
FormItemList *f2;
- tmp = fi->name;
- for (f2 = fi->parent->item; f2 != NULL; f2 = f2->next) {
- if (f2 != fi && Strcmp(tmp, f2->name) == 0 &&
- f2->type == FORM_INPUT_RADIO) {
+ for (i = 0; i < buf->formitem->nanchor; i++) {
+ a2 = &buf->formitem->anchors[i];
+ f2 = (FormItemList *) a2->url;
+ if (f2->parent == fi->parent && f2 != fi &&
+ f2->type == FORM_INPUT_RADIO &&
+ Strcmp(f2->name, fi->name) == 0) {
f2->checked = 0;
- if (update_hook != NULL) {
- update_hook(f2, data);
- }
+ formUpdateBuffer(a2, buf, f2);
}
}
fi->checked = 1;
- if (update_hook != NULL) {
- update_hook(fi, data);
- }
+ formUpdateBuffer(a, buf, fi);
}
void
@@ -264,8 +268,9 @@ formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form)
int i, j, k;
Buffer save;
char *p;
- int spos, epos, c_len;
+ int spos, epos, c_len, rows, c_rows, pos, col;
Lineprop c_type;
+ Line *l;
copyBuffer(&save, buf);
gotoLine(buf, a->start.line);
@@ -300,46 +305,80 @@ formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form)
case FORM_TEXTAREA:
#ifdef MENU_SELECT
case FORM_SELECT:
- if (form->type == FORM_SELECT)
+ if (form->type == FORM_SELECT) {
p = form->label->ptr;
- else
+ updateSelectOption(form, form->select_option);
+ } else
#endif /* MENU_SELECT */
p = form->value->ptr;
- i = spos + 1;
- for (j = 0; p[j];) {
- if (p[j] == '\r') {
- j++;
- continue;
- }
- c_type = get_mctype(&p[j]);
- c_len = get_mclen(c_type);
- k = i + c_len;
- if (k > epos)
- break;
+ j = 0;
+ l = buf->currentLine;
+ if (form->type == FORM_TEXTAREA) {
+ int n = a->y - buf->currentLine->linenumber;
+ if (n > 0)
+ for (; l && n; l = l->prev, n--);
+ else if (n < 0)
+ for (; l && n; l = l->prev, n++);
+ if (! l)
+ break;
+ }
+ rows = form->rows ? form->rows : 1;
+ if (rows > 1)
+ col = COLPOS(l, a->start.pos);
+ for (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {
+ if (rows > 1) {
+ pos = columnPos(l, col);
+ a = retrieveAnchor(buf->formitem, l->linenumber, pos);
+ if (a == NULL)
+ break;
+ spos = a->start.pos - 1;
+ epos = a->end.pos;
+ }
+ i = spos + 1;
+ while (p[j]) {
+ if (rows > 1 && (p[j] == '\r' || p[j] == '\n'))
+ break;
+ if (p[j] == '\r') {
+ j++;
+ continue;
+ }
+ c_type = get_mctype(&p[j]);
+ c_len = get_mclen(c_type);
+ k = i + c_len;
+ if (k > epos)
+ break;
#ifdef JP_CHARSET
- if (c_type == PC_KANJI && form->type != FORM_INPUT_PASSWORD) {
- SetCharType(buf->currentLine->propBuf[i], PC_KANJI1);
- SetCharType(buf->currentLine->propBuf[i+1], PC_KANJI2);
- }
- else
+ if (c_type == PC_KANJI && form->type != FORM_INPUT_PASSWORD) {
+ SetCharType(l->propBuf[i], PC_KANJI1);
+ SetCharType(l->propBuf[i+1], PC_KANJI2);
+ }
+ else
#endif /* JP_CHARSET */
- SetCharType(buf->currentLine->propBuf[i], PC_ASCII);
-
- for (; i < k; i++, j++) {
- if (form->type == FORM_INPUT_PASSWORD)
- buf->currentLine->lineBuf[i] = '*';
- else if (c_type == PC_CTRL ||
- IS_UNPRINTABLE_ASCII(p[j], c_type))
- buf->currentLine->lineBuf[i] = ' ';
- else
- buf->currentLine->lineBuf[i] = p[j];
+ SetCharType(l->propBuf[i], PC_ASCII);
+
+ for (; i < k; i++, j++) {
+ if (form->type == FORM_INPUT_PASSWORD)
+ l->lineBuf[i] = '*';
+ else if (c_type == PC_CTRL ||
+ IS_UNPRINTABLE_ASCII(p[j], c_type))
+ l->lineBuf[i] = ' ';
+ else
+ l->lineBuf[i] = p[j];
+ }
+ }
+ if (rows > 1) {
+ while (p[j] && p[j] != '\r' && p[j] != '\n')
+ j++;
+ if (p[j] == '\r')
+ j++;
+ if (p[j] == '\n')
+ j++;
+ }
+ for (; i < epos; i++) {
+ l->lineBuf[i] = ' ';
+ SetCharType(l->propBuf[i], PC_ASCII);
}
}
- for (; i < epos; i++) {
- buf->currentLine->lineBuf[i] = ' ';
- SetCharType(buf->currentLine->propBuf[i], PC_ASCII);
- }
- i--;
break;
}
copyBuffer(buf, &save);
@@ -399,12 +438,12 @@ form_fputs_decode(Str s, FILE * f)
p++;
}
break;
-#if !defined(CYGWIN) && !defined(__EMX__)
+#if !defined( __CYGWIN__ ) && !defined( __EMX__ )
case '\r':
if (*(p + 1) == '\n')
p++;
/* continue to the next label */
-#endif /* !defined(CYGWIN) && !defined(__EMX__) */
+#endif /* !defined( __CYGWIN__ ) && !defined( __EMX__ ) */
default:
Strcat_char(z, *p);
p++;
@@ -425,6 +464,9 @@ input_textarea(FormItemList * fi)
Str tmpname = tmpfname(TMPF_DFL, NULL);
Str tmp;
FILE *f;
+#ifdef JP_CHARSET
+ char code = DisplayCode, ic;
+#endif
f = fopen(tmpname->ptr, "w");
if (f == NULL) {
@@ -435,13 +477,23 @@ input_textarea(FormItemList * fi)
form_fputs_decode(fi->value, f);
fclose(f);
if (strcasestr(Editor, "%s"))
- tmp = Sprintf(Editor, tmpname->ptr);
- else
- tmp = Sprintf("%s %s", Editor, tmpname->ptr);
+ if (strcasestr(Editor, "%d"))
+ tmp = Sprintf(Editor, 1, tmpname->ptr);
+ else
+ tmp = Sprintf(Editor, tmpname->ptr);
+ else {
+ if (strcasestr(Editor, "%d"))
+ tmp = Sprintf(Editor, 1);
+ else
+ tmp = Strnew_charp(Editor);
+ Strcat_m_charp(tmp, " ", tmpname->ptr, NULL);
+ }
fmTerm();
system(tmp->ptr);
fmInit();
+ if (fi->readonly)
+ return;
f = fopen(tmpname->ptr, "r");
if (f == NULL) {
disp_err_message("Can't open temporary file", FALSE);
@@ -459,10 +511,10 @@ input_textarea(FormItemList * fi)
Strcat_charp(tmp, "\r\n");
}
#ifdef JP_CHARSET
- Strcat(fi->value, conv_str(tmp, DisplayCode, InnerCode));
-#else /* not JP_CHARSET */
- Strcat(fi->value, tmp);
+ if ((ic = checkShiftCode(tmp, code)) != '\0')
+ tmp = conv_str(tmp, (code = ic), InnerCode);
#endif /* not JP_CHARSET */
+ Strcat(fi->value, tmp);
}
fclose(f);
unlink(tmpname->ptr);
@@ -503,53 +555,73 @@ addSelectOption(FormSelectOption * fso, Str value, Str label, int chk)
}
}
-Str
-chooseSelectOption(FormSelectOptionItem * item, int choose_type)
+void
+chooseSelectOption(FormItemList *fi, FormSelectOptionItem *item)
{
- Str chosen;
- if (item == NULL)
- return Strnew_size(0);
- if (choose_type == CHOOSE_OPTION)
- chosen = item->label;
- else
- chosen = item->value;
- while (item) {
- if (item->checked) {
- if (choose_type == CHOOSE_OPTION)
- chosen = item->label;
- else
- chosen = item->value;
+ FormSelectOptionItem *opt;
+ int i;
+
+ fi->selected = 0;
+ if (item == NULL) {
+ fi->value = Strnew_size(0);
+ fi->label = Strnew_size(0);
+ return;
+ }
+ fi->value = item->value;
+ fi->label = item->label;
+ for (i = 0, opt = item; opt != NULL; i++, opt = opt->next) {
+ if (opt->checked) {
+ fi->value = opt->value;
+ fi->label = opt->label;
+ fi->selected = i;
+ break;
}
- item = item->next;
}
- return chosen;
+ updateSelectOption(fi, item);
}
void
+updateSelectOption(FormItemList *fi, FormSelectOptionItem *item)
+{
+ int i;
+
+ if (fi == NULL || item == NULL)
+ return;
+ for (i = 0; item != NULL; i++, item = item->next) {
+ if (i == fi->selected)
+ item->checked = TRUE;
+ else
+ item->checked = FALSE;
+ }
+}
+
+int
formChooseOptionByMenu(struct form_item_list *fi, int x, int y)
{
- int i, n, selected = -1, init_select = 0;
+ int i, n, selected = -1, init_select = fi->selected;
FormSelectOptionItem *opt;
char **label;
for (n = 0, opt = fi->select_option; opt != NULL; n++, opt = opt->next);
label = New_N(char *, n + 1);
- for (i = 0, opt = fi->select_option; opt != NULL; i++, opt = opt->next) {
+ for (i = 0, opt = fi->select_option; opt != NULL; i++, opt = opt->next)
label[i] = opt->label->ptr;
- if (!Strcmp(fi->value, opt->value))
- init_select = i;
- }
label[n] = NULL;
optionMenu(x, y, label, &selected, init_select, NULL);
+ if (selected < 0)
+ return 0;
for (i = 0, opt = fi->select_option; opt != NULL; i++, opt = opt->next) {
if (i == selected) {
+ fi->selected = selected;
fi->value = opt->value;
fi->label = opt->label;
break;
}
}
+ updateSelectOption(fi, fi->select_option);
+ return 1;
}
#endif /* MENU_SELECT */
@@ -562,16 +634,19 @@ form_write_data(FILE * f, char *boundary, char *name, char *value)
}
void
-form_write_form_file(FILE * f, char *boundary, char *name, char *file)
+form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char *file)
{
FILE *fd;
struct stat st;
int c;
+ char *type;
fprintf(f, "--%s\r\n", boundary);
fprintf(f, "Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n",
- name, mybasename(file));
- fprintf(f, "Content-Type: text/plain\r\n\r\n");
+ name, mybasename(filename));
+ type = guessContentType(file);
+ fprintf(f, "Content-Type: %s\r\n\r\n",
+ type ? type : "application/octet-stream");
#ifdef READLINK
if (lstat(file, &st) < 0)
diff --git a/form.h b/form.h
@@ -32,10 +32,10 @@
#define FORM_ENCTYPE_URLENCODED 0
#define FORM_ENCTYPE_MULTIPART 1
-#define MAX_TEXTAREA 100 /* max number of * <textarea>..</textarea>
+#define MAX_TEXTAREA 10 /* max number of * <textarea>..</textarea>
* within one * document */
#ifdef MENU_SELECT
-#define MAX_SELECT 100 /* max number of <select>..</select> *
+#define MAX_SELECT 10 /* max number of <select>..</select> *
* within one document */
#endif /* MENU_SELECT */
@@ -45,6 +45,7 @@ typedef struct form_list {
int method;
Str action;
char *target;
+ char *name;
int charset;
int enctype;
struct form_list *next;
@@ -68,29 +69,28 @@ typedef struct form_select_option {
} FormSelectOption;
void addSelectOption(FormSelectOption * fso, Str value, Str label, int chk);
-Str chooseSelectOption(FormSelectOptionItem * item, int choose_type);
-void formChooseOptionByMenu(struct form_item_list *fi, int x, int y);
-/* macros for chooseSelectOption */
-#define CHOOSE_OPTION 0
-#define CHOOSE_VALUE 1
+void chooseSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
+void updateSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
+int formChooseOptionByMenu(struct form_item_list *fi, int x, int y);
#endif /* MENU_SELECT */
typedef struct form_item_list {
int type;
Str name;
- Str value;
- int checked;
+ Str value, init_value;
+ int checked, init_checked;
int accept;
int size;
int rows;
int maxlength;
+ int readonly;
#ifdef MENU_SELECT
FormSelectOptionItem *select_option;
- Str label;
+ Str label, init_label;
+ int selected, init_selected;
#endif /* MENU_SELECT */
struct form_list *parent;
struct form_item_list *next;
- int anchor_num;
} FormItemList;
#endif /* not FORM_H */
diff --git a/frame.c b/frame.c
@@ -4,6 +4,9 @@
#include "myctype.h"
#include <signal.h>
#include <setjmp.h>
+#ifdef __EMX__
+#include <strings.h> /* for bzero() and bcopy() */
+#endif /* __EMX__ */
#ifdef KANJI_SYMBOLS
#define RULE_WIDTH 2
@@ -105,7 +108,7 @@ newFrameSet(struct parsed_tag *tag)
}
struct frame_body *
-newFrame(struct parsed_tag *tag, ParsedURL * baseURL)
+newFrame(struct parsed_tag *tag, Buffer *buf)
{
struct frame_body *body;
char *p;
@@ -114,11 +117,12 @@ newFrame(struct parsed_tag *tag, ParsedURL * baseURL)
bzero((void *) body, sizeof(*body));
body->attr = F_UNLOADED;
body->flags = 0;
- body->baseURL = baseURL;
+ body->baseURL = baseURL(buf);
if (tag) {
- parsedtag_get_value(tag, ATTR_SRC, &body->url);
+ if (parsedtag_get_value(tag, ATTR_SRC, &p))
+ body->url = url_quote_conv(p, buf->document_code);
if (parsedtag_get_value(tag, ATTR_NAME, &p) && *p != '_')
- body->name = p;
+ body->name = url_quote_conv(p, buf->document_code);
}
return body;
}
@@ -267,8 +271,7 @@ flushFrameSet(struct frameset *fs)
void
pushFrameTree(struct frameset_queue **fqpp,
struct frameset *fs,
- long linenumber,
- short pos)
+ Buffer *buf)
{
struct frameset_queue *rfq, *cfq = *fqpp;
@@ -276,8 +279,11 @@ pushFrameTree(struct frameset_queue **fqpp,
return;
rfq = New(struct frameset_queue);
- rfq->linenumber = linenumber;
- rfq->pos = pos;
+ rfq->linenumber = (buf && buf->currentLine) ? buf->currentLine->linenumber : 1;
+ rfq->top_linenumber = (buf && buf->topLine) ? buf->topLine->linenumber : 1;
+ rfq->pos = buf ? buf->pos : 0;
+ rfq->currentColumn = buf ? buf->currentColumn : 0;
+ rfq->formitem = buf ? buf->formitem : NULL;
rfq->back = cfq;
if (cfq) {
@@ -294,9 +300,7 @@ pushFrameTree(struct frameset_queue **fqpp,
}
struct frameset *
-popFrameTree(struct frameset_queue **fqpp,
- long *linenumber,
- short *pos)
+popFrameTree(struct frameset_queue **fqpp)
{
struct frameset_queue *rfq = NULL, *cfq = *fqpp;
struct frameset *rfs = NULL;
@@ -304,11 +308,6 @@ popFrameTree(struct frameset_queue **fqpp,
if (!cfq)
return rfs;
- if (linenumber)
- *linenumber = cfq->linenumber;
- if (pos)
- *pos = cfq->pos;
-
rfs = cfq->frameset;
if (cfq->next) {
(rfq = cfq->next)->back = cfq->back;
@@ -337,11 +336,11 @@ resetFrameElement(union frameset_element *f_element,
f_element->set = buf->frameset;
f_element->set->currentURL = New(ParsedURL);
copyParsedURL(f_element->set->currentURL, &buf->currentURL);
- buf->frameset = popFrameTree(&(buf->frameQ), NULL, NULL);
+ buf->frameset = popFrameTree(&(buf->frameQ));
f_element->set->name = f_name;
}
else {
- f_body = newFrame(NULL, baseURL(buf));
+ f_body = newFrame(NULL, buf);
f_body->attr = F_BODY;
f_body->name = f_name;
f_body->url = parsedURL2Str(&buf->currentURL)->ptr;
@@ -355,6 +354,7 @@ resetFrameElement(union frameset_element *f_element,
f_body->flags |= FB_TODELETE;
buf->sourcefile = NULL;
}
+ f_body->type = buf->type;
f_body->referer = referer;
f_body->request = request;
deleteFrameSetElement(*f_element);
@@ -378,15 +378,19 @@ frame_download_source(struct frame_body *b, ParsedURL * currentURL,
parseURL2(b->url, &url, currentURL);
switch (url.scheme) {
case SCM_LOCAL:
- b->source = url.file;
+/*
+ b->source = url.real_file;
+*/
b->flags = 0;
default:
is_redisplay = TRUE;
+ w3m_dump |= DUMP_FRAME;
buf = loadGeneralFile(b->url,
baseURL ? baseURL : currentURL,
b->referer,
flag,
b->request);
+ w3m_dump &= ~DUMP_FRAME;
is_redisplay = FALSE;
break;
}
@@ -397,6 +401,8 @@ frame_download_source(struct frame_body *b, ParsedURL * currentURL,
return NULL;
}
b->url = parsedURL2Str(&buf->currentURL)->ptr;
+ b->source = buf->sourcefile;
+ b->type = buf->type;
if (buf->real_scheme != SCM_LOCAL) {
tmp = tmpfname(TMPF_FRAME, NULL);
rename(buf->sourcefile, tmp->ptr);
@@ -410,7 +416,7 @@ frame_download_source(struct frame_body *b, ParsedURL * currentURL,
ret_frameset->name = b->name;
ret_frameset->currentURL = New(ParsedURL);
copyParsedURL(ret_frameset->currentURL, &buf->currentURL);
- buf->frameset = popFrameTree(&(buf->frameQ), NULL, NULL);
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
discardBuffer(buf);
return ret_frameset;
@@ -453,7 +459,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
if (level == 0) {
fprintf(f1, "<html><head><title>%s</title></head><body>\n",
- htmlquote_str(current->buffername));
+ html_quote(current->buffername));
fputs("<table hborder width=\"100%\">\n", f1);
}
else
@@ -482,7 +488,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
fputs("<td", f1);
if (frame.element->name)
- fprintf(f1, " id=\"_%s\"", htmlquote_str(frame.element->name));
+ fprintf(f1, " id=\"_%s\"", html_quote(frame.element->name));
if (!r)
fprintf(f1, " width=\"%s\"", f->width[c]);
fputs(">\n", f1);
@@ -496,7 +502,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
switch (frame.element->attr) {
default:
fprintf(f1, "Frameset \"%s\" frame %d: type unrecognized",
- htmlquote_str(f->name), i + 1);
+ html_quote(f->name), i + 1);
break;
case F_UNLOADED:
if (!frame.body->name && f->name) {
@@ -519,8 +525,11 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
frame.body->attr = F_UNLOADED;
if (frame.body->flags & FB_NO_BUFFER)
fprintf(f1, "Open %s with other method", frame.body->url);
- else
+ else if (frame.body->url)
fprintf(f1, "Can't open %s", frame.body->url);
+ else
+ fprintf(f1, "This frame (%s) contains no src attribute",
+ frame.body->name ? frame.body->name : "(no name)");
break;
}
parseURL2(frame.body->url, &base, currentURL);
@@ -532,6 +541,23 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
code = '\0';
#endif /* JP_CHARSET */
t_stack = 0;
+ if (frame.body->type &&
+ ! strcasecmp(frame.body->type, "text/plain")) {
+ Str tmp;
+ fprintf(f1, "<pre>\n");
+ while ((tmp = StrmyISgets(f2))->length) {
+#ifdef JP_CHARSET
+ if ((ic = checkShiftCode(tmp, code)) != '\0')
+ tmp = conv_str(tmp, (code = ic), InnerCode);
+
+#endif /* JP_CHARSET */
+ cleanup_line(tmp, HTML_MODE);
+ fprintf(f1, "%s", html_quote(tmp->ptr));
+ }
+ fprintf(f1, "</pre>\n");
+ ISclose(f2);
+ break;
+ }
do {
status = R_ST_NORMAL;
do {
@@ -575,15 +601,17 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
fputs("-->", f1);
goto token_end;
case HTML_BASE:
- if (parsedtag_get_value(tag, ATTR_HREF, &q))
+ if (parsedtag_get_value(tag, ATTR_HREF, &q)) {
+ q = url_quote_conv(q, code);
parseURL(q, &base, NULL);
+ }
if (parsedtag_get_value(tag, ATTR_TARGET, &q)) {
if (!strcasecmp(q, "_self"))
d_target = s_target;
else if (!strcasecmp(q, "_parent"))
d_target = p_target;
else
- d_target = q;
+ d_target = url_quote_conv(q, code);
}
/* fall thru, "BASE" is prohibit tag */
case HTML_HEAD:
@@ -643,6 +671,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
case ATTR_ACTION:
if (!tag->value[j])
break;
+ tag->value[j] = url_quote_conv(tag->value[j], code);
parseURL2(tag->value[j], &url, &base);
if (url.scheme == SCM_MAILTO ||
url.scheme == SCM_UNKNOWN ||
diff --git a/frame.h b/frame.h
@@ -21,6 +21,7 @@ struct frame_body {
char *url;
ParsedURL *baseURL;
char *source;
+ char *type;
char *referer;
struct _anchorList *nameList;
FormList *request;
@@ -50,7 +51,10 @@ struct frameset_queue {
struct frameset_queue *back;
struct frameset *frameset;
long linenumber;
+ long top_linenumber;
short pos;
+ short currentColumn;
+ struct _anchorList *formitem;
};
extern struct frameset *renderFrameSet;
diff --git a/ftp.c b/ftp.c
@@ -139,7 +139,7 @@ FtpLogin(FTP * ftp_return, char *host, char *user, char *pass)
if (atoi(tmp->ptr) != 220)
return -1;
if (fmInitialized) {
- message(Sprintf("Sending FTP username (%s) to remote server.\n", user)->ptr, 0, 0);
+ message(Sprintf("Sending FTP username (%s) to remote server.", user)->ptr, 0, 0);
refresh();
}
tmp = Sprintf("USER %s\r\n", user);
@@ -154,7 +154,7 @@ FtpLogin(FTP * ftp_return, char *host, char *user, char *pass)
if (atoi(tmp->ptr) != 331)
return -1;
if (fmInitialized) {
- message(Sprintf("Sending FTP password to remote server.\n")->ptr, 0, 0);
+ message(Sprintf("Sending FTP password to remote server.")->ptr, 0, 0);
refresh();
}
tmp = Sprintf("PASS %s\r\n", pass);
@@ -263,17 +263,26 @@ FtpCwd(FTP ftp, char *path)
}
int
-FtpOpenRead(FTP ftp, char *path)
+FtpOpenReadBody(FTP ftp, char *path)
{
Str tmp;
- if (ftp_pasv(ftp) < 0)
- return -1;
tmp = Sprintf("RETR %s\r\n", path);
fwrite(tmp->ptr, tmp->length, sizeof(char), ftp->wcontrol);
fflush(ftp->wcontrol);
tmp = read_response(ftp);
if (tmp->ptr[0] == '5') {
+ return -1;
+ }
+ return 0;
+}
+
+int
+FtpOpenRead(FTP ftp, char *path)
+{
+ if (ftp_pasv(ftp) < 0)
+ return -1;
+ if (FtpOpenReadBody(ftp, path) < 0) {
fclose(ftp->data);
ftp->data = NULL;
return -1;
@@ -292,12 +301,10 @@ Ftpfclose(FILE * f)
}
int
-FtpData(FTP ftp, char *cmd, char *arg, char *mode)
+FtpDataBody(FTP ftp, char *cmd, char *arg, char *mode)
{
Str tmp;
- if (ftp_pasv(ftp) < 0)
- return -1;
tmp = Sprintf(cmd, arg);
Strcat_charp(tmp, "\r\n");
fwrite(tmp->ptr, tmp->length, sizeof(char), ftp->wcontrol);
@@ -312,6 +319,15 @@ FtpData(FTP ftp, char *cmd, char *arg, char *mode)
}
int
+FtpData(FTP ftp, char *cmd, char *arg, char *mode)
+{
+ if (ftp_pasv(ftp) < 0)
+ return -1;
+
+ return FtpDataBody(ftp, cmd, arg, mode);
+}
+
+int
FtpClose(FTP ftp)
{
Str tmp;
@@ -409,6 +425,7 @@ openFTP(ParsedURL * pu)
if (fmInitialized) {
term_raw();
pwd = Strnew_charp(inputLine("Password: ", NULL, IN_PASSWORD));
+ pwd = Str_conv_to_system(pwd);
term_cbreak();
}
else {
@@ -437,11 +454,18 @@ openFTP(ParsedURL * pu)
if (pu->file == NULL || *pu->file == '\0')
goto ftp_dir;
else
- realpath = ftp_restore_str(pu->file);
+ realpath = file_unquote(pu->file);
+
+ if (pu->file[strlen(pu->file)-1] == '/')
+ goto ftp_dir;
/* Get file */
FtpBinary(ftp);
- s = FtpOpenRead(ftp, realpath);
+ if (ftp_pasv(ftp) < 0) {
+ FtpBye(ftp);
+ return NULL;
+ }
+ s = FtpOpenReadBody(ftp, realpath);
if (!FtpError(s)) {
#ifdef JP_CHARSET
pathStr = Strnew_charp(realpath);
@@ -453,18 +477,24 @@ openFTP(ParsedURL * pu)
pu->file = realpath;
return FTPDATA(ftp);
}
+ goto ftp_dir1;
/* Get directory */
ftp_dir:
+ if (ftp_pasv(ftp) < 0) {
+ FtpBye(ftp);
+ return NULL;
+ }
+ ftp_dir1:
pu->scheme = SCM_FTPDIR;
FTPDIRtmp = Strnew();
sv_type = ftp_system(ftp);
if (pu->file == NULL || *pu->file == '\0') {
if (sv_type == UNIXLIKE_SERVER) {
- s = FtpData(ftp, "LIST", NULL, "r");
+ s = FtpDataBody(ftp, "LIST", NULL, "r");
}
else {
- s = FtpData(ftp, "NLST", NULL, "r");
+ s = FtpDataBody(ftp, "NLST", NULL, "r");
}
curdir = Strnew_charp("/");
}
@@ -472,11 +502,11 @@ openFTP(ParsedURL * pu)
if (sv_type == UNIXLIKE_SERVER) {
s = FtpCwd(ftp, realpath);
if (!FtpError(s)) {
- s = FtpData(ftp, "LIST", NULL, "r");
+ s = FtpDataBody(ftp, "LIST", NULL, "r");
}
}
else {
- s = FtpData(ftp, "NLST %s", realpath, "r");
+ s = FtpDataBody(ftp, "NLST %s", realpath, "r");
}
if (realpath[0] == '/')
curdir = Strnew_charp(realpath);
@@ -496,10 +526,10 @@ openFTP(ParsedURL * pu)
Strcat_charp(host, pu->host);
if (Strlastchar(host) == '/')
Strshrink(host, 1);
- qdir = htmlquote_str(curdir->ptr);
+ qdir = html_quote(curdir->ptr);
FTPDIRtmp = Sprintf("<html><head><title>%s%s</title></head><body><h1>Index of %s%s</h1>\n",
host->ptr, qdir, host->ptr, qdir);
- curdir = Strnew_charp(ftp_escape_str(curdir->ptr));
+ curdir = Strnew_charp(file_quote(curdir->ptr));
qdir = curdir->ptr;
tmp2 = Strdup(curdir);
if (Strcmp_charp(curdir, "/") != 0) {
@@ -514,7 +544,7 @@ openFTP(ParsedURL * pu)
Strcat_charp(FTPDIRtmp, "<ul><li><a href=\"");
}
Strcat_m_charp(FTPDIRtmp, host->ptr,
- htmlquote_str(tmp2->ptr),
+ html_quote(tmp2->ptr),
"\">[Upper Directory]</a>\n", NULL);
flist = New_N(char *, nfile_max);
@@ -578,9 +608,9 @@ openFTP(ParsedURL * pu)
Strcat_m_charp(FTPDIRtmp, "<a href=\"",
host->ptr,
qdir,
- ftp_escape_str(fn),
+ html_quote(file_quote(fn)),
"\">",
- htmlquote_str(fn), NULL);
+ html_quote(fn), NULL);
if (ftype == FTPDIR_DIR) {
Strcat_charp(FTPDIRtmp, "/");
len++;
@@ -616,9 +646,9 @@ openFTP(ParsedURL * pu)
fn = flist[i];
Strcat_m_charp(FTPDIRtmp, "<li><a href=\"",
host->ptr, qdir,
- ftp_escape_str(fn),
+ html_quote(file_quote(fn)),
"\">",
- htmlquote_str(fn),
+ html_quote(fn),
"</a>\n", NULL);
}
Strcat_charp(FTPDIRtmp, "</ul></body></html>\n");
@@ -779,7 +809,7 @@ ex_ftpdir_name_size_date(char *line, char **name, char **date, char **sizep)
&& IS_SPACE(cp[6])
&& (IS_SPACE(cp[7]) || IS_DIGIT(cp[7])) && IS_DIGIT(cp[8])
&& (cp[9] == ':' || IS_DIGIT(cp[9]))
- && IS_DIGIT(cp[10]) && IS_DIGIT(cp[11])
+ && IS_DIGIT(cp[10]) && (IS_DIGIT(cp[11]) || IS_SPACE(cp[11]))
&& IS_SPACE(cp[12])) {
cp[12] = '\0';
date_str = Strnew_charp(cp);
diff --git a/func.c b/func.c
@@ -24,6 +24,8 @@ initKeymap(void)
int c;
int f;
int lineno;
+ int verbose = 1;
+ extern int str_to_bool(char *value, int old);
if (!w3mNFuncList)
w3mNFuncList = countFuncList(w3mFuncList);
@@ -43,36 +45,46 @@ initKeymap(void)
s = getWord(&p);
if (*s == '#') /* comment */
continue;
- if (strcmp(s, "keymap")) { /* error */
- emsg = Sprintf("line %d: keymap not found\n", lineno)->ptr;
+ if (! strcmp(s, "keymap"))
+ ;
+ else if (! strcmp(s, "verbose")) {
+ s = getWord(&p);
+ if (*s)
+ verbose = str_to_bool(s, verbose);
+ continue;
+ } else { /* error */
+ emsg = Sprintf("line %d: syntax error '%s'", lineno, s)->ptr;
record_err_message(emsg);
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
continue;
}
s = getQWord(&p);
c = getKey(s);
if (c < 0) { /* error */
- emsg = Sprintf("line %d: unknown key '%s'\n", lineno, s)->ptr;
+ emsg = Sprintf("line %d: unknown key '%s'", lineno, s)->ptr;
record_err_message(emsg);
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
continue;
}
s = getWord(&p);
f = getFuncList(s, w3mFuncList, w3mNFuncList);
if (f < 0) {
- emsg = Sprintf("line %d: invalid command '%s'\n", lineno, s)->ptr;
+ emsg = Sprintf("line %d: invalid command '%s'", lineno, s)->ptr;
record_err_message(emsg);
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
- f = FUNCNAME_nulcmd;
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ continue;
}
if (c & K_ESCD)
- EscDKeymap[c ^ K_ESCD] = (f >= 0) ? f : FUNCNAME_nulcmd;
+ EscDKeymap[c ^ K_ESCD] = f;
else if (c & K_ESCB)
- EscBKeymap[c ^ K_ESCB] = (f >= 0) ? f : FUNCNAME_nulcmd;
+ EscBKeymap[c ^ K_ESCB] = f;
else if (c & K_ESC)
- EscKeymap[c ^ K_ESC] = (f >= 0) ? f : FUNCNAME_nulcmd;
+ EscKeymap[c ^ K_ESC] = f;
else
- GlobalKeymap[c] = (f >= 0) ? f : FUNCNAME_nulcmd;
+ GlobalKeymap[c] = f;
s = getQWord(&p);
addKeyList(&w3mKeyList, c, s);
}
diff --git a/funcname.c b/funcname.c
@@ -46,53 +46,68 @@ FuncList w3mFuncList[] = {
/*44*/ {"MOUSE",mouse},
/*45*/ {"MOUSE_TOGGLE",msToggle},
/*46*/ {"MOVE_DOWN",movD},
-/*47*/ {"MOVE_LEFT",movL},
-/*48*/ {"MOVE_RIGHT",movR},
-/*49*/ {"MOVE_UP",movU},
-/*50*/ {"MSGS",msgs},
-/*51*/ {"NEXT_LINK",nextA},
-/*52*/ {"NEXT_MARK",nextMk},
-/*53*/ {"NEXT_PAGE",pgFore},
-/*54*/ {"NEXT_WORD",movRW},
-/*55*/ {"NOTHING",nulcmd},
-/*56*/ {"NULL",nulcmd},
-/*57*/ {"OPTIONS",ldOpt},
-/*58*/ {"PCMAP",pcmap},
-/*59*/ {"PEEK",curURL},
-/*60*/ {"PEEK_LINK",peekURL},
-/*61*/ {"PEEK_IMG",peekIMG},
-/*62*/ {"PIPE_SHELL",pipesh},
-/*63*/ {"PREV_LINK",prevA},
-/*64*/ {"PREV_MARK",prevMk},
-/*65*/ {"PREV_PAGE",pgBack},
-/*66*/ {"PREV_WORD",movLW},
-/*67*/ {"PRINT",svBuf},
-/*68*/ {"QUIT",qquitfm},
-/*69*/ {"READ_SHELL",readsh},
-/*70*/ {"REDRAW",rdrwSc},
-/*71*/ {"REG_MARK",reMark},
-/*72*/ {"RELOAD",reload},
-/*73*/ {"RIGHT",col1R},
-/*74*/ {"SAVE",svSrc},
-/*75*/ {"SAVE_IMAGE",svI},
-/*76*/ {"SAVE_LINK",svA},
-/*77*/ {"SAVE_SCREEN",svBuf},
-/*78*/ {"SEARCH",srchfor},
-/*79*/ {"SEARCH_BACK",srchbak},
-/*80*/ {"SEARCH_FORE",srchfor},
-/*81*/ {"SEARCH_NEXT",srchnxt},
-/*82*/ {"SEARCH_PREV",srchprv},
-/*83*/ {"SELECT",selBuf},
-/*84*/ {"SHELL",execsh},
-/*85*/ {"SHIFT_LEFT",shiftl},
-/*86*/ {"SHIFT_RIGHT",shiftr},
-/*87*/ {"SOURCE",vwSrc},
-/*88*/ {"SUSPEND",susp},
-/*89*/ {"UP",lup1},
-/*90*/ {"VIEW",vwSrc},
-/*91*/ {"VIEW_BOOKMARK",ldBmark},
-/*92*/ {"VIEW_IMAGE",followI},
-/*93*/ {"WHEREIS",srchfor},
-/*94*/ {"WRAP_TOGGLE",wrapToggle},
+/*47*/ {"MOVE_DOWN1",movD1},
+/*48*/ {"MOVE_LEFT",movL},
+/*49*/ {"MOVE_LEFT1",movL1},
+/*50*/ {"MOVE_RIGHT",movR},
+/*51*/ {"MOVE_RIGHT1",movR1},
+/*52*/ {"MOVE_UP",movU},
+/*53*/ {"MOVE_UP1",movU1},
+/*54*/ {"MSGS",msgs},
+/*55*/ {"NEXT_DOWN",nextD},
+/*56*/ {"NEXT_LEFT",nextL},
+/*57*/ {"NEXT_LEFT_UP",nextLU},
+/*58*/ {"NEXT_LINK",nextA},
+/*59*/ {"NEXT_MARK",nextMk},
+/*60*/ {"NEXT_PAGE",pgFore},
+/*61*/ {"NEXT_RIGHT",nextR},
+/*62*/ {"NEXT_RIGHT_DOWN",nextRD},
+/*63*/ {"NEXT_UP",nextU},
+/*64*/ {"NEXT_WORD",movRW},
+/*65*/ {"NOTHING",nulcmd},
+/*66*/ {"NULL",nulcmd},
+/*67*/ {"OPTIONS",ldOpt},
+/*68*/ {"PCMAP",pcmap},
+/*69*/ {"PEEK",curURL},
+/*70*/ {"PEEK_IMG",peekIMG},
+/*71*/ {"PEEK_LINK",peekURL},
+/*72*/ {"PIPE_BUF",pipeBuf},
+/*73*/ {"PIPE_SHELL",pipesh},
+/*74*/ {"PREV_LINK",prevA},
+/*75*/ {"PREV_MARK",prevMk},
+/*76*/ {"PREV_PAGE",pgBack},
+/*77*/ {"PREV_WORD",movLW},
+/*78*/ {"PRINT",svBuf},
+/*79*/ {"QUIT",qquitfm},
+/*80*/ {"READ_SHELL",readsh},
+/*81*/ {"REDRAW",rdrwSc},
+/*82*/ {"REG_MARK",reMark},
+/*83*/ {"RELOAD",reload},
+/*84*/ {"RIGHT",col1R},
+/*85*/ {"SAVE",svSrc},
+/*86*/ {"SAVE_IMAGE",svI},
+/*87*/ {"SAVE_LINK",svA},
+/*88*/ {"SAVE_SCREEN",svBuf},
+/*89*/ {"SEARCH",srchfor},
+/*90*/ {"SEARCH_BACK",srchbak},
+/*91*/ {"SEARCH_FORE",srchfor},
+/*92*/ {"SEARCH_NEXT",srchnxt},
+/*93*/ {"SEARCH_PREV",srchprv},
+/*94*/ {"SELECT",selBuf},
+/*95*/ {"SETENV",setEnv},
+/*96*/ {"SET_OPTION",setOpt},
+/*97*/ {"SHELL",execsh},
+/*98*/ {"SHIFT_LEFT",shiftl},
+/*99*/ {"SHIFT_RIGHT",shiftr},
+/*100*/ {"SOURCE",vwSrc},
+/*101*/ {"SUBMIT",submitForm},
+/*102*/ {"SUSPEND",susp},
+/*103*/ {"UP",lup1},
+/*104*/ {"VERSION",dispVer},
+/*105*/ {"VIEW",vwSrc},
+/*106*/ {"VIEW_BOOKMARK",ldBmark},
+/*107*/ {"VIEW_IMAGE",followI},
+/*108*/ {"WHEREIS",srchfor},
+/*109*/ {"WRAP_TOGGLE",wrapToggle},
{ NULL, NULL }
};
diff --git a/funcname.tab b/funcname.tab
@@ -47,21 +47,32 @@ MENU mainMn
MOUSE mouse
MOUSE_TOGGLE msToggle
MOVE_DOWN movD
+MOVE_DOWN1 movD1
MOVE_LEFT movL
+MOVE_LEFT1 movL1
MOVE_RIGHT movR
+MOVE_RIGHT1 movR1
MOVE_UP movU
+MOVE_UP1 movU1
MSGS msgs
+NEXT_DOWN nextD
+NEXT_LEFT nextL
+NEXT_LEFT_UP nextLU
NEXT_LINK nextA
NEXT_MARK nextMk
NEXT_PAGE pgFore
+NEXT_RIGHT nextR
+NEXT_RIGHT_DOWN nextRD
+NEXT_UP nextU
NEXT_WORD movRW
NOTHING nulcmd
NULL nulcmd
OPTIONS ldOpt
PCMAP pcmap
PEEK curURL
-PEEK_LINK peekURL
PEEK_IMG peekIMG
+PEEK_LINK peekURL
+PIPE_BUF pipeBuf
PIPE_SHELL pipesh
PREV_LINK prevA
PREV_MARK prevMk
@@ -84,12 +95,17 @@ SEARCH_FORE srchfor
SEARCH_NEXT srchnxt
SEARCH_PREV srchprv
SELECT selBuf
+SELECT_MENU selMn
+SETENV setEnv
+SET_OPTION setOpt
SHELL execsh
SHIFT_LEFT shiftl
SHIFT_RIGHT shiftr
SOURCE vwSrc
+SUBMIT submitForm
SUSPEND susp
UP lup1
+VERSION dispVer
VIEW vwSrc
VIEW_BOOKMARK ldBmark
VIEW_IMAGE followI
diff --git a/funcname1.h b/funcname1.h
@@ -43,41 +43,57 @@
#define FUNCNAME_mouse 44
#define FUNCNAME_msToggle 45
#define FUNCNAME_movD 46
-#define FUNCNAME_movL 47
-#define FUNCNAME_movR 48
-#define FUNCNAME_movU 49
-#define FUNCNAME_msgs 50
-#define FUNCNAME_nextA 51
-#define FUNCNAME_nextMk 52
-#define FUNCNAME_pgFore 53
-#define FUNCNAME_movRW 54
-#define FUNCNAME_ldOpt 57
-#define FUNCNAME_pcmap 58
-#define FUNCNAME_curURL 59
-#define FUNCNAME_peekURL 60
-#define FUNCNAME_peekIMG 61
-#define FUNCNAME_pipesh 62
-#define FUNCNAME_prevA 63
-#define FUNCNAME_prevMk 64
-#define FUNCNAME_pgBack 65
-#define FUNCNAME_movLW 66
-#define FUNCNAME_svBuf 67
-#define FUNCNAME_qquitfm 68
-#define FUNCNAME_readsh 69
-#define FUNCNAME_rdrwSc 70
-#define FUNCNAME_reMark 71
-#define FUNCNAME_reload 72
-#define FUNCNAME_col1R 73
-#define FUNCNAME_svI 75
-#define FUNCNAME_svA 76
-#define FUNCNAME_srchfor 78
-#define FUNCNAME_srchbak 79
-#define FUNCNAME_srchnxt 81
-#define FUNCNAME_srchprv 82
-#define FUNCNAME_selBuf 83
-#define FUNCNAME_shiftl 85
-#define FUNCNAME_shiftr 86
-#define FUNCNAME_vwSrc 87
-#define FUNCNAME_lup1 89
-#define FUNCNAME_followI 92
-#define FUNCNAME_wrapToggle 94
+#define FUNCNAME_movD1 47
+#define FUNCNAME_movL 48
+#define FUNCNAME_movL1 49
+#define FUNCNAME_movR 50
+#define FUNCNAME_movR1 51
+#define FUNCNAME_movU 52
+#define FUNCNAME_movU1 53
+#define FUNCNAME_msgs 54
+#define FUNCNAME_nextD 55
+#define FUNCNAME_nextL 56
+#define FUNCNAME_nextLU 57
+#define FUNCNAME_nextA 58
+#define FUNCNAME_nextMk 59
+#define FUNCNAME_pgFore 60
+#define FUNCNAME_nextR 61
+#define FUNCNAME_nextRD 62
+#define FUNCNAME_nextU 63
+#define FUNCNAME_movRW 64
+#define FUNCNAME_ldOpt 67
+#define FUNCNAME_pcmap 68
+#define FUNCNAME_curURL 69
+#define FUNCNAME_peekIMG 70
+#define FUNCNAME_peekURL 71
+#define FUNCNAME_pipeBuf 72
+#define FUNCNAME_pipesh 73
+#define FUNCNAME_prevA 74
+#define FUNCNAME_prevMk 75
+#define FUNCNAME_pgBack 76
+#define FUNCNAME_movLW 77
+#define FUNCNAME_svBuf 78
+#define FUNCNAME_qquitfm 79
+#define FUNCNAME_readsh 80
+#define FUNCNAME_rdrwSc 81
+#define FUNCNAME_reMark 82
+#define FUNCNAME_reload 83
+#define FUNCNAME_col1R 84
+#define FUNCNAME_svI 86
+#define FUNCNAME_svA 87
+#define FUNCNAME_srchfor 89
+#define FUNCNAME_srchbak 90
+#define FUNCNAME_srchnxt 92
+#define FUNCNAME_srchprv 93
+#define FUNCNAME_selBuf 94
+#define FUNCNAME_selMn 95
+#define FUNCNAME_setEnv 96
+#define FUNCNAME_setOpt 97
+#define FUNCNAME_shiftl 99
+#define FUNCNAME_shiftr 100
+#define FUNCNAME_vwSrc 101
+#define FUNCNAME_submitForm 102
+#define FUNCNAME_lup1 104
+#define FUNCNAME_dispVer 105
+#define FUNCNAME_followI 108
+#define FUNCNAME_wrapToggle 110
diff --git a/funcname2.h b/funcname2.h
@@ -43,41 +43,57 @@
#define mouse 44
#define msToggle 45
#define movD 46
-#define movL 47
-#define movR 48
-#define movU 49
-#define msgs 50
-#define nextA 51
-#define nextMk 52
-#define pgFore 53
-#define movRW 54
-#define ldOpt 57
-#define pcmap 58
-#define curURL 59
-#define peekURL 60
-#define peekIMG 61
-#define pipesh 62
-#define prevA 63
-#define prevMk 64
-#define pgBack 65
-#define movLW 66
-#define svBuf 67
-#define qquitfm 68
-#define readsh 69
-#define rdrwSc 70
-#define reMark 71
-#define reload 72
-#define col1R 73
-#define svI 75
-#define svA 76
-#define srchfor 78
-#define srchbak 79
-#define srchnxt 81
-#define srchprv 82
-#define selBuf 83
-#define shiftl 85
-#define shiftr 86
-#define vwSrc 87
-#define lup1 89
-#define followI 92
-#define wrapToggle 94
+#define movD1 47
+#define movL 48
+#define movL1 49
+#define movR 50
+#define movR1 51
+#define movU 52
+#define movU1 53
+#define msgs 54
+#define nextD 55
+#define nextL 56
+#define nextLU 57
+#define nextA 58
+#define nextMk 59
+#define pgFore 60
+#define nextR 61
+#define nextRD 62
+#define nextU 63
+#define movRW 64
+#define ldOpt 67
+#define pcmap 68
+#define curURL 69
+#define peekIMG 70
+#define peekURL 71
+#define pipeBuf 72
+#define pipesh 73
+#define prevA 74
+#define prevMk 75
+#define pgBack 76
+#define movLW 77
+#define svBuf 78
+#define qquitfm 79
+#define readsh 80
+#define rdrwSc 81
+#define reMark 82
+#define reload 83
+#define col1R 84
+#define svI 86
+#define svA 87
+#define srchfor 89
+#define srchbak 90
+#define srchnxt 92
+#define srchprv 93
+#define selBuf 94
+#define selMn 95
+#define setEnv 96
+#define setOpt 97
+#define shiftl 99
+#define shiftr 100
+#define vwSrc 101
+#define submitForm 102
+#define lup1 104
+#define dispVer 105
+#define followI 108
+#define wrapToggle 110
diff --git a/gc/AmigaOS.c b/gc/AmigaOS.c
@@ -0,0 +1,623 @@
+
+
+/******************************************************************
+
+ AmigaOS-spesific routines for GC.
+ This file is normally included from os_dep.c
+
+******************************************************************/
+
+
+#if !defined(GC_AMIGA_DEF) && !defined(GC_AMIGA_SB) && !defined(GC_AMIGA_DS) && !defined(GC_AMIGA_AM)
+# include "gc_priv.h"
+# include <stdio.h>
+# include <signal.h>
+# define GC_AMIGA_DEF
+# define GC_AMIGA_SB
+# define GC_AMIGA_DS
+# define GC_AMIGA_AM
+#endif
+
+
+#ifdef GC_AMIGA_DEF
+
+# ifndef __GNUC__
+# include <exec/exec.h>
+# endif
+# include <proto/exec.h>
+# include <proto/dos.h>
+# include <dos/dosextens.h>
+# include <workbench/startup.h>
+
+#endif
+
+
+
+
+#ifdef GC_AMIGA_SB
+
+/******************************************************************
+ Find the base of the stack.
+******************************************************************/
+
+ptr_t GC_get_stack_base()
+{
+ struct Process *proc = (struct Process*)SysBase->ThisTask;
+
+ /* Reference: Amiga Guru Book Pages: 42,567,574 */
+ if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS
+ && proc->pr_CLI != NULL) {
+ /* first ULONG is StackSize */
+ /*longPtr = proc->pr_ReturnAddr;
+ size = longPtr[0];*/
+
+ return (char *)proc->pr_ReturnAddr + sizeof(ULONG);
+ } else {
+ return (char *)proc->pr_Task.tc_SPUpper;
+ }
+}
+
+#if 0 /* old version */
+ptr_t GC_get_stack_base()
+{
+ extern struct WBStartup *_WBenchMsg;
+ extern long __base;
+ extern long __stack;
+ struct Task *task;
+ struct Process *proc;
+ struct CommandLineInterface *cli;
+ long size;
+
+ if ((task = FindTask(0)) == 0) {
+ GC_err_puts("Cannot find own task structure\n");
+ ABORT("task missing");
+ }
+ proc = (struct Process *)task;
+ cli = BADDR(proc->pr_CLI);
+
+ if (_WBenchMsg != 0 || cli == 0) {
+ size = (char *)task->tc_SPUpper - (char *)task->tc_SPLower;
+ } else {
+ size = cli->cli_DefaultStack * 4;
+ }
+ return (ptr_t)(__base + GC_max(size, __stack));
+}
+#endif
+
+
+#endif
+
+
+#ifdef GC_AMIGA_DS
+/******************************************************************
+ Register data segments.
+******************************************************************/
+
+ void GC_register_data_segments()
+ {
+ struct Process *proc;
+ struct CommandLineInterface *cli;
+ BPTR myseglist;
+ ULONG *data;
+
+ int num;
+
+
+# ifdef __GNUC__
+ ULONG dataSegSize;
+ GC_bool found_segment = FALSE;
+ extern char __data_size[];
+
+ dataSegSize=__data_size+8;
+ /* Can`t find the Location of __data_size, because
+ it`s possible that is it, inside the segment. */
+
+# endif
+
+ proc= (struct Process*)SysBase->ThisTask;
+
+ /* Reference: Amiga Guru Book Pages: 538ff,565,573
+ and XOper.asm */
+ if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS) {
+ if (proc->pr_CLI == NULL) {
+ myseglist = proc->pr_SegList;
+ } else {
+ /* ProcLoaded 'Loaded as a command: '*/
+ cli = BADDR(proc->pr_CLI);
+ myseglist = cli->cli_Module;
+ }
+ } else {
+ ABORT("Not a Process.");
+ }
+
+ if (myseglist == NULL) {
+ ABORT("Arrrgh.. can't find segments, aborting");
+ }
+
+ /* xoper hunks Shell Process */
+
+ num=0;
+ for (data = (ULONG *)BADDR(myseglist); data != NULL;
+ data = (ULONG *)BADDR(data[0])) {
+ if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
+ ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
+# ifdef __GNUC__
+ if (dataSegSize == data[-1]) {
+ found_segment = TRUE;
+ }
+# endif
+ GC_add_roots_inner((char *)&data[1],
+ ((char *)&data[1]) + data[-1], FALSE);
+ }
+ ++num;
+ } /* for */
+# ifdef __GNUC__
+ if (!found_segment) {
+ ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library");
+ }
+# endif
+ }
+
+#if 0 /* old version */
+ void GC_register_data_segments()
+ {
+ extern struct WBStartup *_WBenchMsg;
+ struct Process *proc;
+ struct CommandLineInterface *cli;
+ BPTR myseglist;
+ ULONG *data;
+
+ if ( _WBenchMsg != 0 ) {
+ if ((myseglist = _WBenchMsg->sm_Segment) == 0) {
+ GC_err_puts("No seglist from workbench\n");
+ return;
+ }
+ } else {
+ if ((proc = (struct Process *)FindTask(0)) == 0) {
+ GC_err_puts("Cannot find process structure\n");
+ return;
+ }
+ if ((cli = BADDR(proc->pr_CLI)) == 0) {
+ GC_err_puts("No CLI\n");
+ return;
+ }
+ if ((myseglist = cli->cli_Module) == 0) {
+ GC_err_puts("No seglist from CLI\n");
+ return;
+ }
+ }
+
+ for (data = (ULONG *)BADDR(myseglist); data != 0;
+ data = (ULONG *)BADDR(data[0])) {
+# ifdef AMIGA_SKIP_SEG
+ if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
+ ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
+# else
+ {
+# endif /* AMIGA_SKIP_SEG */
+ GC_add_roots_inner((char *)&data[1],
+ ((char *)&data[1]) + data[-1], FALSE);
+ }
+ }
+ }
+#endif /* old version */
+
+
+#endif
+
+
+
+#ifdef GC_AMIGA_AM
+
+#ifndef GC_AMIGA_FASTALLOC
+
+void *GC_amiga_allocwrapper(size_t size,void *(*AllocFunction)(size_t size2)){
+ return (*AllocFunction)(size);
+}
+
+void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2))
+ =GC_amiga_allocwrapper;
+
+#else
+
+
+
+
+void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2));
+
+void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2))
+ =GC_amiga_allocwrapper_firsttime;
+
+
+/******************************************************************
+ Amiga-spesific routines to obtain memory, and force GC to give
+ back fast-mem whenever possible.
+ These hacks makes gc-programs go many times faster when
+ the amiga is low on memory, and are therefore strictly necesarry.
+
+ -Kjetil S. Matheussen, 2000.
+******************************************************************/
+
+
+
+/* List-header for all allocated memory. */
+
+struct GC_Amiga_AllocedMemoryHeader{
+ ULONG size;
+ struct GC_Amiga_AllocedMemoryHeader *next;
+};
+struct GC_Amiga_AllocedMemoryHeader *GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(int)~(NULL);
+
+
+
+/* Type of memory. Once in the execution of a program, this might change to MEMF_ANY|MEMF_CLEAR */
+
+ULONG GC_AMIGA_MEMF = MEMF_FAST | MEMF_CLEAR;
+
+
+/* Prevents GC_amiga_get_mem from allocating memory if this one is TRUE. */
+#ifndef GC_AMIGA_ONLYFAST
+BOOL GC_amiga_dontalloc=FALSE;
+#endif
+
+#ifdef GC_AMIGA_PRINTSTATS
+int succ=0,succ2=0;
+int nsucc=0,nsucc2=0;
+int nullretries=0;
+int numcollects=0;
+int chipa=0;
+int allochip=0;
+int allocfast=0;
+int cur0=0;
+int cur1=0;
+int cur10=0;
+int cur50=0;
+int cur150=0;
+int cur151=0;
+int ncur0=0;
+int ncur1=0;
+int ncur10=0;
+int ncur50=0;
+int ncur150=0;
+int ncur151=0;
+#endif
+
+/* Free everything at program-end. */
+
+void GC_amiga_free_all_mem(void){
+ struct GC_Amiga_AllocedMemoryHeader *gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(GC_AMIGAMEM));
+ struct GC_Amiga_AllocedMemoryHeader *temp;
+
+#ifdef GC_AMIGA_PRINTSTATS
+ printf("\n\n"
+ "%d bytes of chip-mem, and %d bytes of fast-mem where allocated from the OS.\n",
+ allochip,allocfast
+ );
+ printf(
+ "%d bytes of chip-mem were returned from the GC_AMIGA_FASTALLOC supported allocating functions.\n",
+ chipa
+ );
+ printf("\n");
+ printf("GC_gcollect was called %d times to avoid returning NULL or start allocating with the MEMF_ANY flag.\n",numcollects);
+ printf("%d of them was a success. (the others had to use allocation from the OS.)\n",nullretries);
+ printf("\n");
+ printf("Succeded forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",succ,succ2);
+ printf("Failed forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",nsucc,nsucc2);
+ printf("\n");
+ printf(
+ "Number of retries before succeding a chip->fast force:\n"
+ "0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n",
+ cur0,cur1,cur10,cur50,cur150,cur151
+ );
+ printf(
+ "Number of retries before giving up a chip->fast force:\n"
+ "0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n",
+ ncur0,ncur1,ncur10,ncur50,ncur150,ncur151
+ );
+#endif
+
+ while(gc_am!=NULL){
+ temp=gc_am->next;
+ FreeMem(gc_am,gc_am->size);
+ gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(temp));
+ }
+}
+
+#ifndef GC_AMIGA_ONLYFAST
+
+/* All memory with address lower than this one is chip-mem. */
+
+char *chipmax;
+
+
+/*
+ * Allways set to the last size of memory tried to be allocated.
+ * Needed to ensure allocation when the size is bigger than 100000.
+ *
+ */
+size_t latestsize;
+
+#endif
+
+
+/*
+ * The actual function that is called with the GET_MEM macro.
+ *
+ */
+
+void *GC_amiga_get_mem(size_t size){
+ struct GC_Amiga_AllocedMemoryHeader *gc_am;
+
+#ifndef GC_AMIGA_ONLYFAST
+ if(GC_amiga_dontalloc==TRUE){
+// printf("rejected, size: %d, latestsize: %d\n",size,latestsize);
+ return NULL;
+ }
+
+ // We really don't want to use chip-mem, but if we must, then as little as possible.
+ if(GC_AMIGA_MEMF==(MEMF_ANY|MEMF_CLEAR) && size>100000 && latestsize<50000) return NULL;
+#endif
+
+ gc_am=AllocMem((ULONG)(size + sizeof(struct GC_Amiga_AllocedMemoryHeader)),GC_AMIGA_MEMF);
+ if(gc_am==NULL) return NULL;
+
+ gc_am->next=GC_AMIGAMEM;
+ gc_am->size=size + sizeof(struct GC_Amiga_AllocedMemoryHeader);
+ GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(gc_am));
+
+// printf("Allocated %d (%d) bytes at address: %x. Latest: %d\n",size,tot,gc_am,latestsize);
+
+#ifdef GC_AMIGA_PRINTSTATS
+ if((char *)gc_am<chipmax){
+ allochip+=size;
+ }else{
+ allocfast+=size;
+ }
+#endif
+
+ return gc_am+1;
+
+}
+
+
+
+
+#ifndef GC_AMIGA_ONLYFAST
+
+/* Tries very hard to force GC to find fast-mem to return. Done recursively
+ * to hold the rejected memory-pointers reachable from the collector in an
+ * easy way.
+ *
+ */
+#ifdef GC_AMIGA_RETRY
+void *GC_amiga_rec_alloc(size_t size,void *(*AllocFunction)(size_t size2),const int rec){
+ void *ret;
+
+ ret=(*AllocFunction)(size);
+
+#ifdef GC_AMIGA_PRINTSTATS
+ if((char *)ret>chipmax || ret==NULL){
+ if(ret==NULL){
+ nsucc++;
+ nsucc2+=size;
+ if(rec==0) ncur0++;
+ if(rec==1) ncur1++;
+ if(rec>1 && rec<10) ncur10++;
+ if(rec>=10 && rec<50) ncur50++;
+ if(rec>=50 && rec<150) ncur150++;
+ if(rec>=150) ncur151++;
+ }else{
+ succ++;
+ succ2+=size;
+ if(rec==0) cur0++;
+ if(rec==1) cur1++;
+ if(rec>1 && rec<10) cur10++;
+ if(rec>=10 && rec<50) cur50++;
+ if(rec>=50 && rec<150) cur150++;
+ if(rec>=150) cur151++;
+ }
+ }
+#endif
+
+ if (((char *)ret)<=chipmax && ret!=NULL && (rec<(size>500000?9:size/5000))){
+ ret=GC_amiga_rec_alloc(size,AllocFunction,rec+1);
+// GC_free(ret2);
+ }
+
+ return ret;
+}
+#endif
+
+
+/* The allocating-functions defined inside the amiga-blocks in gc.h is called
+ * via these functions.
+ */
+
+
+void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2)){
+ void *ret,*ret2;
+
+ GC_amiga_dontalloc=TRUE; // Pretty tough thing to do, but its indeed necesarry.
+ latestsize=size;
+
+ ret=(*AllocFunction)(size);
+
+ if(((char *)ret) <= chipmax){
+ if(ret==NULL){
+ //Give GC access to allocate memory.
+#ifdef GC_AMIGA_GC
+ if(!GC_dont_gc){
+ GC_gcollect();
+#ifdef GC_AMIGA_PRINTSTATS
+ numcollects++;
+#endif
+ ret=(*AllocFunction)(size);
+ }
+#endif
+ if(ret==NULL){
+ GC_amiga_dontalloc=FALSE;
+ ret=(*AllocFunction)(size);
+ if(ret==NULL){
+ WARN("Out of Memory! Returning NIL!\n", 0);
+ }
+ }
+#ifdef GC_AMIGA_PRINTSTATS
+ else{
+ nullretries++;
+ }
+ if(ret!=NULL && (char *)ret<=chipmax) chipa+=size;
+#endif
+ }
+#ifdef GC_AMIGA_RETRY
+ else{
+ /* We got chip-mem. Better try again and again and again etc., we might get fast-mem sooner or later... */
+ /* Using gctest to check the effectiviness of doing this, does seldom give a very good result. */
+ /* However, real programs doesn't normally rapidly allocate and deallocate. */
+// printf("trying to force... %d bytes... ",size);
+ if(
+ AllocFunction!=GC_malloc_uncollectable
+#ifdef ATOMIC_UNCOLLECTABLE
+ && AllocFunction!=GC_malloc_atomic_uncollectable
+#endif
+ ){
+ ret2=GC_amiga_rec_alloc(size,AllocFunction,0);
+ }else{
+ ret2=(*AllocFunction)(size);
+#ifdef GC_AMIGA_PRINTSTATS
+ if((char *)ret2<chipmax || ret2==NULL){
+ nsucc++;
+ nsucc2+=size;
+ ncur0++;
+ }else{
+ succ++;
+ succ2+=size;
+ cur0++;
+ }
+#endif
+ }
+ if(((char *)ret2)>chipmax){
+// printf("Succeeded.\n");
+ GC_free(ret);
+ ret=ret2;
+ }else{
+ GC_free(ret2);
+// printf("But did not succeed.\n");
+ }
+ }
+#endif
+ }
+
+ GC_amiga_dontalloc=FALSE;
+
+ return ret;
+}
+
+
+
+void (*GC_amiga_toany)(void)=NULL;
+
+void GC_amiga_set_toany(void (*func)(void)){
+ GC_amiga_toany=func;
+}
+
+#endif // !GC_AMIGA_ONLYFAST
+
+
+void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2)){
+ void *ret;
+
+ ret=(*AllocFunction)(size);
+
+ if(ret==NULL){
+ // Enable chip-mem allocation.
+// printf("ret==NULL\n");
+#ifdef GC_AMIGA_GC
+ if(!GC_dont_gc){
+ GC_gcollect();
+#ifdef GC_AMIGA_PRINTSTATS
+ numcollects++;
+#endif
+ ret=(*AllocFunction)(size);
+ }
+#endif
+ if(ret==NULL){
+#ifndef GC_AMIGA_ONLYFAST
+ GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR;
+ if(GC_amiga_toany!=NULL) (*GC_amiga_toany)();
+ GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any;
+ return GC_amiga_allocwrapper_any(size,AllocFunction);
+#endif
+ }
+#ifdef GC_AMIGA_PRINTSTATS
+ else{
+ nullretries++;
+ }
+#endif
+ }
+
+ return ret;
+}
+
+void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2)){
+ atexit(&GC_amiga_free_all_mem);
+ chipmax=(char *)SysBase->MaxLocMem; // For people still having SysBase in chip-mem, this might speed up a bit.
+ GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_fast;
+ return GC_amiga_allocwrapper_fast(size,AllocFunction);
+}
+
+
+#endif //GC_AMIGA_FASTALLOC
+
+
+
+/*
+ * The wrapped realloc function.
+ *
+ */
+void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes){
+#ifndef GC_AMIGA_FASTALLOC
+ return GC_realloc(old_object,new_size_in_bytes);
+#else
+ void *ret;
+ latestsize=new_size_in_bytes;
+ ret=GC_realloc(old_object,new_size_in_bytes);
+ if(ret==NULL && GC_AMIGA_MEMF==(MEMF_FAST | MEMF_CLEAR)){
+ /* Out of fast-mem. */
+#ifdef GC_AMIGA_GC
+ if(!GC_dont_gc){
+ GC_gcollect();
+#ifdef GC_AMIGA_PRINTSTATS
+ numcollects++;
+#endif
+ ret=GC_realloc(old_object,new_size_in_bytes);
+ }
+#endif
+ if(ret==NULL){
+#ifndef GC_AMIGA_ONLYFAST
+ GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR;
+ if(GC_amiga_toany!=NULL) (*GC_amiga_toany)();
+ GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any;
+ ret=GC_realloc(old_object,new_size_in_bytes);
+#endif
+ }
+#ifdef GC_AMIGA_PRINTSTATS
+ else{
+ nullretries++;
+ }
+#endif
+ }
+ if(ret==NULL){
+ WARN("Out of Memory! Returning NIL!\n", 0);
+ }
+#ifdef GC_AMIGA_PRINTSTATS
+ if(((char *)ret)<chipmax && ret!=NULL){
+ chipa+=new_size_in_bytes;
+ }
+#endif
+ return ret;
+#endif
+}
+
+#endif //GC_AMIGA_AM
+
+
diff --git a/gc/BCC_MAKEFILE b/gc/BCC_MAKEFILE
@@ -47,9 +47,9 @@ gc.lib: $(OBJS)
$(XXXOBJS:XXX=+)
|
-gctest.exe: test.obj gc.lib
+gctest.exe: tests\test.obj gc.lib
$(cc) @&&|
- $(cflags) -W -e$* test.obj gc.lib
+ $(cflags) -W -e$* tests\test.obj gc.lib
|
cord\de.obj cord\de_win.obj: cord\cord.h cord\private\cord_pos.h cord\de_win.h \
@@ -68,8 +68,8 @@ gc_cpp.obj: gc_cpp.h gc.h
gc_cpp.cpp: gc_cpp.cc
copy gc_cpp.cc gc_cpp.cpp
-test_cpp.cpp: test_cpp.cc
- copy test_cpp.cc test_cpp.cpp
+test_cpp.cpp: tests\test_cpp.cc
+ copy tests\test_cpp.cc test_cpp.cpp
test_cpp.exe: test_cpp.obj gc_cpp.h gc.h gc.lib
$(cc) @&&|
diff --git a/gc/EMX_MAKEFILE b/gc/EMX_MAKEFILE
@@ -77,7 +77,7 @@ $(OBJS) test.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
-mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
+mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
gc.a: $(OBJS)
$(AR) ru gc.a $(OBJS)
@@ -120,13 +120,13 @@ cord/de.exe: $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxt
$(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
clean:
- rm -f gc.a test.o gctest.exe output-local output-diff $(OBJS) \
+ rm -f gc.a tests/test.o gctest.exe output-local output-diff $(OBJS) \
setjmp_test mon.out gmon.out a.out core \
$(CORD_OBJS) cord/cordtest.exe cord/de.exe
-rm -f *~
-gctest.exe: test.o gc.a
- $(CC) $(CFLAGS) -o gctest.exe test.o gc.a
+gctest.exe: tests/test.o gc.a
+ $(CC) $(CFLAGS) -o gctest.exe tests/test.o gc.a
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
diff --git a/gc/Makefile b/gc/Makefile
@@ -1,52 +1,77 @@
+# This is the original manually generated Makefile. It may still be used
+# to build the collector.
+#
# Primary targets:
# gc.a - builds basic library
-# libgc.a - builds library for use with g++ "-fgc-keyword" extension
# c++ - adds C++ interface to library
# cords - adds cords (heavyweight strings) to library
# test - prints porting information, then builds basic version of gc.a,
# and runs some tests of collector and cords. Does not add cords or
# c++ interface to gc.a
# cord/de - builds dumb editor based on cords.
-ABI_FLAG=
+ABI_FLAG=
CC=cc $(ABI_FLAG)
-CXX=CC $(ABI_FLAG)
+CXX=g++ $(ABI_FLAG)
AS=as $(ABI_FLAG)
# The above doesn't work with gas, which doesn't run cpp.
# Define AS as `gcc -c -x assembler-with-cpp' instead.
# Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
# if you use something other than the default ABI on your machine.
-CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS -DSILENT
+# Redefining srcdir allows object code for the nonPCR version of the collector
+# to be generated in different directories.
+srcdir= .
+VPATH= $(srcdir)
+
+CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
+
+# To build the parallel collector on Linux, add to the above:
+# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
+# To build the parallel collector n a static library on HP/UX, add to the above:
+# -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -DUSE_HPUX_TLS -D_POSIX_C_SOURCE=199506L
+
+# HOSTCC and HOSTCFLAGS are used to build executables that will be run as
+# part of the build process, i.e. on the build machine. These will usually
+# be the same as CC and CFLAGS, except in a cross-compilation environment.
+# Note that HOSTCFLAGS should include any -D flags that affect thread support.
+HOSTCC=$(CC)
+HOSTCFLAGS=$(CFLAGS)
# For dynamic library builds, it may be necessary to add flags to generate
# PIC code, e.g. -fPIC on Linux.
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
+
+# These define arguments influence the collector configuration:
# -DSILENT disables statistics printing, and improves performance.
# -DFIND_LEAK causes GC_find_leak to be initially set.
# This causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
# Finalization and the test program are not usable in this mode.
-# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
-# (Clients should also define SOLARIS_THREADS and then include
+# -DGC_SOLARIS_THREADS enables support for Solaris (thr_) threads.
+# (Clients should also define GC_SOLARIS_THREADS and then include
# gc.h before performing thr_ or dl* or GC_ operations.)
# Must also define -D_REENTRANT.
-# -D_SOLARIS_PTHREADS enables support for Solaris pthreads.
+# -DGC_SOLARIS_PTHREADS enables support for Solaris pthreads.
# Define SOLARIS_THREADS as well.
-# -DIRIX_THREADS enables support for Irix pthreads. See README.irix.
-# -DLINUX_THREADS enables support for Xavier Leroy's Linux threads.
+# -DGC_IRIX_THREADS enables support for Irix pthreads. See README.irix.
+# -DGC_HPUX_THREADS enables support for HP/UX 11 pthreads.
+# Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp.
+# -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads.
# see README.linux. -D_REENTRANT may also be required.
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_priv.h for consequences.)
+# Alternatively, GC_all_interior_pointers can be set at process
+# initialization time.
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
# usually causing it to use less space in such situations.
# Incremental collection no longer works in this case.
# -DLARGE_CONFIG tunes the collector for unusually large heaps.
# Necessary for heaps larger than about 500 MB on most machines.
# Recommended for heaps larger than about 64 MB.
-# -DDONT_ADD_BYTE_AT_END is meaningful only with
-# -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
+# -DDONT_ADD_BYTE_AT_END is meaningful only with -DALL_INTERIOR_POINTERS or
+# GC_all_interior_pointers = 1. Normally -DALL_INTERIOR_POINTERS
# causes all objects to be padded so that pointers just past the end of
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
@@ -56,24 +81,34 @@ CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DALL_INT
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
+# This is on by default. Turning it off has not been extensively tested with
+# compilers that reorder stores. It should have been.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
# collector on UNIX machines. It may greatly improve its performance,
# since this may avoid some expensive cache synchronization.
-# -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
-# new syntax "operator new[]" for allocating and deleting arrays.
+# -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
+# the new syntax "operator new[]" for allocating and deleting arrays.
# See gc_cpp.h for details. No effect on the C part of the collector.
-# This is defined implicitly in a few environments.
+# This is defined implicitly in a few environments. Must also be defined
+# by clients that use gc_cpp.h.
# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
# as aliases for X, GC_realloc, and GC_free, respectively.
# Calloc is redefined in terms of the new malloc. X should
-# be either GC_malloc or GC_malloc_uncollectable.
+# be either GC_malloc or GC_malloc_uncollectable, or
+# GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
+# with dummy source location information, but still results in
+# properly remembered call stacks on Linux/X86 and Solaris/SPARC.)
# The former is occasionally useful for working around leaks in code
# you don't want to (or can't) look at. It may not work for
# existing code, but it often does. Neither works on all platforms,
# since some ports use malloc or calloc to obtain system memory.
# (Probably works for UNIX, and win32.)
+# -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
+# The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
+# together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
+# generate leak reports with call stacks for both malloc and realloc.
# -DIGNORE_FREE turns calls to free into a noop. Only useful with
# -DREDIRECT_MALLOC.
# -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
@@ -110,81 +145,138 @@ CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DALL_INT
# like a pointer, print both the address containing the value, and the
# value of the near-bogus-pointer. Can be used to identifiy regions of
# memory that are likely to contribute misidentified pointers.
-# -DOLD_BLOCK_ALLOC Use the old, possibly faster, large block
-# allocation strategy. The new strategy tries harder to minimize
-# fragmentation, sometimes at the expense of spending more time in the
-# large block allocator and/or collecting more frequently.
-# If you expect the allocator to promptly use an explicitly expanded
-# heap, this is highly recommended.
# -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
# for objects allocated with the debugging allocator. If all objects
# through GC_MALLOC with GC_DEBUG defined, this allows the client
# to determine how particular or randomly chosen objects are reachable
-# for debugging/profiling purposes. The backptr.h interface is
+# for debugging/profiling purposes. The gc_backptr.h interface is
# implemented only if this is defined.
# -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
# this facility is only used in a few places. It is intended primarily
# for debugging of the garbage collector itself, but could also
+# -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
+# the reliability (from 99.9999% to 100%) of some of the debugging
+# code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
+# Assumes that all client allocation is done through debugging
+# allocators.
+# -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
+# the headers to minimize object size, at the expense of checking for
+# writes past the end of an object. This is intended for environments
+# in which most client code is written in a "safe" language, such as
+# Scheme or Java. Assumes that all client allocation is done using
+# the GC_debug_ functions, or through the macros that expand to these,
+# or by redirecting malloc to GC_debug_malloc_replacement.
+# (Also eliminates the field for the requested object size.)
# occasionally be useful for debugging of client code. Slows down the
# collector somewhat, but not drastically.
+# -DSAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
+# allocated through the debugging interface. Affects the amount of
+# information generated in leak reports. Only matters on platforms
+# on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
+# and Solaris/SPARC. Turns on call chain saving on X86. On X86, client
+# code should NOT be compiled with -fomit-frame-pointer.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# Use only for debugging of the incremental collector.
+# -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
+# that include a pointer to a type descriptor in each allocated object).
+# Building this way requires an ANSI C compiler.
+# -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
+# prefetch instructions. No effect except on X86 Linux platforms.
+# Assumes a very recent gcc-compatible compiler and assembler.
+# (Gas prefetcht0 support was added around May 1999.)
+# Empirically the code appears to still run correctly on Pentium II
+# processors, though with no performance benefit. May not run on other
+# X86 processors? In some cases this improves performance by
+# 15% or so.
+# -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
+# prefetch instructions. Same restrictions as USE_I686_PREFETCH.
+# UNTESTED!!
+# -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux
+# causes the collector some system and pthread calls in a more transparent
+# fashion than the usual macro-based approach. Requires GNU ld, and
+# currently probably works only with Linux.
+# -DTHREAD_LOCAL_ALLOC defines GC_local_malloc(), GC_local_malloc_atomic()
+# and GC_local_gcj_malloc(). Needed for gc_gcj.h interface. These allocate
+# in a way that usually does not involve acquisition of a global lock.
+# Currently requires -DGC_LINUX_THREADS, but should be easy to port to
+# other pthreads environments. Recommended for multiprocessors.
+# -DPARALLEL_MARK allows the marker to run in multiple threads. Recommended
+# for multiprocessors. Currently requires Linux on X86 or IA64, though
+# support for other Posix platforms should be fairly easy to add,
+# if the thread implementation is otherwise supported.
+# -DNO_GETENV prevents the collector from looking at environment variables.
+# These may otherwise alter its configuration, or turn off GC altogether.
+# I don't know of a reason to disable this, except possibly if the
+# resulting process runs as a privileged user?
+# -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
+# makes incremental collection easier. Was enabled by default until 6.0.
+# Rarely used, to my knowledge.
#
-
-LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
- -DREDIRECT_MALLOC=GC_malloc_uncollectable \
- -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
-# Flags for building libgc.a -- the last two are required.
-
CXXFLAGS= $(CFLAGS)
AR= ar
RANLIB= ranlib
-# Redefining srcdir allows object code for the nonPCR version of the collector
-# to be generated in different directories. In this case, the destination directory
-# should contain a copy of the original include directory.
-srcdir = .
-VPATH = $(srcdir)
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o
-OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o
+CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c
-CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c
-
-CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
+CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
- sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h \
- gcconfig.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man \
- threadlibs.c if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h weakpointer.h \
- gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h gc_alloc.h \
+ sparc_mach_dep.s include/gc.h include/gc_typed.h \
+ include/private/gc_hdrs.h include/private/gc_priv.h \
+ include/private/gcconfig.h include/private/gc_pmark.h \
+ include/gc_inl.h include/gc_inline.h include/gc_mark.h \
+ threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
+ gcname.c include/weakpointer.h include/private/gc_locks.h \
+ gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
- solaris_threads.h backptr.h $(CORD_SRCS)
-
-OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
- README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
- SCoptions.amiga README.amiga README.win32 cord/README \
- cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
- include/ec.h include/private/cord_pos.h include/private/gcconfig.h \
- include/private/gc_hdrs.h include/private/gc_priv.h \
- include/gc_cpp.h README.rs6000 include/backptr.h \
- include/weakpointer.h README.QUICK callprocs pc_excludes \
- barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
- MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
- include/gc_cpp.h Mac_files/datastart.c Mac_files/dataend.c \
+ sparc_netbsd_mach_dep.s \
+ include/private/solaris_threads.h include/gc_backptr.h \
+ hpux_test_and_clear.s include/gc_gcj.h \
+ include/gc_local_alloc.h include/private/dbg_mlc.h \
+ include/private/specific.h powerpc_macosx_mach_dep.s \
+ include/leak_detector.h include/gc_amiga_redirects.h \
+ include/gc_pthread_redirects.h $(CORD_SRCS)
+
+DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
+ doc/README.amiga doc/README.cords doc/debugging.html \
+ doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \
+ doc/README.sgi doc/README.solaris2 doc/README.uts \
+ doc/README.win32 doc/barrett_diagram doc/README \
+ doc/README.contributors doc/README.changes doc/gc.man \
+ doc/README.environment doc/tree.html doc/gcdescr.html \
+ doc/README.autoconf doc/README.macros
+
+TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
+ tests/leak_test.c tests/thread_leak_test.c
+
+GNU_BUILD_FILES= configure.in Makefile.am configure acinclude.m4 \
+ libtool.m4 install-sh configure.host Makefile.in \
+ aclocal.m4 config.sub config.guess ltconfig \
+ ltmain.sh mkinstalldirs
+
+OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \
+ BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
+ PCR-Makefile SMakefile.amiga Makefile.DLLs \
+ digimars.mak Makefile.direct
+# Makefile and Makefile.direct are copies of each other.
+
+OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
+ MacProjects.sit.hqx MacOS.c \
+ Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
- add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
- win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \
- README.alpha README.linux version.h Makefile.DLLs \
- WCC_MAKEFILE nursery.c nursery.h gc_copy_descr.h \
- include/leak_detector.h
+ add_gc_prefix.c gc_cpp.cpp win32_threads.c \
+ version.h AmigaOS.c \
+ $(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
-CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
- $(srcdir)/cord/private/cord_pos.h
+CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
+ $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
UTILS= if_mach if_not_there threadlibs
@@ -196,7 +288,7 @@ CURSES= -lcurses -ltermlib
# the SHELL environment variable.
SHELL= /bin/sh
-SPECIALCFLAGS =
+SPECIALCFLAGS = -I$(srcdir)/include
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
@@ -204,17 +296,47 @@ SPECIALCFLAGS =
all: gc.a gctest
-pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h gcconfig.h mach_dep.o $(SRCS)
- make -f PCR-Makefile depend
- make -f PCR-Makefile
-
-$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
- $(srcdir)/gcconfig.h $(srcdir)/gc_typed.h Makefile
+BSD-pkg-all: bsd-libgc.a
+
+bsd-libgc.a:
+ $(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
+ mv gc.a bsd-libgc.a
+
+BSD-pkg-install: BSD-pkg-all
+ ${CP} bsd-libgc.a libgc.a
+ ${INSTALL_DATA} libgc.a ${PREFIX}/lib
+ ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
+
+pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
+include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
+mach_dep.o $(SRCS)
+ $(MAKE) -f PCR-Makefile depend
+ $(MAKE) -f PCR-Makefile
+
+$(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
+ $(srcdir)/include/private/gc_priv.h \
+ $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
+ $(srcdir)/include/gc.h \
+ $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
+ Makefile
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
-mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
+mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
+
+specific.o linux_threads.o: $(srcdir)/include/private/specific.h
+
+solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
+
+dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
+
+tests/test.o: tests $(srcdir)/tests/test.c
+ $(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
+ mv test.o tests/test.o
+
+tests:
+ mkdir tests
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
echo > base_lib
@@ -236,16 +358,22 @@ cords: $(CORD_OBJS) cord/cordtest $(UTILS)
./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS)
./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null
-gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
+gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
-test_cpp: $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h \
+test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
base_lib $(UTILS)
rm -f test_cpp
- ./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
- ./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
+ ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs`
+ ./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
-c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp
+c++-t: c++
+ ./test_cpp 1
+
+c++-nt: c++
+ @echo "Use ./test_cpp 1 to test the leak library"
+
+c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp
rm -f dont_ar_4
./if_mach SPARC SUNOS5 touch dont_ar_4
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
@@ -276,7 +404,7 @@ libirixgc.so: $(OBJS) dyn_load.o
# Linux shared library version of the collector
liblinuxgc.so: $(OBJS) dyn_load.o
- gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o -lo
+ gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
ln liblinuxgc.so libgc.so
# Alternative Linux rule. This is preferable, but is likely to break the
@@ -292,19 +420,24 @@ liblinuxgc.so: $(OBJS) dyn_load.o
# gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
# touch liblinuxgc.so
-mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s $(srcdir)/rs6000_mach_dep.s $(UTILS)
+mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s \
+ $(srcdir)/rs6000_mach_dep.s $(srcdir)/powerpc_macosx_mach_dep.s $(UTILS)
rm -f mach_dep.o
./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
- ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
+ ./if_mach POWERPC MACOSX $(AS) -o mach_dep.o $(srcdir)/powerpc_macosx_mach_dep.s
+# ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
+# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
+# Gcc on a 21264 can spill pointers to fp registers. Oops.
./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
+ ./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
-mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS)
+mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
rm -f mark_rts.o
-./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
@@ -313,60 +446,67 @@ mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS)
alloc.o: version.h
-cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
+cord:
+ mkdir cord
+
+cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
mv cordbscs.o cord/cordbscs.o
# not all compilers understand -o filename
-cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
+cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
mv cordxtra.o cord/cordxtra.o
-cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
+cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
mv cordprnt.o cord/cordprnt.o
cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
rm -f cord/cordtest
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
- ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
rm -f cord/de
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
- ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld `./threadlibs`
./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
+ ./if_mach POWERPC MACOSX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
- ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
- ./if_mach M68K AMIGA $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
+ ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
+ ./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs`
-if_mach: $(srcdir)/if_mach.c $(srcdir)/gcconfig.h
- $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
+if_mach: $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
+ $(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/if_mach.c
-threadlibs: $(srcdir)/threadlibs.c $(srcdir)/gcconfig.h Makefile
- $(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
+threadlibs: $(srcdir)/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile
+ $(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/threadlibs.c
if_not_there: $(srcdir)/if_not_there.c
- $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
+ $(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/if_not_there.c
clean:
- rm -f gc.a *.o gctest gctest_dyn_link test_cpp \
+ rm -f gc.a *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \
setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
threadlibs $(CORD_OBJS) cord/cordtest cord/de
-rm -f *~
-gctest: test.o gc.a if_mach if_not_there
+gctest: tests/test.o gc.a $(UTILS)
rm -f gctest
- ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest test.o gc.a -lucb
- ./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest test.o gc.a -ldld
- ./if_not_there gctest $(CC) $(CFLAGS) -o gctest test.o gc.a `./threadlibs`
+ ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest tests/test.o gc.a `./threadlibs`
+ ./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/test.o gc.a `./threadlibs`
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
-setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/gc.h if_mach if_not_there
+setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h $(UTILS)
$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
test: KandRtest cord/cordtest
@@ -377,12 +517,22 @@ KandRtest: setjmp_test gctest
./setjmp_test
./gctest
-add_gc_prefix: add_gc_prefix.c
+add_gc_prefix: $(srcdir)/add_gc_prefix.c $(srcdir)/version.h
$(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c
-gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
- ./add_gc_prefix $(SRCS) $(OTHER_FILES) > /tmp/gc.tar-files
- (cd $(srcdir)/.. ; tar cvfh - `cat /tmp/gc.tar-files`) > gc.tar
+gcname: $(srcdir)/gcname.c $(srcdir)/version.h
+ $(CC) -o gcname $(srcdir)/gcname.c
+
+gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname
+ cp Makefile Makefile.old
+ cp Makefile.direct Makefile
+ rm -f `./gcname`
+ ln -s . `./gcname`
+ ./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) > /tmp/gc.tar-files
+ tar cvfh gc.tar `cat /tmp/gc.tar-files`
+ cp gc.tar `./gcname`.tar
+ gzip `./gcname`.tar
+ rm `./gcname`
pc_gc.tar: $(SRCS) $(OTHER_FILES)
tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
@@ -408,21 +558,23 @@ gc.tar.Z: gc.tar
gc.tar.gz: gc.tar
gzip gc.tar
-lint: $(CSRCS) test.c
- lint -DLINT $(CSRCS) test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
+lint: $(CSRCS) tests/test.c
+ lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
# BTL: added to test shared library version of collector.
# Currently works only under SunOS5. Requires GC_INIT call from statically
# loaded client code.
ABSDIR = `pwd`
-gctest_dyn_link: test.o libgc.so
- $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
+gctest_dyn_link: tests/test.o libgc.so
+ $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
-gctest_irix_dyn_link: test.o libirixgc.so
- $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link test.o -lirixgc
+gctest_irix_dyn_link: tests/test.o libirixgc.so
+ $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
-test_dll.o: test.c libgc_globals.h
- $(CC) $(CFLAGS) -DGC_USE_DLL -c test.c -o test_dll.o
+# The following appear to be dead, especially since libgc_globals.h
+# is apparently lost.
+test_dll.o: tests/test.c libgc_globals.h
+ $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o
test_dll: test_dll.o libgc_dll.a libgc.dll
$(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
@@ -433,13 +585,13 @@ SYM_PREFIX-libgc=GC
# include Makefile.DLLs
reserved_namespace: $(SRCS)
- for file in $(SRCS) test.c test_cpp.cc; do \
+ for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
sed s/GC_/_GC_/g < $$file > tmp; \
cp tmp $$file; \
done
user_namespace: $(SRCS)
- for file in $(SRCS) test.c test_cpp.cc; do \
+ for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
sed s/_GC_/GC_/g < $$file > tmp; \
cp tmp $$file; \
done
diff --git a/gc/Makefile.am b/gc/Makefile.am
@@ -0,0 +1,158 @@
+# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
+#
+# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+#
+# Original author: Tom Tromey
+
+## Process this file with automake to produce Makefile.in.
+
+## FIXME: `make dist' in this directory will not currently work. Many
+## files that should be in the distribution are not mentioned in this
+## Makefile.am.
+
+AUTOMAKE_OPTIONS = cygnus
+
+# Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+## Install a library built with a cross compiler in tooldir, not
+## libdir.
+if USE_LIBDIR
+toolexeclibdir = $(libdir)$(MULTISUBDIR)
+else
+toolexecdir = $(exec_prefix)/$(target_alias)
+toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
+endif
+
+toolexeclib_LTLIBRARIES = $(target_all)
+EXTRA_LTLIBRARIES = libgc.la
+libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
+dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c irix_threads.c \
+linux_threads.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
+obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
+solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c
+
+# Include THREADLIBS here to ensure that the correct versions of
+# linuxthread semaphore functions get linked:
+libgc_la_LIBADD = @addobjs@ $(THREADLIBS)
+libgc_la_DEPENDENCIES = @addobjs@
+libgc_la_LDFLAGS = -version-info 1:1:0 -rpath $(toolexeclibdir)
+
+EXTRA_libgc_la_SOURCES = alpha_mach_dep.s \
+mips_sgi_mach_dep.s mips_ultrix_mach_dep.s powerpc_macosx_mach_dep.s \
+rs6000_mach_dep.s sparc_mach_dep.s sparc_netbsd_mach_dep.s \
+sparc_sunos4_mach_dep.s
+
+AM_CXXFLAGS = @GC_CFLAGS@
+AM_CFLAGS = @GC_CFLAGS@
+
+check_PROGRAMS = gctest
+# The following hack produces a warning from automake, but we need it in order
+# to build a file from a subdirectory. FIXME.
+test.o: tests/test.c
+ $(COMPILE) -c $<
+gctest_OBJECTS = test.o
+gctest_LDADD = ./libgc.la $(THREADLIBS) $(EXTRA_TEST_LIBS)
+TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
+TESTS = gctest
+
+## FIXME: relies on internal code generated by automake.
+all_objs = @addobjs@ $(libgc_la_OBJECTS)
+$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \
+include/private/gc_hdrs.h include/gc.h include/gc_gcj.h include/gc_mark.h
+
+## FIXME: we shouldn't have to do this, but automake forces us to.
+.s.lo:
+## We use -Wp,-P to strip #line directives. Irix `as' chokes on
+## these.
+ $(LTCOMPILE) -Wp,-P -x assembler-with-cpp -c $<
+
+## We have our own definition of LTCOMPILE because we want to use our
+## CFLAGS, not those passed in from the top level make.
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(MY_CFLAGS) $(GC_CFLAGS)
+LINK = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(MY_CFLAGS) $(LDFLAGS) -o $@
+
+AM_CFLAGS = @GC_CFLAGS@
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = \
+ "AR_FLAGS=$(AR_FLAGS)" \
+ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
+ "CFLAGS=$(CFLAGS)" \
+ "CXXFLAGS=$(CXXFLAGS)" \
+ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
+ "INSTALL=$(INSTALL)" \
+ "INSTALL_DATA=$(INSTALL_DATA)" \
+ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
+ "LDFLAGS=$(LDFLAGS)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
+ "MAKE=$(MAKE)" \
+ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
+ "PICFLAG=$(PICFLAG)" \
+ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
+ "SHELL=$(SHELL)" \
+ "EXPECT=$(EXPECT)" \
+ "RUNTEST=$(RUNTEST)" \
+ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
+ "exec_prefix=$(exec_prefix)" \
+ "infodir=$(infodir)" \
+ "libdir=$(libdir)" \
+ "prefix=$(prefix)" \
+ "tooldir=$(tooldir)" \
+ "AR=$(AR)" \
+ "AS=$(AS)" \
+ "CC=$(CC)" \
+ "CXX=$(CXX)" \
+ "LD=$(LD)" \
+ "LIBCFLAGS=$(LIBCFLAGS)" \
+ "NM=$(NM)" \
+ "PICFLAG=$(PICFLAG)" \
+ "RANLIB=$(RANLIB)" \
+ "DESTDIR=$(DESTDIR)"
+
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
+
+# Multilib support.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-am: all-multi
+install-am: install-multi
+mostlyclean-am: mostlyclean-multi
+clean-am: clean-multi
+distclean-am: distclean-multi
+maintainer-clean-am: maintainer-clean-multi
+
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+MAKEOVERRIDES=
diff --git a/gc/Makefile.direct b/gc/Makefile.direct
@@ -0,0 +1,597 @@
+# This is the original manually generated Makefile. It may still be used
+# to build the collector.
+#
+# Primary targets:
+# gc.a - builds basic library
+# c++ - adds C++ interface to library
+# cords - adds cords (heavyweight strings) to library
+# test - prints porting information, then builds basic version of gc.a,
+# and runs some tests of collector and cords. Does not add cords or
+# c++ interface to gc.a
+# cord/de - builds dumb editor based on cords.
+ABI_FLAG=
+CC=cc $(ABI_FLAG)
+CXX=g++ $(ABI_FLAG)
+AS=as $(ABI_FLAG)
+# The above doesn't work with gas, which doesn't run cpp.
+# Define AS as `gcc -c -x assembler-with-cpp' instead.
+# Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64)
+# if you use something other than the default ABI on your machine.
+
+# Redefining srcdir allows object code for the nonPCR version of the collector
+# to be generated in different directories.
+srcdir= .
+VPATH= $(srcdir)
+
+CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
+
+# To build the parallel collector on Linux, add to the above:
+# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
+# To build the parallel collector n a static library on HP/UX, add to the above:
+# -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -DUSE_HPUX_TLS -D_POSIX_C_SOURCE=199506L
+
+# HOSTCC and HOSTCFLAGS are used to build executables that will be run as
+# part of the build process, i.e. on the build machine. These will usually
+# be the same as CC and CFLAGS, except in a cross-compilation environment.
+# Note that HOSTCFLAGS should include any -D flags that affect thread support.
+HOSTCC=$(CC)
+HOSTCFLAGS=$(CFLAGS)
+
+# For dynamic library builds, it may be necessary to add flags to generate
+# PIC code, e.g. -fPIC on Linux.
+
+# Setjmp_test may yield overly optimistic results when compiled
+# without optimization.
+
+# These define arguments influence the collector configuration:
+# -DSILENT disables statistics printing, and improves performance.
+# -DFIND_LEAK causes GC_find_leak to be initially set.
+# This causes the collector to assume that all inaccessible
+# objects should have been explicitly deallocated, and reports exceptions.
+# Finalization and the test program are not usable in this mode.
+# -DGC_SOLARIS_THREADS enables support for Solaris (thr_) threads.
+# (Clients should also define GC_SOLARIS_THREADS and then include
+# gc.h before performing thr_ or dl* or GC_ operations.)
+# Must also define -D_REENTRANT.
+# -DGC_SOLARIS_PTHREADS enables support for Solaris pthreads.
+# Define SOLARIS_THREADS as well.
+# -DGC_IRIX_THREADS enables support for Irix pthreads. See README.irix.
+# -DGC_HPUX_THREADS enables support for HP/UX 11 pthreads.
+# Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp.
+# -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads.
+# see README.linux. -D_REENTRANT may also be required.
+# -DALL_INTERIOR_POINTERS allows all pointers to the interior
+# of objects to be recognized. (See gc_priv.h for consequences.)
+# Alternatively, GC_all_interior_pointers can be set at process
+# initialization time.
+# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
+# usually causing it to use less space in such situations.
+# Incremental collection no longer works in this case.
+# -DLARGE_CONFIG tunes the collector for unusually large heaps.
+# Necessary for heaps larger than about 500 MB on most machines.
+# Recommended for heaps larger than about 64 MB.
+# -DDONT_ADD_BYTE_AT_END is meaningful only with -DALL_INTERIOR_POINTERS or
+# GC_all_interior_pointers = 1. Normally -DALL_INTERIOR_POINTERS
+# causes all objects to be padded so that pointers just past the end of
+# an object can be recognized. This can be expensive. (The padding
+# is normally more than one byte due to alignment constraints.)
+# -DDONT_ADD_BYTE_AT_END disables the padding.
+# -DNO_SIGNALS does not disable signals during critical parts of
+# the GC process. This is no less correct than many malloc
+# implementations, and it sometimes has a significant performance
+# impact. However, it is dangerous for many not-quite-ANSI C
+# programs that call things like printf in asynchronous signal handlers.
+# This is on by default. Turning it off has not been extensively tested with
+# compilers that reorder stores. It should have been.
+# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
+# have execute permission, i.e. it may be impossible to execute
+# code from the heap. Currently this only affects the incremental
+# collector on UNIX machines. It may greatly improve its performance,
+# since this may avoid some expensive cache synchronization.
+# -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
+# the new syntax "operator new[]" for allocating and deleting arrays.
+# See gc_cpp.h for details. No effect on the C part of the collector.
+# This is defined implicitly in a few environments. Must also be defined
+# by clients that use gc_cpp.h.
+# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
+# as aliases for X, GC_realloc, and GC_free, respectively.
+# Calloc is redefined in terms of the new malloc. X should
+# be either GC_malloc or GC_malloc_uncollectable, or
+# GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
+# with dummy source location information, but still results in
+# properly remembered call stacks on Linux/X86 and Solaris/SPARC.)
+# The former is occasionally useful for working around leaks in code
+# you don't want to (or can't) look at. It may not work for
+# existing code, but it often does. Neither works on all platforms,
+# since some ports use malloc or calloc to obtain system memory.
+# (Probably works for UNIX, and win32.)
+# -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
+# The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
+# together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
+# generate leak reports with call stacks for both malloc and realloc.
+# -DIGNORE_FREE turns calls to free into a noop. Only useful with
+# -DREDIRECT_MALLOC.
+# -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
+# Reduces code size slightly at the expense of debuggability.
+# -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
+# order by specifying a nonstandard finalization mark procedure (see
+# finalize.c). Objects reachable from finalizable objects will be marked
+# in a sepearte postpass, and hence their memory won't be reclaimed.
+# Not recommended unless you are implementing a language that specifies
+# these semantics. Since 5.0, determines only only the initial value
+# of GC_java_finalization variable.
+# -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
+# to explicit GC_invoke_finalizers() calls.
+# In 5.0 this became runtime adjustable, and this only determines the
+# initial value of GC_finalize_on_demand.
+# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
+# This is useful if either the vendor malloc implementation is poor,
+# or if REDIRECT_MALLOC is used.
+# -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
+# sets the heap block size. Each heap block is devoted to a single size and
+# kind of object. For the incremental collector it makes sense to match
+# the most likely page size. Otherwise large values result in more
+# fragmentation, but generally better performance for large heaps.
+# -DUSE_MMAP use MMAP instead of sbrk to get new memory.
+# Works for Solaris and Irix.
+# -DUSE_MUNMAP causes memory to be returned to the OS under the right
+# circumstances. This currently disables VM-based incremental collection.
+# This is currently experimental, and works only under some Unix and
+# Linux versions.
+# -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
+# GC_scratch_alloc() to get stack memory.
+# -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
+# the garbage collector detects a value that looks almost, but not quite,
+# like a pointer, print both the address containing the value, and the
+# value of the near-bogus-pointer. Can be used to identifiy regions of
+# memory that are likely to contribute misidentified pointers.
+# -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
+# for objects allocated with the debugging allocator. If all objects
+# through GC_MALLOC with GC_DEBUG defined, this allows the client
+# to determine how particular or randomly chosen objects are reachable
+# for debugging/profiling purposes. The gc_backptr.h interface is
+# implemented only if this is defined.
+# -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
+# this facility is only used in a few places. It is intended primarily
+# for debugging of the garbage collector itself, but could also
+# -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
+# the reliability (from 99.9999% to 100%) of some of the debugging
+# code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
+# Assumes that all client allocation is done through debugging
+# allocators.
+# -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
+# the headers to minimize object size, at the expense of checking for
+# writes past the end of an object. This is intended for environments
+# in which most client code is written in a "safe" language, such as
+# Scheme or Java. Assumes that all client allocation is done using
+# the GC_debug_ functions, or through the macros that expand to these,
+# or by redirecting malloc to GC_debug_malloc_replacement.
+# (Also eliminates the field for the requested object size.)
+# occasionally be useful for debugging of client code. Slows down the
+# collector somewhat, but not drastically.
+# -DSAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
+# allocated through the debugging interface. Affects the amount of
+# information generated in leak reports. Only matters on platforms
+# on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
+# and Solaris/SPARC. Turns on call chain saving on X86. On X86, client
+# code should NOT be compiled with -fomit-frame-pointer.
+# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
+# altered stubborn objects, at substantial performance cost.
+# Use only for debugging of the incremental collector.
+# -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
+# that include a pointer to a type descriptor in each allocated object).
+# Building this way requires an ANSI C compiler.
+# -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
+# prefetch instructions. No effect except on X86 Linux platforms.
+# Assumes a very recent gcc-compatible compiler and assembler.
+# (Gas prefetcht0 support was added around May 1999.)
+# Empirically the code appears to still run correctly on Pentium II
+# processors, though with no performance benefit. May not run on other
+# X86 processors? In some cases this improves performance by
+# 15% or so.
+# -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
+# prefetch instructions. Same restrictions as USE_I686_PREFETCH.
+# UNTESTED!!
+# -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux
+# causes the collector some system and pthread calls in a more transparent
+# fashion than the usual macro-based approach. Requires GNU ld, and
+# currently probably works only with Linux.
+# -DTHREAD_LOCAL_ALLOC defines GC_local_malloc(), GC_local_malloc_atomic()
+# and GC_local_gcj_malloc(). Needed for gc_gcj.h interface. These allocate
+# in a way that usually does not involve acquisition of a global lock.
+# Currently requires -DGC_LINUX_THREADS, but should be easy to port to
+# other pthreads environments. Recommended for multiprocessors.
+# -DPARALLEL_MARK allows the marker to run in multiple threads. Recommended
+# for multiprocessors. Currently requires Linux on X86 or IA64, though
+# support for other Posix platforms should be fairly easy to add,
+# if the thread implementation is otherwise supported.
+# -DNO_GETENV prevents the collector from looking at environment variables.
+# These may otherwise alter its configuration, or turn off GC altogether.
+# I don't know of a reason to disable this, except possibly if the
+# resulting process runs as a privileged user?
+# -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
+# makes incremental collection easier. Was enabled by default until 6.0.
+# Rarely used, to my knowledge.
+#
+
+CXXFLAGS= $(CFLAGS)
+AR= ar
+RANLIB= ranlib
+
+
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o
+
+CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c
+
+CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
+
+CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
+
+SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
+ sparc_mach_dep.s include/gc.h include/gc_typed.h \
+ include/private/gc_hdrs.h include/private/gc_priv.h \
+ include/private/gcconfig.h include/private/gc_pmark.h \
+ include/gc_inl.h include/gc_inline.h include/gc_mark.h \
+ threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
+ gcname.c include/weakpointer.h include/private/gc_locks.h \
+ gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
+ include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
+ sparc_netbsd_mach_dep.s \
+ include/private/solaris_threads.h include/gc_backptr.h \
+ hpux_test_and_clear.s include/gc_gcj.h \
+ include/gc_local_alloc.h include/private/dbg_mlc.h \
+ include/private/specific.h powerpc_macosx_mach_dep.s \
+ include/leak_detector.h include/gc_amiga_redirects.h \
+ include/gc_pthread_redirects.h $(CORD_SRCS)
+
+DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
+ doc/README.amiga doc/README.cords doc/debugging.html \
+ doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \
+ doc/README.sgi doc/README.solaris2 doc/README.uts \
+ doc/README.win32 doc/barrett_diagram doc/README \
+ doc/README.contributors doc/README.changes doc/gc.man \
+ doc/README.environment doc/tree.html doc/gcdescr.html \
+ doc/README.autoconf doc/README.macros
+
+TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
+ tests/leak_test.c tests/thread_leak_test.c
+
+GNU_BUILD_FILES= configure.in Makefile.am configure acinclude.m4 \
+ libtool.m4 install-sh configure.host Makefile.in \
+ aclocal.m4 config.sub config.guess ltconfig \
+ ltmain.sh mkinstalldirs
+
+OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \
+ BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
+ PCR-Makefile SMakefile.amiga Makefile.DLLs \
+ digimars.mak Makefile.direct
+# Makefile and Makefile.direct are copies of each other.
+
+OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
+ MacProjects.sit.hqx MacOS.c \
+ Mac_files/datastart.c Mac_files/dataend.c \
+ Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
+ add_gc_prefix.c gc_cpp.cpp win32_threads.c \
+ version.h AmigaOS.c \
+ $(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
+
+CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
+ $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
+
+UTILS= if_mach if_not_there threadlibs
+
+# Libraries needed for curses applications. Only needed for de.
+CURSES= -lcurses -ltermlib
+
+# The following is irrelevant on most systems. But a few
+# versions of make otherwise fork the shell specified in
+# the SHELL environment variable.
+SHELL= /bin/sh
+
+SPECIALCFLAGS = -I$(srcdir)/include
+# Alternative flags to the C compiler for mach_dep.c.
+# Mach_dep.c often doesn't like optimization, and it's
+# not time-critical anyway.
+# Set SPECIALCFLAGS to -q nodirect_code on Encore.
+
+all: gc.a gctest
+
+BSD-pkg-all: bsd-libgc.a
+
+bsd-libgc.a:
+ $(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
+ mv gc.a bsd-libgc.a
+
+BSD-pkg-install: BSD-pkg-all
+ ${CP} bsd-libgc.a libgc.a
+ ${INSTALL_DATA} libgc.a ${PREFIX}/lib
+ ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
+
+pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
+include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
+mach_dep.o $(SRCS)
+ $(MAKE) -f PCR-Makefile depend
+ $(MAKE) -f PCR-Makefile
+
+$(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
+ $(srcdir)/include/private/gc_priv.h \
+ $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
+ $(srcdir)/include/gc.h \
+ $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
+ Makefile
+# The dependency on Makefile is needed. Changing
+# options such as -DSILENT affects the size of GC_arrays,
+# invalidating all .o files that rely on gc_priv.h
+
+mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
+
+specific.o linux_threads.o: $(srcdir)/include/private/specific.h
+
+solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
+
+dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
+
+tests/test.o: tests $(srcdir)/tests/test.c
+ $(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
+ mv test.o tests/test.o
+
+tests:
+ mkdir tests
+
+base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
+ echo > base_lib
+ rm -f dont_ar_1
+ ./if_mach SPARC SUNOS5 touch dont_ar_1
+ ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
+ ./if_mach M68K AMIGA touch dont_ar_1
+ ./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o
+ ./if_not_there dont_ar_1 $(AR) ru gc.a $(OBJS) dyn_load.o
+ ./if_not_there dont_ar_1 $(RANLIB) gc.a || cat /dev/null
+# ignore ranlib failure; that usually means it doesn't exist, and isn't needed
+
+cords: $(CORD_OBJS) cord/cordtest $(UTILS)
+ rm -f dont_ar_3
+ ./if_mach SPARC SUNOS5 touch dont_ar_3
+ ./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
+ ./if_mach M68K AMIGA touch dont_ar_3
+ ./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS)
+ ./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS)
+ ./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null
+
+gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
+ $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
+
+test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
+base_lib $(UTILS)
+ rm -f test_cpp
+ ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs`
+ ./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
+
+c++-t: c++
+ ./test_cpp 1
+
+c++-nt: c++
+ @echo "Use ./test_cpp 1 to test the leak library"
+
+c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp
+ rm -f dont_ar_4
+ ./if_mach SPARC SUNOS5 touch dont_ar_4
+ ./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
+ ./if_mach M68K AMIGA touch dont_ar_4
+ ./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o
+ ./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o
+ ./if_not_there dont_ar_4 $(RANLIB) gc.a || cat /dev/null
+ ./test_cpp 1
+ echo > c++
+
+dyn_load_sunos53.o: dyn_load.c
+ $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
+
+# SunOS5 shared library version of the collector
+sunos5gc.so: $(OBJS) dyn_load_sunos53.o
+ $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
+ ln sunos5gc.so libgc.so
+
+# Alpha/OSF shared library version of the collector
+libalphagc.so: $(OBJS)
+ ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
+ ln libalphagc.so libgc.so
+
+# IRIX shared library version of the collector
+libirixgc.so: $(OBJS) dyn_load.o
+ ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
+ ln libirixgc.so libgc.so
+
+# Linux shared library version of the collector
+liblinuxgc.so: $(OBJS) dyn_load.o
+ gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
+ ln liblinuxgc.so libgc.so
+
+# Alternative Linux rule. This is preferable, but is likely to break the
+# Makefile for some non-linux platforms.
+# LIBOBJS= $(patsubst %.o, %.lo, $(OBJS))
+#
+#.SUFFIXES: .lo $(SUFFIXES)
+#
+#.c.lo:
+# $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
+#
+# liblinuxgc.so: $(LIBOBJS) dyn_load.lo
+# gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
+# touch liblinuxgc.so
+
+mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s \
+ $(srcdir)/rs6000_mach_dep.s $(srcdir)/powerpc_macosx_mach_dep.s $(UTILS)
+ rm -f mach_dep.o
+ ./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
+ ./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
+ ./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
+ ./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
+ ./if_mach POWERPC MACOSX $(AS) -o mach_dep.o $(srcdir)/powerpc_macosx_mach_dep.s
+# ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
+# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
+# Gcc on a 21264 can spill pointers to fp registers. Oops.
+ ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
+ ./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
+ ./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
+ ./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
+ ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
+
+mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
+ rm -f mark_rts.o
+ -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
+ ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
+# Work-around for DEC optimizer tail recursion elimination bug.
+# The ALPHA-specific line should be removed if gcc is used.
+
+alloc.o: version.h
+
+cord:
+ mkdir cord
+
+cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
+ $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
+ mv cordbscs.o cord/cordbscs.o
+# not all compilers understand -o filename
+
+cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
+ $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
+ mv cordxtra.o cord/cordxtra.o
+
+cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
+ $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
+ mv cordprnt.o cord/cordprnt.o
+
+cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
+ rm -f cord/cordtest
+ ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
+ ./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
+
+cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
+ rm -f cord/de
+ ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs`
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld `./threadlibs`
+ ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
+ ./if_mach POWERPC MACOSX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
+ ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
+ ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
+ ./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
+ ./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs`
+
+if_mach: $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
+ $(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/if_mach.c
+
+threadlibs: $(srcdir)/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile
+ $(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/threadlibs.c
+
+if_not_there: $(srcdir)/if_not_there.c
+ $(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/if_not_there.c
+
+clean:
+ rm -f gc.a *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \
+ setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
+ threadlibs $(CORD_OBJS) cord/cordtest cord/de
+ -rm -f *~
+
+gctest: tests/test.o gc.a $(UTILS)
+ rm -f gctest
+ ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
+ ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs`
+ ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest tests/test.o gc.a `./threadlibs`
+ ./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/test.o gc.a `./threadlibs`
+
+# If an optimized setjmp_test generates a segmentation fault,
+# odds are your compiler is broken. Gctest may still work.
+# Try compiling setjmp_t.c unoptimized.
+setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h $(UTILS)
+ $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
+
+test: KandRtest cord/cordtest
+ cord/cordtest
+
+# Those tests that work even with a K&R C compiler:
+KandRtest: setjmp_test gctest
+ ./setjmp_test
+ ./gctest
+
+add_gc_prefix: $(srcdir)/add_gc_prefix.c $(srcdir)/version.h
+ $(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c
+
+gcname: $(srcdir)/gcname.c $(srcdir)/version.h
+ $(CC) -o gcname $(srcdir)/gcname.c
+
+gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname
+ cp Makefile Makefile.old
+ cp Makefile.direct Makefile
+ rm -f `./gcname`
+ ln -s . `./gcname`
+ ./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) > /tmp/gc.tar-files
+ tar cvfh gc.tar `cat /tmp/gc.tar-files`
+ cp gc.tar `./gcname`.tar
+ gzip `./gcname`.tar
+ rm `./gcname`
+
+pc_gc.tar: $(SRCS) $(OTHER_FILES)
+ tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
+
+floppy: pc_gc.tar
+ -mmd a:/cord
+ -mmd a:/cord/private
+ -mmd a:/include
+ -mmd a:/include/private
+ mkdir /tmp/pc_gc
+ cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
+ -mcopy -tmn /tmp/pc_gc/* a:
+ -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
+ -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
+ -mcopy -tmn /tmp/pc_gc/cord/private/* a:/cord/private
+ -mcopy -tmn /tmp/pc_gc/include/* a:/include
+ -mcopy -tmn /tmp/pc_gc/include/private/* a:/include/private
+ rm -r /tmp/pc_gc
+
+gc.tar.Z: gc.tar
+ compress gc.tar
+
+gc.tar.gz: gc.tar
+ gzip gc.tar
+
+lint: $(CSRCS) tests/test.c
+ lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
+
+# BTL: added to test shared library version of collector.
+# Currently works only under SunOS5. Requires GC_INIT call from statically
+# loaded client code.
+ABSDIR = `pwd`
+gctest_dyn_link: tests/test.o libgc.so
+ $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
+
+gctest_irix_dyn_link: tests/test.o libirixgc.so
+ $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
+
+# The following appear to be dead, especially since libgc_globals.h
+# is apparently lost.
+test_dll.o: tests/test.c libgc_globals.h
+ $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o
+
+test_dll: test_dll.o libgc_dll.a libgc.dll
+ $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
+
+SYM_PREFIX-libgc=GC
+
+# Uncomment the following line to build a GNU win32 DLL
+# include Makefile.DLLs
+
+reserved_namespace: $(SRCS)
+ for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
+ sed s/GC_/_GC_/g < $$file > tmp; \
+ cp tmp $$file; \
+ done
+
+user_namespace: $(SRCS)
+ for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
+ sed s/_GC_/GC_/g < $$file > tmp; \
+ cp tmp $$file; \
+ done
diff --git a/gc/Makefile.dj b/gc/Makefile.dj
@@ -1,3 +1,7 @@
+# This Makefile is intended only for DJGPP use.
+# It is mainly a copy of the main Makefile, but tends to get out of sync
+# with it. A merge would probably be appropriate.
+
# Primary targets:
# gc.a - builds basic library
# libgc.a - builds library for use with g++ "-fgc-keyword" extension
@@ -20,29 +24,18 @@ AS=gcc -c -x assembler-with-cpp $(ABI_FLAG)
CXXLD=gxx $(ABI_FLAG)
EXE_SUFFIX=.exe
-CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
+srcdir= .
+VPATH= $(srcdir)
-# For dynamic library builds, it may be necessary to add flags to generate
-# PIC code, e.g. -fPIC on Linux.
+CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
-# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
-# altered stubborn objects, at substantial performance cost.
-# Use only for incremental collector debugging.
-# -DFIND_LEAK causes the collector to assume that all inaccessible
+# -DFIND_LEAK causes GC_find_leak to be initially set.
+# This causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
# Finalization and the test program are not usable in this mode.
-# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
-# (Clients should also define SOLARIS_THREADS and then include
-# gc.h before performing thr_ or dl* or GC_ operations.)
-# Must also define -D_REENTRANT.
-# -D_SOLARIS_PTHREADS enables support for Solaris pthreads.
-# Define SOLARIS_THREADS as well.
-# -DIRIX_THREADS enables support for Irix pthreads. See README.irix.
-# -DLINUX_THREADS enables support for Xavier Leroy's Linux threads.
-# see README.linux. -D_REENTRANT may also be required.
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_priv.h for consequences.)
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
@@ -62,15 +55,18 @@ CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXEC
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
+# This is on by default. Turning it off has not been extensively tested with
+# compilers that reorder stores. It should have been.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
# collector on UNIX machines. It may greatly improve its performance,
# since this may avoid some expensive cache synchronization.
-# -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
-# new syntax "operator new[]" for allocating and deleting arrays.
+# -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
+# the new syntax "operator new[]" for allocating and deleting arrays.
# See gc_cpp.h for details. No effect on the C part of the collector.
-# This is defined implicitly in a few environments.
+# This is defined implicitly in a few environments. Must also be defined
+# by clients that use gc_cpp.h.
# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
# as aliases for X, GC_realloc, and GC_free, respectively.
# Calloc is redefined in terms of the new malloc. X should
@@ -89,9 +85,12 @@ CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXEC
# finalize.c). Objects reachable from finalizable objects will be marked
# in a sepearte postpass, and hence their memory won't be reclaimed.
# Not recommended unless you are implementing a language that specifies
-# these semantics.
+# these semantics. Since 5.0, determines only only the initial value
+# of GC_java_finalization variable.
# -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
# to explicit GC_invoke_finalizers() calls.
+# In 5.0 this became runtime adjustable, and this only determines the
+# initial value of GC_finalize_on_demand.
# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
# This is useful if either the vendor malloc implementation is poor,
# or if REDIRECT_MALLOC is used.
@@ -100,76 +99,100 @@ CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXEC
# kind of object. For the incremental collector it makes sense to match
# the most likely page size. Otherwise large values result in more
# fragmentation, but generally better performance for large heaps.
-# -DUSE_MMAP use MMAP instead of sbrk to get new memory.
-# Works for Solaris and Irix.
-# -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
-# GC_scratch_alloc() to get stack memory.
# -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
# the garbage collector detects a value that looks almost, but not quite,
# like a pointer, print both the address containing the value, and the
# value of the near-bogus-pointer. Can be used to identifiy regions of
# memory that are likely to contribute misidentified pointers.
-# -DOLD_BLOCK_ALLOC Use the old, possibly faster, large block
-# allocation strategy. The new strategy tries harder to minimize
-# fragmentation, sometimes at the expense of spending more time in the
-# large block allocator and/or collecting more frequently.
-# If you expect the allocator to promtly use an explicitly expanded
-# heap, this is highly recommended.
-#
-
-
+# -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
+# for objects allocated with the debugging allocator. If all objects
+# through GC_MALLOC with GC_DEBUG defined, this allows the client
+# to determine how particular or randomly chosen objects are reachable
+# for debugging/profiling purposes. The gc_backptr.h interface is
+# implemented only if this is defined.
+# -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
+# this facility is only used in a few places. It is intended primarily
+# for debugging of the garbage collector itself, but could also
+# -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
+# the reliability (from 99.9999% to 100%) of some of the debugging
+# code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
+# Assumes that all client allocation is done through debugging
+# allocators.
+# -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
+# the headers to minimize object size, at the expense of checking for
+# writes past the end of an object. This is intended for environments
+# in which most client code is written in a "safe" language, such as
+# Scheme or Java. Assumes that all client allocation is done using
+# the GC_debug_ functions (or through the macros that expand to these.
+# (Also eliminates the field for the requested object size.)
+# occasionally be useful for debugging of client code. Slows down the
+# collector somewhat, but not drastically.
+# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
+# altered stubborn objects, at substantial performance cost.
+# Use only for debugging of the incremental collector.
+# -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
+# that include a pointer to a type descriptor in each allocated object).
+# Building this way requires an ANSI C compiler.
+# -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
+# prefetch instructions. No effect except on X86 Linux platforms.
+# Assumes a very recent gcc-compatible compiler and assembler.
+# (Gas prefetcht0 support was added around May 1999.)
+# Empirically the code appears to still run correctly on Pentium II
+# processors, though with no performance benefit. May not run on other
+# X86 processors? In some cases this improves performance by
+# 15% or so.
+# -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
+# prefetch instructions. Same restrictions as USE_I686_PREFETCH.
+# UNTESTED!!
+# -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux
+# causes the collector some system and pthread calls in a more transparent
+# fashion than the usual macro-based approach. Requires GNU ld, and
+# currently probably works only with Linux.
-LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
- -DREDIRECT_MALLOC=GC_malloc_uncollectable \
- -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
-# Flags for building libgc.a -- the last two are required.
CXXFLAGS= $(CFLAGS) -DOPERATOR_NEW_ARRAY
AR= ar
RANLIB= ranlib
-# Redefining srcdir allows object code for the nonPCR version of the collector
-# to be generated in different directories. In this case, the destination directory
-# should contain a copy of the original include directory.
-srcdir = .
-VPATH = $(srcdir)
-
-OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o hpux_irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o
-CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c
+CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c hpux_irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c
-CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
+CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
- sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h \
- gcconfig.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man \
- threadlibs.c if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h weakpointer.h \
- gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h gc_alloc.h \
+ sparc_mach_dep.s include/gc.h include/gc_typed.h \
+ include/private/gc_hdrs.h include/private/gc_priv.h \
+ include/private/gcconfig.h include/private/gc_mark.h \
+ include/gc_inl.h include/gc_inline.h gc.man \
+ threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
+ include/weakpointer.h include/private/gc_locks.h \
+ gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
- solaris_threads.h $(CORD_SRCS)
+ include/private/solaris_threads.h include/gc_backptr.h \
+ hpux_test_and_clear.s include/gc_gcj.h \
+ include/gc_local_alloc.h include/private/dbg_mlc.h \
+ include/private/specific.h powerpc_macosx_mach_dep.s \
+ include/leak_detector.h $(CORD_SRCS)
OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
SCoptions.amiga README.amiga README.win32 cord/README \
- cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
- include/ec.h include/private/cord_pos.h include/private/gcconfig.h \
- include/private/gc_hdrs.h include/private/gc_priv.h \
- include/gc_cpp.h README.rs6000 \
- include/weakpointer.h README.QUICK callprocs pc_excludes \
+ README.rs6000 README.QUICK callprocs pc_excludes \
barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
- MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
- include/gc_cpp.h Mac_files/datastart.c Mac_files/dataend.c \
+ MacOS.c EMX_MAKEFILE README.debugging \
+ Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \
- README.alpha README.linux version.h Makefile.DLLs \
- WCC_MAKEFILE
+ README.alpha README.linux README.MacOSX version.h Makefile.DLLs \
+ WCC_MAKEFILE nursery.c include/gc_nursery.h include/gc_copy_descr.h
-CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
- $(srcdir)/cord/private/cord_pos.h
+CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
+ $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
UTILS= if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
@@ -189,12 +212,12 @@ SPECIALCFLAGS =
all: gc.a gctest$(EXE_SUFFIX)
-pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h gcconfig.h mach_dep.o $(SRCS)
- make -f PCR-Makefile depend
- make -f PCR-Makefile
-
-$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
- $(srcdir)/gcconfig.h $(srcdir)/gc_typed.h Makefile
+$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: \
+ $(srcdir)/include/private/gc_priv.h \
+ $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
+ $(srcdir)/include/gc.h \
+ $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
+ Makefile
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
@@ -217,17 +240,17 @@ cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS)
./if_not_there on_sparc_sunos5_3 $(AR) ru gc.a $(CORD_OBJS)
-./if_not_there on_sparc_sunos5_3 $(RANLIB) gc.a
-gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
+gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
-test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h \
+test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
base_lib $(UTILS)
rm -f test_cpp test_cpp$(EXE_SUFFIX)
./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
./if_not_there test_cpp$(EXE_SUFFIX) $(CXXLD) $(CXXFLAGS) -o test_cpp$(EXE_SUFFIX) $(srcdir)/test_cpp.cc gc_cpp.o gc.a
rm -f test_cpp
-c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp$(EXE_SUFFIX)
+c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp$(EXE_SUFFIX)
rm -f on_sparc_sunos5_4
./if_mach SPARC SUNOS5 touch on_sparc_sunos5_4
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
@@ -259,12 +282,14 @@ liblinuxgc.so: $(OBJS) dyn_load.o
gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o -lo
ln liblinuxgc.so libgc.so
-mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s $(srcdir)/rs6000_mach_dep.s $(UTILS)
+mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s \
+ $(srcdir)/rs6000_mach_dep.s $(srcdir)/powerpc_macosx_mach_dep.s $(UTILS)
rm -f mach_dep.o
./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
+ ./if_mach POWERPC MACOSX $(AS) -o mach_dep.o $(srcdir)/powerpc_macosx_mach_dep.s
./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
@@ -312,20 +337,17 @@ cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $
./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_not_there cord/de$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/de$(EXE_SUFFIX) $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES)
-if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/gcconfig.h
+if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
rm -f if_mach if_mach$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
- rm -f if_mach
-threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)/gcconfig.h Makefile
+threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)include/private/gcconfig.h Makefile
rm -f threadlibs threadlibs$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
- rm -f threadlibs
if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c
rm -f if_not_there if_not_there$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
- rm -f if_not_there
# Clean removes *.o several times,
# because as the first one doesn't seem to get them all!
@@ -352,7 +374,7 @@ gctest$(EXE_SUFFIX): test.o gc.a if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
-setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/gc.h \
+setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h \
if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
rm -f setjmp_test$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
@@ -377,21 +399,6 @@ gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
pc_gc.tar: $(SRCS) $(OTHER_FILES)
tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
-floppy: pc_gc.tar
- -mmd a:/cord
- -mmd a:/cord/private
- -mmd a:/include
- -mmd a:/include/private
- mkdir /tmp/pc_gc
- cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
- -mcopy -tmn /tmp/pc_gc/* a:
- -mcopy -tmn /tmp/pc_gc/cord/* a:/cord
- -mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
- -mcopy -tmn /tmp/pc_gc/cord/private/* a:/cord/private
- -mcopy -tmn /tmp/pc_gc/include/* a:/include
- -mcopy -tmn /tmp/pc_gc/include/private/* a:/include/private
- rm -r /tmp/pc_gc
-
gc.tar.Z: gc.tar
compress gc.tar
@@ -408,9 +415,6 @@ ABSDIR = `pwd`
gctest_dyn_link: test.o libgc.so
$(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
-gctest_irix_dyn_link: test.o libirixgc.so
- $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link test.o -lirixgc
-
test_dll.o: test.c libgc_globals.h
$(CC) $(CFLAGS) -DGC_USE_DLL -c test.c -o test_dll.o
@@ -422,15 +426,3 @@ SYM_PREFIX-libgc=GC
# Uncomment the following line to build a GNU win32 DLL
# include Makefile.DLLs
-reserved_namespace: $(SRCS)
- for file in $(SRCS) test.c test_cpp.cc; do \
- sed s/GC_/_GC_/g < $$file > tmp; \
- cp tmp $$file; \
- done
-
-user_namespace: $(SRCS)
- for file in $(SRCS) test.c test_cpp.cc; do \
- sed s/_GC_/GC_/g < $$file > tmp; \
- cp tmp $$file; \
- done
-
diff --git a/gc/Makefile.in b/gc/Makefile.in
@@ -0,0 +1,518 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
+#
+# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+#
+# Original author: Tom Tromey
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
+host_alias = @host_alias@
+host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
+AR = @AR@
+AS = @AS@
+CC = @CC@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXINCLUDES = @CXXINCLUDES@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+EXTRA_TEST_LIBS = @EXTRA_TEST_LIBS@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+GC_CFLAGS = @GC_CFLAGS@
+INCLUDES = @INCLUDES@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MY_CFLAGS = @MY_CFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+THREADLIBS = @THREADLIBS@
+VERSION = @VERSION@
+addobjs = @addobjs@
+gc_basedir = @gc_basedir@
+target_all = @target_all@
+
+AUTOMAKE_OPTIONS = cygnus
+
+# Multilib support variables.
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+@USE_LIBDIR_TRUE@toolexeclibdir = $(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = $(exec_prefix)/$(target_alias)
+
+toolexeclib_LTLIBRARIES = $(target_all)
+EXTRA_LTLIBRARIES = libgc.la
+libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c irix_threads.c linux_threads.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c
+
+
+# Include THREADLIBS here to ensure that the correct versions of
+# linuxthread semaphore functions get linked:
+libgc_la_LIBADD = @addobjs@ $(THREADLIBS)
+libgc_la_DEPENDENCIES = @addobjs@
+libgc_la_LDFLAGS = -version-info 1:1:0 -rpath $(toolexeclibdir)
+
+EXTRA_libgc_la_SOURCES = alpha_mach_dep.s mips_sgi_mach_dep.s mips_ultrix_mach_dep.s powerpc_macosx_mach_dep.s rs6000_mach_dep.s sparc_mach_dep.s sparc_netbsd_mach_dep.s sparc_sunos4_mach_dep.s
+
+
+AM_CXXFLAGS = @GC_CFLAGS@
+
+AM_CFLAGS = @GC_CFLAGS@
+
+check_PROGRAMS = gctest
+gctest_OBJECTS = test.o
+gctest_LDADD = ./libgc.la $(THREADLIBS) $(EXTRA_TEST_LIBS)
+TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
+TESTS = gctest
+
+all_objs = @addobjs@ $(libgc_la_OBJECTS)
+
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(MY_CFLAGS) $(GC_CFLAGS)
+
+LINK = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(MY_CFLAGS) $(LDFLAGS) -o $@
+
+# Work around what appears to be a GNU make bug handling MAKEFLAGS
+# values defined in terms of make variables, as is the case for CC and
+# friends when we are called from the top level Makefile.
+AM_MAKEFLAGS = "AR_FLAGS=$(AR_FLAGS)" "CC_FOR_BUILD=$(CC_FOR_BUILD)" "CFLAGS=$(CFLAGS)" "CXXFLAGS=$(CXXFLAGS)" "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" "INSTALL=$(INSTALL)" "INSTALL_DATA=$(INSTALL_DATA)" "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" "LDFLAGS=$(LDFLAGS)" "LIBCFLAGS=$(LIBCFLAGS)" "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" "MAKE=$(MAKE)" "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" "PICFLAG=$(PICFLAG)" "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" "SHELL=$(SHELL)" "EXPECT=$(EXPECT)" "RUNTEST=$(RUNTEST)" "RUNTESTFLAGS=$(RUNTESTFLAGS)" "exec_prefix=$(exec_prefix)" "infodir=$(infodir)" "libdir=$(libdir)" "prefix=$(prefix)" "tooldir=$(tooldir)" "AR=$(AR)" "AS=$(AS)" "CC=$(CC)" "CXX=$(CXX)" "LD=$(LD)" "LIBCFLAGS=$(LIBCFLAGS)" "NM=$(NM)" "PICFLAG=$(PICFLAG)" "RANLIB=$(RANLIB)" "DESTDIR=$(DESTDIR)"
+
+
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
+
+MAKEOVERRIDES =
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
+dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo headers.lo \
+irix_threads.lo linux_threads.lo malloc.lo mallocx.lo mark.lo \
+mark_rts.lo misc.lo new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo \
+ptr_chck.lo real_malloc.lo reclaim.lo solaris_pthreads.lo \
+solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo
+check_PROGRAMS = gctest$(EXEEXT)
+gctest_DEPENDENCIES = ./libgc.la
+gctest_LDFLAGS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+DIST_COMMON = Makefile.am Makefile.in acinclude.m4 aclocal.m4 \
+config.guess config.sub configure configure.in install-sh ltconfig \
+ltmain.sh
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+SOURCES = $(libgc_la_SOURCES) $(EXTRA_libgc_la_SOURCES)
+OBJECTS = $(libgc_la_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+mostlyclean-toolexeclibLTLIBRARIES:
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+
+distclean-toolexeclibLTLIBRARIES:
+
+maintainer-clean-toolexeclibLTLIBRARIES:
+
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p; \
+ else :; fi; \
+ done
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
+ done
+
+.c.o:
+ $(COMPILE) -c $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+.c.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+
+maintainer-clean-libtool:
+
+libgc.la: $(libgc_la_OBJECTS) $(libgc_la_DEPENDENCIES)
+ $(LINK) $(libgc_la_LDFLAGS) $(libgc_la_OBJECTS) $(libgc_la_LIBADD) $(LIBS)
+
+mostlyclean-checkPROGRAMS:
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+
+distclean-checkPROGRAMS:
+
+maintainer-clean-checkPROGRAMS:
+
+gctest$(EXEEXT): $(gctest_OBJECTS) $(gctest_DEPENDENCIES)
+ @rm -f gctest$(EXEEXT)
+ $(LINK) $(gctest_LDFLAGS) $(gctest_OBJECTS) $(gctest_LDADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+check-TESTS: $(TESTS)
+ @failed=0; all=0; \
+ srcdir=$(srcdir); export srcdir; \
+ for tst in $(TESTS); do \
+ if test -f $$tst; then dir=.; \
+ else dir="$(srcdir)"; fi; \
+ if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
+ all=`expr $$all + 1`; \
+ echo "PASS: $$tst"; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="$$failed of $$all tests failed"; \
+ fi; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-info-am:
+install-info: install-info-am
+install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-checkPROGRAMS \
+ mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
+ clean-checkPROGRAMS clean-tags clean-generic \
+ mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \
+ distclean-libtool distclean-checkPROGRAMS \
+ distclean-tags distclean-generic clean-am
+ -rm -f libtool
+
+distclean: distclean-am
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-toolexeclibLTLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-checkPROGRAMS maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+ -rm -f config.status
+
+.PHONY: mostlyclean-toolexeclibLTLIBRARIES \
+distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+maintainer-clean-toolexeclibLTLIBRARIES \
+uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-libtool distclean-libtool \
+clean-libtool maintainer-clean-libtool mostlyclean-checkPROGRAMS \
+distclean-checkPROGRAMS clean-checkPROGRAMS \
+maintainer-clean-checkPROGRAMS tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir check-TESTS info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-info-am \
+install-info install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+# The following hack produces a warning from automake, but we need it in order
+# to build a file from a subdirectory. FIXME.
+test.o: tests/test.c
+ $(COMPILE) -c tests/test.c
+$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \
+include/private/gc_hdrs.h include/gc.h include/gc_gcj.h include/gc_mark.h
+
+.s.lo:
+ $(LTCOMPILE) -Wp,-P -x assembler-with-cpp -c $<
+
+# Multilib support.
+.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
+ maintainer-clean-multi
+
+all-am: all-multi
+install-am: install-multi
+mostlyclean-am: mostlyclean-multi
+clean-am: clean-multi
+distclean-am: distclean-multi
+maintainer-clean-am: maintainer-clean-multi
+
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gc/NT_MAKEFILE b/gc/NT_MAKEFILE
@@ -10,29 +10,29 @@ OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_r
all: gctest.exe cord\de.exe test_cpp.exe
.c.obj:
- $(cc) $(cdebug) $(cflags) $(cvars) -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ $*.c /Fo$*.obj
+ $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL $*.c /Fo$*.obj
.cpp.obj:
- $(cc) $(cdebug) $(cflags) $(cvars) -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS $*.CPP /Fo$*.obj
+ $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP /Fo$*.obj
-$(OBJS) test.obj: gc_priv.h gc_hdrs.h gc.h
+$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h
gc.lib: $(OBJS)
lib /MACHINE:i386 /out:gc.lib $(OBJS)
# The original NT SDK used lib32 instead of lib
-gctest.exe: test.obj gc.lib
+gctest.exe: tests\test.obj gc.lib
# The following works for win32 debugging. For win32s debugging use debugtype:coff
# and add mapsympe line.
# This produces a "GUI" applications that opens no windows and writes to the log file
# "gc.log". This is done to make the result runnable under win32s.
- $(link) -debug:full -debugtype:cv $(guiflags) -stack:131072 -out:$*.exe test.obj $(guilibs) gc.lib
+ $(link) -debug:full -debugtype:cv $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc.lib
# mapsympe -n -o gctest.sym gctest.exe
cord\de_win.rbj: cord\de_win.res
cvtres -$(CPU) cord\de_win.res -o cord\de_win.rbj
-cord\de.obj cord\de_win.obj: cord\cord.h cord\private\cord_pos.h cord\de_win.h cord\de_cmds.h
+cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h cord\de_cmds.h
cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h
$(rc) $(rcvars) -r -fo cord\de_win.res $(cvars) cord\de_win.rc
@@ -41,18 +41,18 @@ cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs)
-gc_cpp.obj: gc_cpp.h gc.h
+gc_cpp.obj: include\gc_cpp.h include\gc.h
gc_cpp.cpp: gc_cpp.cc
copy gc_cpp.cc gc_cpp.cpp
-test_cpp.cpp: test_cpp.cc
- copy test_cpp.cc test_cpp.cpp
+test_cpp.cpp: tests\test_cpp.cc
+ copy tests\test_cpp.cc test_cpp.cpp
# This generates the C++ test executable. The executable expects
# a single numeric argument, which is the number of iterations.
# The output appears in the file "gc.log".
-test_cpp.exe: test_cpp.obj gc_cpp.h gc.h gc.lib
+test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs)
diff --git a/gc/NT_THREADS_MAKEFILE b/gc/NT_THREADS_MAKEFILE
@@ -0,0 +1,2158 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
+# This has been hand-edited way too many times.
+# A clean, manually generated makefile would be an improvement.
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+!IF "$(CFG)" == ""
+CFG=gctest - Win32 Release
+!MESSAGE No configuration specified. Defaulting to cord - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "gc - Win32 Release" && "$(CFG)" != "gc - Win32 Debug" &&\
+ "$(CFG)" != "gctest - Win32 Release" && "$(CFG)" != "gctest - Win32 Debug" &&\
+ "$(CFG)" != "cord - Win32 Release" && "$(CFG)" != "cord - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "gc.mak" CFG="cord - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "gc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "gc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "gctest - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "gctest - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "cord - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "cord - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "gctest - Win32 Debug"
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+OUTDIR=.\Release
+INTDIR=.\Release
+
+ALL : ".\Release\gc.dll" ".\Release\gc.bsc"
+
+CLEAN :
+ -@erase ".\Release\allchblk.obj"
+ -@erase ".\Release\allchblk.sbr"
+ -@erase ".\Release\alloc.obj"
+ -@erase ".\Release\alloc.sbr"
+ -@erase ".\Release\blacklst.obj"
+ -@erase ".\Release\blacklst.sbr"
+ -@erase ".\Release\checksums.obj"
+ -@erase ".\Release\checksums.sbr"
+ -@erase ".\Release\dbg_mlc.obj"
+ -@erase ".\Release\dbg_mlc.sbr"
+ -@erase ".\Release\dyn_load.obj"
+ -@erase ".\Release\dyn_load.sbr"
+ -@erase ".\Release\finalize.obj"
+ -@erase ".\Release\finalize.sbr"
+ -@erase ".\Release\gc.bsc"
+ -@erase ".\Release\gc_cpp.obj"
+ -@erase ".\Release\gc_cpp.sbr"
+ -@erase ".\Release\gc.dll"
+ -@erase ".\Release\gc.exp"
+ -@erase ".\Release\gc.lib"
+ -@erase ".\Release\headers.obj"
+ -@erase ".\Release\headers.sbr"
+ -@erase ".\Release\mach_dep.obj"
+ -@erase ".\Release\mach_dep.sbr"
+ -@erase ".\Release\malloc.obj"
+ -@erase ".\Release\malloc.sbr"
+ -@erase ".\Release\mallocx.obj"
+ -@erase ".\Release\mallocx.sbr"
+ -@erase ".\Release\mark.obj"
+ -@erase ".\Release\mark.sbr"
+ -@erase ".\Release\mark_rts.obj"
+ -@erase ".\Release\mark_rts.sbr"
+ -@erase ".\Release\misc.obj"
+ -@erase ".\Release\misc.sbr"
+ -@erase ".\Release\new_hblk.obj"
+ -@erase ".\Release\new_hblk.sbr"
+ -@erase ".\Release\obj_map.obj"
+ -@erase ".\Release\obj_map.sbr"
+ -@erase ".\Release\os_dep.obj"
+ -@erase ".\Release\os_dep.sbr"
+ -@erase ".\Release\ptr_chck.obj"
+ -@erase ".\Release\ptr_chck.sbr"
+ -@erase ".\Release\reclaim.obj"
+ -@erase ".\Release\reclaim.sbr"
+ -@erase ".\Release\stubborn.obj"
+ -@erase ".\Release\stubborn.sbr"
+ -@erase ".\Release\typd_mlc.obj"
+ -@erase ".\Release\typd_mlc.sbr"
+ -@erase ".\Release\win32_threads.obj"
+ -@erase ".\Release\win32_threads.sbr"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D\
+ "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
+ "WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.\Release/
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc"
+BSC32_SBRS= \
+ ".\Release\allchblk.sbr" \
+ ".\Release\alloc.sbr" \
+ ".\Release\blacklst.sbr" \
+ ".\Release\checksums.sbr" \
+ ".\Release\dbg_mlc.sbr" \
+ ".\Release\dyn_load.sbr" \
+ ".\Release\finalize.sbr" \
+ ".\Release\gc_cpp.sbr" \
+ ".\Release\headers.sbr" \
+ ".\Release\mach_dep.sbr" \
+ ".\Release\malloc.sbr" \
+ ".\Release\mallocx.sbr" \
+ ".\Release\mark.sbr" \
+ ".\Release\mark_rts.sbr" \
+ ".\Release\misc.sbr" \
+ ".\Release\new_hblk.sbr" \
+ ".\Release\obj_map.sbr" \
+ ".\Release\os_dep.sbr" \
+ ".\Release\ptr_chck.sbr" \
+ ".\Release\reclaim.sbr" \
+ ".\Release\stubborn.sbr" \
+ ".\Release\typd_mlc.sbr" \
+ ".\Release\win32_threads.sbr"
+
+".\Release\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
+ /pdb:"$(OUTDIR)/gc.pdb" /machine:I386 /out:"$(OUTDIR)/gc.dll"\
+ /implib:"$(OUTDIR)/gc.lib"
+LINK32_OBJS= \
+ ".\Release\allchblk.obj" \
+ ".\Release\alloc.obj" \
+ ".\Release\blacklst.obj" \
+ ".\Release\checksums.obj" \
+ ".\Release\dbg_mlc.obj" \
+ ".\Release\dyn_load.obj" \
+ ".\Release\finalize.obj" \
+ ".\Release\gc_cpp.obj" \
+ ".\Release\headers.obj" \
+ ".\Release\mach_dep.obj" \
+ ".\Release\malloc.obj" \
+ ".\Release\mallocx.obj" \
+ ".\Release\mark.obj" \
+ ".\Release\mark_rts.obj" \
+ ".\Release\misc.obj" \
+ ".\Release\new_hblk.obj" \
+ ".\Release\obj_map.obj" \
+ ".\Release\os_dep.obj" \
+ ".\Release\ptr_chck.obj" \
+ ".\Release\reclaim.obj" \
+ ".\Release\stubborn.obj" \
+ ".\Release\typd_mlc.obj" \
+ ".\Release\win32_threads.obj"
+
+".\Release\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+OUTDIR=.\Debug
+INTDIR=.\Debug
+
+ALL : ".\Debug\gc.dll" ".\Debug\gc.bsc"
+
+CLEAN :
+ -@erase ".\Debug\allchblk.obj"
+ -@erase ".\Debug\allchblk.sbr"
+ -@erase ".\Debug\alloc.obj"
+ -@erase ".\Debug\alloc.sbr"
+ -@erase ".\Debug\blacklst.obj"
+ -@erase ".\Debug\blacklst.sbr"
+ -@erase ".\Debug\checksums.obj"
+ -@erase ".\Debug\checksums.sbr"
+ -@erase ".\Debug\dbg_mlc.obj"
+ -@erase ".\Debug\dbg_mlc.sbr"
+ -@erase ".\Debug\dyn_load.obj"
+ -@erase ".\Debug\dyn_load.sbr"
+ -@erase ".\Debug\finalize.obj"
+ -@erase ".\Debug\finalize.sbr"
+ -@erase ".\Debug\gc_cpp.obj"
+ -@erase ".\Debug\gc_cpp.sbr"
+ -@erase ".\Debug\gc.bsc"
+ -@erase ".\Debug\gc.dll"
+ -@erase ".\Debug\gc.exp"
+ -@erase ".\Debug\gc.lib"
+ -@erase ".\Debug\gc.map"
+ -@erase ".\Debug\gc.pdb"
+ -@erase ".\Debug\headers.obj"
+ -@erase ".\Debug\headers.sbr"
+ -@erase ".\Debug\mach_dep.obj"
+ -@erase ".\Debug\mach_dep.sbr"
+ -@erase ".\Debug\malloc.obj"
+ -@erase ".\Debug\malloc.sbr"
+ -@erase ".\Debug\mallocx.obj"
+ -@erase ".\Debug\mallocx.sbr"
+ -@erase ".\Debug\mark.obj"
+ -@erase ".\Debug\mark.sbr"
+ -@erase ".\Debug\mark_rts.obj"
+ -@erase ".\Debug\mark_rts.sbr"
+ -@erase ".\Debug\misc.obj"
+ -@erase ".\Debug\misc.sbr"
+ -@erase ".\Debug\new_hblk.obj"
+ -@erase ".\Debug\new_hblk.sbr"
+ -@erase ".\Debug\obj_map.obj"
+ -@erase ".\Debug\obj_map.sbr"
+ -@erase ".\Debug\os_dep.obj"
+ -@erase ".\Debug\os_dep.sbr"
+ -@erase ".\Debug\ptr_chck.obj"
+ -@erase ".\Debug\ptr_chck.sbr"
+ -@erase ".\Debug\reclaim.obj"
+ -@erase ".\Debug\reclaim.sbr"
+ -@erase ".\Debug\stubborn.obj"
+ -@erase ".\Debug\stubborn.sbr"
+ -@erase ".\Debug\typd_mlc.obj"
+ -@erase ".\Debug\typd_mlc.sbr"
+ -@erase ".\Debug\vc40.idb"
+ -@erase ".\Debug\vc40.pdb"
+ -@erase ".\Debug\win32_threads.obj"
+ -@erase ".\Debug\win32_threads.sbr"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD"\
+ /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
+ "WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/"\
+ /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.\Debug/
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /win32
+MTL_PROJ=/nologo /D "_DEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc"
+BSC32_SBRS= \
+ ".\Debug\allchblk.sbr" \
+ ".\Debug\alloc.sbr" \
+ ".\Debug\blacklst.sbr" \
+ ".\Debug\checksums.sbr" \
+ ".\Debug\dbg_mlc.sbr" \
+ ".\Debug\dyn_load.sbr" \
+ ".\Debug\finalize.sbr" \
+ ".\Debug\gc_cpp.sbr" \
+ ".\Debug\headers.sbr" \
+ ".\Debug\mach_dep.sbr" \
+ ".\Debug\malloc.sbr" \
+ ".\Debug\mallocx.sbr" \
+ ".\Debug\mark.sbr" \
+ ".\Debug\mark_rts.sbr" \
+ ".\Debug\misc.sbr" \
+ ".\Debug\new_hblk.sbr" \
+ ".\Debug\obj_map.sbr" \
+ ".\Debug\os_dep.sbr" \
+ ".\Debug\ptr_chck.sbr" \
+ ".\Debug\reclaim.sbr" \
+ ".\Debug\stubborn.sbr" \
+ ".\Debug\typd_mlc.sbr" \
+ ".\Debug\win32_threads.sbr"
+
+".\Debug\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
+ /pdb:"$(OUTDIR)/gc.pdb" /map:"$(INTDIR)/gc.map" /debug /machine:I386\
+ /out:"$(OUTDIR)/gc.dll" /implib:"$(OUTDIR)/gc.lib"
+LINK32_OBJS= \
+ ".\Debug\allchblk.obj" \
+ ".\Debug\alloc.obj" \
+ ".\Debug\blacklst.obj" \
+ ".\Debug\checksums.obj" \
+ ".\Debug\dbg_mlc.obj" \
+ ".\Debug\dyn_load.obj" \
+ ".\Debug\finalize.obj" \
+ ".\Debug\gc_cpp.obj" \
+ ".\Debug\headers.obj" \
+ ".\Debug\mach_dep.obj" \
+ ".\Debug\malloc.obj" \
+ ".\Debug\mallocx.obj" \
+ ".\Debug\mark.obj" \
+ ".\Debug\mark_rts.obj" \
+ ".\Debug\misc.obj" \
+ ".\Debug\new_hblk.obj" \
+ ".\Debug\obj_map.obj" \
+ ".\Debug\os_dep.obj" \
+ ".\Debug\ptr_chck.obj" \
+ ".\Debug\reclaim.obj" \
+ ".\Debug\stubborn.obj" \
+ ".\Debug\typd_mlc.obj" \
+ ".\Debug\win32_threads.obj"
+
+".\Debug\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "gctest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "gctest\Release"
+# PROP BASE Intermediate_Dir "gctest\Release"
+# PROP BASE Target_Dir "gctest"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "gctest\Release"
+# PROP Intermediate_Dir "gctest\Release"
+# PROP Target_Dir "gctest"
+OUTDIR=.\gctest\Release
+INTDIR=.\gctest\Release
+
+ALL : "gc - Win32 Release" ".\Release\gctest.exe"
+
+CLEAN :
+ -@erase ".\gctest\Release\test.obj"
+ -@erase ".\Release\gctest.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+test.c : tests\test.c
+ copy tests\test.c test.c
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+ "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS"\
+ /Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\gctest\Release/
+CPP_SBRS=.\.
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/gctest.exe"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/gctest.pdb" /machine:I386 /out:"Release/gctest.exe"
+LINK32_OBJS= \
+ ".\gctest\Release\test.obj" \
+ ".\Release\gc.lib"
+
+".\Release\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "gctest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "gctest\Debug"
+# PROP BASE Intermediate_Dir "gctest\Debug"
+# PROP BASE Target_Dir "gctest"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "gctest\Debug"
+# PROP Intermediate_Dir "gctest\Debug"
+# PROP Target_Dir "gctest"
+OUTDIR=.\gctest\Debug
+INTDIR=.\gctest\Debug
+
+ALL : "gc - Win32 Debug" ".\Debug\gctest.exe" ".\gctest\Debug\gctest.bsc"
+
+CLEAN :
+ -@erase ".\Debug\gctest.exe"
+ -@erase ".\gctest\Debug\gctest.bsc"
+ -@erase ".\gctest\Debug\gctest.map"
+ -@erase ".\gctest\Debug\gctest.pdb"
+ -@erase ".\gctest\Debug\test.obj"
+ -@erase ".\gctest\Debug\test.sbr"
+ -@erase ".\gctest\Debug\vc40.idb"
+ -@erase ".\gctest\Debug\vc40.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
+ /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR"$(INTDIR)/"\
+ /Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\gctest\Debug/
+CPP_SBRS=.\gctest\Debug/
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /win32
+MTL_PROJ=/nologo /D "_DEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc"
+BSC32_SBRS= \
+ ".\gctest\Debug\test.sbr"
+
+".\gctest\Debug\gctest.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+ $(BSC32) @<<
+ $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"Debug/gctest.exe"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/gctest.pdb" /map:"$(INTDIR)/gctest.map" /debug /machine:I386\
+ /out:"Debug/gctest.exe"
+LINK32_OBJS= \
+ ".\Debug\gc.lib" \
+ ".\gctest\Debug\test.obj"
+
+".\Debug\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "cord - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "cord\Release"
+# PROP BASE Intermediate_Dir "cord\Release"
+# PROP BASE Target_Dir "cord"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "cord\Release"
+# PROP Intermediate_Dir "cord\Release"
+# PROP Target_Dir "cord"
+OUTDIR=.\cord\Release
+INTDIR=.\cord\Release
+
+ALL : "gc - Win32 Release" ".\Release\de.exe"
+
+CLEAN :
+ -@erase ".\cord\Release\cordbscs.obj"
+ -@erase ".\cord\Release\cordxtra.obj"
+ -@erase ".\cord\Release\de.obj"
+ -@erase ".\cord\Release\de_win.obj"
+ -@erase ".\cord\Release\de_win.res"
+ -@erase ".\Release\de.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+ "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\cord\Release/
+CPP_SBRS=.\.
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/de.exe"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/de.pdb"\
+ /machine:I386 /out:"Release/de.exe"
+LINK32_OBJS= \
+ ".\cord\Release\cordbscs.obj" \
+ ".\cord\Release\cordxtra.obj" \
+ ".\cord\Release\de.obj" \
+ ".\cord\Release\de_win.obj" \
+ ".\cord\Release\de_win.res" \
+ ".\Release\gc.lib"
+
+".\Release\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "cord\Debug"
+# PROP BASE Intermediate_Dir "cord\Debug"
+# PROP BASE Target_Dir "cord"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "cord\Debug"
+# PROP Intermediate_Dir "cord\Debug"
+# PROP Target_Dir "cord"
+OUTDIR=.\cord\Debug
+INTDIR=.\cord\Debug
+
+ALL : "gc - Win32 Debug" ".\Debug\de.exe"
+
+CLEAN :
+ -@erase ".\cord\Debug\cordbscs.obj"
+ -@erase ".\cord\Debug\cordxtra.obj"
+ -@erase ".\cord\Debug\de.obj"
+ -@erase ".\cord\Debug\de.pdb"
+ -@erase ".\cord\Debug\de_win.obj"
+ -@erase ".\cord\Debug\de_win.res"
+ -@erase ".\cord\Debug\vc40.idb"
+ -@erase ".\cord\Debug\vc40.pdb"
+ -@erase ".\Debug\de.exe"
+ -@erase ".\Debug\de.ilk"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I include /D "_DEBUG" /D "WIN32" /D\
+ "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX\
+ /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\cord\Debug/
+CPP_SBRS=.\.
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+MTL=mktyplib.exe
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /win32
+MTL_PROJ=/nologo /D "_DEBUG" /win32
+RSC=rc.exe
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/de.exe"
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib /nologo /subsystem:windows /incremental:yes\
+ /pdb:"$(OUTDIR)/de.pdb" /debug /machine:I386 /out:"Debug/de.exe"
+LINK32_OBJS= \
+ ".\cord\Debug\cordbscs.obj" \
+ ".\cord\Debug\cordxtra.obj" \
+ ".\cord\Debug\de.obj" \
+ ".\cord\Debug\de_win.obj" \
+ ".\cord\Debug\de_win.res" \
+ ".\Debug\gc.lib"
+
+".\Debug\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+################################################################################
+# Begin Target
+
+# Name "gc - Win32 Release"
+# Name "gc - Win32 Debug"
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\gc_cpp.cpp
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_cpp.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Release\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_cpp.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Debug\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\reclaim.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Release\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Debug\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\os_dep.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_OS_DE=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\STAT.H"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_OS_DE=\
+ ".\il\PCR_IL.h"\
+ ".\mm\PCR_MM.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+ ".\vd\PCR_VD.h"\
+
+
+".\Release\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)"
+
+".\Release\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_OS_DE=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\STAT.H"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_OS_DE=\
+ ".\il\PCR_IL.h"\
+ ".\mm\PCR_MM.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+ ".\vd\PCR_VD.h"\
+
+
+".\Debug\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)"
+
+".\Debug\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\misc.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MISC_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MISC_=\
+ ".\il\PCR_IL.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)"
+
+".\Release\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MISC_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MISC_=\
+ ".\il\PCR_IL.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)"
+
+".\Debug\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mark_rts.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MARK_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MARK_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)"
+
+".\Release\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MARK_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MARK_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)"
+
+".\Debug\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mach_dep.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MACH_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MACH_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)"
+
+".\Release\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MACH_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MACH_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)"
+
+".\Debug\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\headers.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_HEADE=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_HEADE=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)"
+
+".\Release\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_HEADE=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_HEADE=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)"
+
+".\Debug\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\alloc.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_ALLOC=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_ALLOC=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)"
+
+".\Release\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_ALLOC=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_ALLOC=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)"
+
+".\Debug\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\allchblk.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_ALLCH=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_ALLCH=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)"
+
+".\Release\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_ALLCH=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_ALLCH=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)"
+
+".\Debug\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\stubborn.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_STUBB=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_STUBB=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)"
+
+".\Release\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_STUBB=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_STUBB=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)"
+
+".\Debug\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\obj_map.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_OBJ_M=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_OBJ_M=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)"
+
+".\Release\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_OBJ_M=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_OBJ_M=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)"
+
+".\Debug\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\new_hblk.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_NEW_H=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_NEW_H=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)"
+
+".\Release\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_NEW_H=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_NEW_H=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)"
+
+".\Debug\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mark.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MARK_C=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MARK_C=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)"
+
+".\Release\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MARK_C=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MARK_C=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)"
+
+".\Debug\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\malloc.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MALLO=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MALLO=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)"
+
+".\Release\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MALLO=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MALLO=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)"
+
+".\Debug\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\mallocx.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_MALLX=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MALLX=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)"
+
+".\Release\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_MALLX=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_MALLX=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)"
+
+".\Debug\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\finalize.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_FINAL=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_FINAL=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)"
+
+".\Release\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_FINAL=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_FINAL=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)"
+
+".\Debug\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dbg_mlc.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_DBG_M=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_DBG_M=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)"
+
+".\Release\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_DBG_M=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_DBG_M=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)"
+
+".\Debug\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\blacklst.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_BLACK=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_BLACK=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)"
+
+".\Release\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_BLACK=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_BLACK=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)"
+
+".\Debug\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\typd_mlc.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_TYPD_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_TYPD_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)"
+
+".\Release\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_TYPD_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_TYPD_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)"
+
+".\Debug\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\ptr_chck.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_PTR_C=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_PTR_C=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)"
+
+".\Release\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_PTR_C=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_PTR_C=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)"
+
+".\Debug\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dyn_load.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_DYN_L=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\STAT.H"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_DYN_L=\
+ ".\il\PCR_IL.h"\
+ ".\mm\PCR_MM.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)"
+
+".\Release\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_DYN_L=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\STAT.H"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_DYN_L=\
+ ".\il\PCR_IL.h"\
+ ".\mm\PCR_MM.h"\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)"
+
+".\Debug\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\win32_threads.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_WIN32=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_WIN32=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
+
+".\Release\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_WIN32=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_WIN32=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
+
+".\Debug\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\checksums.c
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_CHECK=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_CHECK=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)"
+
+".\Release\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_CHECK=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_CHECK=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)"
+
+".\Debug\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "gctest - Win32 Release"
+# Name "gctest - Win32 Debug"
+
+!IF "$(CFG)" == "gctest - Win32 Release"
+
+!ELSEIF "$(CFG)" == "gctest - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Project Dependency
+
+# Project_Dep_Name "gc"
+
+!IF "$(CFG)" == "gctest - Win32 Release"
+
+"gc - Win32 Release" :
+ $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release"
+
+!ELSEIF "$(CFG)" == "gctest - Win32 Debug"
+
+"gc - Win32 Debug" :
+ $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug"
+
+!ENDIF
+
+# End Project Dependency
+################################################################################
+# Begin Source File
+
+SOURCE=.\tests\test.c
+DEP_CPP_TEST_=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_TEST_=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+!IF "$(CFG)" == "gctest - Win32 Release"
+
+
+".\gctest\Release\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gctest - Win32 Debug"
+
+
+".\gctest\Debug\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
+
+".\gctest\Debug\test.sbr" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "cord - Win32 Release"
+# Name "cord - Win32 Debug"
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+!ENDIF
+
+################################################################################
+# Begin Project Dependency
+
+# Project_Dep_Name "gc"
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+"gc - Win32 Release" :
+ $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release"
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+"gc - Win32 Debug" :
+ $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug"
+
+!ENDIF
+
+# End Project Dependency
+################################################################################
+# Begin Source File
+
+SOURCE=.\cord\de_win.c
+DEP_CPP_DE_WI=\
+ ".\include\cord.h"\
+ ".\cord\de_cmds.h"\
+ ".\cord\de_win.h"\
+ ".\include\private\cord_pos.h"\
+
+NODEP_CPP_DE_WI=\
+ ".\include\gc.h"\
+
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+
+".\cord\Release\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+
+".\cord\Debug\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cord\de.c
+DEP_CPP_DE_C2e=\
+ ".\include\cord.h"\
+ ".\cord\de_cmds.h"\
+ ".\cord\de_win.h"\
+ ".\include\private\cord_pos.h"\
+
+NODEP_CPP_DE_C2e=\
+ ".\include\gc.h"\
+
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+
+".\cord\Release\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+
+".\cord\Debug\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cord\cordxtra.c
+DEP_CPP_CORDX=\
+ ".\include\cord.h"\
+ ".\include\ec.h"\
+ ".\include\private\cord_pos.h"\
+
+NODEP_CPP_CORDX=\
+ ".\include\gc.h"\
+
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+
+".\cord\Release\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+
+".\cord\Debug\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cord\cordbscs.c
+DEP_CPP_CORDB=\
+ ".\include\cord.h"\
+ ".\include\private\cord_pos.h"\
+
+NODEP_CPP_CORDB=\
+ ".\include\gc.h"\
+
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+
+".\cord\Release\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+
+".\cord\Debug\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cord\de_win.RC
+
+!IF "$(CFG)" == "cord - Win32 Release"
+
+
+".\cord\Release\de_win.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "NDEBUG" $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "cord - Win32 Debug"
+
+
+".\cord\Debug\de_win.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "_DEBUG" $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+# End Target
+# End Project
+################################################################################
diff --git a/gc/OS2_MAKEFILE b/gc/OS2_MAKEFILE
@@ -17,7 +17,7 @@ CFLAGS= /O /Q /DSILENT /DSMALL_CONFIG /DALL_INTERIOR_POINTERS
all: $(OBJS) gctest.exe cord\cordtest.exe
-$(OBJS) test.obj: gc_priv.h gc_hdrs.h gc.h
+$(OBJS) test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h
## ERASE THE LIB FIRST - if it is already there then this command will fail
## (make sure its there or erase will fail!)
@@ -32,14 +32,14 @@ mach_dep.obj: mach_dep.c
gctest.exe: test.obj gc.lib
$(CC) $(CFLAGS) /B"/STACK:524288" /Fegctest test.obj gc.lib
-cord\cordbscs.obj: cord\cordbscs.c cord\cord.h cord\private\cord_pos.h
+cord\cordbscs.obj: cord\cordbscs.c include\cord.h include\private\cord_pos.h
$(CC) $(CFLAGS) /C /Focord\cordbscs cord\cordbscs.c
-cord\cordxtra.obj: cord\cordxtra.c cord\cord.h cord\private\cord_pos.h cord\ec.h
+cord\cordxtra.obj: cord\cordxtra.c include\cord.h include\private\cord_pos.h include\ec.h
$(CC) $(CFLAGS) /C /Focord\cordxtra cord\cordxtra.c
-cord\cordprnt.obj: cord\cordprnt.c cord\cord.h cord\private\cord_pos.h cord\ec.h
+cord\cordprnt.obj: cord\cordprnt.c include\cord.h include\private\cord_pos.h include\ec.h
$(CC) $(CFLAGS) /C /Focord\cordprnt cord\cordprnt.c
-cord\cordtest.exe: cord\cordtest.c cord\cord.h cord\private\cord_pos.h cord\ec.h $(CORDOBJS) gc.lib
+cord\cordtest.exe: cord\cordtest.c include\cord.h include\private\cord_pos.h include\ec.h $(CORDOBJS) gc.lib
$(CC) $(CFLAGS) /B"/STACK:65536" /Fecord\cordtest cord\cordtest.c gc.lib $(CORDOBJS)
diff --git a/gc/README b/gc/README
@@ -1,1517 +0,0 @@
-Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
-Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
-Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
-
-THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-
-Permission is hereby granted to use or copy this program
-for any purpose, provided the above notices are retained on all copies.
-Permission to modify the code and to distribute modified code is granted,
-provided the above notices are retained, and a notice that the code was
-modified is included with the above copyright notice.
-
-This is version 5.0alpha3 of a conservative garbage collector for C and C++.
-
-You might find a more recent version of this at
-
-http://www.hpl.hp.com/personal/Hans_Boehm/gc
-
-HISTORY -
-
- Early versions of this collector were developed as a part of research
-projects supported in part by the National Science Foundation
-and the Defense Advance Research Projects Agency.
-Much of the code was rewritten by Hans-J. Boehm (boehm@acm.org) at Xerox PARC
-and at SGI.
-
-Some other contributors:
-
-More recent contributors are mentioned in the modification history at the
-end of this file. My apologies for any omissions.
-
-The SPARC specific code was contributed by Mark Weiser
-(weiser@parc.xerox.com). The Encore Multimax modifications were supplied by
-Kevin Kenny (kenny@m.cs.uiuc.edu). The adaptation to the RT is largely due
-to Vernon Lee (scorpion@rice.edu), on machines made available by IBM.
-Much of the HP specific code and a number of good suggestions for improving the
-generic code are due to Walter Underwood (wunder@hp-ses.sde.hp.com).
-Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code.
-Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk)
-subsequently provided updates and information on variation between ULTRIX
-systems. Parag Patel (parag@netcom.com) supplied the A/UX code.
-Jesper Peterson(jep@mtiame.mtia.oz.au), Michel Schinz, and
-Martin Tauchmann (martintauchmann@bigfoot.com) supplied the Amiga port.
-Thomas Funke (thf@zelator.in-berlin.de(?)) and
-Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports.
-Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code.
-Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader
-specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and
-Sony News specific code. Al Dosser provided Alpha/OSF/1 code. He and
-Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes.
-Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports.
-Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port.
-Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to
-a Motorola 88K processor running CX/UX (Harris NightHawk).
-Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to
-nonIBM development environments (a nontrivial task).
-Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port.
-David Chase, then at Olivetti Research, suggested several improvements.
-Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the
-code to save and print call stacks for leak detection on a SPARC.
-Jesse Hull and John Ellis supplied the C++ interface code.
-Zhong Shao performed much of the experimentation that led to the
-current typed allocation facility. (His dynamic type inference code hasn't
-made it into the released version of the collector, yet.)
-(Blame for misinstallation of these modifications goes to the first author,
-however.)
-
-OVERVIEW
-
- This is intended to be a general purpose, garbage collecting storage
-allocator. The algorithms used are described in:
-
-Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
-Software Practice & Experience, September 1988, pp. 807-820.
-
-Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
-Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
-and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
-
-Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
-of the ACM SIGPLAN '91 Conference on Programming Language Design and
-Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
-
- Possible interactions between the collector and optimizing compilers are
-discussed in
-
-Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
-The Journal of C Language Translation 4, 2 (December 1992).
-
-and
-
-Boehm H., "Simple GC-safe Compilation", Proceedings
-of the ACM SIGPLAN '96 Conference on Programming Language Design and
-Implementation.
-
-(Both are also available from
-http://reality.sgi.com/boehm/papers/, among other places.)
-
- Unlike the collector described in the second reference, this collector
-operates either with the mutator stopped during the entire collection
-(default) or incrementally during allocations. (The latter is supported
-on only a few machines.) It does not rely on threads, but is intended
-to be thread-safe.
-
- Some of the ideas underlying the collector have previously been explored
-by others. (Doug McIlroy wrote a vaguely similar collector that is part of
-version 8 UNIX (tm).) However none of this work appears to have been widely
-disseminated.
-
- Rudimentary tools for use of the collector as a leak detector are included, as
-is a fairly sophisticated string package "cord" that makes use of the collector.
-(See cord/README.)
-
-
-GENERAL DESCRIPTION
-
- This is a garbage collecting storage allocator that is intended to be
-used as a plug-in replacement for C's malloc.
-
- Since the collector does not require pointers to be tagged, it does not
-attempt to ensure that all inaccessible storage is reclaimed. However,
-in our experience, it is typically more successful at reclaiming unused
-memory than most C programs using explicit deallocation. Unlike manually
-introduced leaks, the amount of unreclaimed memory typically stays
-bounded.
-
- In the following, an "object" is defined to be a region of memory allocated
-by the routines described below.
-
- Any objects not intended to be collected must be pointed to either
-from other such accessible objects, or from the registers,
-stack, data, or statically allocated bss segments. Pointers from
-the stack or registers may point to anywhere inside an object.
-The same is true for heap pointers if the collector is compiled with
- ALL_INTERIOR_POINTERS defined, as is now the default.
-
-Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
-of garbage objects, by requiring pointers from the heap to to the beginning
-of an object. But this no longer appears to be a significant
-issue for most programs.
-
-There are a number of routines which modify the pointer recognition
-algorithm. GC_register_displacement allows certain interior pointers
-to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
-GC_malloc_ignore_off_page allows some pointers into the middle of large objects
-to be disregarded, greatly reducing the probablility of accidental
-retention of large objects. For most purposes it seems best to compile
-with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
-you get collector warnings from allocations of very large objects.
-See README.debugging for details.
-
- Note that pointers inside memory allocated by the standard "malloc" are not
-seen by the garbage collector. Thus objects pointed to only from such a
-region may be prematurely deallocated. It is thus suggested that the
-standard "malloc" be used only for memory regions, such as I/O buffers, that
-are guaranteed not to contain pointers to garbage collectable memory.
-Pointers in C language automatic, static, or register variables,
-are correctly recognized. (Note that GC_malloc_uncollectable has semantics
-similar to standard malloc, but allocates objects that are traced by the
-collector.)
-
- The collector does not always know how to find pointers in data
-areas that are associated with dynamic libraries. This is easy to
-remedy IF you know how to find those data areas on your operating
-system (see GC_add_roots). Code for doing this under SunOS, IRIX 5.X and 6.X,
-HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default. (See
-README.win32 for win32 details.) On other systems pointers from dynamic
-library data areas may not be considered by the collector.
-
- Note that the garbage collector does not need to be informed of shared
-read-only data. However if the shared library mechanism can introduce
-discontiguous data areas that may contain pointers, then the collector does
-need to be informed.
-
- Signal processing for most signals may be deferred during collection,
-and during uninterruptible parts of the allocation process. Unlike
-standard ANSI C mallocs, it can be safe to invoke malloc
-from a signal handler while another malloc is in progress, provided
-the original malloc is not restarted. (Empirically, many UNIX
-applications already assume this.) To obtain this level of signal
-safety, remove the definition of -DNO_SIGNALS in Makefile. This incurs
-a minor performance penalty, and hence is no longer the default.
-
- The allocator/collector can also be configured for thread-safe operation.
-(Full signal safety can also be achieved, but only at the cost of two system
-calls per malloc, which is usually unacceptable.)
-
-INSTALLATION AND PORTABILITY
-
- As distributed, the macro SILENT is defined in Makefile.
-In the event of problems, this can be removed to obtain a moderate
-amount of descriptive output for each collection.
-(The given statistics exhibit a few peculiarities.
-Things don't appear to add up for a variety of reasons, most notably
-fragmentation losses. These are probably much more significant for the
-contrived program "test.c" than for your application.)
-
- Note that typing "make test" will automatically build the collector
-and then run setjmp_test and gctest. Setjmp_test will give you information
-about configuring the collector, which is useful primarily if you have
-a machine that's not already supported. Gctest is a somewhat superficial
-test of collector functionality. Failure is indicated by a core dump or
-a message to the effect that the collector is broken. Gctest takes about
-35 seconds to run on a SPARCstation 2. On a slower machine,
-expect it to take a while. It may use up to 8 MB of memory. (The
-multi-threaded version will use more.) "Make test" will also, as
-its last step, attempt to build and test the "cord" string library.
-This will fail without an ANSI C compiler.
-
- The Makefile will generate a library gc.a which you should link against.
-Typing "make cords" will add the cord library to gc.a.
-Note that this requires an ANSI C compiler.
-
- It is suggested that if you need to replace a piece of the collector
-(e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
- work.)
-ld command line, rather than replacing the one in gc.a. (This will
-generate numerous warnings under some versions of AIX, but it still
-works.)
-
- All include files that need to be used by clients will be put in the
-include subdirectory. (Normally this is just gc.h. "Make cords" adds
-"cord.h" and "ec.h".)
-
- The collector currently is designed to run essentially unmodified on
-machines that use a flat 32-bit or 64-bit address space.
-That includes the vast majority of Workstations and X86 (X >= 3) PCs.
-(The list here was deleted because it was getting too long and constantly
-out of date.)
- It does NOT run under plain 16-bit DOS or Windows 3.X. There are however
-various packages (e.g. win32s, djgpp) that allow flat 32-bit address
-applications to run under those systemsif the have at least an 80386 processor,
-and several of those are compatible with the collector.
-
- In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
-or equivalent is supplied. Many of these have separate README.system
-files.
-
- Dynamic libraries are completely supported only under SunOS
-(and even that support is not functional on the last Sun 3 release),
-IRIX 5&6, HP-PA, Win32 (not Win32S) and OSF/1 on DEC AXP machines.
-On other machines we recommend that you do one of the following:
-
- 1) Add dynamic library support (and send us the code).
- 2) Use static versions of the libraries.
- 3) Arrange for dynamic libraries to use the standard malloc.
- This is still dangerous if the library stores a pointer to a
- garbage collected object. But nearly all standard interfaces
- prohibit this, because they deal correctly with pointers
- to stack allocated objects. (Strtok is an exception. Don't
- use it.)
-
- In all cases we assume that pointer alignment is consistent with that
-enforced by the standard C compilers. If you use a nonstandard compiler
-you may have to adjust the alignment parameters defined in gc_priv.h.
-
- A port to a machine that is not byte addressed, or does not use 32 bit
-or 64 bit addresses will require a major effort. A port to plain MSDOS
-or win16 is hard.
-
- For machines not already mentioned, or for nonstandard compilers, the
-following are likely to require change:
-
-1. The parameters in gcconfig.h.
- The parameters that will usually require adjustment are
- STACKBOTTOM, ALIGNMENT and DATASTART. Setjmp_test
- prints its guesses of the first two.
- DATASTART should be an expression for computing the
- address of the beginning of the data segment. This can often be
- &etext. But some memory management units require that there be
- some unmapped space between the text and the data segment. Thus
- it may be more complicated. On UNIX systems, this is rarely
- documented. But the adb "$m" command may be helpful. (Note
- that DATASTART will usually be a function of &etext. Thus a
- single experiment is usually insufficient.)
- STACKBOTTOM is used to initialize GC_stackbottom, which
- should be a sufficient approximation to the coldest stack address.
- On some machines, it is difficult to obtain such a value that is
- valid across a variety of MMUs, OS releases, etc. A number of
- alternatives exist for using the collector in spite of this. See the
- discussion in gcconfig.h immediately preceding the various
- definitions of STACKBOTTOM.
-
-2. mach_dep.c.
- The most important routine here is one to mark from registers.
- The distributed file includes a generic hack (based on setjmp) that
- happens to work on many machines, and may work on yours. Try
- compiling and running setjmp_t.c to see whether it has a chance of
- working. (This is not correct C, so don't blame your compiler if it
- doesn't work. Based on limited experience, register window machines
- are likely to cause trouble. If your version of setjmp claims that
- all accessible variables, including registers, have the value they
- had at the time of the longjmp, it also will not work. Vanilla 4.2 BSD
- on Vaxen makes such a claim. SunOS does not.)
- If your compiler does not allow in-line assembly code, or if you prefer
- not to use such a facility, mach_dep.c may be replaced by a .s file
- (as we did for the MIPS machine and the PC/RT).
- At this point enough architectures are supported by mach_dep.c
- that you will rarely need to do more than adjust for assembler
- syntax.
-
-3. os_dep.c (and gc_priv.h).
- Several kinds of operating system dependent routines reside here.
- Many are optional. Several are invoked only through corresponding
- macros in gc_priv.h, which may also be redefined as appropriate.
- The routine GC_register_data_segments is crucial. It registers static
- data areas that must be traversed by the collector. (User calls to
- GC_add_roots may sometimes be used for similar effect.)
- Routines to obtain memory from the OS also reside here.
- Alternatively this can be done entirely by the macro GET_MEM
- defined in gc_priv.h. Routines to disable and reenable signals
- also reside here if they are need by the macros DISABLE_SIGNALS
- and ENABLE_SIGNALS defined in gc_priv.h.
- In a multithreaded environment, the macros LOCK and UNLOCK
- in gc_priv.h will need to be suitably redefined.
- The incremental collector requires page dirty information, which
- is acquired through routines defined in os_dep.c. Unless directed
- otherwise by gcconfig.h, these are implemented as stubs that simply
- treat all pages as dirty. (This of course makes the incremental
- collector much less useful.)
-
-4. dyn_load.c
- This provides a routine that allows the collector to scan data
- segments associated with dynamic libraries. Often it is not
- necessary to provide this routine unless user-written dynamic
- libraries are used.
-
- For a different version of UN*X or different machines using the
-Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
-it should frequently suffice to change definitions in gcconfig.h.
-
-
-THE C INTERFACE TO THE ALLOCATOR
-
- The following routines are intended to be directly called by the user.
-Note that usually only GC_malloc is necessary. GC_clear_roots and GC_add_roots
-calls may be required if the collector has to trace from nonstandard places
-(e.g. from dynamic library data areas on a machine on which the
-collector doesn't already understand them.) On some machines, it may
-be desirable to set GC_stacktop to a good approximation of the stack base.
-(This enhances code portability on HP PA machines, since there is no
-good way for the collector to compute this value.) Client code may include
-"gc.h", which defines all of the following, plus many others.
-
-1) GC_malloc(nbytes)
- - allocate an object of size nbytes. Unlike malloc, the object is
- cleared before being returned to the user. Gc_malloc will
- invoke the garbage collector when it determines this to be appropriate.
- GC_malloc may return 0 if it is unable to acquire sufficient
- space from the operating system. This is the most probable
- consequence of running out of space. Other possible consequences
- are that a function call will fail due to lack of stack space,
- or that the collector will fail in other ways because it cannot
- maintain its internal data structures, or that a crucial system
- process will fail and take down the machine. Most of these
- possibilities are independent of the malloc implementation.
-
-2) GC_malloc_atomic(nbytes)
- - allocate an object of size nbytes that is guaranteed not to contain any
- pointers. The returned object is not guaranteed to be cleared.
- (Can always be replaced by GC_malloc, but results in faster collection
- times. The collector will probably run faster if large character
- arrays, etc. are allocated with GC_malloc_atomic than if they are
- statically allocated.)
-
-3) GC_realloc(object, new_size)
- - change the size of object to be new_size. Returns a pointer to the
- new object, which may, or may not, be the same as the pointer to
- the old object. The new object is taken to be atomic iff the old one
- was. If the new object is composite and larger than the original object,
- then the newly added bytes are cleared (we hope). This is very likely
- to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
- Even then, it is likely to recycle the old object only if the object
- is grown in small additive increments (which, we claim, is generally bad
- coding practice.)
-
-4) GC_free(object)
- - explicitly deallocate an object returned by GC_malloc or
- GC_malloc_atomic. Not necessary, but can be used to minimize
- collections if performance is critical. Probably a performance
- loss for very small objects (<= 8 bytes).
-
-5) GC_expand_hp(bytes)
- - Explicitly increase the heap size. (This is normally done automatically
- if a garbage collection failed to GC_reclaim enough memory. Explicit
- calls to GC_expand_hp may prevent unnecessarily frequent collections at
- program startup.)
-
-6) GC_malloc_ignore_off_page(bytes)
- - identical to GC_malloc, but the client promises to keep a pointer to
- the somewhere within the first 256 bytes of the object while it is
- live. (This pointer should nortmally be declared volatile to prevent
- interference from compiler optimizations.) This is the recommended
- way to allocate anything that is likely to be larger than 100Kbytes
- or so. (GC_malloc may result in failure to reclaim such objects.)
-
-7) GC_set_warn_proc(proc)
- - Can be used to redirect warnings from the collector. Such warnings
- should be rare, and should not be ignored during code development.
-
-8) GC_enable_incremental()
- - Enables generational and incremental collection. Useful for large
- heaps on machines that provide access to page dirty information.
- Some dirty bit implementations may interfere with debugging
- (by catching address faults) and place restrictions on heap arguments
- to system calls (since write faults inside a system call may not be
- handled well).
-
-9) Several routines to allow for registration of finalization code.
- User supplied finalization code may be invoked when an object becomes
- unreachable. To call (*f)(obj, x) when obj becomes inaccessible, use
- GC_register_finalizer(obj, f, x, 0, 0);
- For more sophisticated uses, and for finalization ordering issues,
- see gc.h.
-
- The global variable GC_free_space_divisor may be adjusted up from its
-default value of 4 to use less space and more collection time, or down for
-the opposite effect. Setting it to 1 or 0 will effectively disable collections
-and cause all allocations to simply grow the heap.
-
- The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
-the amount of memory allocated by the above routines that should not be
-considered as a candidate for collection. Careless use may, of course, result
-in excessive memory consumption.
-
- Some additional tuning is possible through the parameters defined
-near the top of gc_priv.h.
-
- If only GC_malloc is intended to be used, it might be appropriate to define:
-
-#define malloc(n) GC_malloc(n)
-#define calloc(m,n) GC_malloc((m)*(n))
-
- For small pieces of VERY allocation intensive code, gc_inl.h
-includes some allocation macros that may be used in place of GC_malloc
-and friends.
-
- All externally visible names in the garbage collector start with "GC_".
-To avoid name conflicts, client code should avoid this prefix, except when
-accessing garbage collector routines or variables.
-
- There are provisions for allocation with explicit type information.
-This is rarely necessary. Details can be found in gc_typed.h.
-
-THE C++ INTERFACE TO THE ALLOCATOR:
-
- The Ellis-Hull C++ interface to the collector is included in
-the collector distribution. If you intend to use this, type
-"make c++" after the initial build of the collector is complete.
-See gc_cpp.h for the definition of the interface. This interface
-tries to approximate the Ellis-Detlefs C++ garbage collection
-proposal without compiler changes.
-
-Cautions:
-1. Arrays allocated without new placement syntax are
-allocated as uncollectable objects. They are traced by the
-collector, but will not be reclaimed.
-
-2. Failure to use "make c++" in combination with (1) will
-result in arrays allocated using the default new operator.
-This is likely to result in disaster without linker warnings.
-
-3. If your compiler supports an overloaded new[] operator,
-then gc_cpp.cc and gc_cpp.h should be suitably modified.
-
-4. Many current C++ compilers have deficiencies that
-break some of the functionality. See the comments in gc_cpp.h
-for suggested workarounds.
-
-USE AS LEAK DETECTOR:
-
- The collector may be used to track down leaks in C programs that are
-intended to run with malloc/free (e.g. code with extreme real-time or
-portability constraints). To do so define FIND_LEAK in Makefile
-This will cause the collector to invoke the report_leak
-routine defined near the top of reclaim.c whenever an inaccessible
-object is found that has not been explicitly freed. The collector will
-no longer reclaim inaccessible memory; in this form it is purely a
-debugging tool.
- Productive use of this facility normally involves redefining report_leak
-to do something more intelligent. This typically requires annotating
-objects with additional information (e.g. creation time stack trace) that
-identifies their origin. Such code is typically not very portable, and is
-not included here, except on SPARC machines.
- If all objects are allocated with GC_DEBUG_MALLOC (see next section),
-then the default version of report_leak will report the source file
-and line number at which the leaked object was allocated. This may
-sometimes be sufficient. (On SPARC/SUNOS4 machines, it will also report
-a cryptic stack trace. This can often be turned into a sympolic stack
-trace by invoking program "foo" with "callprocs foo". Callprocs is
-a short shell script that invokes adb to expand program counter values
-to symbolic addresses. It was largely supplied by Scott Schwartz.)
- Note that the debugging facilities described in the next section can
-sometimes be slightly LESS effective in leak finding mode, since in
-leak finding mode, GC_debug_free actually results in reuse of the object.
-(Otherwise the object is simply marked invalid.) Also note that the test
-program is not designed to run meaningfully in FIND_LEAK mode.
-Use "make gc.a" to build the collector.
-
-DEBUGGING FACILITIES:
-
- The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
-and GC_debug_free provide an alternate interface to the collector, which
-provides some help with memory overwrite errors, and the like.
-Objects allocated in this way are annotated with additional
-information. Some of this information is checked during garbage
-collections, and detected inconsistencies are reported to stderr.
-
- Simple cases of writing past the end of an allocated object should
-be caught if the object is explicitly deallocated, or if the
-collector is invoked while the object is live. The first deallocation
-of an object will clear the debugging info associated with an
-object, so accidentally repeated calls to GC_debug_free will report the
-deallocation of an object without debugging information. Out of
-memory errors will be reported to stderr, in addition to returning
-NIL.
-
- GC_debug_malloc checking during garbage collection is enabled
-with the first call to GC_debug_malloc. This will result in some
-slowdown during collections. If frequent heap checks are desired,
-this can be achieved by explicitly invoking GC_gcollect, e.g. from
-the debugger.
-
- GC_debug_malloc allocated objects should not be passed to GC_realloc
-or GC_free, and conversely. It is however acceptable to allocate only
-some objects with GC_debug_malloc, and to use GC_malloc for other objects,
-provided the two pools are kept distinct. In this case, there is a very
-low probablility that GC_malloc allocated objects may be misidentified as
-having been overwritten. This should happen with probability at most
-one in 2**32. This probability is zero if GC_debug_malloc is never called.
-
- GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
-additional trailing arguments, a string and an integer. These are not
-interpreted by the allocator. They are stored in the object (the string is
-not copied). If an error involving the object is detected, they are printed.
-
- The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
-GC_REGISTER_FINALIZER are also provided. These require the same arguments
-as the corresponding (nondebugging) routines. If gc.h is included
-with GC_DEBUG defined, they call the debugging versions of these
-functions, passing the current file name and line number as the two
-extra arguments, where appropriate. If gc.h is included without GC_DEBUG
-defined, then all these macros will instead be defined to their nondebugging
-equivalents. (GC_REGISTER_FINALIZER is necessary, since pointers to
-objects with debugging information are really pointers to a displacement
-of 16 bytes form the object beginning, and some translation is necessary
-when finalization routines are invoked. For details, about what's stored
-in the header, see the definition of the type oh in debug_malloc.c)
-
-INCREMENTAL/GENERATIONAL COLLECTION:
-
-The collector normally interrupts client code for the duration of
-a garbage collection mark phase. This may be unacceptable if interactive
-response is needed for programs with large heaps. The collector
-can also run in a "generational" mode, in which it usually attempts to
-collect only objects allocated since the last garbage collection.
-Furthermore, in this mode, garbage collections run mostly incrementally,
-with a small amount of work performed in response to each of a large number of
-GC_malloc requests.
-
-This mode is enabled by a call to GC_enable_incremental().
-
-Incremental and generational collection is effective in reducing
-pause times only if the collector has some way to tell which objects
-or pages have been recently modified. The collector uses two sources
-of information:
-
-1. Information provided by the VM system. This may be provided in
-one of several forms. Under Solaris 2.X (and potentially under other
-similar systems) information on dirty pages can be read from the
-/proc file system. Under other systems (currently SunOS4.X) it is
-possible to write-protect the heap, and catch the resulting faults.
-On these systems we require that system calls writing to the heap
-(other than read) be handled specially by client code.
-See os_dep.c for details.
-
-2. Information supplied by the programmer. We define "stubborn"
-objects to be objects that are rarely changed. Such an object
-can be allocated (and enabled for writing) with GC_malloc_stubborn.
-Once it has been initialized, the collector should be informed with
-a call to GC_end_stubborn_change. Subsequent writes that store
-pointers into the object must be preceded by a call to
-GC_change_stubborn.
-
-This mechanism performs best for objects that are written only for
-initialization, and such that only one stubborn object is writable
-at once. It is typically not worth using for short-lived
-objects. Stubborn objects are treated less efficiently than pointerfree
-(atomic) objects.
-
-A rough rule of thumb is that, in the absence of VM information, garbage
-collection pauses are proportional to the amount of pointerful storage
-plus the amount of modified "stubborn" storage that is reachable during
-the collection.
-
-Initial allocation of stubborn objects takes longer than allocation
-of other objects, since other data structures need to be maintained.
-
-We recommend against random use of stubborn objects in client
-code, since bugs caused by inappropriate writes to stubborn objects
-are likely to be very infrequently observed and hard to trace.
-However, their use may be appropriate in a few carefully written
-library routines that do not make the objects themselves available
-for writing by client code.
-
-
-BUGS:
-
- Any memory that does not have a recognizable pointer to it will be
-reclaimed. Exclusive-or'ing forward and backward links in a list
-doesn't cut it.
- Some C optimizers may lose the last undisguised pointer to a memory
-object as a consequence of clever optimizations. This has almost
-never been observed in practice. Send mail to boehm@acm.org
-for suggestions on how to fix your compiler.
- This is not a real-time collector. In the standard configuration,
-percentage of time required for collection should be constant across
-heap sizes. But collection pauses will increase for larger heaps.
-(On SPARCstation 2s collection times will be on the order of 300 msecs
-per MB of accessible memory that needs to be scanned. Your mileage
-may vary.) The incremental/generational collection facility helps,
-but is portable only if "stubborn" allocation is used.
- Please address bug reports to boehm@acm.org. If you are
-contemplating a major addition, you might also send mail to ask whether
-it's already been done (or whether we tried and discarded it).
-
-RECENT VERSIONS:
-
- Version 1.3 and immediately preceding versions contained spurious
-assembly language assignments to TMP_SP. Only the assignment in the PC/RT
-code is necessary. On other machines, with certain compiler options,
-the assignments can lead to an unsaved register being overwritten.
-Known to cause problems under SunOS 3.5 WITHOUT the -O option. (With
--O the compiler recognizes it as dead code. It probably shouldn't,
-but that's another story.)
-
- Version 1.4 and earlier versions used compile time determined values
-for the stack base. This no longer works on Sun 3s, since Sun 3/80s use
-a different stack base. We now use a straightforward heuristic on all
-machines on which it is known to work (incl. Sun 3s) and compile-time
-determined values for the rest. There should really be library calls
-to determine such values.
-
- Version 1.5 and earlier did not ensure 8 byte alignment for objects
-allocated on a sparc based machine.
-
- Version 1.8 added ULTRIX support in gc_private.h.
-
- Version 1.9 fixed a major bug in gc_realloc.
-
- Version 2.0 introduced a consistent naming convention for collector
-routines and added support for registering dynamic library data segments
-in the standard mark_roots.c. Most of the data structures were revamped.
-The treatment of interior pointers was completely changed. Finalization
-was added. Support for locking was added. Object kinds were added.
-We added a black listing facility to avoid allocating at addresses known
-to occur as integers somewhere in the address space. Much of this
-was accomplished by adapting ideas and code from the PCR collector.
-The test program was changed and expanded.
-
- Version 2.1 was the first stable version since 1.9, and added support
-for PPCR.
-
- Version 2.2 added debugging allocation, and fixed various bugs. Among them:
-- GC_realloc could fail to extend the size of the object for certain large object sizes.
-- A blatant subscript range error in GC_printf, which unfortunately
- wasn't exercised on machines with sufficient stack alignment constraints.
-- GC_register_displacement did the wrong thing if it was called after
- any allocation had taken place.
-- The leak finding code would eventually break after 2048 byte
- byte objects leaked.
-- interface.c didn't compile.
-- The heap size remained much too small for large stacks.
-- The stack clearing code behaved badly for large stacks, and perhaps
- on HP/PA machines.
-
- Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs:
-- Missing declaration of etext in the A/UX version.
-- Some PCR root-finding problems.
-- Blacklisting was not 100% effective, because the plausible future
- heap bounds were being miscalculated.
-- GC_realloc didn't handle out-of-memory correctly.
-- GC_base could return a nonzero value for addresses inside free blocks.
-- test.c wasn't really thread safe, and could erroneously report failure
- in a multithreaded environment. (The locking primitives need to be
- replaced for other threads packages.)
-- GC_CONS was thoroughly broken.
-- On a SPARC with dynamic linking, signals stayed diabled while the
- client code was running.
- (Thanks to Manuel Serrano at INRIA for reporting the last two.)
-
- Version 2.4 added GC_free_space_divisor as a tuning knob, added
- support for OS/2 and linux, and fixed the following bugs:
-- On machines with unaligned pointers (e.g. Sun 3), every 128th word could
- fail to be considered for marking.
-- Dynamic_load.c erroneously added 4 bytes to the length of the data and
- bss sections of the dynamic library. This could result in a bad memory
- reference if the actual length was a multiple of a page. (Observed on
- Sun 3. Can probably also happen on a Sun 4.)
- (Thanks to Robert Brazile for pointing out that the Sun 3 version
- was broken. Dynamic library handling is still broken on Sun 3s
- under 4.1.1U1, but apparently not 4.1.1. If you have such a machine,
- use -Bstatic.)
-
- Version 2.5 fixed the following bugs:
-- Removed an explicit call to exit(1)
-- Fixed calls to GC_printf and GC_err_printf, so the correct number of
- arguments are always supplied. The OS/2 C compiler gets confused if
- the number of actuals and the number of formals differ. (ANSI C
- doesn't require this to work. The ANSI sanctioned way of doing things
- causes too many compatibility problems.)
-
- Version 3.0 added generational/incremental collection and stubborn
- objects.
-
- Version 3.1 added the following features:
-- A workaround for a SunOS 4.X SPARC C compiler
- misfeature that caused problems when the collector was turned into
- a dynamic library.
-- A fix for a bug in GC_base that could result in a memory fault.
-- A fix for a performance bug (and several other misfeatures) pointed
- out by Dave Detlefs and Al Dosser.
-- Use of dirty bit information for static data under Solaris 2.X.
-- DEC Alpha/OSF1 support (thanks to Al Dosser).
-- Incremental collection on more platforms.
-- A more refined heap expansion policy. Less space usage by default.
-- Various minor enhancements to reduce space usage, and to reduce
- the amount of memory scanned by the collector.
-- Uncollectable allocation without per object overhead.
-- More conscientious handling of out-of-memory conditions.
-- Fixed a bug in debugging stubborn allocation.
-- Fixed a bug that resulted in occasional erroneous reporting of smashed
- objects with debugging allocation.
-- Fixed bogus leak reports of size 4096 blocks with FIND_LEAK.
-
- Version 3.2 fixed a serious and not entirely repeatable bug in
- the incremental collector. It appeared only when dirty bit info
- on the roots was available, which is normally only under Solaris.
- It also added GC_general_register_disappearing_link, and some
- testing code. Interface.c disappeared.
-
- Version 3.3 fixes several bugs and adds new ports:
-- PCR-specific bugs.
-- Missing locking in GC_free, redundant FASTUNLOCK
- in GC_malloc_stubborn, and 2 bugs in
- GC_unregister_disappearing_link.
- All of the above were pointed out by Neil Sharman
- (neil@cs.mu.oz.au).
-- Common symbols allocated by the SunOS4.X dynamic loader
- were not included in the root set.
-- Bug in GC_finalize (reported by Brian Beuning and Al Dosser)
-- Merged Amiga port from Jesper Peterson (untested)
-- Merged NeXT port from Thomas Funke (significantly
- modified and untested)
-
- Version 3.4:
-- Fixed a performance bug in GC_realloc.
-- Updated the amiga port.
-- Added NetBSD and 386BSD ports.
-- Added cord library.
-- Added trivial performance enhancement for
- ALL_INTERIOR_POINTERS. (Don't scan last word.)
-
- Version 3.5
-- Minor collections now mark from roots only once, if that
- doesn't cause an excessive pause.
-- The stack clearing heuristic was refined to prevent anomalies
- with very heavily recursive programs and sparse stacks.
-- Fixed a bug that prevented mark stack growth in some cases.
- GC_objects_are_marked should be set to TRUE after a call
- to GC_push_roots and as part of GC_push_marked, since
- both can now set mark bits. I think this is only a performance
- bug, but I wouldn't bet on it. It's certainly very hard to argue
- that the old version was correct.
-- Fixed an incremental collection bug that prevented it from
- working at all when HBLKSIZE != getpagesize()
-- Changed dynamic_loading.c to include gc_priv.h before testing
- DYNAMIC_LOADING. SunOS dynamic library scanning
- must have been broken in 3.4.
-- Object size rounding now adapts to program behavior.
-- Added a workaround (provided by Manuel Serrano and
- colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug
- that I had incorrectly assumed to have been squished.
- The collector was broken if the text segment size was within
- 32 bytes of a multiple of 8K bytes, and if the beginning of
- the data segment contained interesting roots. The workaround
- assumes a demand-loadable executable. The original may have
- have "worked" in some other cases.
-- Added dynamic library support under IRIX5.
-- Added support for EMX under OS/2 (thanks to Ari Huttunen).
-
-Version 3.6:
-- fixed a bug in the mark stack growth code that was introduced
- in 3.4.
-- fixed Makefile to work around DEC AXP compiler tail recursion
- bug.
-
-Version 3.7:
-- Added a workaround for an HP/UX compiler bug.
-- Fixed another stack clearing performance bug. Reworked
- that code once more.
-
-Version 4.0:
-- Added support for Solaris threads (which was possible
- only by reimplementing some fraction of Solaris threads,
- since Sun doesn't currently make the thread debugging
- interface available).
-- Added non-threads win32 and win32S support.
-- (Grudgingly, with suitable muttering of obscenities) renamed
- files so that the collector distribution could live on a FAT
- file system. Files that are guaranteed to be useless on
- a PC still have long names. Gc_inline.h and gc_private.h
- still exist, but now just include gc_inl.h and gc_priv.h.
-- Fixed a really obscure bug in finalization that could cause
- undetected mark stack overflows. (I would be surprised if
- any real code ever tickled this one.)
-- Changed finalization code to dynamically resize the hash
- tables it maintains. (This probably does not matter for well-
- -written code. It no doubt does for C++ code that overuses
- destructors.)
-- Added typed allocation primitives. Rewrote the marker to
- accommodate them with more reasonable efficiency. This
- change should also speed up marking for GC_malloc allocated
- objects a little. See gc_typed.h for new primitives.
-- Improved debugging facilities slightly. Allocation time
- stack traces are now kept by default on SPARC/SUNOS4.
- (Thanks to Scott Schwartz.)
-- Added better support for small heap applications.
-- Significantly extended cord package. Fixed a bug in the
- implementation of lazily read files. Printf and friends now
- have cord variants. Cord traversals are a bit faster.
-- Made ALL_INTERIOR_POINTERS recognition the default.
-- Fixed de so that it can run in constant space, independent
- of file size. Added simple string searching to cords and de.
-- Added the Hull-Ellis C++ interface.
-- Added dynamic library support for OSF/1.
- (Thanks to Al Dosser and Tim Bingham at DEC.)
-- Changed argument to GC_expand_hp to be expressed
- in units of bytes instead of heap blocks. (Necessary
- since the heap block size now varies depending on
- configuration. The old version was never very clean.)
-- Added GC_get_heap_size(). The previous "equivalent"
- was broken.
-- Restructured the Makefile a bit.
-
-Since version 4.0:
-- Changed finalization implementation to guarantee that
- finalization procedures are called outside of the allocation
- lock, making direct use of the interface a little less dangerous.
- MAY BREAK EXISTING CLIENTS that assume finalizers
- are protected by a lock. Since there seem to be few multithreaded
- clients that use finalization, this is hopefully not much of
- a problem.
-- Fixed a gross bug in CORD_prev.
-- Fixed a bug in blacklst.c that could result in unbounded
- heap growth during startup on machines that do not clear
- memory obtained from the OS (e.g. win32S).
-- Ported de editor to win32/win32S. (This is now the only
- version with a mouse-sensitive UI.)
-- Added GC_malloc_ignore_off_page to allocate large arrays
- in the presence of ALL_INTERIOR_POINTERS.
-- Changed GC_call_with_alloc_lock to not disable signals in
- the single-threaded case.
-- Reduced retry count in GC_collect_or_expand for garbage
- collecting when out of memory.
-- Made uncollectable allocations bypass black-listing, as they
- should.
-- Fixed a bug in typed_test in test.c that could cause (legitimate)
- GC crashes.
-- Fixed some potential synchronization problems in finalize.c
-- Fixed a real locking problem in typd_mlc.c.
-- Worked around an AIX 3.2 compiler feature that results in
- out of bounds memory references.
-- Partially worked around an IRIX5.2 beta problem (which may
- or may not persist to the final release).
-- Fixed a bug in the heap integrity checking code that could
- result in explicitly deallocated objects being identified as
- smashed. Fixed a bug in the dbg_mlc stack saving code
- that caused old argument pointers to be considered live.
-- Fixed a bug in CORD_ncmp (and hence CORD_str).
-- Repaired the OS2 port, which had suffered from bit rot
- in 4.0. Worked around what appears to be CSet/2 V1.0
- optimizer bug.
-- Fixed a Makefile bug for target "c++".
-
-Since version 4.1:
-- Multiple bug fixes/workarounds in the Solaris threads version.
- (It occasionally failed to locate some register contents for
- marking. It also turns out that thr_suspend and friends are
- unreliable in Solaris 2.3. Dirty bit reads appear
- to be unreliable under some weird
- circumstances. My stack marking code
- contained a serious performance bug. The new code is
- extremely defensive, and has not failed in several cpu
- hours of testing. But no guarantees ...)
-- Added MacOS support (thanks to Patrick Beard.)
-- Fixed several syntactic bugs in gc_c++.h and friends. (These
- didn't bother g++, but did bother most other compilers.)
- Fixed gc_c++.h finalization interface. (It didn't.)
-- 64 bit alignment for allocated objects was not guaranteed in a
- few cases in which it should have been.
-- Added GC_malloc_atomic_ignore_off_page.
-- Added GC_collect_a_little.
-- Added some prototypes to gc.h.
-- Some other minor bug fixes (notably in Makefile).
-- Fixed OS/2 / EMX port (thanks to Ari Huttunen).
-- Fixed AmigaDOS port. (thanks to Michel Schinz).
-- Fixed the DATASTART definition under Solaris. There
- was a 1 in 16K chance of the collector missing the first
- 64K of static data (and thus crashing).
-- Fixed some blatant anachronisms in the README file.
-- Fixed PCR-Makefile for upcoming PPCR release.
-
-Since version 4.2:
-- Fixed SPARC alignment problem with GC_DEBUG.
-- Fixed Solaris threads /proc workaround. The real
- problem was an interaction with mprotect.
-- Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h).
-- Slightly improved allocator space utilization by
- fixing the GC_size_map mechanism.
-- Integrated some Sony News and MIPS RISCos 4.51
- patches. (Thanks to Nobuyuki Hikichi of
- Software Research Associates, Inc. Japan)
-- Fixed HP_PA alignment problem. (Thanks to
- xjam@cork.cs.berkeley.edu.)
-- Added GC_same_obj and friends. Changed GC_base
- to return 0 for pointers past the end of large objects.
- Improved GC_base performance with ALL_INTERIOR_POINTERS
- on machines with a slow integer mod operation.
- Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare
- for preprocessor.
-- changed the default on most UNIX machines to be that
- signals are not disabled during critical GC operations.
- This is still ANSI-conforming, though somewhat dangerous
- in the presence of signal handlers. But the performance
- cost of the alternative is sometimes problematic.
- Can be changed back with a minor Makefile edit.
-- renamed IS_STRING in gc.h, to CORD_IS_STRING, thus
- following my own naming convention. Added the function
- CORD_to_const_char_star.
-- Fixed a gross bug in GC_finalize. Symptom: occasional
- address faults in that function. (Thanks to Anselm
- Baird-Smith (Anselm.BairdSmith@inria.fr)
-- Added port to ICL DRS6000 running DRS/NX. Restructured
- things a bit to factor out common code, and remove obsolete
- code. Collector should now run under SUNOS5 with either
- mprotect or /proc dirty bits. (Thanks to Douglas Steel
- (doug@wg.icl.co.uk)).
-- More bug fixes and workarounds for Solaris 2.X. (These were
- mostly related to putting the collector in a dynamic library,
- which didn't really work before. Also SOLARIS_THREADS
- didn't interact well with dl_open.) Thanks to btlewis@eng.sun.com.
-- Fixed a serious performance bug on the DEC Alpha. The text
- segment was getting registered as part of the root set.
- (Amazingly, the result was still fast enough that the bug
- was not conspicuous.) The fix works on OSF/1, version 1.3.
- Hopefully it also works on other versions of OSF/1 ...
-- Fixed a bug in GC_clear_roots.
-- Fixed a bug in GC_generic_malloc_words_small that broke
- gc_inl.h. (Reported by Antoine de Maricourt. I broke it
- in trying to tweak the Mac port.)
-- Fixed some problems with cord/de under Linux.
-- Fixed some cord problems, notably with CORD_riter4.
-- Added DG/UX port.
- Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov)
-- Added finalization registration routines with weaker ordering
- constraints. (This is necessary for C++ finalization with
- multiple inheritance, since the compiler often adds self-cycles.)
-- Filled the holes in the SCO port. (Thanks to Michael Arnoldus
- <chime@proinf.dk>.)
-- John Ellis' additions to the C++ support: From John:
-
-* I completely rewrote the documentation in the interface gc_c++.h
-(later renamed gc_cpp.h). I've tried to make it both clearer and more
-precise.
-
-* The definition of accessibility now ignores pointers from an
-finalizable object (an object with a clean-up function) to itself.
-This allows objects with virtual base classes to be finalizable by the
-collector. Compilers typically implement virtual base classes using
-pointers from an object to itself, which under the old definition of
-accessibility prevented objects with virtual base classes from ever
-being collected or finalized.
-
-* gc_cleanup now includes gc as a virtual base. This was enabled by
-the change in the definition of accessibility.
-
-* I added support for operator new[]. Since most (all?) compilers
-don't yet support operator new[], it is conditionalized on
--DOPERATOR_NEW_ARRAY. The code is untested, but its trivial and looks
-correct.
-
-* The test program test_gc_c++ (later renamed test_cpp.cc)
-tries to test for the C++-specific functionality not tested by the
-other programs.
-- Added <unistd.h> include to misc.c. (Needed for ppcr.)
-- Added PowerMac port. (Thanks to Patrick Beard again.)
-- Fixed "srcdir"-related Makefile problems. Changed things so
- that all externally visible include files always appear in the
- include subdirectory of the source. Made gc.h directly
- includable from C++ code. (These were at Per
- Bothner's suggestion.)
-- Changed Intel code to also mark from ebp (Kevin Warne's
- suggestion).
-- Renamed C++ related files so they could live in a FAT
- file system. (Charles Fiterman's suggestion.)
-- Changed Windows NT Makefile to include C++ support in
- gc.lib. Added C++ test as Makefile target.
-
-Since version 4.3:
- - ASM_CLEAR_CODE was erroneously defined for HP
- PA machines, resulting in a compile error.
- - Fixed OS/2 Makefile to create a library. (Thanks to
- Mark Boulter (mboulter@vnet.ibm.com)).
- - Gc_cleanup objects didn't work if they were created on
- the stack. Fixed.
- - One copy of Gc_cpp.h in the distribution was out of
- synch, and failed to document some known compiler
- problems with explicit destructor invocation. Partially
- fixed. There are probably other compilers on which
- gc_cleanup is miscompiled.
- - Fixed Makefile to pass C compiler flags to C++ compiler.
- - Added Mac fixes.
- - Fixed os_dep.c to work around what appears to be
- a new and different VirtualQuery bug under newer
- versions of win32S.
- - GC_non_gc_bytes was not correctly maintained by
- GC_free. Fixed. Thanks to James Clark (jjc@jclark.com).
- - Added GC_set_max_heap_size.
- - Changed allocation code to ignore blacklisting if it is preventing
- use of a very large block of memory. This has the advantage
- that naive code allocating very large objects is much more
- likely to work. The downside is you might no
- longer find out that such code should really use
- GC_malloc_ignore_off_page.
- - Changed GC_printf under win32 to close and reopen the file
- between calls. FAT file systems otherwise make the log file
- useless for debugging.
- - Added GC_try_to_collect and GC_get_bytes_since_gc. These
- allow starting an abortable collection during idle times.
- This facility does not require special OS support. (Thanks to
- Michael Spertus of Geodesic Systems for suggesting this. It was
- actually an easy addition. Kumar Srikantan previously added a similar
- facility to a now ancient version of the collector. At the time
- this was much harder, and the result was less convincing.)
- - Added some support for the Borland development environment. (Thanks
- to John Ellis and Michael Spertus.)
- - Removed a misfeature from checksums.c that caused unexpected
- heap growth. (Thanks to Scott Schwartz.)
- - Changed finalize.c to call WARN if it encounters a finalization cycle.
- WARN is defined in gc_priv.h to write a message, usually to stdout.
- In many environments, this may be inappropriate.
- - Renamed NO_PARAMS in gc.h to GC_NO_PARAMS, thus adhering to my own
- naming convention.
- - Added GC_set_warn_proc to intercept warnings.
- - Fixed Amiga port. (Thanks to Michel Schinz (schinz@alphanet.ch).)
- - Fixed a bug in mark.c that could result in an access to unmapped
- memory from GC_mark_from_mark_stack on machines with unaligned
- pointers.
- - Fixed a win32 specific performance bug that could result in scanning of
- objects allocated with the system malloc.
- - Added REDIRECT_MALLOC.
-
-Since version 4.4:
- - Fixed many minor and one major README bugs. (Thanks to Franklin Chen
- (chen@adi.com) for pointing out many of them.)
- - Fixed ALPHA/OSF/1 dynamic library support. (Thanks to Jonathan Bachrach
- (jonathan@harlequin.com)).
- - Added incremental GC support (MPROTECT_VDB) for Linux (with some
- help from Bruno Haible).
- - Altered SPARC recognition tests in gc.h and config.h (mostly as
- suggested by Fergus Henderson).
- - Added basic incremental GC support for win32, as implemented by
- Windows NT and Windows 95. GC_enable_incremental is a noop
- under win32s, which doesn't implement enough of the VM interface.
- - Added -DLARGE_CONFIG.
- - Fixed GC_..._ignore_off_page to also function without
- -DALL_INTERIOR_POINTERS.
- - (Hopefully) fixed RS/6000 port. (Only the test was broken.)
- - Fixed a performance bug in the nonincremental collector running
- on machines supporting incremental collection with MPROTECT_VDB
- (e.g. SunOS 4, DEC AXP). This turned into a correctness bug under
- win32s with win32 incremental collection. (Not all memory protection
- was disabled.)
- - Fixed some ppcr related bit rot.
- - Caused dynamic libraries to be unregistered before reregistering.
- The old way turned out to be a performance bug on some machines.
- - GC_root_size was not properly maintained under MSWIN32.
- - Added -DNO_DEBUGGING and GC_dump.
- - Fixed a couple of bugs arising with SOLARIS_THREADS +
- REDIRECT_MALLOC.
- - Added NetBSD/M68K port. (Thanks to Peter Seebach
- <seebs@taniemarie.solon.com>.)
- - Fixed a serious realloc bug. For certain object sizes, the collector
- wouldn't scan the expanded part of the object. (Thanks to Clay Spence
- (cds@peanut.sarnoff.com) for noticing the problem, and helping me to
- track it down.)
-
-Since version 4.5:
- - Added Linux ELF support. (Thanks to Arrigo Triulzi <arrigo@ic.ac.uk>.)
- - GC_base crashed if it was called before any other GC_ routines.
- This could happen if a gc_cleanup object was allocated outside the heap
- before any heap allocation.
- - The heap expansion heuristic was not stable if all objects had finalization
- enabled. Fixed finalize.c to count memory in finalization queue and
- avoid explicit deallocation. Changed alloc.c to also consider this count.
- (This is still not recommended. It's expensive if nothing else.) Thanks
- to John Ellis for pointing this out.
- - GC_malloc_uncollectable(0) was broken. Thanks to Phong Vo for pointing
- this out.
- - The collector didn't compile under Linux 1.3.X. (Thanks to Fred Gilham for
- pointing this out.) The current workaround is ugly, but expected to be
- temporary.
- - Fixed a formatting problem for SPARC stack traces.
- - Fixed some '=='s in os_dep.c that should have been assignments.
- Fortunately these were in code that should never be executed anyway.
- (Thanks to Fergus Henderson.)
- - Fixed the heap block allocator to only drop blacklisted blocks in small
- chunks. Made BL_LIMIT self adjusting. (Both of these were in response
- to heap growth observed by Paul Graham.)
- - Fixed the Metrowerks/68K Mac code to also mark from a6. (Thanks
- to Patrick Beard.)
- - Significantly updated README.debugging.
- - Fixed some problems with longjmps out of signal handlers, especially under
- Solaris. Added a workaround for the fact that siglongjmp doesn't appear to
- do the right thing with -lthread under Solaris.
- - Added MSDOS/djgpp port. (Thanks to Mitch Harris (maharri@uiuc.edu).)
- - Added "make reserved_namespace" and "make user_namespace". The
- first renames ALL "GC_xxx" identifiers as "_GC_xxx". The second is the
- inverse transformation. Note that doing this is guaranteed to break all
- clients written for the other names.
- - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
- defined should be -ALIGNMENT not WORDS_TO_BYTES(-1). This is
- a serious bug on machines with pointer alignment of less than a word.
- - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the
- end of the object correctly. Caused failures of the C++ test on a DEC Alpha
- with g++.
- - gc_inl.h still had problems. Partially fixed. Added warnings at the
- beginning to hopefully specify the remaining dangers.
- - Added DATAEND definition to config.h.
- - Fixed some of the .h file organization. Fixed "make floppy".
-
-Since version 4.6:
- - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle)
- - Updated some Mac specific files to synchronize with Patrick Beard.
- - Fixed a serious bug for machines with non-word-aligned pointers.
- (Thanks to Patrick Beard for pointing out the problem. The collector
- should fail almost any conceivable test immediately on such machines.)
-
-Since version 4.7:
- - Changed a "comment" in a MacOS specific part of mach-dep.c that caused
- gcc to fail on other platforms.
-
-Since version 4.8
- - More README.debugging fixes.
- - Objects ready for finalization, but not finalized in the same GC
- cycle, could be prematurely collected. This occasionally happened
- in test_cpp.
- - Too little memory was obtained from the system for very large
- objects. That could cause a heap explosion if these objects were
- not contiguous (e.g. under PCR), and too much of them was blacklisted.
- - Due to an improper initialization, the collector was too hesitant to
- allocate blacklisted objects immediately after system startup.
- - Moved GC_arrays from the data into the bss segment by not explicitly
- initializing it to zero. This significantly
- reduces the size of executables, and probably avoids some disk accesses
- on program startup. It's conceivable that it might break a port that I
- didn't test.
- - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which
- occurred a while ago.
-
-Since 4.9:
- - Fixed a typo around a call to GC_collect_or_expand in alloc.c. It broke
- handling of out of memory. (Thanks to Patrick Beard for noticing.)
-
-Since 4.10:
- - Rationalized (hopefully) GC_try_to_collect in an incremental collection
- environment. It appeared to not handle a call while a collection was in
- progress, and was otherwise too conservative.
- - Merged GC_reclaim_or_delete_all into GC_reclaim_all to get rid of some
- code.
- - Added Patrick Beard's Mac fixes, with substantial completely untested
- modifications.
- - Fixed the MPROTECT_VDB code to deal with large pages and imprecise
- fault addresses (as on an UltraSPARC running Solaris 2.5). Note that this
- was not a problem in the default configuration, which uses PROC_VDB.
- - The DEC Alpha assembly code needed to restore $gp between calls.
- Thanks to Fergus Henderson for tracking this down and supplying a
- patch.
- - The write command for "de" was completely broken for large files.
- I used the easiest portable fix, which involved changing the semantics
- so that f.new is written instead of overwriting f. That's safer anyway.
- - Added README.solaris2 with a discussion of the possible problems of
- mixing the collector's sbrk allocation with malloc/realloc.
- - Changed the data segment starting address for SGI machines. The
- old code failed under IRIX6.
- - Required double word alignment for MIPS.
- - Various minor fixes to remove warnings.
- - Attempted to fix some Solaris threads problems reported by Zhiying Chen.
- In particular, the collector could try to fork a thread with the
- world stopped as part of GC_thr_init. It also failed to deal with
- the case in which the original thread terminated before the whole
- process did.
- - Added -DNO_EXECUTE_PERMISSION. This has a major performance impact
- on the incremental collector under Irix, and perhaps under other
- operating systems.
- - Added some code to support allocating the heap with mmap. This may
- be preferable under some circumstances.
- - Integrated dynamic library support for HP.
- (Thanks to Knut Tvedten <knuttv@ifi.uio.no>.)
- - Integrated James Clark's win32 threads support, and made a number
- of changes to it, many of which were suggested by Pontus Rydin.
- This is still not 100% solid.
- - Integrated Alistair Crooks' support for UTS4 running on an Amdahl
- 370-class machine.
- - Fixed a serious bug in explicitly typed allocation. Objects requiring
- large descriptors where handled in a way that usually resulted in
- a segmentation fault in the marker. (Thanks to Jeremy Fitzhardinge
- for helping to track this down.)
- - Added partial support for GNU win32 development. (Thanks to Fergus
- Henderson.)
- - Added optional support for Java-style finalization semantics. (Thanks
- to Patrick Bridges.) This is recommended only for Java implementations.
- - GC_malloc_uncollectable faulted instead of returning 0 when out of
- memory. (Thanks to dan@math.uiuc.edu for noticing.)
- - Calls to GC_base before the collector was initialized failed on a
- DEC Alpha. (Thanks to Matthew Flatt.)
- - Added base pointer checking to GC_REGISTER_FINALIZER in debugging
- mode, at the suggestion of Jeremy Fitzhardinge.
- - GC_debug_realloc failed for uncollectable objects. (Thanks to
- Jeremy Fitzhardinge.)
- - Explicitly typed allocation could crash if it ran out of memory.
- (Thanks to Jeremy Fitzhardinge.)
- - Added minimal support for a DEC Alpha running Linux.
- - Fixed a problem with allocation of objects whose size overflowed
- ptrdiff_t. (This now fails unconditionally, as it should.)
- - Added the beginning of Irix pthread support.
- - Integrated Xiaokun Zhu's fixes for djgpp 2.01.
- - Added SGI-style STL allocator support (gc_alloc.h).
- - Fixed a serious bug in README.solaris2. Multithreaded programs must include
- gc.h with SOLARIS_THREADS defined.
- - Changed GC_free so it actually deallocates uncollectable objects.
- (Thanks to Peter Chubb for pointing out the problem.)
- - Added Linux ELF support for dynamic libararies. (Thanks again to
- Patrick Bridges.)
- - Changed the Borland cc configuration so that the assembler is not
- required.
- - Fixed a bug in the C++ test that caused it to fail in 64-bit
- environments.
-
-Since 4.11:
- - Fixed ElfW definition in dyn_load.c. (Thanks to Fergus Henderson.)
- This prevented the dynamic library support from compiling on some
- older ELF Linux systems.
- - Fixed UTS4 port (which I apparently mangled during the integration)
- (Thanks to again to Alistair Crooks.)
- - "Make C++" failed on Suns with SC4.0, due to a problem with "bool".
- Fixed in gc_priv.h.
- - Added more pieces for GNU win32. (Thanks to Timothy N. Newsham.)
- The current state of things should suffice for at least some
- applications.
- - Changed the out of memory retry count handling as suggested by
- Kenjiro Taura. (This matters only if GC_max_retries > 0, which
- is no longer the default.)
- - If a /proc read failed repeatedly, GC_written_pages was not updated
- correctly. (Thanks to Peter Chubb for diagnosing this.)
- - Under unlikely circumstances, the allocator could infinite loop in
- an out of memory situation. (Thanks again to Kenjiro Taura for
- identifying the problem and supplying a fix.)
- - Fixed a syntactic error in the DJGPP code. (Thanks to Fergus
- Henderson for finding this by inspection.) Also fixed a test program
- problem with DJGPP (Thanks to Peter Monks.)
- - Atomic uncollectable objects were not treated correctly by the
- incremental collector. This resulted in weird log statistics and
- occasional performance problems. (Thanks to Peter Chubb for pointing
- this out.)
- - Fixed some problems resulting from compilers that dont define
- __STDC__. In this case void * and char * were used inconsistently
- in some cases. (Void * should not have been used at all. If
- you have an ANSI superset compiler that does not define __STDC__,
- please compile with -D__STDC__=0. Thanks to Manuel Serrano and others
- for pointing out the problem.)
- - Fixed a compilation problem on Irix with -n32 and -DIRIX_THREADS.
- Also fixed some other IRIX_THREADS problems which may or may not have
- had observable symptoms.
- - Fixed an HP PA compilation problem in dyn_load.c. (Thanks to
- Philippe Queinnec.)
- - SEGV fault handlers sometimes did not get reset correctly. (Thanks
- to David Pickens.)
- - Added a fix for SOLARIS_THREADS on Intel. (Thanks again to David
- Pickens.) This probably needs more work to become functional.
- - Fixed struct sigcontext_struct in os_dep.c for compilation under
- Linux 2.1.X. (Thanks to Fergus Henderson.)
- - Changed the DJGPP STACKBOTTOM and DATASTART values to those suggested
- by Kristian Kristensen. These may still not be right, but it is
- it is likely to work more often than what was there before. They may
- even be exactly right.
- - Added a #include <string.h> to test_cpp.cc. This appears to help
- with HP/UX and gcc. (Thanks to assar@sics.se.)
- - Version 4.11 failed to run in incremental mode on recent 64-bit Irix
- kernels. This was a problem related to page unaligned heap segments.
- Changed the code to page align heap sections on all platforms.
- (I had mistakenly identified this as a kernel problem earlier.
- It was not.)
- - Version 4.11 did not make allocated storage executable, except on
- one or two platforms, due to a bug in a #if test. (Thanks to Dave
- Grove for pointing this out.)
- - Added sparc_sunos4_mach_dep.s to support Sun's compilers under SunOS4.
- - Added GC_exclude_static_roots.
- - Fixed the object size mapping algorithm. This shouldn't matter,
- but the old code was ugly.
- - Heap checking code could die if one of the allocated objects was
- larger than its base address. (Unsigned underflow problem. Thanks
- to Clay Spence for isolating the problem.)
- - Added RS6000 (AIX) dynamic library support and fixed STACK_BOTTOM.
- (Thanks to Fred Stearns.)
- - Added Fergus Henderson's patches for improved robustness with large
- heaps and lots of blacklisting.
- - Added Peter Chubb's changes to support Solaris Pthreads, to support
- MMAP allocation in Solaris, to allow Solaris to find dynamic libraries
- through /proc, to add malloc_typed_ignore_off_page, and a few other
- minor features and bug fixes.
- - The Solaris 2 port should not use sbrk. I received confirmation from
- Sun that the use of sbrk and malloc in the same program is not
- supported. The collector now defines USE_MMAP by default on Solaris.
- - Replaced the djgpp makefile with Gary Leavens' version.
- - Fixed MSWIN32 detection test.
- - Added Fergus Henderson's patches to allow putting the collector into
- a DLL under GNU win32.
- - Added Ivan V. Demakov's port to Watcom C on X86.
- - Added Ian Piumarta's Linux/PowerPC port.
- - On Brian Burton's suggestion added PointerFreeGC to the placement
- options in gc_cpp.h. This is of course unsafe, and may be controversial.
- On the other hand, it seems to be needed often enough that it's worth
- adding as a standard facility.
-
-Since 4.12:
- - Fixed a crucial bug in the Watcom port. There was a redundant decl
- of GC_push_one in gc_priv.h.
- - Added FINALIZE_ON_DEMAND.
- - Fixed some pre-ANSI cc problems in test.c.
- - Removed getpagesize() use for Solaris. It seems to be missing in one
- or two versions.
- - Fixed bool handling for SPARCCompiler version 4.2.
- - Fixed some files in include that had gotten unlinked from the main
- copy.
- - Some RS/6000 fixes (missing casts). Thanks to Toralf Foerster.
- - Fixed several problems in GC_debug_realloc, affecting mostly the
- FIND_LEAK case.
- - GC_exclude_static_roots contained a buggy unsigned comparison to
- terminate a loop. (Thanks to Wilson Ho.)
- - CORD_str failed if the substring occurred at the last possible position.
- (Only affects cord users.)
- - Fixed Linux code to deal with RedHat 5.0 and integrated Peter Bigot's
- os_dep.c code for dealing with various Linux versions.
- - Added workaround for Irix pthreads sigaction bug and possible signal
- misdirection problems.
-Since alpha1:
- - Changed RS6000 STACKBOTTOM.
- - Integrated Patrick Beard's Mac changes.
- - Alpha1 didn't compile on Irix m.n, m < 6.
- - Replaced Makefile.dj with a new one from Gary Leavens.
- - Added Andrew Stitcher's changes to support SCO OpenServer.
- - Added PRINT_BLACK_LIST, to allow debugging of high densities of false
- pointers.
- - Added code to debug allocator to keep track of return address
- in GC_malloc caller, thus giving a bit more context.
- - Changed default behavior of large block allocator to more
- aggressively avoid fragmentation. This is likely to slow down the
- collector when it succeeds at reducing space cost.
- - Integrated Fergus Henderson's CYGWIN32 changes. They are untested,
- but needed for newer versions.
- - USE_MMAP had some serious bugs. This caused the collector to fail
- consistently on Solaris with -DSMALL_CONFIG.
- - Added Linux threads support, thanks largely to Fergus Henderson.
-Since alpha2:
- - Fixed more Linux threads problems.
- - Changed default GC_free_space_divisor to 3 with new large block allocation.
- (Thanks to Matthew Flatt for some measurements that suggest the old
- value sometimes favors space too much over time.)
- - More CYGWIN32 fixes.
- - Integrated Tyson-Dowd's Linux-M68K port.
- - Minor HP PA and DEC UNIX fixes from Fergus Henderson.
- - Integrated Christoffe Raffali's Linux-SPARC changes.
- - Allowed for one more GC fixup iteration after a full GC in incremental
- mode. Some quick measurements suggested that this significantly
- reduces pause times even with smaller GC_RATE values.
- - Moved some more GC data structures into GC_arrays. This decreases
- pause times and GC overhead, but makes debugging slightly less convenient.
- - Fixed namespace pollution problem ("excl_table").
- - Made GC_incremental a constant for -DSMALL_CONFIG, hopefully shrinking
- that slightly.
- - Added some win32 threads fixes.
- - Integrated Ivan Demakov and David Stes' Watcom fixes.
- - Various other minor fixes contributed by many people.
- - Renamed config.h to gcconfig.h, since config.h tends to be used for
- many other things.
- - Integrated Matthew Flatt's support for 68K MacOS "far globals".
- - Fixed up some of the dynamic library Makefile targets for consistency
- across platforms.
- - Fixed a USE_MMAP typo that caused out-of-memory handling to fail
- on Solaris.
- - Added code to test.c to test thread creation a bit more.
- - Integrated GC_win32_free_heap, as suggested by Ivan Demakov.
- - Fixed Solaris 2.7 stack base finding problem. (This may actually
- have been done in an earlier alpha release.)
-Since alpha3:
- - Fixed MSWIN32 recognition test, which interfered with cygwin.
- - Removed unnecessary gc_watcom.asm from distribution. Removed
- some obsolete README.win32 text.
- - Added Alpha Linux incremental GC support. (Thanks to Philipp Tomsich
- for code for retrieving the fault address in a signal handler.)
- Changed Linux signal handler context argument to be a pointer.
- - Took care of some new warnings generated by the 7.3 SGI compiler.
- - Integrated Phillip Musumeci's FreeBSD/ELF fixes.
- - -DIRIX_THREADS was broken with the -o32 ABI (typo in gc_priv.h>
-
-Since 4.13:
- - Fixed GC_print_source_ptr to not use a prototype.
- - generalized CYGWIN test.
- - gc::new did the wrong thing with PointerFreeGC placement.
- (Thanks to Rauli Ruohonen.)
- - In the ALL_INTERIOR_POINTERS (default) case, some callee-save register
- values could fail to be scanned if the register was saved and
- reused in a GC frame. This showed up in verbose mode with gctest
- compiled with an unreleased SGI compiler. I vaguely recall an old
- bug report that may have been related. The bug was probably quite old.
- (The problem was that the stack scanning could be deferred until
- after the relevant frame was overwritten, and the new save location
- might be outside the scanned area. Fixed by more eager stack scanning.)
- - PRINT_BLACK_LIST had some problems. A few source addresses were garbage.
- - Replaced Makefile.dj and added -I flags to cord make targets.
- (Thanks to Gary Leavens.)
- - GC_try_to_collect was broken with the nonincremental collector.
- - gc_cleanup destructors could pass the wrong address to
- GC_register_finalizer_ignore_self in the presence of multiple
- inheritance. (Thanks to Darrell Schiebel.)
- - Changed PowerPC Linux stack finding code.
-
-Since 4.14alpha1
- - -DSMALL_CONFIG did not work reliably with large (> 4K) pages.
- Recycling the mark stack during expansion could result in a size
- zero heap segment, which confused things. (This was probably also an
- issue with the normal config and huge pages.)
- - Did more work to make sure that callee-save registers were scanned
- completely, even with the setjmp-based code. Added USE_GENERIC_PUSH_REGS
- macro to facilitate testing on machines I have access to.
- - Added code to explicitly push register contents for win32 threads.
- This seems to be necessary. (Thanks to Pierre de Rop.)
-
-Since 4.14alpha2
- - changed STACKBOTTOM for DJGPP (Thanks to Salvador Eduardo Tropea).
-
-Since 4.14
- - Reworked large block allocator. Now uses multiple doubly linked free
- lists to approximate best fit.
- - Changed heap expansion heuristic. Entirely free blocks are no longer
- counted towards the heap size. This seems to have a major impact on
- heap size stability; the old version could expand the heap way too
- much in the presence of large block fragmentation.
- - added -DGC_ASSERTIONS and some simple assertions inside the collector.
- This is mainlyt for collector debugging.
- - added -DUSE_MUNMAP to allow the heap to shrink. Suupported on only
- a few UNIX-like platforms for now.
- - added GC_dump_regions() for debugging of fragmentation issues.
- - Changed PowerPC pointer alignment under Linux to 4. (This needs
- checking by someone who has one. The suggestions came to me via a
- rather circuitous path.)
- - Changed the Linux/Alpha port to walk the data segment backwards until
- it encounters a SIGSEGV. The old way to find the start of the data
- segment broke with a recent release.
- - cordxtra.c needed to call GC_REGISTER_FINALIZER instead of
- GC_register_finalizer, so that it would continue to work with GC_DEBUG.
- - allochblk sometimes cleared the wrong block for debugging purposes
- when it dropped blacklisted blocks. This could result in spurious
- error reports with GC_DEBUG.
- - added MACOS X Server support. (Thanks to Andrew Stone.)
- - Changed the Solaris threads code to ignore stack limits > 8 MB with
- a warning. Empirically, it is not safe to access arbitrary pages
- in such large stacks. And the dirty bit implementation does not
- guarantee that none of them will be accessed.
- - Integrated Martin Tauchmann's Amiga changes.
- - Integrated James Dominy's OpenBSD/SPARC port.
-
-Since 5.0alpha1
- - Fixed bugs introduced in alpha1 (OpenBSD & large block initialization).
- - Added -DKEEP_BACK_PTRS and backptr.h interface. (The implementation
- idea came from Al Demers.)
-
-Since 5.0alpha2
- - Added some highly incomplete code to support a copied young generation.
- Comments on nursery.h are appreciated.
- - Changed -DFIND_LEAK, -DJAVA_FINALIZATION, and -DFINALIZE_ON_DEMAND,
- so the same effect could be obtained with a runtime switch. This is
- a step towards standardizing on a single dynamic GC library.
- - Significantly changed the way leak detection is handled, as a consequence
- of the above.
-
-To do:
- - Very large root set sizes (> 16 MB or so) could cause the collector
- to abort with an unexpected mark stack overflow. (Thanks again to
- Peter Chubb.) NOT YET FIXED. Workaround is to increase the initial
- size.
- - The SGI version of the collector marks from mmapped pages, even
- if they are not part of dynamic library static data areas. This
- causes performance problems with some SGI libraries that use mmap
- as a bitmap allocator. NOT YET FIXED. It may be possible to turn
- off DYNAMIC_LOADING in the collector as a workaround. It may also
- be possible to conditionally intercept mmap and use GC_exclude_static_roots.
- The real fix is to walk rld data structures, which looks possible.
- - Integrate MIT and DEC pthreads ports.
- - Deal with very uneven black-listing distributions. If all the black listed
- blocks reside in the newly allocated heap section, the heuristic for
- temporarily ignoring black-listing fails, and the heap grows too much.
- (This was observed in only one case, and could be worked around, but ...)
- - Some platform specific updates are waiting for 4.15alpha1.
diff --git a/gc/README.Mac b/gc/README.Mac
@@ -1,385 +0,0 @@
-Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2:
-----------------------------------------------------------------------------
-The current build environment for the collector is CodeWarrior Pro 2.
-Projects for CodeWarrior Pro 2 (and for quite a few older versions)
-are distributed in the file Mac_projects.sit.hqx. The project file
-:Mac_projects:gc.prj builds static library versions of the collector.
-:Mac_projects:gctest.prj builds the GC test suite.
-
-Configuring the collector is still done by editing the files
-:Mac_files:MacOS_config.h and :Mac_files:MacOS_Test_config.h.
-
-Lars Farm's suggestions on building the collector:
-----------------------------------------------------------------------------
-Garbage Collection on MacOS - a manual 'MakeFile'
--------------------------------------------------
-
-Project files and IDE's are great on the Macintosh, but they do have
-problems when used as distribution media. This note tries to provide
-porting instructions in pure TEXT form to avoid those problems. A manual
-'makefile' if you like.
-
- GC version: 4.12a2
- Codewarrior: CWPro1
- date: 18 July 1997
-
-The notes may or may not apply to earlier or later versions of the
-GC/CWPro. Actually, they do apply to earlier versions of both except that
-until recently a project could only build one target so each target was a
-separate project. The notes will most likely apply to future versions too.
-Possibly with minor tweaks.
-
-This is just to record my experiences. These notes do not mean I now
-provide a supported port of the GC to MacOS. It works for me. If it works
-for you, great. If it doesn't, sorry, try again...;-) Still, if you find
-errors, please let me know.
-
- mailto: lars.farm@ite.mh.se
-
- address: Lars Farm
- Krönvägen 33b
- 856 44 Sundsvall
- Sweden
-
-Porting to MacOS is a bit more complex than it first seems. Which MacOS?
-68K/PowerPC? Which compiler? Each supports both 68K and PowerPC and offer a
-large number of (unique to each environment) compiler settings. Each
-combination of compiler/68K/PPC/settings require a unique combination of
-standard libraries. And the IDE's does not select them for you. They don't
-even check that the library is built with compatible setting and this is
-the major source of problems when porting the GC (and otherwise too).
-
-You will have to make choices when you configure the GC. I've made some
-choices here, but there are other combinations of settings and #defines
-that work too.
-
-As for target settings the major obstacles may be:
-- 68K Processor: check "4-byte Ints".
-- PPC Processor: uncheck "Store Static Data in TOC".
-
-What you need to do:
-===================
-
-1) Build the GC as a library
-2) Test that the library works with 'test.c'.
-3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
-
-1) The Libraries:
-=================
-I made one project with four targets (68K/PPC tempmem or appheap). One target
-will suffice if you're able to decide which one you want. I wasn't...
-
-Codewarrior allows a large number of compiler/linker settings. I used these:
-
-Settings shared by all targets:
-------------------------------
-o Access Paths:
- - User Paths: the GC folder
- - System Paths: {Compiler}:Metrowerks Standard Library:
- {Compiler}:MacOS Support:Headers:
- {Compiler}:MacOS Support:MacHeaders:
-o C/C++ language:
- - inlining: normal
- - direct to SOM: off
- - enable/check: exceptions, RTTI, bool (and if you like pool strings)
-
-PowerPC target settings
------------------------
-o Target Settings:
- - name of target
- - MacOS PPC Linker
-o PPC Target
- - name of library
-o C/C++ language
- - prefix file as described below
-o PPC Processor
- - Struct Alignment: PowerPC
- - uncheck "Store Static Data in TOC" -- important!
- I don't think the others matter, I use full optimization and its ok
-o PPC Linker
- - Factory Settings (SYM file with full paths, faster linking, dead-strip
- static init, Main: __start)
-
-
-68K target settings
--------------------
-o Target Settings:
- - name of target
- - MacOS 68K Linker
-o 68K Target
- - name of library
- - A5 relative data
-o C/C++ language
- - prefix file as described below
-o 68K Processor
- - Code model: smart
- - Struct alignment: 68K
- - FP: SANE
- - enable 4-Byte Ints -- important!
- I don't think the others matter. I selected...
- - enable: 68020
- - enable: global register allocation
-o IR Optimizer
- - enable: Optimize Space, Optimize Speed
- I suppose the others would work too, but haven't tried...
-o 68K Linker
- - Factory Settings (New Style MacsBug,SYM file with full paths,
- A6 Frames, fast link, Merge compiler glue into segment 1,
- dead-strip static init)
-
-Prefix Files to configure the GC sources
-----------------------------------------
-The Codewarrior equivalent of commandline compilers -DNAME=X is to use
-prefix-files. A TEXT file that is automatically #included before the first byte
-of every source file. I used these:
-
----- ( cut here ) ---- gc_prefix_tempmem.h -- 68K and PPC -----
- #include "gc_prefix_common.h"
- #undef USE_TEMPORARY_MEMORY
- #define USE_TEMPORARY_MEMORY
----- ( cut here ) ---- gc_prefix_appmem.h -- 68K and PPC -----
- #include "gc_prefix_common.h"
- #undef USE_TEMPORARY_MEMORY
-// #define USE_TEMPORARY_MEMORY
-
----- ( cut here ) ---- gc_prefix_common.h --------------------
-// gc_prefix_common.h
-// ------------------
-// Codewarrior prefix file to configure the GC libraries
-//
-// prefix files are the Codewarrior equivalent of the
-// command line option -Dname=x frequently seen in makefiles
-
-#if !__MWERKS__
- #error only tried this with Codewarrior
-#endif
-
-#if macintosh
- #define MSL_USE_PRECOMPILED_HEADERS 0
- #include <ansi_prefix.mac.h>
- #ifndef __STDC__
- #define __STDC__ 0
- #endif
-
- // See list of #defines to configure the library in: 'MakeFile'
- // see also README
-
- #define SILENT // no collection messages. In case
- // of trouble you might want this off
- #define ALL_INTERIOR_POINTERS // follows interior pointers.
-//#define DONT_ADD_BYTE_AT_END // disables the padding if defined.
-//#define SMALL_CONFIG // whether to use a smaller heap.
- #define NO_SIGNALS // signals aren't real on the Macintosh.
- #define ATOMIC_UNCOLLECTABLE // GC_malloc_atomic_uncollectable()
-
- // define either or none as per personal preference
- // used in malloc.c
- #define REDIRECT_MALLOC GC_malloc
-//#define REDIRECT_MALLOC GC_malloc_uncollectable
- // if REDIRECT_MALLOC is #defined make sure that the GC library
- // is listed before the ANSI/ISO libs in the Codewarrior
- // 'Link order' panel
-//#define IGNORE_FREE
-
- // mac specific configs
-//#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
-//#define SHARED_LIBRARY_BUILD // build for use in a shared library.
-
-#else
- // could build Win32 here too, or in the future
- // Rhapsody PPC-mach, Rhapsody PPC-MacOS,
- // Rhapsody Intel-mach, Rhapsody Intel-Win32,...
- // ... ugh this will get messy ...
-#endif
-
-// make sure ints are at least 32-bit
-// ( could be set to 16-bit by compiler settings (68K) )
-
-struct gc_private_assert_intsize_{ char x[ sizeof(int)>=4 ? 1 : 0 ]; };
-
-#if __powerc
- #if __option(toc_data)
- #error turn off "store static data in TOC" when using GC
- // ... or find a way to add TOC to the root set...(?)
- #endif
-#endif
----- ( cut here ) ---- end of gc_prefix_common.h -----------------
-
-Files to build the GC libraries:
---------------------------------
- allchblk.c
- alloc.c
- blacklst.c
- checksums.c
- dbg_mlc.c
- finalize.c
- headers.c
- mach_dep.c
- MacOS.c -- contains MacOS code
- malloc.c
- mallocx.c
- mark.c
- mark_rts.c
- misc.c
- new_hblk.c
- obj_map.c
- os_dep.c -- contains MacOS code
- ptr_chck.c
- reclaim.c
- stubborn.c
- typd_mlc.c
- gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and
- -- throw std::bad_alloc when out of memory
- -- gc_cpp.cc works just fine too
-
-2) Test that the library works with 'test.c'.
-=============================================
-
-The test app is just an ordinary ANSI-C console app. Make sure settings
-match the library you're testing.
-
-Files
------
- test.c
- the GC library to test -- link order before ANSI libs
- suitable Mac+ANSI libraries
-
-prefix:
-------
----- ( cut here ) ---- gc_prefix_testlib.h -- all libs -----
-#define MSL_USE_PRECOMPILED_HEADERS 0
-#include <ansi_prefix.mac.h>
-#undef NDEBUG
-
-#define ALL_INTERIOR_POINTERS /* for GC_priv.h */
----- ( cut here ) ----
-
-3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
-
-The test app is just an ordinary ANSI-C console app. Make sure settings match
-the library you're testing.
-
-Files
------
- test_cpp.cc
- the GC library to test -- link order before ANSI libs
- suitable Mac+ANSI libraries
-
-prefix:
-------
-same as for test.c
-
-For convenience I used one test-project with several targets so that all
-test apps are build at once. Two for each library to test: test.c and
-gc_app.cc. When I was satisfied that the libraries were ok. I put the
-libraries + gc.h + the c++ interface-file in a folder that I then put into
-the MSL hierarchy so that I don't have to alter access-paths in projects
-that use the GC.
-
-After that, just add the proper GC library to your project and the GC is in
-action! malloc will call GC_malloc and free GC_free, new/delete too. You
-don't have to call free or delete. You may have to be a bit cautious about
-delete if you're freeing other resources than RAM. See gc_cpp.h. You can
-also keep coding as always with delete/free. That works too. If you want,
-"include <gc.h> and tweak it's use a bit.
-
-Symantec SPM
-============
-It has been a while since I tried the GC in SPM, but I think that the above
-instructions should be sufficient to guide you through in SPM too. SPM
-needs to know where the global data is. Use the files 'datastart.c' and
-'dataend.c'. Put 'datastart.c' at the top of your project and 'dataend.c'
-at the bottom of your project so that all data is surrounded. This is not
-needed in Codewarrior because it provides intrinsic variables
-__datastart__, __data_end__ that wraps all globals.
-
-Source Changes (GC 4.12a2)
-==========================
-Very few. Just one tiny in the GC, not strictly needed.
-- MacOS.c line 131 in routine GC_MacFreeTemporaryMemory()
- change # if !defined(SHARED_LIBRARY_BUILD)
- to # if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD)
- To turn off a message when the application quits (actually, I faked
- this change by #defining SHARED_LIBRARY_BUILD in a statically linked
- library for more than a year without ill effects but perhaps this is
- better).
-
-- test_cpp.cc
- made the first lines of main() look like this:
- ------------
- int main( int argc, char* argv[] ) {
- #endif
- #if macintosh // MacOS
- char* argv_[] = {"test_cpp","10"}; // doesn't
- argv=argv_; // have a
- argc = sizeof(argv_)/sizeof(argv_[0]); // commandline
- #endif //
-
- int i, iters, n;
- # ifndef __GNUC__
- alloc dummy_to_fool_the_compiler_into_doing_things_it_currently_cant_handle;
- ------------
-
-- config.h [now gcconfig.h]
- __MWERKS__ does not have to mean MACOS. You can use Codewarrior to
- build a Win32 or BeOS library and soon a Rhapsody library. You may
- have to change that #if...
-
-
-
- It worked for me, hope it works for you.
-
- Lars Farm
- 18 July 1997
-----------------------------------------------------------------------------
-
-
-Patrick Beard's instructions (may be dated):
-
-v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and
-Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided
-to build and test the collector under both development systems.
-
-Configuration
--------------
-
-To configure the collector, under both development systems, a prefix file
-is used to set preprocessor directives. This file is called "MacOS_config.h".
-Also to test the collector, "MacOS_Test_config.h" is provided.
-
-Testing
--------
-
-To test the collector (always a good idea), build one of the gctest projects,
-gctest.¹ (Symantec C++/THINK C), mw/gctest.68K.¹, or mw/gctest.PPC.¹. The
-test will ask you how many times to run; 1 should be sufficient.
-
-Building
---------
-
-For your convenience project files for the major Macintosh development
-systems are provided.
-
-For Symantec C++/THINK C, you must build the two projects gclib-1.¹ and
-gclib-2.¹. It has to be split up because the collector has more than 32k
-of static data and no library can have more than this in the Symantec
-environment. (Future versions will probably fix this.)
-
-For Metrowerks C/C++ 4.5 you build gc.68K.¹/gc.PPC.¹ and the result will
-be a library called gc.68K.lib/gc.PPC.lib.
-
-Using
------
-
-Under Symantec C++/THINK C, you can just add the gclib-1.¹ and gclib-2.¹
-projects to your own project. Under Metrowerks, you add gc.68K.lib or
-gc.PPC.lib and two additional files. You add the files called datastart.c
-and dataend.c to your project, bracketing all files that use the collector.
-See mw/gctest.¹ for an example.
-
-Include the projects/libraries you built above into your own project,
-#include "gc.h", and call GC_malloc. You don't have to call GC_free.
-
-
-Patrick C. Beard
-January 4, 1995
diff --git a/gc/README.OS2 b/gc/README.OS2
@@ -1,6 +0,0 @@
-The code assumes static linking, and a single thread. The editor de has
-not been ported. The cord test program has. The supplied OS2_MAKEFILE
-assumes the IBM C Set/2 environment, but the code shouldn't.
-
-Since we haven't figured out hoe to do perform partial links or to build static
-libraries, clients currently need to link against a long list of executables.
diff --git a/gc/README.QUICK b/gc/README.QUICK
@@ -1,5 +1,7 @@
Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
-Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+Copyright (c) 1999-2001 by Hewlett-Packard. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -10,32 +12,74 @@ Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
+A few files have other copyright holders. A few of the files needed
+to use the GNU-style build procedure come with a modified GPL license
+that appears not to significantly restrict use of the collector, though
+use of those files for a purpose other than building the collector may
+require the resulting code to be covered by the GPL.
For more details and the names of other contributors, see the
-README file and gc.h. This file describes typical use of
+doc/README* files and include/gc.h. This file describes typical use of
the collector on a machine that is already supported.
+For the version number, see doc/README or version.h.
+
INSTALLATION:
-Under UN*X, type "make test". Under OS/2 or Windows NT, copy the
-appropriate makefile to MAKEFILE, read it, and type "nmake test".
-Read the machine specific README if one exists. The only way to
-develop code with the collector for Windows 3.1 is to develop under
-Windows NT, and then to use win32S.
+Under UN*X, Linux:
+Alternative 1 (the old way): type "make test" in this directory.
+ Link against gc.a.
+
+Alternative 2 (the new way): type
+ "./configure --prefix=<dir>; make; make check; make install".
+ Link against <dir>/lib/libgc.a or <dir>/lib/libgc.so.
+ See README.autoconf for details
+
+Under OS/2 or Windows 95, 98, Me, NT, or 2000:
+copy the appropriate makefile to MAKEFILE, read it, and type "nmake test".
+(Under Windows, this assumes you have Microsoft command-line tools
+installed, and have DOS configured with enough environment space to run them.)
+Read the machine specific README in the doc directory if one exists.
+The only way to develop code with the collector for Windows 3.1 is
+to develop under Windows NT or 95+, and then to use win32S.
+
+If you need thread support, you will need to either follow the special
+platform-dependent instructions (win32), or add a suitable define
+option as described in Makefile.
-If you wish to use the cord (structured string) library type
+If you wish to use the cord (structured string) library, type
"make cords". (This requires an ANSI C compiler. You may need
-to redefine CC in the Makefile.)
+to redefine CC in the Makefile. The CORD_printf implementation in
+cordprnt.c is known to be less than perfectly portable. The rest
+of the package should still work.)
If you wish to use the collector from C++, type
"make c++". These add further files to gc.a and to the include
-subdirectory. See cord/cord.h and gc_c++.h.
+subdirectory. See cord/cord.h and include/gc_cpp.h.
TYPICAL USE:
-Include "gc.h" from this directory. Link against the appropriate library
-("gc.a" under UN*X). Replace calls to malloc by calls to GC_MALLOC,
-and calls to realloc by calls to GC_REALLOC. If the object is known
-to never contain pointers, use GC_MALLOC_ATOMIC instead of
-GC_MALLOC.
+Include "gc.h" from the include subdirectory. Link against the
+appropriate library ("gc.a" under UN*X). Replace calls to malloc
+by calls to GC_MALLOC, and calls to realloc by calls to GC_REALLOC.
+If the object is known to never contain pointers, use GC_MALLOC_ATOMIC
+instead of GC_MALLOC.
Define GC_DEBUG before including gc.h for additional checking.
+More documentation on the collector interface can be found at
+http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcinterface.html,
+in doc/README, and in include/gc.h .
+
+WARNINGS:
+
+Do not store the only pointer to an object in memory allocated
+with system malloc, since the collector usually does not scan
+memory allocated in this way.
+
+Use with threads may be supported on your system, but requires the
+collector to be built with thread support. See Makefile. The collector
+does not guarantee to scan thread-local storage (e.g. of the kind
+accessed with pthread_getspecific()). The collector does scan
+thread stacks though, so generally the best solution is to ensure that
+any pointers stored in thread-local storage are also stored on the
+thread's stack for the duration of their lifetime.
+
diff --git a/gc/README.alpha b/gc/README.alpha
@@ -1,22 +0,0 @@
-Should work under OSF/1 and Linux. Currently no VMS or NT support, though
-the latter shouldn't be hard.
-
-Incremental gc not yet supported under Linux because signal handler
-for SIGSEGV can't get a hold of fault address. Dynamic library support
-is also missing from Linux/alpha, probably for no good reason.
-
-Currently there is no thread support in the standard distribution. There
-exists a separate port to DEC Unix pthreads. It should be possible to
-port the X86 Linux threads support to Alpha without much trouble.
-
-If you get asssembler errors, be sure to read the first few lines of the
-Makefile.
-
-From Philippe Queinnec:
-
-System: DEC/Alpha OSF1 v3.2, vendor cc
-Problem: can't link if libgc has been compiled with "cc -std1".
- It works if the library has been compiled with either gcc or "cc"
- alone. The problem is because the variable "end" is not defined if
- compiling in std1 mode (see man ld).
-Proposed fix: none. Don't use cc -std1 !
diff --git a/gc/README.amiga b/gc/README.amiga
@@ -1,180 +0,0 @@
-===========================================================================
- Martin Tauchmann's notes (1-Apr-99)
-===========================================================================
-
-Works now, also with the GNU-C compiler V2.7.2.1. <ftp://ftp.unina.it/pub/amiga/geekgadgets/amiga/m68k/snapshots/971125/amiga-bin/>
-Modify the `Makefile`
-CC=cc $(ABI_FLAG)
-to
-CC=gcc $(ABI_FLAG)
-
-TECHNICAL NOTES
-
-- `GC_get_stack_base()`, `GC_register_data_segments()` works now with every
- C compiler; also Workbench.
-
-- Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC.
-
-
-PROBLEMS
-- When the Linker, does`t merge all Code-Segments to an single one. LD of GCC
- do it always.
-
-- With ixemul.library V47.3, when an GC program launched from another program
- (example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()`
- found the Segment-List of the caller program.
- Can be fixed, if the run-time initialization code (for C programs, usually *crt0*)
- support `__data` and `__bss`.
-
-- PowerPC Amiga currently not supported.
-
-- Dynamic libraries (dyn_load.c) not supported.
-
-
-TESTED WITH SOFTWARE
-
-`Optimized Oberon 2 C` (oo2c) <http://cognac.informatik.uni-kl.de/download/index.html>
-
-
-TESTED WITH HARDWARE
-
-MC68030
-
-
-CONTACT
-
-Please, contact me at <martintauchmann@bigfoot.com>, when you change the
-Amiga port. <http://martintauchmann.home.pages.de>
-
-===========================================================================
- Michel Schinz's notes
-===========================================================================
-WHO DID WHAT
-
-The original Amiga port was made by Jesper Peterson. I (Michel Schinz)
-modified it slightly to reflect the changes made in the new official
-distributions, and to take advantage of the new SAS/C 6.x features. I also
-created a makefile to compile the "cord" package (see the cord
-subdirectory).
-
-TECHNICAL NOTES
-
-In addition to Jesper's notes, I have the following to say:
-
-- Starting with version 4.3, gctest checks to see if the code segment is
- added to the root set or not, and complains if it is. Previous versions
- of this Amiga port added the code segment to the root set, so I tried to
- fix that. The only problem is that, as far as I know, it is impossible to
- know which segments are code segments and which are data segments (there
- are indeed solutions to this problem, like scanning the program on disk
- or patch the LoadSeg functions, but they are rather complicated). The
- solution I have chosen (see os_dep.c) is to test whether the program
- counter is in the segment we are about to add to the root set, and if it
- is, to skip the segment. The problems are that this solution is rather
- awkward and that it works only for one code segment. This means that if
- your program has more than one code segment, all of them but one will be
- added to the root set. This isn't a big problem in fact, since the
- collector will continue to work correctly, but it may be slower.
-
- Anyway, the code which decides whether to skip a segment or not can be
- removed simply by not defining AMIGA_SKIP_SEG. But notice that if you do
- so, gctest will complain (it will say that "GC_is_visible produced wrong
- failure indication"). However, it may be useful if you happen to have
- pointers stored in a code segment (you really shouldn't).
-
- If anyone has a good solution to the problem of finding, when a program
- is loaded in memory, whether a segment is a code or a data segment,
- please let me know.
-
-PROBLEMS
-
-If you have any problem with this version, please contact me at
-schinz@alphanet.ch (but do *not* send long files, since we pay for
-every mail!).
-
-===========================================================================
- Jesper Peterson's notes
-===========================================================================
-
-ADDITIONAL NOTES FOR AMIGA PORT
-
-These notes assume some familiarity with Amiga internals.
-
-WHY I PORTED TO THE AMIGA
-
-The sole reason why I made this port was as a first step in getting
-the Sather(*) language on the Amiga. A port of this language will
-be done as soon as the Sather 1.0 sources are made available to me.
-Given this motivation, the garbage collection (GC) port is rather
-minimal.
-
-(*) For information on Sather read the comp.lang.sather newsgroup.
-
-LIMITATIONS
-
-This port assumes that the startup code linked with target programs
-is that supplied with SAS/C versions 6.0 or later. This allows
-assumptions to be made about where to find the stack base pointer
-and data segments when programs are run from WorkBench, as opposed
-to running from the CLI. The compiler dependent code is all in the
-GC_get_stack_base() and GC_register_data_segments() functions, but
-may spread as I add Amiga specific features.
-
-Given that SAS/C was assumed, the port is set up to be built with
-"smake" using the "SMakefile". Compiler options in "SCoptions" can
-be set with "scopts" program. Both "smake" and "scopts" are part of
-the SAS/C commercial development system.
-
-In keeping with the porting philosophy outlined above, this port
-will not behave well with Amiga specific code. Especially not inter-
-process comms via messages, and setting up public structures like
-Intuition objects or anything else in the system lists. For the
-time being the use of this library is limited to single threaded
-ANSI/POSIX compliant or near-complient code. (ie. Stick to stdio
-for now). Given this limitation there is currently no mechanism for
-allocating "CHIP" or "PUBLIC" memory under the garbage collector.
-I'll add this after giving it considerable thought. The major
-problem is the entire physical address space may have to me scanned,
-since there is no telling who we may have passed memory to.
-
-If you allocate your own stack in client code, you will have to
-assign the pointer plus stack size to GC_stackbottom.
-
-The initial stack size of the target program can be compiled in by
-setting the __stack symbol (see SAS documentaion). It can be over-
-ridden from the CLI by running the AmigaDOS "stack" program, or from
-the WorkBench by setting the stack size in the tool types window.
-
-SAS/C COMPILER OPTIONS (SCoptions)
-
-You may wish to check the "CPU" code option is appropriate for your
-intended target system.
-
-Under no circumstances set the "StackExtend" code option in either
-compiling the library or *ANY* client code.
-
-All benign compiler warnings have been suppressed. These mainly
-involve lack of prototypes in the code, and dead assignments
-detected by the optimizer.
-
-THE GOOD NEWS
-
-The library as it stands is compatible with the GigaMem commercial
-virtual memory software, and probably similar PD software.
-
-The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz)
-compares favourably with an HP9000 with similar architecture (a 325
-with a 68030 I think).
-
------------------------------------------------------------------------
-
-The Amiga port has been brought to you by:
-
-Jesper Peterson.
-
-jep@mtiame.mtia.oz.au (preferred, but 1 week turnaround)
-jep@orca1.vic.design.telecom.au (that's orca<one>, 1 day turnaround)
-
-At least one of these addresses should be around for a while, even
-though I don't work for either of the companies involved.
-
diff --git a/gc/README.debugging b/gc/README.debugging
@@ -1,58 +0,0 @@
-Debugging suggestions:
-
-****If you get a segmentation fault or bus error while debugging with a debugger:
-If the fault occurred in GC_find_limit, or with incremental collection enabled, this is probably normal. The collector installs handlers to take care of these. You will not see these unless you are using a debugger. Your debugger should allow you to continue. It's preferable to tell the debugger to ignore SIGBUS and SIGSEGV ("handle" in gdb, "ignore" in most versions of dbx) and set a breakpoint in abort. The collector will call abort if the signal had another cause, and there was not other handler previously installed. I recommend debugging without incremental collection if possible. (This applies directly to UNIX systems. Debugging with incremental collection under win32 is worse. See README.win32.)
-
-****If you get warning messages informing you that the collector needed to allocate blacklisted blocks:
-
-0) Ignore these warnings while you are using GC_DEBUG. Some of the routines mentioned below don't have debugging equivalents. (Alternatively, write the missing routines and send them to me.)
-
-1) Replace allocator calls that request large blocks with calls to GC_malloc_ignore_off_page or GC_malloc_atomic_ignore_off_page. You may want to set a breakpoint in GC_default_warn_proc to help you identify such calls. Make sure that a pointer to somewhere near the beginning of the resulting block is maintained in a (preferably volatile) variable as long as the block is needed.
-
-2) If the large blocks are allocated with realloc, I suggest instead allocating them with something like the following. Note that the realloc size increment should be fairly large (e.g. a factor of 3/2) for this to exhibit reasonable performance. But we all know we should do that anyway.
-
-void * big_realloc(void *p, size_t new_size)
-{
- size_t old_size = GC_size(p);
- void * result;
-
- if (new_size <= 10000) return(GC_realloc(p, new_size));
- if (new_size <= old_size) return(p);
- result = GC_malloc_ignore_off_page(new_size);
- if (result == 0) return(0);
- memcpy(result,p,old_size);
- GC_free(p);
- return(result);
-}
-
-3) In the unlikely case that even relatively small object (<20KB) allocations are triggering these warnings, then your address space contains lots of "bogus pointers", i.e. values that appear to be pointers but aren't. Usually this can be solved by using GC_malloc_atomic or the routines in gc_typed.h to allocate large pointerfree regions of bitmaps, etc. Sometimes the problem can be solved with trivial changes of encoding in certain values. It is possible, though not pleasant, to identify the source of the bogus pointers by setting a breakpoint in GC_add_to_black_list_stack, and looking at the value of current_p in the GC_mark_from_mark_stack frame. Current_p contains the address of the bogus pointer.
-
-4) If you get only a fixed number of these warnings, you are probably only introducing a bounded leak by ignoring them. If the data structures being allocated are intended to be permanent, then it is also safe to ignore them. The warnings can be turned off by calling GC_set_warn_proc with a procedure that ignores these warnings (e.g. by doing absolutely nothing).
-
-
-****If the collector dies in GC_malloc while trying to remove a free list element:
-
-1) With > 99% probability, you wrote past the end of an allocated object. Try setting GC_DEBUG and using the debugging facilities in gc.h.
-
-
-****If the heap grows too much:
-
-1) Consider using GC_malloc_atomic for objects containing nonpointers. This is especially important for large arrays containg compressed data, pseudo-random numbers, and the like. (This isn't all that likely to solve your problem, but it's a useful and easy optimization anyway, and this is a good time to try it.) If you allocate large objects containg only one or two pointers at the beginning, either try the typed allocation primitives is gc.h, or separate out the pointerfree component.
-2) If you are using the collector in its default mode, with interior pointer recognition enabled, consider using GC_malloc_ignore_off_page to allocate large objects. (See gc.h and above for details. Large means > 100K in most environments.)
-3) GC_print_block_list() will print a list of all currently allocated heap blocks and what size objects they contain. GC_print_hblkfreelist() will print a list of free heap blocks, and whether they are blacklisted. GC_dump calls both of these, and also prints information about heap sections, and root segments.
-4) Write a tool that traces back references to the appropriate root. Send me the code. (I have code that does this for old PCR.)
-
-
-****If the collector appears to be losing objects:
-
-1) Replace all calls to GC_malloc_atomic and typed allocation by GC_malloc calls. If this fixes the problem, gradually reinsert your optimizations.
-2) You may also want to try the safe(r) pointer manipulation primitives in gc.h. But those are hard to use until the preprocessor becomes available.
-3) Try using the GC_DEBUG facilities. This is less likely to be successful here than if the collector crashes.
-[The rest of these are primarily for wizards. You shouldn't need them unless you're doing something really strange, or debugging a collector port.]
-4) Don't turn on incremental collection. If that fixes the problem, suspect a bug in the dirty bit implementation. Try compiling with -DCHECKSUMS to check for modified, but supposedly clean, pages.
-5) On a SPARC, in a single-threaded environment, GC_print_callers(GC_arrays._last_stack) prints a cryptic stack trace as of the time of the last collection. (You will need a debugger to decipher the result.) The question to ask then is "why should this object have been accessible at the time of the last collection? Where was a pointer to it stored?". This facility should be easy to add for some other collector ports (namely if it's easy to traverse stack frames), but will be hard for others.
-6) "print *GC_find_header(p)" in dbx or gdb will print the garbage collector block header information associated with the object p (e.g. object size, etc.)
-7) GC_is_marked(p) determines whether p is the base address of a marked object. Note that objects allocated since the last collection should not be marked, and that unmarked objects are reclaimed incrementally. It's usually most interesting to set a breakpoint in GC_finish_collection and then to determine how much of the damaged data structure is marked at that point.
-8) Look at the tracing facility in mark.c. (Ignore this suggestion unless you are very familiar with collector internals.)
-
-
diff --git a/gc/README.dj b/gc/README.dj
@@ -1,12 +0,0 @@
-[Original version supplied by Xiaokun Zhu <xiaokun@aero.gla.ac.uk>]
-[This version came mostly from Gary Leavens. ]
-
-Look first at Makefile.dj, and possibly change the definitions of
-RM and MV if you don't have rm and mv installed.
-Then use Makefile.dj to compile the garbage collector.
-For example, you can do:
-
- make -f Makefile.dj test
-
-All the tests should work fine.
-
diff --git a/gc/README.hp b/gc/README.hp
@@ -1,11 +0,0 @@
-Dynamic loading support requires that executables be linked with -ldld.
-The alternative is to build the collector without defining DYNAMIC_LOADING
-in gcconfig.h and ensuring that all garbage collectable objects are
-accessible without considering statically allocated variables in dynamic
-libraries.
-
-The collector should compile with either plain cc or cc -Ae. CC -Aa
-fails to define _HPUX_SOURCE and thus will not configure the collector
-correctly.
-
-There is currently no thread support.
diff --git a/gc/README.linux b/gc/README.linux
@@ -1,50 +0,0 @@
-See README.alpha for Linux on DEC AXP info.
-
-This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K
-and PowerPC are also integrated. They should behave similarly, except that
-the PowerPC port lacks incremental GC support, and it is unknown to what
-extent the Linux threads code is functional.
-
-Incremental GC is supported on Intel IA32 and M68K.
-
-Dynamic libraries are supported on an ELF system. A static executable
-should be linked with the gcc option "-Wl,-defsym,_DYNAMIC=0".
-
-The collector appears to work with Linux threads. We have seen
-intermittent hangs in sem_wait. So far we have been unable to reproduce
-these unless the process was being debugged or traced. Thus it's
-possible that the only real issue is that the debugger loses
-signals on rare occasions.
-
-The garbage collector uses SIGPWR and SIGXCPU if it is used with
-Linux threads. These should not be touched by the client program.
-
-To use threads, you need to abide by the following requirements:
-
-1) You need to use LinuxThreads (which are included in libc6).
-
- The collector relies on some implementation details of the LinuxThreads
- package. It is unlikely that this code will work on other
- pthread implementations (in particular it will *not* work with
- MIT pthreads).
-
-2) You must compile the collector with -DLINUX_THREADS and -D_REENTRANT
- specified in the Makefile.
-
-3) Every file that makes thread calls should define LINUX_THREADS and
- _REENTRANT and then include gc.h. Gc.h redefines some of the
- pthread primitives as macros which also provide the collector with
- information it requires.
-
-4) Currently dlopen() is probably not safe. The collector must traverse
- the list of libraries maintained by the runtime loader. That can
- probably be an inconsistent state when a thread calling the loader is
- is stopped for GC. (It's possible that this is fixable in the
- same way it is handled for SOLARIS_THREADS, with GC_dlopen.)
-
-5) The combination of LINUX_THREADS, REDIRECT_MALLOC, and incremental
- collection fails in seemingly random places. This hasn't been tracked
- down yet, but is perhaps not completely astonishing. The thread package
- uses malloc, and thus can presumably get SIGSEGVs while inside the
- package. There is no real guarantee that signals are handled properly
- at that point.
diff --git a/gc/README.rs6000 b/gc/README.rs6000
@@ -1,9 +0,0 @@
-We have so far failed to find a good way to determine the stack base.
-It is highly recommended that GC_stackbottom be set explicitly on program
-startup. The supplied value sometimes causes failure under AIX 4.1, though
-it appears to work under 3.X. HEURISTIC2 seems to work under 4.1, but
-involves a substantial performance penalty, and will fail if there is
-no limit on stack size.
-
-There is no thread support. (I assume recent versions of AIX provide
-pthreads? I no longer have access to a machine ...)
diff --git a/gc/README.sgi b/gc/README.sgi
@@ -1,41 +0,0 @@
-Performance of the incremental collector can be greatly enhanced with
--DNO_EXECUTE_PERMISSION.
-
-The collector should run with all of the -32, -n32 and -64 ABIs. Remember to
-define the AS macro in the Makefile to be "as -64", or "as -n32".
-
-If you use -DREDIRECT_MALLOC=GC_malloc with C++ code, your code should make
-at least one explicit call to malloc instead of new to ensure that the proper
-version of malloc is linked in.
-
-Sproc threads are not supported in this version, though there may exist other
-ports.
-
-Pthreads support is provided. This requires that:
-
-1) You compile the collector with -DIRIX_THREADS specified in the Makefile.
-
-2) You have the latest pthreads patches installed.
-
-(Though the collector makes only documented pthread calls,
-it relies on signal/threads interactions working just right in ways
-that are not required by the standard. It is unlikely that this code
-will run on other pthreads platforms. But please tell me if it does.)
-
-3) Every file that makes thread calls should define IRIX_THREADS and then
-include gc.h. Gc.h redefines some of the pthread primitives as macros which
-also provide the collector with information it requires.
-
-4) pthread_cond_wait and pthread_cond_timed_wait should be prepared for
-premature wakeups. (I believe the pthreads and realted standards require this
-anyway. Irix pthreads often terminate a wait if a signal arrives.
-The garbage collector uses signals to stop threads.)
-
-5) It is expensive to stop a thread waiting in IO at the time the request is
-initiated. Applications with many such threads may not exhibit acceptable
-performance with the collector. (Increasing the heap size may help.)
-
-6) The collector should not be compiled with -DREDIRECT_MALLOC. This
-confuses some library calls made by the pthreads implementation, which
-expect the standard malloc.
-
diff --git a/gc/README.solaris2 b/gc/README.solaris2
@@ -1,65 +0,0 @@
-The collector supports both incremental collection and threads under
-Solaris 2. The incremental collector normally retrieves page dirty information
-through the appropriate /proc calls. But it can also be configured
-(by defining MPROTECT_VDB instead of PROC_VDB in gcconfig.h) to use mprotect
-and signals. This may result in shorter pause times, but it is no longer
-safe to issue arbitrary system calls that write to the heap.
-
-Under other UNIX versions,
-the collector normally obtains memory through sbrk. There is some reason
-to expect that this is not safe if the client program also calls the system
-malloc, or especially realloc. The sbrk man page strongly suggests this is
-not safe: "Many library routines use malloc() internally, so use brk()
-and sbrk() only when you know that malloc() definitely will not be used by
-any library routine." This doesn't make a lot of sense to me, since there
-seems to be no documentation as to which routines can transitively call malloc.
-Nonetheless, under Solaris2, the collector now (since 4.12) allocates
-memory using mmap by default. (It defines USE_MMAP in gcconfig.h.)
-You may want to reverse this decisions if you use -DREDIRECT_MALLOC=...
-
-
-SOLARIS THREADS:
-
-The collector must be compiled with -DSOLARIS_THREADS to be thread safe.
-It is also essential that gc.h be included in files that call thr_create,
-thr_join, thr_suspend, thr_continue, or dlopen. Gc.h macro defines
-these to also do GC bookkeeping, etc. Gc.h must be included with
-SOLARIS_THREADS defined, otherwise these replacements are not visible.
-A collector built in this way way only be used by programs that are
-linked with the threads library.
-
-If you are using the Pthreads interface, also define _SOLARIS_PTHREADS.
-
-In this mode, the collector contains various workarounds for older Solaris
-bugs. Mostly, these should not be noticeable unless you look at system
-call traces. However, it cannot protect a guard page at the end of
-a thread stack. If you know that you will only be running Solaris2.5
-or later, it should be possible to fix this by compiling the collector
-with -DSOLARIS23_MPROTECT_BUG_FIXED.
-
-Jeremy Fitzhardinge points out that there is a problem with the dlopen
-replacement, in that startup code in the library is run while the allocation
-lock is held. This appears to be difficult to fix, since the collector does
-look at data structures maintained by dlopen, and hence some locking is needed
-around the dlopen call. Defining USE_PROC_FOR_LIBRARIES will get address
-space layout information from /proc avoiding the dlopen lock. But this has
-other disadvanatages, e.g. mmapped files may be scanned.
-
-If solaris_threads are used on an X86 processor with malloc redirected to
-GC_malloc, it is necessary to call GC_thr_init explicitly before forking the
-first thread. (This avoids a deadlock arising from calling GC_thr_init
-with the allocation lock held.)
-
-It appears that there is a problem in using gc_cpp.h in conjunction with
-Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator
-is invoked by some iostream initialization code before threads are correctly
-initialized. As a result, call to thr_self() in garbage collector
-initialization segfaults. Currently the only known workaround is to not
-invoke the garbage collector from a user defined global operator new, or to
-have it invoke the garbage-collector's allocators only after main has started.
-(Note that the latter requires a moderately expensive test in operator
-delete.)
-
-Hans-J. Boehm
-(The above contains my personal opinions, which are probably not shared
-by anyone else.)
diff --git a/gc/README.uts b/gc/README.uts
@@ -1,2 +0,0 @@
-Alistair Crooks supplied the port. He used Lexa C version 2.1.3 with
--Xa to compile.
diff --git a/gc/README.win32 b/gc/README.win32
@@ -1,149 +0,0 @@
-The collector has only been compiled under Windows NT, with the
-original Microsoft SDK, with Visual C++ 2.0 and later, with
-the GNU win32 environment, with Borland 4.5, and recently with
-Watcom C.
-
-It runs under both win32s and win32, but with different semantics.
-Under win32, all writable pages outside of the heaps and stack are
-scanned for roots. Thus the collector sees pointers in DLL data
-segments. Under win32s, only the main data segment is scanned.
-(The main data segment should always be scanned. Under some
-versions of win32s, other regions may also be scanned.)
-Thus all accessible objects should be accessible from local variables
-or variables in the main data segment. Alternatively, other data
-segments (e.g. in DLLs) may be registered with the collector by
-calling GC_init() and then GC_register_root_section(a), where
-a is the address of some variable inside the data segment. (Duplicate
-registrations are ignored, but not terribly quickly.)
-
-(There are two reasons for this. We didn't want to see many 16:16
-pointers. And the VirtualQuery call has different semantics under
-the two systems, and under different versions of win32s.)
-
-The collector test program "gctest" is linked as a GUI application,
-but does not open any windows. Its output appears in the file
-"gc.log". It may be started from the file manager. The hour glass
-cursor will appear as long as it's running. If it is started from the
-command line, it will usually run in the background. Wait a few
-minutes (a few seconds on a modern machine) before you check the output.
-You should see either a failure indication or a "Collector appears to
-work" message.
-
-The cord test program has not been ported (but should port
-easily). A toy editor (cord/de.exe) based on cords (heavyweight
-strings represented as trees) has been ported and is included.
-It runs fine under either win32 or win32S. It serves as an example
-of a true Windows application, except that it was written by a
-nonexpert Windows programmer. (There are some peculiarities
-in the way files are displayed. The <cr> is displayed explicitly
-for standard DOS text files. As in the UNIX version, control
-characters are displayed explicitly, but in this case as red text.
-This may be suboptimal for some tastes and/or sets of default
-window colors.)
-
-For Microsoft development tools, rename NT_MAKEFILE as
-MAKEFILE. (Make sure that the CPU environment variable is defined
-to be i386.)
-
-For GNU-win32, use the regular makefile, possibly after uncommenting
-the line "include Makefile.DLLs". The latter should be necessary only
-if you want to package the collector as a DLL. The GNU-win32 port is
-believed to work only for b18, not b19, probably dues to linker changes
-in b19. This is probably fixable with a different definition of
-DATASTART and DATAEND in gcconfig.h.
-
-For Borland tools, use BCC_MAKEFILE. Note that
-Borland's compiler defaults to 1 byte alignment in structures (-a1),
-whereas Visual C++ appears to default to 8 byte alignment (/Zp8).
-The garbage collector in its default configuration EXPECTS AT
-LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST
-BE OVERRIDDEN. (In my opinion, it should usually be anyway.
-I expect that -a1 introduces major performance penalties on a
-486 or Pentium.) Note that this changes structure layouts. (As a last
-resort, gcconfig.h can be changed to allow 1 byte alignment. But
-this has significant negative performance implications.)
-The Makefile is set up to assume Borland 4.5. If you have another
-version, change the line near the top. By default, it does not
-require the assembler. If you do have the assembler, I recommend
-removing the -DUSE_GENERIC.
-
-Incremental collection support was recently added. This is
-currently pretty simpleminded. Pages are protected. Protection
-faults are caught by a handler installed at the bottom of the handler
-stack. This is both slow and interacts poorly with a debugger.
-Whenever possible, I recommend adding a call to
-GC_enable_incremental at the last possible moment, after most
-debugging is complete. Unlike the UNIX versions, no system
-calls are wrapped by the collector itself. It may be necessary
-to wrap ReadFile calls that use a buffer in the heap, so that the
-call does not encounter a protection fault while it's running.
-(As usual, none of this is an issue unless GC_enable_incremental
-is called.)
-
-Note that incremental collection is disabled with -DSMALL_CONFIG,
-which is the default for win32. If you need incremental collection,
-undefine SMALL_CONFIG.
-
-Incremental collection is not supported under win32s, and it may not
-be possible to do so. However, win32 applications that attempt to use
-incremental collection should continue to run, since the
-collector detects if it's running under win32s and turns calls to
-GC_enable_incremental() into noops.
-
-James Clark has contributed the necessary code to support win32 threads.
-This code is known to exhibit some problems with incremental collection
-enabled. Use NT_THREADS_MAKEFILE (a.k.a gc.mak) instead of NT_MAKEFILE
-to build this version. Note that this requires some files whose names
-are more than 8 + 3 characters long. Thus you should unpack the tar file
-so that long file names are preserved. To build the garbage collector
-test with VC++ from the command line, use
-
-nmake /F ".\gc.mak" CFG="gctest - Win32 Release"
-
-This requires that the subdirectory gctest\Release exist.
-The test program and DLL will reside in the Release directory.
-
-This version relies on the collector residing in a dll.
-
-This version currently supports incremental collection only if it is
-enabled before any additional threads are created.
-Version 4.13 attempts to fix some of the earlier problems, but there
-may be other issues. If you need solid support for win32 threads, you
-might check with Geodesic Systems. Their collector must be licensed,
-but they have invested far more time in win32-specific issues.
-
-Hans
-
-Ivan V. Demakov's README for the Watcom port:
-
-The collector has been compiled with Watcom C 10.6 and 11.0.
-It runs under win32, win32s, and even under msdos with dos4gw
-dos-extender. It should also run under OS/2, though this isn't
-tested. Under win32 the collector can be built either as dll
-or as static library.
-
-Note that all compilations were done under Windows 95 or NT.
-For unknown reason compiling under Windows 3.11 for NT (one
-attempt has been made) leads to broken executables.
-
-Incremental collection is not supported.
-
-cord is not ported.
-
-Before compiling you may need to edit WCC_MAKEFILE to set target
-platform, library type (dynamic or static), calling conventions, and
-optimization options.
-
-To compile the collector and testing programs use the command:
- wmake -f WCC_MAKEFILE
-
-All programs using gc should be compiled with 4-byte alignment.
-For further explanations on this see comments about Borland.
-
-If gc compiled as dll, the macro ``GC_DLL'' should be defined before
-including "gc.h" (for example, with -DGC_DLL compiler option). It's
-important, otherwise resulting programs will not run.
-
-Ivan Demakov (email: ivan@tgrad.nsk.su)
-
-
diff --git a/gc/SCoptions.amiga b/gc/SCoptions.amiga
@@ -1,16 +0,0 @@
-CPU=68030
-NOSTACKCHECK
-OPTIMIZE
-VERBOSE
-MAPHUNK
-NOVERSION
-NOICONS
-OPTIMIZERTIME
-DEFINE SILENT
-DEFINE AMIGA_SKIP_SEG
-IGNORE=85
-IGNORE=154
-IGNORE=161
-IGNORE=100
-OPTIMIZERCOMPLEXITY=4
-OPTIMIZERDEPTH=3
diff --git a/gc/SMakefile.amiga b/gc/SMakefile.amiga
@@ -1,48 +1,178 @@
-OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o
-INC= gc_private.h gc_hdrs.h gc.h gcconfig.h
+# Rewritten smakefile for amiga / sas/c. -Kjetil M.
+# Dont use the cord-package if you define parm=both or parm=reg.
+
+
+#----------------TOOLS--------------------------------
+CC=sc
+LINKER=slink
+LIBER=oml
+
+#----------------CPU OPTIONS--------------------------
+
+CPU=68060
+
+#----------------FPU OPTIONS--------------------------
+
+MATH=8
+MATHLIB=LIB:scm881.lib
+
+#----------------COMPILER OPTIONS---------------------
+
+IGNORE= IGNORE=85 IGNORE=154 IGNORE=161 IGNORE=100
+
+OPTIMIZE=optimize optimizetime optglobal optimizerdepth=100 optimizerpeephole optloop OPTSCHED optimizerinlocal optimizerrecurdepth=100
+# optimizerinline optimizercomplexity=100
+
+OPT= $(OPTIMIZE) CPU=$(CPU) math=$(MATH) NOSTACKCHECK VERBOSE \
+MAPHUNK NOVERSION NOICONS nodebug \
+DEFINE SILENT \
+parm=reg \
+DEFINE __USE_SYSBASE
+
+
+SOPT= $(OPT) $(IGNORE) \
+DEFINE AMIGA_SKIP_SEG \
+DEFINE ATOMIC_UNCOLLECTABLE \
+DEFINE GC_AMIGA_FASTALLOC \
+DEFINE GC_AMIGA_RETRY \
+DEFINE GC_AMIGA_PRINTSTATS \
+DEFINE GC_AMIGA_GC
+
+
+#DEFINE ALL_INTERIOR_POINTERS \
+
+
+SCOPT= $(SOPT) define GC_AMIGA_MAKINGLIB
+
+CSCOPT= $(OPT) DEFINE AMIGA IGNORE=100 IGNORE=161
+
+#------------------LINKING----------------------------
+
+
+all: gctest setjmp_t cord/cordtest
+
+clean:
+ delete *.lib gctest setjmp_t *.o *.lnk cord/*.o cord/*.lib cord/*.lnk cord/cordtest
+ smake
+
+test: setjmp_t gctest cord/cordtest
+ setjmp_t
+ gctest
+ cord/cordtest
+
+gctest: gc$(CPU).lib GCAmigaOS$(CPU).lib test.o
+ $(LINKER) LIB:c.o test.o TO gctest LIB gc$(CPU).lib LIB:sc.lib $(MATHLIB)
+
+setjmp_t: setjmp_t.o gc.h
+ $(LINKER) LIB:c.o setjmp_t.o to setjmp_t lib LIB:sc.lib
+
+cord/cordtest: cord/cordtest.o cord/cord$(CPU).lib gc$(CPU).lib
+ slink LIB:c.o cord/cordtest.o LIB $(MATHLIB) gc$(CPU).lib cord/cord$(CPU).lib LIB:sc.lib TO cord/cordtest
+
+
+#------------------LIBBING----------------------------
+
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o
+
+gc$(CPU).lib: $(OBJS)
+ $(LIBER) gc$(CPU).lib r $(OBJS)
+
+
+COBJS = cord/cordbscs.o cord/cordprnt.o cord/cordxtra.o
-all: gctest setjmp_t
+cord/cord$(CPU).lib: $(COBJS)
+ oml cord/cord$(CPU).lib r $(COBJS)
+
+#------------------COMPILING--------------------------
+
+INC= gc_private.h gc_hdrs.h gc.h gcconfig.h
alloc.o : alloc.c $(INC)
+ $(CC) alloc.c $(SCOPT) ignore=7
+
reclaim.o : reclaim.c $(INC)
+ $(CC) reclaim.c $(SCOPT)
+
allchblk.o : allchblk.c $(INC)
+ $(CC) allchblk.c $(SCOPT)
+
misc.o : misc.c $(INC)
-os_dep.o : os_dep.c $(INC)
+ $(CC) misc.c $(SCOPT)
+
+os_dep.o : os_dep.c $(INC) AmigaOS.c
+ $(CC) os_dep.c $(SCOPT)
+
mark_rts.o : mark_rts.c $(INC)
+ $(CC) mark_rts.c $(SCOPT)
+
headers.o : headers.c $(INC)
+ $(CC) headers.c $(SCOPT)
+
mark.o : mark.c $(INC)
+ $(CC) mark.c $(SCOPT)
+
obj_map.o : obj_map.c $(INC)
+ $(CC) obj_map.c $(SCOPT)
+
blacklst.o : blacklst.c $(INC)
+ $(CC) blacklst.c $(SCOPT)
+
finalize.o : finalize.c $(INC)
- sc noopt finalize.c # There seems to be a bug in the optimizer (V6.51).
- # gctest won't work if you remove this...
+ $(CC) finalize.c $(SCOPT) noopt #Could sas/c still have problems with this one? Gctest sometimes fails to finalize all.
+
new_hblk.o : new_hblk.c $(INC)
+ $(CC) new_hblk.c $(SCOPT)
+
real_malloc.o : real_malloc.c $(INC)
+ $(CC) real_malloc.c $(SCOPT)
+
dyn_load.o : dyn_load.c $(INC)
+ $(CC) dyn_load.c $(SCOPT)
+
dbg_mlc.o : dbg_mlc.c $(INC)
+ $(CC) dbg_mlc.c $(SCOPT)
+
malloc.o : malloc.c $(INC)
-mallocx.o : malloc.c $(INC)
+ $(CC) malloc.c $(SCOPT)
+
+mallocx.o : mallocx.c $(INC)
+ $(CC) mallocx.c $(SCOPT)
+
stubborn.o : stubborn.c $(INC)
+ $(CC) stubborn.c $(SCOPT)
+
checksums.o : checksums.c $(INC)
+ $(CC) checksums.c $(SCOPT)
+
typd_mlc.o: typd_mlc.c $(INC)
+ $(CC) typd_mlc.c $(SCOPT)
+
mach_dep.o : mach_dep.c $(INC)
+ $(CC) mach_dep.c $(SCOPT)
+
ptr_chck.o: ptr_chck.c $(INC)
+ $(CC) ptr_chck.c $(SCOPT)
+
test.o : test.c $(INC)
+ $(CC) test.c $(SOPT)
-gc.lib: $(OBJS)
- oml gc.lib r $(OBJS)
+setjmp_t: setjmp_t.c gc.h
+ $(CC) setjmp_t.c $(SOPT)
-clean:
- delete gc.lib gctest setjmp_t \#?.o
-gctest: gc.lib test.o
- slink LIB:c.o test.o to $@ lib gc.lib LIB:sc.lib LIB:scm.lib
+# cords:
+
+cord/cordbscs.o: cord/cordbscs.c
+ sc cord/cordbscs.c $(CSCOPT)
+
+cord/cordprnt.o: cord/cordprnt.c
+ sc cord/cordprnt.c $(CSCOPT)
+
+cord/cordxtra.o: cord/cordxtra.c
+ sc cord/cordxtra.c $(CSCOPT)
+
+cord/cordtest.o: cord/cordtest.c
+ sc cord/cordtest.c $(CSCOPT)
-setjmp_t: setjmp_t.c gc.h
- sc setjmp_t.c
- slink LIB:c.o $@.o to $@ lib LIB:sc.lib
-test: setjmp_t gctest
- setjmp_t
- gctest
diff --git a/gc/WCC_MAKEFILE b/gc/WCC_MAKEFILE
@@ -169,9 +169,9 @@ test_cpp.exe: test_cpp.obj gc.lib
gc_cpp.obj: gc_cpp.cc .AUTODEPEND
$(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
-test.obj: test.c .AUTODEPEND
+test.obj: tests\test.c .AUTODEPEND
$(CC) $(TEST_CFLAGS) $*.c
-test_cpp.obj: test_cpp.cc .AUTODEPEND
+test_cpp.obj: tests\test_cpp.cc .AUTODEPEND
$(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
diff --git a/gc/acinclude.m4 b/gc/acinclude.m4
@@ -0,0 +1,182 @@
+# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
+#
+# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+#
+# Original author: Tom Tromey
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(GC_CONFIGURE,
+[
+dnl Default to --enable-multilib
+AC_ARG_ENABLE(multilib,
+[ --enable-multilib build many library versions (default)],
+[case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=yes])dnl
+
+dnl We may get other options which we don't document:
+dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+
+dnl I needed to add the -n test to allow configuration in src directory - HB
+if test "[$]{srcdir}" = "."; then
+ if test "[$]{with_target_subdir}" != "." -a -n "[$]{with_target_subdir}"; then
+ gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+ else
+ gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+ fi
+else
+ gc_basedir="[$]{srcdir}/$1"
+fi
+AC_SUBST(gc_basedir)
+AC_CONFIG_AUX_DIR($gc_basedir)
+
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE(gc, 6.0, no-define)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+dnl Fool anybody using AC_PROG_CC.
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CC
+
+# Likewise for AC_PROG_CXX.
+AC_DEFUN(LIB_AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+dnl Fool anybody using AC_PROG_CXX.
+AC_PROVIDE([AC_PROG_CXX])
+AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
+
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ AC_PROG_CXX_G
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CXX
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
+# run it explicitly here, it will be run implicitly before
+# NEWLIB_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+AC_CANONICAL_BUILD
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_PROG_INSTALL
+
+AM_MAINTAINER_MODE
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which can't create executables. So we include AC_EXEEXT to keep
+# automake happy, but we don't execute it, since we don't care about
+# the result.
+if false; then
+ # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+ # to nothing, so nothing would remain between `then' and `fi' if it
+ # were not for the `:' below.
+ :
+ AC_EXEEXT
+fi
+
+. [$]{srcdir}/configure.host
+
+case [$]{gc_basedir} in
+/* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
+*) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
+esac
+
+gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{gc_flagbasedir}/libc/include"
+case "${host}" in
+ *-*-cygwin32*)
+ gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
+ ;;
+esac
+
+dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
+
+GC_CFLAGS=${gc_cflags}
+AC_SUBST(GC_CFLAGS)
+]))
+
+))))
+
+sinclude(libtool.m4)
+dnl The line below arranges for aclocal not to bring a definition of
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[AC_DEFUN([AM_PROG_LIBTOOL],[AC_SUBST(LIBTOOL)])])
diff --git a/gc/aclocal.m4 b/gc/aclocal.m4
@@ -0,0 +1,320 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
+#
+# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+#
+# Original author: Tom Tromey
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(GC_CONFIGURE,
+[
+dnl Default to --enable-multilib
+AC_ARG_ENABLE(multilib,
+[ --enable-multilib build many library versions (default)],
+[case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=yes])dnl
+
+dnl We may get other options which we don't document:
+dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+
+dnl I needed to add the -n test to allow configuration in src directory - HB
+if test "[$]{srcdir}" = "."; then
+ if test "[$]{with_target_subdir}" != "." -a -n "[$]{with_target_subdir}"; then
+ gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
+ else
+ gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
+ fi
+else
+ gc_basedir="[$]{srcdir}/$1"
+fi
+AC_SUBST(gc_basedir)
+AC_CONFIG_AUX_DIR($gc_basedir)
+
+AC_CANONICAL_SYSTEM
+
+AM_INIT_AUTOMAKE(gc, 6.0, no-define)
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+dnl Fool anybody using AC_PROG_CC.
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CC
+
+# Likewise for AC_PROG_CXX.
+AC_DEFUN(LIB_AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+dnl Fool anybody using AC_PROG_CXX.
+AC_PROVIDE([AC_PROG_CXX])
+AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
+test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
+
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ AC_PROG_CXX_G
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+])
+
+LIB_AC_PROG_CXX
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
+# run it explicitly here, it will be run implicitly before
+# NEWLIB_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+AC_CANONICAL_BUILD
+
+AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_PROG_INSTALL
+
+AM_MAINTAINER_MODE
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which can't create executables. So we include AC_EXEEXT to keep
+# automake happy, but we don't execute it, since we don't care about
+# the result.
+if false; then
+ # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+ # to nothing, so nothing would remain between `then' and `fi' if it
+ # were not for the `:' below.
+ :
+ AC_EXEEXT
+fi
+
+. [$]{srcdir}/configure.host
+
+case [$]{gc_basedir} in
+/* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
+*) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
+esac
+
+gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{gc_flagbasedir}/libc/include"
+case "${host}" in
+ *-*-cygwin32*)
+ gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
+ ;;
+esac
+
+dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
+
+GC_CFLAGS=${gc_cflags}
+AC_SUBST(GC_CFLAGS)
+]))
+
+))))
+
+sinclude(libtool.m4)
+dnl The line below arranges for aclocal not to bring a definition of
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[AC_DEFUN([AM_PROG_LIBTOOL],[AC_SUBST(LIBTOOL)])])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN(AM_MAINTAINER_MODE,
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT($USE_MAINTAINER_MODE)
+ AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST(MAINT)dnl
+]
+)
+
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
diff --git a/gc/add_gc_prefix.c b/gc/add_gc_prefix.c
@@ -1,4 +1,5 @@
# include <stdio.h>
+# include "version.h"
int main(argc, argv, envp)
int argc;
@@ -8,7 +9,12 @@ char ** envp;
int i;
for (i = 1; i < argc; i++) {
- printf("gc/%s ", argv[i]);
+ if (GC_ALPHA_VERSION == GC_NOT_ALPHA) {
+ printf("gc%d.%d/%s ", GC_VERSION_MAJOR, GC_VERSION_MINOR, argv[i]);
+ } else {
+ printf("gc%d.%dalpha%d/%s ", GC_VERSION_MAJOR,
+ GC_VERSION_MINOR, GC_ALPHA_VERSION, argv[i]);
+ }
}
return(0);
}
diff --git a/gc/allchblk.c b/gc/allchblk.c
@@ -2,6 +2,7 @@
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1998-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -13,11 +14,11 @@
* modified is included with the above copyright notice.
*/
-#define DEBUG
-#undef DEBUG
+/* #define DEBUG */
#include <stdio.h>
-#include "gc_priv.h"
+#include "private/gc_priv.h"
+GC_bool GC_use_entire_heap = 0;
/*
* Free heap blocks are kept on one of several free lists,
@@ -45,6 +46,35 @@
struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 };
+#ifndef USE_MUNMAP
+ word GC_free_bytes[N_HBLK_FLS+1] = { 0 };
+ /* Number of free bytes on each list. */
+
+ /* Is bytes + the number of free bytes on lists n .. N_HBLK_FLS */
+ /* > GC_max_large_allocd_bytes? */
+ GC_bool GC_enough_large_bytes_left(bytes,n)
+ word bytes;
+ int n;
+ {
+ int i;
+ for (i = N_HBLK_FLS; i >= n; --i) {
+ bytes += GC_free_bytes[i];
+ if (bytes > GC_max_large_allocd_bytes) return TRUE;
+ }
+ return FALSE;
+ }
+
+# define INCR_FREE_BYTES(n, b) GC_free_bytes[n] += (b);
+
+# define FREE_ASSERT(e) GC_ASSERT(e)
+
+#else /* USE_MUNMAP */
+
+# define INCR_FREE_BYTES(n, b)
+# define FREE_ASSERT(e)
+
+#endif /* USE_MUNMAP */
+
/* Map a number of blocks to the appropriate large block free list index. */
int GC_hblk_fl_from_blocks(blocks_needed)
word blocks_needed;
@@ -77,7 +107,14 @@ void GC_print_hblkfreelist()
for (i = 0; i <= N_HBLK_FLS; ++i) {
h = GC_hblkfreelist[i];
- if (0 != h) GC_printf1("Free list %ld:\n", (unsigned long)i);
+# ifdef USE_MUNMAP
+ if (0 != h) GC_printf1("Free list %ld (Total size %ld):\n",
+ (unsigned long)i);
+# else
+ if (0 != h) GC_printf2("Free list %ld (Total size %ld):\n",
+ (unsigned long)i,
+ (unsigned long)GC_free_bytes[i]);
+# endif
while (h != 0) {
hhdr = HDR(h);
sz = hhdr -> hb_sz;
@@ -122,7 +159,7 @@ hdr * wanted;
void GC_dump_regions()
{
- int i;
+ unsigned i;
ptr_t start, end;
ptr_t p;
size_t bytes;
@@ -217,22 +254,39 @@ void GC_remove_from_fl(hhdr, n)
hdr * hhdr;
int n;
{
+ int index;
+
GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0);
+# ifndef USE_MUNMAP
+ /* We always need index to mainatin free counts. */
+ if (FL_UNKNOWN == n) {
+ index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
+ } else {
+ index = n;
+ }
+# endif
if (hhdr -> hb_prev == 0) {
- int index;
- if (FL_UNKNOWN == n) {
+# ifdef USE_MUNMAP
+ if (FL_UNKNOWN == n) {
index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
- } else {
+ } else {
index = n;
- }
+ }
+# endif
GC_ASSERT(HDR(GC_hblkfreelist[index]) == hhdr);
GC_hblkfreelist[index] = hhdr -> hb_next;
} else {
- PHDR(hhdr) -> hb_next = hhdr -> hb_next;
+ hdr *phdr;
+ GET_HDR(hhdr -> hb_prev, phdr);
+ phdr -> hb_next = hhdr -> hb_next;
}
+ INCR_FREE_BYTES(index, - (signed_word)(hhdr -> hb_sz));
+ FREE_ASSERT(GC_free_bytes[index] >= 0);
if (0 != hhdr -> hb_next) {
+ hdr * nhdr;
GC_ASSERT(!IS_FORWARDING_ADDR_OR_NIL(NHDR(hhdr)));
- NHDR(hhdr) -> hb_prev = hhdr -> hb_prev;
+ GET_HDR(hhdr -> hb_next, nhdr);
+ nhdr -> hb_prev = hhdr -> hb_prev;
}
}
@@ -243,13 +297,20 @@ struct hblk * GC_free_block_ending_at(h)
struct hblk *h;
{
struct hblk * p = h - 1;
- hdr * phdr = HDR(p);
+ hdr * phdr;
+ GET_HDR(p, phdr);
while (0 != phdr && IS_FORWARDING_ADDR_OR_NIL(phdr)) {
p = FORWARDED_ADDR(p,phdr);
phdr = HDR(p);
}
- if (0 != phdr && HBLK_IS_FREE(phdr)) return p;
+ if (0 != phdr) {
+ if(HBLK_IS_FREE(phdr)) {
+ return p;
+ } else {
+ return 0;
+ }
+ }
p = GC_prev_block(h - 1);
if (0 != p) {
phdr = HDR(p);
@@ -270,6 +331,7 @@ hdr * hhdr;
{
int index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
struct hblk *second = GC_hblkfreelist[index];
+ hdr * second_hdr;
# ifdef GC_ASSERTIONS
struct hblk *next = (struct hblk *)((word)h + hhdr -> hb_sz);
hdr * nexthdr = HDR(next);
@@ -280,9 +342,14 @@ hdr * hhdr;
# endif
GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0);
GC_hblkfreelist[index] = h;
+ INCR_FREE_BYTES(index, hhdr -> hb_sz);
+ FREE_ASSERT(GC_free_bytes[index] <= GC_large_free_bytes)
hhdr -> hb_next = second;
hhdr -> hb_prev = 0;
- if (0 != second) HDR(second) -> hb_prev = h;
+ if (0 != second) {
+ GET_HDR(second, second_hdr);
+ second_hdr -> hb_prev = h;
+ }
GC_invalidate_map(hhdr);
}
@@ -329,10 +396,10 @@ void GC_merge_unmapped(void)
for (i = 0; i <= N_HBLK_FLS; ++i) {
h = GC_hblkfreelist[i];
while (h != 0) {
- hhdr = HDR(h);
+ GET_HDR(h, hhdr);
size = hhdr->hb_sz;
next = (struct hblk *)((word)h + size);
- nexthdr = HDR(next);
+ GET_HDR(next, nexthdr);
/* Coalesce with successor, if possible */
if (0 != nexthdr && HBLK_IS_FREE(nexthdr)) {
nextsize = nexthdr -> hb_sz;
@@ -397,12 +464,12 @@ int index;
GC_remove_from_fl(hhdr, index);
if (total_size == bytes) return h;
rest = (struct hblk *)((word)h + bytes);
- if (!GC_install_header(rest)) return(0);
- rest_hdr = HDR(rest);
+ rest_hdr = GC_install_header(rest);
+ if (0 == rest_hdr) return(0);
rest_hdr -> hb_sz = total_size - bytes;
rest_hdr -> hb_flags = 0;
# ifdef GC_ASSERTIONS
- // Mark h not free, to avoid assertion about adjacent free blocks.
+ /* Mark h not free, to avoid assertion about adjacent free blocks. */
hhdr -> hb_map = 0;
# endif
GC_add_to_fl(rest, rest_hdr);
@@ -446,6 +513,8 @@ int index; /* Index of free list */
if (0 != next) {
HDR(next) -> hb_prev = n;
}
+ INCR_FREE_BYTES(index, -(signed_word)h_size);
+ FREE_ASSERT(GC_free_bytes[index] > 0);
# ifdef GC_ASSERTIONS
nhdr -> hb_map = 0; /* Don't fail test for consecutive */
/* free blocks in GC_add_to_fl. */
@@ -467,20 +536,23 @@ struct hblk * GC_allochblk_nth();
* NOTE: We set obj_map field in header correctly.
* Caller is responsible for building an object freelist in block.
*
- * We clear the block if it is destined for large objects, and if
- * kind requires that newly allocated objects be cleared.
+ * Unlike older versions of the collectors, the client is responsible
+ * for clearing the block, if necessary.
*/
struct hblk *
GC_allochblk(sz, kind, flags)
word sz;
int kind;
-unsigned char flags; /* IGNORE_OFF_PAGE or 0 */
+unsigned flags; /* IGNORE_OFF_PAGE or 0 */
{
- int start_list = GC_hblk_fl_from_blocks(OBJ_SZ_TO_BLOCKS(sz));
+ word blocks = OBJ_SZ_TO_BLOCKS(sz);
+ int start_list = GC_hblk_fl_from_blocks(blocks);
int i;
for (i = start_list; i <= N_HBLK_FLS; ++i) {
struct hblk * result = GC_allochblk_nth(sz, kind, flags, i);
- if (0 != result) return result;
+ if (0 != result) {
+ return result;
+ }
}
return 0;
}
@@ -505,16 +577,27 @@ int n;
/* search for a big enough block in free list */
hbp = GC_hblkfreelist[n];
- hhdr = HDR(hbp);
- for(; 0 != hbp; hbp = hhdr -> hb_next, hhdr = HDR(hbp)) {
+ for(; 0 != hbp; hbp = hhdr -> hb_next) {
+ GET_HDR(hbp, hhdr);
size_avail = hhdr->hb_sz;
if (size_avail < size_needed) continue;
-# ifdef PRESERVE_LAST
- if (size_avail != size_needed
- && !GC_incremental && GC_should_collect()) {
+ if (!GC_use_entire_heap
+ && size_avail != size_needed
+ && USED_HEAP_SIZE >= GC_requested_heapsize
+ && !GC_incremental && GC_should_collect()) {
+# ifdef USE_MUNMAP
continue;
- }
-# endif
+# else
+ /* If we enough large blocks left to cover any */
+ /* previous request for large blocks, we go ahead */
+ /* and split. Assuming a steady state, that should */
+ /* be safe. It means that we can use the full */
+ /* heap if we allocate only small objects. */
+ if (!GC_enough_large_bytes_left(GC_large_allocd_bytes, n)) {
+ continue;
+ }
+# endif /* !USE_MUNMAP */
+ }
/* If the next heap block is obviously better, go on. */
/* This prevents us from disassembling a single large block */
/* to get tiny blocks. */
@@ -523,7 +606,7 @@ int n;
thishbp = hhdr -> hb_next;
if (thishbp != 0) {
- thishdr = HDR(thishbp);
+ GET_HDR(thishbp, thishdr);
next_size = (signed_word)(thishdr -> hb_sz);
if (next_size < size_avail
&& next_size >= size_needed
@@ -544,22 +627,23 @@ int n;
while ((ptr_t)lasthbp <= search_end
&& (thishbp = GC_is_black_listed(lasthbp,
- (word)eff_size_needed))) {
+ (word)eff_size_needed))
+ != 0) {
lasthbp = thishbp;
}
size_avail -= (ptr_t)lasthbp - (ptr_t)hbp;
thishbp = lasthbp;
if (size_avail >= size_needed) {
- if (thishbp != hbp && GC_install_header(thishbp)) {
+ if (thishbp != hbp &&
+ 0 != (thishdr = GC_install_header(thishbp))) {
/* Make sure it's mapped before we mangle it. */
# ifdef USE_MUNMAP
if (!IS_MAPPED(hhdr)) {
- GC_remap((ptr_t)hbp, size_avail);
+ GC_remap((ptr_t)hbp, hhdr -> hb_sz);
hhdr -> hb_flags &= ~WAS_UNMAPPED;
}
# endif
/* Split the block at thishbp */
- thishdr = HDR(thishbp);
GC_split_block(hbp, hhdr, thishbp, thishdr, n);
/* Advance to thishbp */
hbp = thishbp;
@@ -571,8 +655,10 @@ int n;
&& orig_avail - size_needed
> (signed_word)BL_LIMIT) {
/* Punt, since anything else risks unreasonable heap growth. */
- WARN("Needed to allocate blacklisted block at 0x%lx\n",
- (word)hbp);
+ if (0 == GETENV("GC_NO_BLACKLIST_WARNING")) {
+ WARN("Needed to allocate blacklisted block at 0x%lx\n",
+ (word)hbp);
+ }
size_avail = orig_avail;
} else if (size_avail == 0 && size_needed == HBLKSIZE
&& IS_MAPPED(hhdr)) {
@@ -597,14 +683,13 @@ int n;
GC_large_free_bytes -= total_size;
GC_remove_from_fl(hhdr, n);
for (h = hbp; h < limit; h++) {
- if (h == hbp || GC_install_header(h)) {
- hhdr = HDR(h);
+ if (h == hbp || 0 != (hhdr = GC_install_header(h))) {
(void) setup_header(
hhdr,
- BYTES_TO_WORDS(HBLKSIZE - HDR_BYTES),
+ BYTES_TO_WORDS(HBLKSIZE),
PTRFREE, 0); /* Cant fail */
if (GC_debugging_started) {
- BZERO(h + HDR_BYTES, HBLKSIZE - HDR_BYTES);
+ BZERO(h, HBLKSIZE);
}
}
}
@@ -621,7 +706,7 @@ int n;
if( size_avail >= size_needed ) {
# ifdef USE_MUNMAP
if (!IS_MAPPED(hhdr)) {
- GC_remap((ptr_t)hbp, size_avail);
+ GC_remap((ptr_t)hbp, hhdr -> hb_sz);
hhdr -> hb_flags &= ~WAS_UNMAPPED;
}
# endif
@@ -647,12 +732,6 @@ int n;
return(0); /* ditto */
}
- /* Clear block if necessary */
- if (GC_debugging_started
- || sz > MAXOBJSZ && GC_obj_kinds[kind].ok_init) {
- BZERO(hbp + HDR_BYTES, size_needed - HDR_BYTES);
- }
-
/* We just successfully allocated a block. Restart count of */
/* consecutive failures. */
{
@@ -685,7 +764,7 @@ hdr *hhdr, *prevhdr, *nexthdr;
signed_word size;
- hhdr = HDR(hbp);
+ GET_HDR(hbp, hhdr);
size = hhdr->hb_sz;
size = HBLKSIZE * OBJ_SZ_TO_BLOCKS(size);
GC_remove_counts(hbp, (word)size);
@@ -700,7 +779,7 @@ signed_word size;
GC_ASSERT(IS_MAPPED(hhdr));
GC_invalidate_map(hhdr);
next = (struct hblk *)((word)hbp + size);
- nexthdr = HDR(next);
+ GET_HDR(next, nexthdr);
prev = GC_free_block_ending_at(hbp);
/* Coalesce with successor, if possible */
if(0 != nexthdr && HBLK_IS_FREE(nexthdr) && IS_MAPPED(nexthdr)) {
diff --git a/gc/alloc.c b/gc/alloc.c
@@ -1,7 +1,8 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
* Copyright (c) 1998 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -15,10 +16,10 @@
*/
-# include "gc_priv.h"
+# include "private/gc_priv.h"
# include <stdio.h>
-# ifndef MACOS
+# if !defined(MACOS) && !defined(MSWINCE)
# include <signal.h>
# include <sys/types.h>
# endif
@@ -59,16 +60,25 @@ word GC_non_gc_bytes = 0; /* Number of bytes not intended to be collected */
word GC_gc_no = 0;
#ifndef SMALL_CONFIG
- int GC_incremental = 0; /* By default, stop the world. */
+ int GC_incremental = 0; /* By default, stop the world. */
#endif
-int GC_full_freq = 4; /* Every 5th collection is a full */
- /* collection. */
+int GC_parallel = FALSE; /* By default, parallel GC is off. */
+
+int GC_full_freq = 19; /* Every 20th collection is a full */
+ /* collection, whether we need it */
+ /* or not. */
+
+GC_bool GC_need_full_gc = FALSE;
+ /* Need full GC do to heap growth. */
+
+word GC_used_heap_size_after_full = 0;
char * GC_copyright[] =
{"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ",
"Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ",
"Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ",
+"Copyright (c) 1999-2000 by Hewlett-Packard Company. All rights reserved. ",
"THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY",
" EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.",
"See source code for details." };
@@ -95,7 +105,7 @@ CLOCK_TYPE GC_start_time; /* Time at which we stopped world. */
int GC_n_attempts = 0; /* Number of attempts at finishing */
/* collection within TIME_LIMIT */
-#ifdef SMALL_CONFIG
+#if defined(SMALL_CONFIG) || defined(NO_CLOCK)
# define GC_timeout_stop_func GC_never_stop_func
#else
int GC_timeout_stop_func GC_PROTO((void))
@@ -108,10 +118,12 @@ int GC_n_attempts = 0; /* Number of attempts at finishing */
GET_TIME(current_time);
time_diff = MS_TIME_DIFF(current_time,GC_start_time);
if (time_diff >= TIME_LIMIT) {
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf0("Abandoning stopped marking after ");
GC_printf1("%lu msecs", (unsigned long)time_diff);
GC_printf1("(attempt %d)\n", (unsigned long) GC_n_attempts);
+ }
# endif
return(1);
}
@@ -210,13 +222,16 @@ GC_bool GC_should_collect()
return(GC_adj_words_allocd() >= min_words_allocd());
}
+
void GC_notify_full_gc()
{
- if (GC_start_call_back != (void (*)())0) {
+ if (GC_start_call_back != (void (*) GC_PROTO((void)))0) {
(*GC_start_call_back)();
}
}
+GC_bool GC_is_full_gc = FALSE;
+
/*
* Initiate a garbage collection if appropriate.
* Choose judiciously
@@ -226,7 +241,6 @@ void GC_notify_full_gc()
void GC_maybe_gc()
{
static int n_partial_gcs = 0;
- GC_bool is_full_gc = FALSE;
if (GC_should_collect()) {
if (!GC_incremental) {
@@ -234,33 +248,42 @@ void GC_maybe_gc()
GC_gcollect_inner();
n_partial_gcs = 0;
return;
- } else if (n_partial_gcs >= GC_full_freq) {
-# ifdef PRINTSTATS
- GC_printf2(
- "***>Full mark for collection %lu after %ld allocd bytes\n",
- (unsigned long) GC_gc_no+1,
- (long)WORDS_TO_BYTES(GC_words_allocd));
+ } else {
+# ifdef PARALLEL_MARK
+ GC_wait_for_reclaim();
+# endif
+ if (GC_need_full_gc || n_partial_gcs >= GC_full_freq) {
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf2(
+ "***>Full mark for collection %lu after %ld allocd bytes\n",
+ (unsigned long) GC_gc_no+1,
+ (long)WORDS_TO_BYTES(GC_words_allocd));
+ }
# endif
GC_promote_black_lists();
(void)GC_reclaim_all((GC_stop_func)0, TRUE);
GC_clear_marks();
n_partial_gcs = 0;
GC_notify_full_gc();
- is_full_gc = TRUE;
- } else {
+ GC_is_full_gc = TRUE;
+ } else {
n_partial_gcs++;
- }
+ }
+ }
/* We try to mark with the world stopped. */
/* If we run out of time, this turns into */
/* incremental marking. */
- GET_TIME(GC_start_time);
+# ifndef NO_CLOCK
+ GET_TIME(GC_start_time);
+# endif
if (GC_stopped_mark(GC_timeout_stop_func)) {
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
GC_finish_collection();
} else {
- if (!is_full_gc) {
+ if (!GC_is_full_gc) {
/* Count this as the first attempt */
GC_n_attempts++;
}
@@ -277,27 +300,36 @@ GC_bool GC_try_to_collect_inner(stop_func)
GC_stop_func stop_func;
{
if (GC_incremental && GC_collection_in_progress()) {
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf0(
"GC_try_to_collect_inner: finishing collection in progress\n");
-# endif /* PRINTSTATS */
+ }
+# endif /* CONDPRINT */
/* Just finish collection already in progress. */
while(GC_collection_in_progress()) {
if (stop_func()) return(FALSE);
GC_collect_a_little_inner(1);
}
}
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf2(
"Initiating full world-stop collection %lu after %ld allocd bytes\n",
(unsigned long) GC_gc_no+1,
(long)WORDS_TO_BYTES(GC_words_allocd));
+ }
# endif
GC_promote_black_lists();
/* Make sure all blocks have been reclaimed, so sweep routines */
/* don't see cleared mark bits. */
/* If we're guaranteed to finish, then this is unnecessary. */
- if (stop_func != GC_never_stop_func
+ /* In the find_leak case, we have to finish to guarantee that */
+ /* previously unmarked objects are not reported as leaks. */
+# ifdef PARALLEL_MARK
+ GC_wait_for_reclaim();
+# endif
+ if ((GC_find_leak || stop_func != GC_never_stop_func)
&& !GC_reclaim_all(stop_func, FALSE)) {
/* Aborted. So far everything is still consistent. */
return(FALSE);
@@ -307,6 +339,7 @@ GC_stop_func stop_func;
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
+ GC_is_full_gc = TRUE;
if (!GC_stopped_mark(stop_func)) {
if (!GC_incremental) {
/* We're partially done and have no way to complete or use */
@@ -334,7 +367,7 @@ GC_stop_func stop_func;
# define GC_RATE 10
# define MAX_PRIOR_ATTEMPTS 1
/* Maximum number of prior attempts at world stop marking */
- /* A value of 1 means that we finish the seconf time, no matter */
+ /* A value of 1 means that we finish the second time, no matter */
/* how long it takes. Doesn't count the initial root scan */
/* for a full GC. */
@@ -353,6 +386,9 @@ int n;
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
+# ifdef PARALLEL_MARK
+ GC_wait_for_reclaim();
+# endif
if (GC_n_attempts < MAX_PRIOR_ATTEMPTS) {
GET_TIME(GC_start_time);
if (!GC_stopped_mark(GC_timeout_stop_func)) {
@@ -398,18 +434,22 @@ GC_stop_func stop_func;
{
register int i;
int dummy;
-# ifdef PRINTSTATS
+# ifdef PRINTTIMES
CLOCK_TYPE start_time, current_time;
# endif
STOP_WORLD();
-# ifdef PRINTSTATS
+# ifdef PRINTTIMES
GET_TIME(start_time);
+# endif
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("--> Marking for collection %lu ",
(unsigned long) GC_gc_no + 1);
GC_printf2("after %lu allocd bytes + %lu wasted bytes\n",
(unsigned long) WORDS_TO_BYTES(GC_words_allocd),
(unsigned long) WORDS_TO_BYTES(GC_words_wasted));
+ }
# endif
/* Mark from all roots. */
@@ -419,10 +459,12 @@ GC_stop_func stop_func;
GC_initiate_gc();
for(i = 0;;i++) {
if ((*stop_func)()) {
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf0("Abandoned stopped marking after ");
GC_printf1("%lu iterations\n",
(unsigned long)i);
+ }
# endif
GC_deficit = i; /* Give the mutator a chance. */
START_WORLD();
@@ -436,12 +478,22 @@ GC_stop_func stop_func;
GC_printf2("Collection %lu reclaimed %ld bytes",
(unsigned long) GC_gc_no - 1,
(long)WORDS_TO_BYTES(GC_mem_found));
- GC_printf1(" ---> heapsize = %lu bytes\n",
- (unsigned long) GC_heapsize);
- /* Printf arguments may be pushed in funny places. Clear the */
- /* space. */
- GC_printf0("");
-# endif
+# else
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf1("Collection %lu finished", (unsigned long) GC_gc_no - 1);
+ }
+# endif
+# endif /* !PRINTSTATS */
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf1(" ---> heapsize = %lu bytes\n",
+ (unsigned long) GC_heapsize);
+ /* Printf arguments may be pushed in funny places. Clear the */
+ /* space. */
+ GC_printf0("");
+ }
+# endif /* CONDPRINT */
/* Check all debugged objects for consistency */
if (GC_debugging_started) {
@@ -457,6 +509,57 @@ GC_stop_func stop_func;
return(TRUE);
}
+/* Set all mark bits for the free list whose first entry is q */
+#ifdef __STDC__
+ void GC_set_fl_marks(ptr_t q)
+#else
+ void GC_set_fl_marks(q)
+ ptr_t q;
+#endif
+{
+ ptr_t p;
+ struct hblk * h, * last_h = 0;
+ hdr *hhdr;
+ int word_no;
+
+ for (p = q; p != 0; p = obj_link(p)){
+ h = HBLKPTR(p);
+ if (h != last_h) {
+ last_h = h;
+ hhdr = HDR(h);
+ }
+ word_no = (((word *)p) - ((word *)h));
+ set_mark_bit_from_hdr(hhdr, word_no);
+ }
+}
+
+/* Clear all mark bits for the free list whose first entry is q */
+/* Decrement GC_mem_found by number of words on free list. */
+#ifdef __STDC__
+ void GC_clear_fl_marks(ptr_t q)
+#else
+ void GC_clear_fl_marks(q)
+ ptr_t q;
+#endif
+{
+ ptr_t p;
+ struct hblk * h, * last_h = 0;
+ hdr *hhdr;
+ int word_no;
+
+ for (p = q; p != 0; p = obj_link(p)){
+ h = HBLKPTR(p);
+ if (h != last_h) {
+ last_h = h;
+ hhdr = HDR(h);
+ }
+ word_no = (((word *)p) - ((word *)h));
+ clear_mark_bit_from_hdr(hhdr, word_no);
+# ifdef GATHERSTATS
+ GC_mem_found -= hhdr -> hb_sz;
+# endif
+ }
+}
/* Finish up a collection. Assumes lock is held, signals are disabled, */
/* but the world is otherwise running. */
@@ -474,26 +577,23 @@ void GC_finish_collection()
# ifdef GATHERSTATS
GC_mem_found = 0;
# endif
+# if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG)
+ if (getenv("GC_PRINT_ADDRESS_MAP") != 0) {
+ GC_print_address_map();
+ }
+# endif
if (GC_find_leak) {
/* Mark all objects on the free list. All objects should be */
/* marked when we're done. */
{
register word size; /* current object size */
- register ptr_t p; /* pointer to current object */
- register struct hblk * h; /* pointer to block containing *p */
- register hdr * hhdr;
- register int word_no; /* "index" of *p in *q */
int kind;
+ ptr_t q;
for (kind = 0; kind < GC_n_kinds; kind++) {
for (size = 1; size <= MAXOBJSZ; size++) {
- for (p= GC_obj_kinds[kind].ok_freelist[size];
- p != 0; p=obj_link(p)){
- h = HBLKPTR(p);
- hhdr = HDR(h);
- word_no = (((word *)p) - ((word *)h));
- set_mark_bit_from_hdr(hhdr, word_no);
- }
+ q = GC_obj_kinds[kind].ok_freelist[size];
+ if (q != 0) GC_set_fl_marks(q);
}
}
}
@@ -511,32 +611,20 @@ void GC_finish_collection()
# endif
/* Clear free list mark bits, in case they got accidentally marked */
- /* Note: HBLKPTR(p) == pointer to head of block containing *p */
- /* (or GC_find_leak is set and they were intentionally marked.) */
+ /* (or GC_find_leak is set and they were intentionally marked). */
/* Also subtract memory remaining from GC_mem_found count. */
/* Note that composite objects on free list are cleared. */
/* Thus accidentally marking a free list is not a problem; only */
/* objects on the list itself will be marked, and that's fixed here. */
{
register word size; /* current object size */
- register ptr_t p; /* pointer to current object */
- register struct hblk * h; /* pointer to block containing *p */
- register hdr * hhdr;
- register int word_no; /* "index" of *p in *q */
+ register ptr_t q; /* pointer to current object */
int kind;
for (kind = 0; kind < GC_n_kinds; kind++) {
for (size = 1; size <= MAXOBJSZ; size++) {
- for (p= GC_obj_kinds[kind].ok_freelist[size];
- p != 0; p=obj_link(p)){
- h = HBLKPTR(p);
- hhdr = HDR(h);
- word_no = (((word *)p) - ((word *)h));
- clear_mark_bit_from_hdr(hhdr, word_no);
-# ifdef GATHERSTATS
- GC_mem_found -= size;
-# endif
- }
+ q = GC_obj_kinds[kind].ok_freelist[size];
+ if (q != 0) GC_clear_fl_marks(q);
}
}
}
@@ -548,6 +636,14 @@ void GC_finish_collection()
# endif
/* Reconstruct free lists to contain everything not marked */
GC_start_reclaim(FALSE);
+ if (GC_is_full_gc) {
+ GC_used_heap_size_after_full = USED_HEAP_SIZE;
+ GC_need_full_gc = FALSE;
+ } else {
+ GC_need_full_gc =
+ BYTES_TO_WORDS(USED_HEAP_SIZE - GC_used_heap_size_after_full)
+ > min_words_allocd();
+ }
# ifdef PRINTSTATS
GC_printf2(
@@ -564,6 +660,7 @@ void GC_finish_collection()
# endif
GC_n_attempts = 0;
+ GC_is_full_gc = FALSE;
/* Reset or increment counters for next cycle */
GC_words_allocd_before_gc += GC_words_allocd;
GC_non_gc_bytes_at_gc = GC_non_gc_bytes;
@@ -630,7 +727,8 @@ word bytes;
if (GC_n_heap_sects >= MAX_HEAP_SECTS) {
ABORT("Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS");
}
- if (!GC_install_header(p)) {
+ phdr = GC_install_header(p);
+ if (0 == phdr) {
/* This is extremely unlikely. Can't add it. This will */
/* almost certainly result in a 0 return from the allocator, */
/* which is entirely appropriate. */
@@ -639,23 +737,22 @@ word bytes;
GC_heap_sects[GC_n_heap_sects].hs_start = (ptr_t)p;
GC_heap_sects[GC_n_heap_sects].hs_bytes = bytes;
GC_n_heap_sects++;
- words = BYTES_TO_WORDS(bytes - HDR_BYTES);
- phdr = HDR(p);
+ words = BYTES_TO_WORDS(bytes);
phdr -> hb_sz = words;
- phdr -> hb_map = (char *)1; /* A value != GC_invalid_map */
+ phdr -> hb_map = (unsigned char *)1; /* A value != GC_invalid_map */
phdr -> hb_flags = 0;
GC_freehblk(p);
GC_heapsize += bytes;
- if ((ptr_t)p <= GC_least_plausible_heap_addr
+ if ((ptr_t)p <= (ptr_t)GC_least_plausible_heap_addr
|| GC_least_plausible_heap_addr == 0) {
- GC_least_plausible_heap_addr = (ptr_t)p - sizeof(word);
+ GC_least_plausible_heap_addr = (GC_PTR)((ptr_t)p - sizeof(word));
/* Making it a little smaller than necessary prevents */
/* us from getting a false hit from the variable */
/* itself. There's some unintentional reflection */
/* here. */
}
- if ((ptr_t)p + bytes >= GC_greatest_plausible_heap_addr) {
- GC_greatest_plausible_heap_addr = (ptr_t)p + bytes;
+ if ((ptr_t)p + bytes >= (ptr_t)GC_greatest_plausible_heap_addr) {
+ GC_greatest_plausible_heap_addr = (GC_PTR)((ptr_t)p + bytes);
}
}
@@ -682,8 +779,8 @@ void GC_print_heap_sects()
}
# endif
-ptr_t GC_least_plausible_heap_addr = (ptr_t)ONES;
-ptr_t GC_greatest_plausible_heap_addr = 0;
+GC_PTR GC_least_plausible_heap_addr = (GC_PTR)ONES;
+GC_PTR GC_greatest_plausible_heap_addr = 0;
ptr_t GC_max(x,y)
ptr_t x, y;
@@ -739,9 +836,16 @@ word n;
}
space = GET_MEM(bytes);
if( space == 0 ) {
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf1("Failed to expand heap by %ld bytes\n",
+ (unsigned long)bytes);
+ }
+# endif
return(FALSE);
}
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf2("Increasing heap size by %lu after %lu allocated bytes\n",
(unsigned long)bytes,
(unsigned long)WORDS_TO_BYTES(GC_words_allocd));
@@ -750,6 +854,7 @@ word n;
GC_print_block_list(); GC_print_hblkfreelist();
GC_printf0("\n");
# endif
+ }
# endif
expansion_slop = 8 * WORDS_TO_BYTES(min_words_allocd());
if (5 * HBLKSIZE * MAXHINCR > expansion_slop) {
@@ -789,6 +894,7 @@ word n;
LOCK();
if (!GC_is_initialized) GC_init_inner();
result = (int)GC_expand_hp_inner(divHBLKSZ((word)bytes));
+ if (result) GC_requested_heapsize += bytes;
UNLOCK();
ENABLE_SIGNALS();
return(result);
@@ -802,7 +908,8 @@ GC_bool GC_collect_or_expand(needed_blocks, ignore_off_page)
word needed_blocks;
GC_bool ignore_off_page;
{
- if (!GC_incremental && !GC_dont_gc && GC_should_collect()) {
+ if (!GC_incremental && !GC_dont_gc &&
+ (GC_dont_expand && GC_words_allocd > 0 || GC_should_collect())) {
GC_notify_full_gc();
GC_gcollect_inner();
} else {
@@ -831,12 +938,14 @@ GC_bool ignore_off_page;
GC_notify_full_gc();
GC_gcollect_inner();
} else {
- WARN("Out of Memory! Returning NIL!\n", 0);
+# if !defined(AMIGA) || !defined(GC_AMIGA_FASTALLOC)
+ WARN("Out of Memory! Returning NIL!\n", 0);
+# endif
return(FALSE);
}
} else {
-# ifdef PRINTSTATS
- if (GC_fail_count) {
+# ifdef CONDPRINT
+ if (GC_fail_count && GC_print_stats) {
GC_printf0("Memory available again ...\n");
}
# endif
diff --git a/gc/alpha_mach_dep.s b/gc/alpha_mach_dep.s
@@ -1,60 +1,87 @@
# $Id$
+ .arch ev6
-# define call_push(x) \
- lda $16, 0(x); /* copy x to first argument register */ \
- jsr $26, GC_push_one; /* call GC_push_one, ret addr in $26 */ \
- ldgp $gp, 0($26) /* restore $gp register from $ra */
-
.text
.align 4
.globl GC_push_regs
.ent GC_push_regs 2
GC_push_regs:
- ldgp $gp, 0($27) # set gp from the procedure value reg
- lda $sp, -32($sp) # make stack frame
- stq $26, 8($sp) # save return address
- .mask 0x04000000, -8
+ ldgp $gp, 0($27)
+ lda $sp, -16($sp)
+ stq $26, 0($sp)
+ .mask 0x04000000, 0
.frame $sp, 16, $26, 0
- # call_push($0) # expression eval and int func result
-
- # call_push($1) # temp regs - not preserved cross calls
- # call_push($2)
- # call_push($3)
- # call_push($4)
- # call_push($5)
- # call_push($6)
- # call_push($7)
- # call_push($8)
+ # $0 integer result
+ # $1-$8 temp regs - not preserved cross calls
+ # $9-$15 call saved regs
+ # $16-$21 argument regs - not preserved cross calls
+ # $22-$28 temp regs - not preserved cross calls
+ # $29 global pointer - not preserved cross calls
+ # $30 stack pointer
- call_push($9) # Saved regs
+# define call_push(x) \
+ mov x, $16; \
+ jsr $26, GC_push_one; \
+ ldgp $gp, 0($26)
+
+ call_push($9)
call_push($10)
call_push($11)
call_push($12)
call_push($13)
call_push($14)
+ call_push($15)
+
+ # $f0-$f1 floating point results
+ # $f2-$f9 call saved regs
+ # $f10-$f30 temp regs - not preserved cross calls
+
+ # Use the most efficient transfer method for this hardware.
+ # Bit 1 detects the FIX extension, which includes ftoit.
+ amask 2, $0
+ bne $0, $use_stack
+
+#undef call_push
+#define call_push(x) \
+ ftoit x, $16; \
+ jsr $26, GC_push_one; \
+ ldgp $gp, 0($26)
+
+ call_push($f2)
+ call_push($f3)
+ call_push($f4)
+ call_push($f5)
+ call_push($f6)
+ call_push($f7)
+ call_push($f8)
+ call_push($f9)
+
+ ldq $26, 0($sp)
+ lda $sp, 16($sp)
+ ret $31, ($26), 1
+
+ .align 4
+$use_stack:
+
+#undef call_push
+#define call_push(x) \
+ stt x, 8($sp); \
+ ldq $16, 8($sp); \
+ jsr $26, GC_push_one; \
+ ldgp $gp, 0($26)
+
+ call_push($f2)
+ call_push($f3)
+ call_push($f4)
+ call_push($f5)
+ call_push($f6)
+ call_push($f7)
+ call_push($f8)
+ call_push($f9)
+
+ ldq $26, 0($sp)
+ lda $sp, 16($sp)
+ ret $31, ($26), 1
- call_push($15) # frame ptr or saved reg
-
- # call_push($16) # argument regs - not preserved cross calls
- # call_push($17)
- # call_push($18)
- # call_push($19)
- # call_push($20)
- # call_push($21)
-
- # call_push($22) # temp regs - not preserved cross calls
- # call_push($23)
- # call_push($24)
- # call_push($25)
-
- # call_push($26) # return address - expression eval
- # call_push($27) # procedure value or temporary reg
- # call_push($28) # assembler temp - not presrved
- call_push($29) # Global Pointer
- # call_push($30) # Stack Pointer
-
- ldq $26, 8($sp) # restore return address
- lda $sp, 32($sp) # pop stack frame
- ret $31, ($26), 1 # return ($31 == hardwired zero)
.end GC_push_regs
diff --git a/gc/backptr.h b/gc/backptr.h
@@ -1,56 +0,0 @@
-/*
- * This is a simple API to implement pointer back tracing, i.e.
- * to answer questions such as "who is pointing to this" or
- * "why is this object being retained by the collector"
- *
- * This API assumes that we have an ANSI C compiler.
- *
- * Most of these calls yield useful information on only after
- * a garbage collection. Usually the client will first force
- * a full collection and then gather information, preferably
- * before much intervening allocation.
- *
- * The implementation of the interface is only about 99.9999%
- * correct. It is intended to be good enough for profiling,
- * but is not intended to be used with production code.
- *
- * Results are likely to be much more useful if all allocation is
- * accomplished through the debugging allocators.
- *
- * The implementation idea is due to A. Demers.
- */
-
-/* Store information about the object referencing dest in *base_p */
-/* and *offset_p. */
-/* If multiple objects or roots point to dest, the one reported */
-/* will be the last on used by the garbage collector to trace the */
-/* object. */
-/* source is root ==> *base_p = address, *offset_p = 0 */
-/* source is heap object ==> *base_p != 0, *offset_p = offset */
-/* Returns 1 on success, 0 if source couldn't be determined. */
-/* Dest can be any address within a heap object. */
-typedef enum { GC_UNREFERENCED, /* No refence info available. */
- GC_NO_SPACE, /* Dest not allocated with debug alloc */
- GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */
- GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */
- GC_FINALIZER_REFD /* Finalizable and hence accessible. */
-} GC_ref_kind;
-
-GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p);
-
-/* Generate a random heap address. */
-/* The resulting address is in the heap, but */
-/* not necessarily inside a valid object. */
-void * GC_generate_random_heap_address(void);
-
-/* Generate a random address inside a valid marked heap object. */
-void * GC_generate_random_valid_address(void);
-
-/* Force a garbage collection and generate a backtrace from a */
-/* random heap address. */
-/* This uses the GC logging mechanism (GC_printf) to produce */
-/* output. It can often be called from a debugger. The */
-/* source in dbg_mlc.c also serves as a sample client. */
-void GC_generate_random_backtrace(void);
-
-
diff --git a/gc/barrett_diagram b/gc/barrett_diagram
@@ -1,106 +0,0 @@
-This is an ASCII diagram of the data structure used to check pointer
-validity. It was provided by Dave Barrett <barrett@asgard.cs.colorado.edu>,
-and should be of use to others attempting to understand the code.
-The data structure in GC4.X is essentially the same. -HB
-
-
-
-
- Data Structure used by GC_base in gc3.7:
- 21-Apr-94
-
-
-
-
- 63 LOG_TOP_SZ[11] LOG_BOTTOM_SZ[10] LOG_HBLKSIZE[13]
- +------------------+----------------+------------------+------------------+
- p:| | TL_HASH(hi) | | HBLKDISPL(p) |
- +------------------+----------------+------------------+------------------+
- \-----------------------HBLKPTR(p)-------------------/
- \------------hi-------------------/
- \______ ________/ \________ _______/ \________ _______/
- V V V
- | | |
- GC_top_index[] | | |
- --- +--------------+ | | |
- ^ | | | | |
- | | | | | |
- TOP +--------------+<--+ | |
- _SZ +-<| [] | * | |
-(items)| +--------------+ if 0 < bi< HBLKSIZE | |
- | | | | then large object | |
- | | | | starts at the bi'th | |
- v | | | HBLK before p. | i |
- --- | +--------------+ | (word- |
- v | aligned) |
- bi= |GET_BI(p){->hash_link}->key==hi | |
- v | |
- | (bottom_index) \ scratch_alloc'd | |
- | ( struct bi ) / by get_index() | |
- --- +->+--------------+ | |
- ^ | | | |
- ^ | | | |
- BOTTOM | | ha=GET_HDR_ADDR(p) | |
-_SZ(items)+--------------+<----------------------+ +-------+
- | +--<| index[] | |
- | | +--------------+ GC_obj_map: v
- | | | | from / +-+-+-----+-+-+-+-+ ---
- v | | | GC_add < 0| | | | | | | | ^
- --- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ |
- | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ
- | +--------------+ +-->| | | j | | | | | +1
- | | key | | +-+-+-----+-+-+-+-+ |
- | +--------------+ | +-+-+-----+-+-+-+-+ |
- | | hash_link | | | | | | | | | | v
- | +--------------+ | +-+-+-----+-+-+-+-+ ---
- | | |<--MAX_OFFSET--->|
- | | (bytes)
-HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->|
- | \ from | =HBLKSIZE/WORDSZ
- | (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha)
- +-->+----------------------+ | (8/16 bits each)
-GET_HDR(p)| word hb_sz (words) | |
- +----------------------+ |
- | struct hblk *hb_next | |
- +----------------------+ |
- |mark_proc hb_mark_proc| |
- +----------------------+ |
- | char * hb_map |>-------------+
- +----------------------+
- | ushort hb_obj_kind |
- +----------------------+
- | hb_last_reclaimed |
- --- +----------------------+
- ^ | |
- MARK_BITS| hb_marks[] | *if hdr is free, hb_sz + DISCARD_WORDS
-_SZ(words)| | is the size of a heap chunk (struct hblk)
- v | | of at least MININCR*HBLKSIZE bytes (below),
- --- +----------------------+ otherwise, size of each object in chunk.
-
-Dynamic data structures above are interleaved throughout the heap in blocks of
-size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be
-freed; free lists are used (e.g. alloc_hdr). HBLKs's below are collected.
-
- (struct hblk)
- --- +----------------------+ < HBLKSIZE --- --- DISCARD_
- ^ |garbage[DISCARD_WORDS]| aligned ^ ^ HDR_BYTES WORDS
- | | | | v (bytes) (words)
- | +-----hb_body----------+ < WORDSZ | --- ---
- | | | aligned | ^ ^
- | | Object 0 | | hb_sz |
- | | | i |(word- (words)|
- | | | (bytes)|aligned) v |
- | + - - - - - - - - - - -+ --- | --- |
- | | | ^ | ^ |
- n * | | j (words) | hb_sz BODY_SZ
- HBLKSIZE | Object 1 | v v | (words)
- (bytes) | |--------------- v MAX_OFFSET
- | + - - - - - - - - - - -+ --- (bytes)
- | | | !All_INTERIOR_PTRS ^ |
- | | | sets j only for hb_sz |
- | | Object N | valid object offsets. | |
- v | | All objects WORDSZ v v
- --- +----------------------+ aligned. --- ---
-
-DISCARD_WORDS is normally zero. Indeed the collector has not been tested
-with another value in ages.
diff --git a/gc/blacklst.c b/gc/blacklst.c
@@ -12,7 +12,7 @@
* modified is included with the above copyright notice.
*/
/* Boehm, August 9, 1995 6:09 pm PDT */
-# include "gc_priv.h"
+# include "private/gc_priv.h"
/*
* We maintain several hash tables of hblks that have had false hits.
@@ -52,15 +52,19 @@ word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* Initial rough guess */
void GC_clear_bl();
-void GC_default_print_heap_obj_proc(p)
-ptr_t p;
+# if defined(__STDC__) || defined(__cplusplus)
+ void GC_default_print_heap_obj_proc(ptr_t p)
+# else
+ void GC_default_print_heap_obj_proc(p)
+ ptr_t p;
+# endif
{
ptr_t base = GC_base(p);
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base));
}
-void (*GC_print_heap_obj)(/* char * s, ptr_t p */) =
+void (*GC_print_heap_obj) GC_PROTO((ptr_t p)) =
GC_default_print_heap_obj_proc;
void GC_print_source_ptr(p)
@@ -81,18 +85,18 @@ ptr_t p;
void GC_bl_init()
{
-# ifndef ALL_INTERIOR_POINTERS
- GC_old_normal_bl = (word *)
+ if (!GC_all_interior_pointers) {
+ GC_old_normal_bl = (word *)
GC_scratch_alloc((word)(sizeof (page_hash_table)));
- GC_incomplete_normal_bl = (word *)GC_scratch_alloc
+ GC_incomplete_normal_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
- if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) {
+ if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) {
GC_err_printf0("Insufficient memory for black list\n");
EXIT();
+ }
+ GC_clear_bl(GC_old_normal_bl);
+ GC_clear_bl(GC_incomplete_normal_bl);
}
- GC_clear_bl(GC_old_normal_bl);
- GC_clear_bl(GC_incomplete_normal_bl);
-# endif
GC_old_stack_bl = (word *)GC_scratch_alloc((word)(sizeof(page_hash_table)));
GC_incomplete_stack_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
@@ -127,9 +131,9 @@ void GC_promote_black_lists()
GC_old_normal_bl = GC_incomplete_normal_bl;
GC_old_stack_bl = GC_incomplete_stack_bl;
-# ifndef ALL_INTERIOR_POINTERS
+ if (!GC_all_interior_pointers) {
GC_clear_bl(very_old_normal_bl);
-# endif
+ }
GC_clear_bl(very_old_stack_bl);
GC_incomplete_normal_bl = very_old_normal_bl;
GC_incomplete_stack_bl = very_old_stack_bl;
@@ -145,17 +149,23 @@ void GC_promote_black_lists()
if (GC_black_list_spacing < 3 * HBLKSIZE) {
GC_black_list_spacing = 3 * HBLKSIZE;
}
+ if (GC_black_list_spacing > MAXHINCR * HBLKSIZE) {
+ GC_black_list_spacing = MAXHINCR * HBLKSIZE;
+ /* Makes it easier to allocate really huge blocks, which otherwise */
+ /* may have problems with nonuniform blacklist distributions. */
+ /* This way we should always succeed immediately after growing the */
+ /* heap. */
+ }
}
void GC_unpromote_black_lists()
{
-# ifndef ALL_INTERIOR_POINTERS
+ if (!GC_all_interior_pointers) {
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl);
-# endif
+ }
GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl);
}
-# ifndef ALL_INTERIOR_POINTERS
/* P is not a valid pointer reference, but it falls inside */
/* the plausible heap bounds. */
/* Add it to the normal incomplete black list if appropriate. */
@@ -186,7 +196,6 @@ word p;
/* object, and isn't worth black listing. */
}
}
-# endif
/* And the same for false pointers from the stack. */
#ifdef PRINT_BLACK_LIST
@@ -229,12 +238,12 @@ word len;
register word i;
word nblocks = divHBLKSZ(len);
-# ifndef ALL_INTERIOR_POINTERS
+ if (!GC_all_interior_pointers) {
if (get_pht_entry_from_index(GC_old_normal_bl, index)
|| get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
return(h+1);
}
-# endif
+ }
for (i = 0; ; ) {
if (GC_old_stack_bl[divWORDSZ(index)] == 0
diff --git a/gc/checksums.c b/gc/checksums.c
@@ -80,7 +80,7 @@ int index;
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
if (pe -> new_sum != 0 && !GC_page_was_ever_dirty(h)) {
GC_printf1("GC_page_was_ever_dirty(0x%lx) is wrong\n",
(unsigned long)h);
diff --git a/gc/configure b/gc/configure
@@ -0,0 +1,2802 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-multilib build many library versions (default)"
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=yes]"
+ac_help="$ac_help
+ --enable-static[=PKGS] build static libraries [default=yes]"
+ac_help="$ac_help
+ --enable-fast-install[=PKGS] optimize for fast installation [default=yes]"
+ac_help="$ac_help
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]"
+ac_help="$ac_help
+ --disable-libtool-lock avoid locking (might break parallel builds)"
+ac_help="$ac_help
+ --with-target-subdir=SUBDIR
+ configuring with a cross compiler"
+ac_help="$ac_help
+ --with-cross-host=HOST configuring with a cross compiler"
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --enable-threads=TYPE choose threading package"
+ac_help="$ac_help
+ --enable-parallel-mark parallelize marking and free list construction"
+ac_help="$ac_help
+ --with-ecos enable runtime eCos target support"
+ac_help="$ac_help
+ --enable-full-debug include full support for pointer backtracing etc."
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=gcj_mlc.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+ac_aux_dir=
+for ac_dir in . $srcdir/.; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in . $srcdir/." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:605: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:626: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:644: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:679: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:732: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:789: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:822: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 827 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:855: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 860 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+# Check whether --enable-multilib or --disable-multilib was given.
+if test "${enable_multilib+set}" = set; then
+ enableval="$enable_multilib"
+ case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
+ esac
+else
+ multilib=yes
+fi
+
+
+if test "${srcdir}" = "."; then
+ if test "${with_target_subdir}" != "." -a -n "${with_target_subdir}"; then
+ gc_basedir="${srcdir}/${with_multisrctop}../."
+ else
+ gc_basedir="${srcdir}/${with_multisrctop}."
+ fi
+else
+ gc_basedir="${srcdir}/."
+fi
+
+ac_aux_dir=
+for ac_dir in $gc_basedir $srcdir/$gc_basedir; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $gc_basedir $srcdir/$gc_basedir" 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:955: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:976: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:994: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+
+PACKAGE=gc
+
+VERSION=6.0
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:1030: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:1043: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:1056: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:1069: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:1082: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1108: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1138: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1187: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1211: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+
+# Likewise for AC_PROG_CXX.
+
+
+
+for ac_prog in $CCC c++ g++ gcc CC cxx cc++
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1248: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CXX="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CXX="$ac_cv_prog_CXX"
+if test -n "$CXX"; then
+ echo "$ac_t""$CXX" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$CXX" && break
+done
+test -n "$CXX" || CXX="gcc"
+
+test -z "$CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
+
+echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
+echo "configure:1281: checking whether we are using GNU C++" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.C <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gxx=yes
+else
+ ac_cv_prog_gxx=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gxx" 1>&6
+
+if test $ac_cv_prog_gxx = yes; then
+ GXX=yes
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS=
+ echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
+echo "configure:1305: checking whether ${CXX-g++} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.cc
+if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
+ ac_cv_prog_cxx_g=yes
+else
+ ac_cv_prog_cxx_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ elif test $ac_cv_prog_cxx_g = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-O2"
+ fi
+else
+ GXX=
+ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
+fi
+
+
+# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
+# run it explicitly here, it will be run implicitly before
+# NEWLIB_CONFIGURE, which doesn't work because that means that it will
+# be run before AC_CANONICAL_HOST.
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1338: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+
+# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1359: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
+fi
+fi
+AS="$ac_cv_prog_AS"
+if test -n "$AS"; then
+ echo "$ac_t""$AS" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1391: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+ echo "$ac_t""$AR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1423: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_RANLIB"; then
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1455: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ RANLIB=":"
+fi
+fi
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1500: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:1554: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
+# at least currently, we never actually build a program, so we never
+# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
+# fails, because we are probably configuring with a cross compiler
+# which can't create executables. So we include AC_EXEEXT to keep
+# automake happy, but we don't execute it, since we don't care about
+# the result.
+if false; then
+ # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+ # to nothing, so nothing would remain between `then' and `fi' if it
+ # were not for the `:' below.
+ :
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1592: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:1602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+fi
+
+. ${srcdir}/configure.host
+
+case ${gc_basedir} in
+/* | A-Za-z:/\\*) gc_flagbasedir=${gc_basedir} ;;
+*) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
+esac
+
+gc_cflags="${gc_cflags} -I"'$(top_builddir)'"/./targ-include -I${gc_flagbasedir}/libc/include"
+case "${host}" in
+ *-*-cygwin32*)
+ gc_cflags="${gc_cflags} -I${gc_flagbasedir}/../winsup/include"
+ ;;
+esac
+
+
+GC_CFLAGS=${gc_cflags}
+
+
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi
+
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1715: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
+echo "configure:1754: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
+echo "configure:1778: checking for GNU ld" >&5
+else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+echo "configure:1781: checking for non-GNU ld" >&5
+fi
+if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ echo "$ac_t""$LD" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
+echo "configure:1816: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+
+
+echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
+echo "configure:1832: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi
+fi
+
+NM="$ac_cv_path_NM"
+echo "$ac_t""$NM" 1>&6
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:1868: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+if ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+#
+# the following will cause an existing older ltconfig to fail, so
+# we ignore this at the expense of the cache file... Checking this
+# will just take longer ... bummer!
+#libtool_flags="--cache-file=$cache_file"
+#
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+ :
+fi
+
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 1922 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
+echo "configure:1944: checking whether the C compiler needs -belf" >&5
+if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1949 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lt_cv_cc_needs_belf=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+
+# Save cache, so that ltconfig can load it
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
+
+# Reload cache, that may have been modified by ltconfig
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+# Check whether --with-target-subdir or --without-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then
+ withval="$with_target_subdir"
+ :
+fi
+
+# Check whether --with-cross-host or --without-cross-host was given.
+if test "${with_cross_host+set}" = set; then
+ withval="$with_cross_host"
+ :
+fi
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:2072: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+ MAINTAINER_MODE_TRUE=
+ MAINTAINER_MODE_FALSE='#'
+else
+ MAINTAINER_MODE_TRUE='#'
+ MAINTAINER_MODE_FALSE=
+fi
+ MAINT=$MAINTAINER_MODE_TRUE
+
+
+# automake wants to see AC_EXEEXT. But we don't need it. And having
+# it is actually a problem, because the compiler we're passed can't
+# necessarily do a full link. So we fool automake here.
+if false; then
+ # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+ # to nothing, so nothing would remain between `then' and `fi' if it
+ # were not for the `:' below.
+ :
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:2105: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:2115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+fi
+
+echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
+echo "configure:2138: checking for threads package to use" >&5
+# Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+ enableval="$enable_threads"
+ THREADS=$enableval
+else
+ echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
+echo "configure:2145: checking for thread model used by GCC" >&5
+ THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+ if test -z "$THREADS"; then
+ THREADS=no
+ fi
+ echo "$ac_t""$THREADS" 1>&6
+fi
+
+
+# Check whether --enable-parallel-mark or --disable-parallel-mark was given.
+if test "${enable_parallel_mark+set}" = set; then
+ enableval="$enable_parallel_mark"
+ case "$THREADS" in
+ no | none | single)
+ { echo "configure: error: Parallel mark requires --enable-threads=x spec" 1>&2; exit 1; }
+ ;;
+ esac
+
+fi
+
+
+INCLUDES=-I${srcdir}/include
+THREADLIBS=
+case "$THREADS" in
+ no | none | single)
+ THREADS=none
+ ;;
+ posix | pthreads)
+ THREADS=posix
+ THREADLIBS=-lpthread
+ case "$host" in
+ x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux*)
+ cat >> confdefs.h <<\EOF
+#define GC_LINUX_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+ if test "${enable_parallel_mark}"; then
+ cat >> confdefs.h <<\EOF
+#define PARALLEL_MARK 1
+EOF
+
+ fi
+ cat >> confdefs.h <<\EOF
+#define THREAD_LOCAL_ALLOC 1
+EOF
+
+ ;;
+ *-*-linux*)
+ cat >> confdefs.h <<\EOF
+#define GC_LINUX_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+ ;;
+ *-*-hpux*)
+ echo "configure: warning: "Only HP/UX 11 threads are supported."" 1>&2
+ cat >> confdefs.h <<\EOF
+#define GC_HPUX_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _POSIX_C_SOURCE 199506L
+EOF
+
+ if test "${enable_parallel_mark}" = yes; then
+ cat >> confdefs.h <<\EOF
+#define PARALLEL_MARK 1
+EOF
+
+ fi
+ cat >> confdefs.h <<\EOF
+#define THREAD_LOCAL_ALLOC 1
+EOF
+
+ THREADLIBS="-lpthread -lrt"
+ ;;
+ *-*-freebsd*)
+ echo "configure: warning: "FreeBSD does not yet fully support threads with Boehm GC."" 1>&2
+ cat >> confdefs.h <<\EOF
+#define FREEBSD_THREADS 1
+EOF
+
+ INCLUDES="$INCLUDES -pthread"
+ THREADLIBS=-pthread
+ ;;
+ *-*-solaris*)
+ cat >> confdefs.h <<\EOF
+#define GC_SOLARIS_THREADS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define GC_SOLARIS_PTHREADS 1
+EOF
+
+ ;;
+ *-*-irix*)
+ cat >> confdefs.h <<\EOF
+#define GC_IRIX_THREADS 1
+EOF
+
+ ;;
+ esac
+ ;;
+ decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ { echo "configure: error: thread package $THREADS not yet supported" 1>&2; exit 1; }
+ ;;
+ *)
+ { echo "configure: error: $THREADS is an unknown thread package" 1>&2; exit 1; }
+ ;;
+esac
+
+
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:2265: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2273 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:2284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+target_all=libgc.la
+
+
+TARGET_ECOS="no"
+# Check whether --with-ecos or --without-ecos was given.
+if test "${with_ecos+set}" = set; then
+ withval="$with_ecos"
+ TARGET_ECOS="$with_ecos"
+
+fi
+
+
+addobjs=
+CXXINCLUDES=
+case "$TARGET_ECOS" in
+ no)
+ ;;
+ *)
+ cat >> confdefs.h <<\EOF
+#define ECOS 1
+EOF
+
+ CXXINCLUDES="-I${TARGET_ECOS}/include"
+ addobjs="$addobjs ecos.lo"
+ ;;
+esac
+
+
+
+
+
+machdep=
+case "$host" in
+# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
+# Gcc on a 21264 can spill pointers to fp registers. Oops.
+# alpha*-*-*)
+# machdep="alpha_mach_dep.lo"
+# ;;
+ mipstx39-*-elf*)
+ machdep="mips_ultrix_mach_dep.lo"
+ cat >> confdefs.h <<\EOF
+#define STACKBASE __stackbase
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define DATASTART_IS_ETEXT 1
+EOF
+
+ ;;
+ mips-dec-ultrix*)
+ machdep="mips_ultrix_mach-dep.lo"
+ ;;
+ mips-*-*)
+ machdep="mips_sgi_mach_dep.lo"
+ cat >> confdefs.h <<\EOF
+#define NO_EXECUTE_PERMISSION 1
+EOF
+
+ ;;
+ sparc-sun-solaris2.3*)
+ cat >> confdefs.h <<\EOF
+#define SUNOS53_SHARED_LIB 1
+EOF
+
+ ;;
+esac
+if test x"$machdep" = x; then
+ machdep="mach_dep.lo"
+fi
+addobjs="$addobjs $machdep"
+
+
+case "$host" in
+ sparc-sun-solaris2*)
+ if test "$GCC" = yes; then
+ new_CFLAGS=
+ for i in $CFLAGS; do
+ case "$i" in
+ -O*)
+ ;;
+ *)
+ new_CFLAGS="$new_CFLAGS $i"
+ ;;
+ esac
+ done
+ CFLAGS="$new_CFLAGS"
+ fi
+ ;;
+esac
+
+MY_CFLAGS="$CFLAGS"
+
+
+cat >> confdefs.h <<\EOF
+#define SILENT 1
+EOF
+
+cat >> confdefs.h <<\EOF
+#define NO_SIGNALS 1
+EOF
+
+cat >> confdefs.h <<\EOF
+#define NO_EXECUTE_PERMISSION 1
+EOF
+
+cat >> confdefs.h <<\EOF
+#define ALL_INTERIOR_POINTERS 1
+EOF
+
+
+cat >> confdefs.h <<\EOF
+#define JAVA_FINALIZATION 1
+EOF
+
+cat >> confdefs.h <<\EOF
+#define GC_GCJ_SUPPORT 1
+EOF
+
+cat >> confdefs.h <<\EOF
+#define ATOMIC_UNCOLLECTABLE 1
+EOF
+
+
+if test -n "${with_cross_host}"; then
+ cat >> confdefs.h <<\EOF
+#define NO_SIGSET 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define NO_CLOCK 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define SMALL_CONFIG 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define NO_DEBUGGING 1
+EOF
+
+fi
+
+# Check whether --enable-full-debug or --disable-full-debug was given.
+if test "${enable_full_debug+set}" = set; then
+ enableval="$enable_full_debug"
+ if test "$enable_full_debug" = "yes"; then
+ echo "configure: warning: "Must define GC_DEBUG and use debug alloc. in clients."" 1>&2
+ cat >> confdefs.h <<\EOF
+#define KEEP_BACK_PTRS 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define DBG_HDRS_ALL 1
+EOF
+
+ case $host in
+ x86-*-linux* | i586-*-linux* | i686-*-linux* )
+ echo "configure: warning: "Client must not use -fomit-frame-pointer."" 1>&2
+ cat >> confdefs.h <<\EOF
+#define SAVE_CALL_COUNT 8
+EOF
+
+ ;;
+ esac
+ fi
+fi
+
+
+
+
+if test -z "$with_cross_host"; then
+ USE_LIBDIR_TRUE=
+ USE_LIBDIR_FALSE='#'
+else
+ USE_LIBDIR_TRUE='#'
+ USE_LIBDIR_FALSE=
+fi
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@gc_basedir@%$gc_basedir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@CXX@%$CXX%g
+s%@AS@%$AS%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@GC_CFLAGS@%$GC_CFLAGS%g
+s%@LN_S@%$LN_S%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@THREADLIBS@%$THREADLIBS%g
+s%@EXTRA_TEST_LIBS@%$EXTRA_TEST_LIBS%g
+s%@target_all@%$target_all%g
+s%@INCLUDES@%$INCLUDES%g
+s%@CXXINCLUDES@%$CXXINCLUDES%g
+s%@addobjs@%$addobjs%g
+s%@MY_CFLAGS@%$MY_CFLAGS%g
+s%@USE_LIBDIR_TRUE@%$USE_LIBDIR_TRUE%g
+s%@USE_LIBDIR_FALSE@%$USE_LIBDIR_FALSE%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+srcdir=${srcdir}
+host=${host}
+target=${target}
+with_multisubdir=${with_multisubdir}
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+gc_basedir=${gc_basedir}
+CC="${CC}"
+DEFS="$DEFS"
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/gc/configure.host b/gc/configure.host
@@ -0,0 +1,53 @@
+# configure.host
+
+# This shell script handles all host based configuration for the garbage
+# collector.
+# It sets various shell variables based on the the host and the
+# configuration options. You can modify this shell script without
+# needing to rerun autoconf.
+
+# This shell script should be invoked as
+# . configure.host
+# If it encounters an error, it will exit with a message.
+
+# It uses the following shell variables:
+# host The configuration host
+# host_cpu The configuration host CPU
+# target_optspace --enable-target-optspace ("yes", "no", "")
+
+# It sets the following shell variables:
+# gc_cflags Special CFLAGS to use when building
+
+# We should set -fexceptions if we are using gcc and might be used
+# inside something like gcj. This is the zeroth approximation:
+case "$host" in
+ *-*-linux* )
+ gc_cflags=-fexceptions
+ ;;
+ *-*-hpux* )
+ gc_cflags=+ESdbgasm
+ ;;
+esac
+
+case "${target_optspace}:${host}" in
+ yes:*)
+ gc_cflags="${gc_cflags} -Os"
+ ;;
+ :m32r-* | :d10v-* | :d30v-*)
+ gc_cflags="${gc_cflags} -Os"
+ ;;
+ no:* | :*)
+ # Nothing.
+ ;;
+esac
+
+# Set any host dependent compiler flags.
+# THIS TABLE IS SORTED. KEEP IT THAT WAY.
+
+case "${host}" in
+ mips-tx39-*|mipstx39-unknown-*)
+ boehm_gc_cflags="${boehm_gc_cflags} -G 0"
+ ;;
+ *)
+ ;;
+esac
diff --git a/gc/configure.in b/gc/configure.in
@@ -0,0 +1,260 @@
+# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
+#
+# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+#
+# Permission is hereby granted to use or copy this program
+# for any purpose, provided the above notices are retained on all copies.
+# Permission to modify the code and to distribute modified code is granted,
+# provided the above notices are retained, and a notice that the code was
+# modified is included with the above copyright notice.
+#
+# Original author: Tom Tromey
+
+dnl Process this file with autoconf to produce configure.
+
+AC_INIT(gcj_mlc.c)
+
+dnl Can't be done in GC_CONFIGURE because that confuses automake.
+AC_CONFIG_AUX_DIR(.)
+
+AC_CANONICAL_SYSTEM
+
+GC_CONFIGURE(.)
+
+AM_PROG_LIBTOOL
+
+dnl We use these options to decide which functions to include.
+AC_ARG_WITH(target-subdir,
+[ --with-target-subdir=SUBDIR
+ configuring with a cross compiler])
+AC_ARG_WITH(cross-host,
+[ --with-cross-host=HOST configuring with a cross compiler])
+
+AM_MAINTAINER_MODE
+# automake wants to see AC_EXEEXT. But we don't need it. And having
+# it is actually a problem, because the compiler we're passed can't
+# necessarily do a full link. So we fool automake here.
+if false; then
+ # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+ # to nothing, so nothing would remain between `then' and `fi' if it
+ # were not for the `:' below.
+ :
+ AC_EXEEXT
+fi
+
+AC_MSG_CHECKING([for threads package to use])
+AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
+ THREADS=$enableval,
+ [ AC_MSG_CHECKING([for thread model used by GCC])
+ THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+ if test -z "$THREADS"; then
+ THREADS=no
+ fi
+ AC_MSG_RESULT([$THREADS])])
+
+AC_ARG_ENABLE(parallel-mark,
+[ --enable-parallel-mark parallelize marking and free list construction],
+ [case "$THREADS" in
+ no | none | single)
+ AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
+ ;;
+ esac]
+)
+
+INCLUDES=-I${srcdir}/include
+THREADLIBS=
+case "$THREADS" in
+ no | none | single)
+ THREADS=none
+ ;;
+ posix | pthreads)
+ THREADS=posix
+ THREADLIBS=-lpthread
+ case "$host" in
+ x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux*)
+ AC_DEFINE(GC_LINUX_THREADS)
+ AC_DEFINE(_REENTRANT)
+ if test "${enable_parallel_mark}"; then
+ AC_DEFINE(PARALLEL_MARK)
+ fi
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ ;;
+ *-*-linux*)
+ AC_DEFINE(GC_LINUX_THREADS)
+ AC_DEFINE(_REENTRANT)
+ ;;
+ *-*-hpux*)
+ AC_MSG_WARN("Only HP/UX 11 threads are supported.")
+ AC_DEFINE(GC_HPUX_THREADS)
+ AC_DEFINE(_POSIX_C_SOURCE,199506L)
+ if test "${enable_parallel_mark}" = yes; then
+ AC_DEFINE(PARALLEL_MARK)
+ fi
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ THREADLIBS="-lpthread -lrt"
+ ;;
+ *-*-freebsd*)
+ AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
+ AC_DEFINE(FREEBSD_THREADS)
+ INCLUDES="$INCLUDES -pthread"
+ THREADLIBS=-pthread
+ ;;
+ *-*-solaris*)
+ AC_DEFINE(GC_SOLARIS_THREADS)
+ AC_DEFINE(GC_SOLARIS_PTHREADS)
+ ;;
+ *-*-irix*)
+ AC_DEFINE(GC_IRIX_THREADS)
+ ;;
+ esac
+ ;;
+ decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ AC_MSG_ERROR(thread package $THREADS not yet supported)
+ ;;
+ *)
+ AC_MSG_ERROR($THREADS is an unknown thread package)
+ ;;
+esac
+AC_SUBST(THREADLIBS)
+
+AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
+AC_SUBST(EXTRA_TEST_LIBS)
+
+target_all=libgc.la
+AC_SUBST(target_all)
+
+dnl If the target is an eCos system, use the appropriate eCos
+dnl I/O routines.
+dnl FIXME: this should not be a local option but a global target
+dnl system; at present there is no eCos target.
+TARGET_ECOS="no"
+AC_ARG_WITH(ecos,
+[ --with-ecos enable runtime eCos target support],
+TARGET_ECOS="$with_ecos"
+)
+
+addobjs=
+CXXINCLUDES=
+case "$TARGET_ECOS" in
+ no)
+ ;;
+ *)
+ AC_DEFINE(ECOS)
+ CXXINCLUDES="-I${TARGET_ECOS}/include"
+ addobjs="$addobjs ecos.lo"
+ ;;
+esac
+AC_SUBST(CXX)
+
+AC_SUBST(INCLUDES)
+AC_SUBST(CXXINCLUDES)
+
+machdep=
+case "$host" in
+# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
+# Gcc on a 21264 can spill pointers to fp registers. Oops.
+# alpha*-*-*)
+# machdep="alpha_mach_dep.lo"
+# ;;
+ mipstx39-*-elf*)
+ machdep="mips_ultrix_mach_dep.lo"
+ AC_DEFINE(STACKBASE, __stackbase)
+ AC_DEFINE(DATASTART_IS_ETEXT)
+ ;;
+ mips-dec-ultrix*)
+ machdep="mips_ultrix_mach-dep.lo"
+ ;;
+ mips-*-*)
+ machdep="mips_sgi_mach_dep.lo"
+ AC_DEFINE(NO_EXECUTE_PERMISSION)
+ ;;
+ sparc-sun-solaris2.3*)
+ AC_DEFINE(SUNOS53_SHARED_LIB)
+ ;;
+esac
+if test x"$machdep" = x; then
+ machdep="mach_dep.lo"
+fi
+addobjs="$addobjs $machdep"
+AC_SUBST(addobjs)
+
+dnl As of 4.13a2, the collector will not properly work on Solaris when
+dnl built with gcc and -O. So we remove -O in the appropriate case.
+case "$host" in
+ sparc-sun-solaris2*)
+ if test "$GCC" = yes; then
+ new_CFLAGS=
+ for i in $CFLAGS; do
+ case "$i" in
+ -O*)
+ ;;
+ *)
+ new_CFLAGS="$new_CFLAGS $i"
+ ;;
+ esac
+ done
+ CFLAGS="$new_CFLAGS"
+ fi
+ ;;
+esac
+
+dnl We need to override the top-level CFLAGS. This is how we do it.
+MY_CFLAGS="$CFLAGS"
+AC_SUBST(MY_CFLAGS)
+
+dnl Include defines that have become de facto standard.
+dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
+AC_DEFINE(SILENT)
+AC_DEFINE(NO_SIGNALS)
+AC_DEFINE(NO_EXECUTE_PERMISSION)
+AC_DEFINE(ALL_INTERIOR_POINTERS)
+
+dnl By default, make the library as general as possible.
+AC_DEFINE(JAVA_FINALIZATION)
+AC_DEFINE(GC_GCJ_SUPPORT)
+AC_DEFINE(ATOMIC_UNCOLLECTABLE)
+
+dnl This is something of a hack. When cross-compiling we turn off
+dnl some functionality. We also enable the "small" configuration.
+dnl These is only correct when targetting an embedded system. FIXME.
+if test -n "${with_cross_host}"; then
+ AC_DEFINE(NO_SIGSET)
+ AC_DEFINE(NO_CLOCK)
+ AC_DEFINE(SMALL_CONFIG)
+ AC_DEFINE(NO_DEBUGGING)
+fi
+
+AC_ARG_ENABLE(full-debug,
+[ --enable-full-debug include full support for pointer backtracing etc.],
+[ if test "$enable_full_debug" = "yes"; then
+ AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
+ AC_DEFINE(KEEP_BACK_PTRS)
+ AC_DEFINE(DBG_HDRS_ALL)
+ case $host in
+ x86-*-linux* | i586-*-linux* | i686-*-linux* )
+ AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
+ AC_DEFINE(SAVE_CALL_COUNT, 8)
+ ;;
+ esac ]
+ fi)
+
+AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_OUTPUT(Makefile,,
+srcdir=${srcdir}
+host=${host}
+target=${target}
+with_multisubdir=${with_multisubdir}
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+gc_basedir=${gc_basedir}
+CC="${CC}"
+DEFS="$DEFS"
+)
diff --git a/gc/cord/README b/gc/cord/README
@@ -1,31 +0,0 @@
-Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
-
-THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-
-Permission is hereby granted to use or copy this program
-for any purpose, provided the above notices are retained on all copies.
-Permission to modify the code and to distribute modified code is granted,
-provided the above notices are retained, and a notice that the code was
-modified is included with the above copyright notice.
-
-Please send bug reports to Hans-J. Boehm (boehm@sgi.com).
-
-This is a string packages that uses a tree-based representation.
-See cord.h for a description of the functions provided. Ec.h describes
-"extensible cords", which are essentially output streams that write
-to a cord. These allow for efficient construction of cords without
-requiring a bound on the size of a cord.
-
-de.c is a very dumb text editor that illustrates the use of cords.
-It maintains a list of file versions. Each version is simply a
-cord representing the file contents. Nonetheless, standard
-editing operations are efficient, even on very large files.
-(Its 3 line "user manual" can be obtained by invoking it without
-arguments. Note that ^R^N and ^R^P move the cursor by
-almost a screen. It does not understand tabs, which will show
-up as highlighred "I"s. Use the UNIX "expand" program first.)
-To build the editor, type "make cord/de" in the gc directory.
-
-This package assumes an ANSI C compiler such as gcc. It will
-not compile with an old-style K&R compiler.
diff --git a/gc/cord/SCOPTIONS.amiga b/gc/cord/SCOPTIONS.amiga
@@ -1,14 +0,0 @@
-MATH=STANDARD
-CPU=68030
-NOSTACKCHECK
-OPTIMIZE
-VERBOSE
-NOVERSION
-NOICONS
-OPTIMIZERTIME
-INCLUDEDIR=/
-DEFINE AMIGA
-LIBRARY=cord.lib
-LIBRARY=/gc.lib
-IGNORE=100
-IGNORE=161
diff --git a/gc/cord/SMakefile.amiga b/gc/cord/SMakefile.amiga
@@ -1,20 +0,0 @@
-# Makefile for cord.lib
-# Michel Schinz 1994/07/20
-
-OBJS = cordbscs.o cordprnt.o cordxtra.o
-
-all: cord.lib cordtest
-
-cordbscs.o: cordbscs.c
-cordprnt.o: cordprnt.c
-cordxtra.o: cordxtra.c
-cordtest.o: cordtest.c
-
-cord.lib: $(OBJS)
- oml cord.lib r $(OBJS)
-
-cordtest: cordtest.o cord.lib
- sc cordtest.o link
-
-clean:
- delete cord.lib cordtest \#?.o \#?.lnk
diff --git a/gc/cord/cord.h b/gc/cord/cord.h
@@ -1,327 +0,0 @@
-/*
- * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- * Author: Hans-J. Boehm (boehm@parc.xerox.com)
- */
-/* Boehm, October 5, 1995 4:20 pm PDT */
-
-/*
- * Cords are immutable character strings. A number of operations
- * on long cords are much more efficient than their strings.h counterpart.
- * In particular, concatenation takes constant time independent of the length
- * of the arguments. (Cords are represented as trees, with internal
- * nodes representing concatenation and leaves consisting of either C
- * strings or a functional description of the string.)
- *
- * The following are reasonable applications of cords. They would perform
- * unacceptably if C strings were used:
- * - A compiler that produces assembly language output by repeatedly
- * concatenating instructions onto a cord representing the output file.
- * - A text editor that converts the input file to a cord, and then
- * performs editing operations by producing a new cord representing
- * the file after echa character change (and keeping the old ones in an
- * edit history)
- *
- * For optimal performance, cords should be built by
- * concatenating short sections.
- * This interface is designed for maximum compatibility with C strings.
- * ASCII NUL characters may be embedded in cords using CORD_from_fn.
- * This is handled correctly, but CORD_to_char_star will produce a string
- * with embedded NULs when given such a cord.
- *
- * This interface is fairly big, largely for performance reasons.
- * The most basic constants and functions:
- *
- * CORD - the type fo a cord;
- * CORD_EMPTY - empty cord;
- * CORD_len(cord) - length of a cord;
- * CORD_cat(cord1,cord2) - concatenation of two cords;
- * CORD_substr(cord, start, len) - substring (or subcord);
- * CORD_pos i; CORD_FOR(i, cord) { ... CORD_pos_fetch(i) ... } -
- * examine each character in a cord. CORD_pos_fetch(i) is the char.
- * CORD_fetch(int i) - Retrieve i'th character (slowly).
- * CORD_cmp(cord1, cord2) - compare two cords.
- * CORD_from_file(FILE * f) - turn a read-only file into a cord.
- * CORD_to_char_star(cord) - convert to C string.
- * (Non-NULL C constant strings are cords.)
- * CORD_printf (etc.) - cord version of printf. Use %r for cords.
- */
-# ifndef CORD_H
-
-# define CORD_H
-# include <stddef.h>
-# include <stdio.h>
-/* Cords have type const char *. This is cheating quite a bit, and not */
-/* 100% portable. But it means that nonempty character string */
-/* constants may be used as cords directly, provided the string is */
-/* never modified in place. The empty cord is represented by, and */
-/* can be written as, 0. */
-
-typedef const char * CORD;
-
-/* An empty cord is always represented as nil */
-# define CORD_EMPTY 0
-
-/* Is a nonempty cord represented as a C string? */
-#define CORD_IS_STRING(s) (*(s) != '\0')
-
-/* Concatenate two cords. If the arguments are C strings, they may */
-/* not be subsequently altered. */
-CORD CORD_cat(CORD x, CORD y);
-
-/* Concatenate a cord and a C string with known length. Except for the */
-/* empty string case, this is a special case of CORD_cat. Since the */
-/* length is known, it can be faster. */
-/* The string y is shared with the resulting CORD. Hence it should */
-/* not be altered by the caller. */
-CORD CORD_cat_char_star(CORD x, const char * y, size_t leny);
-
-/* Compute the length of a cord */
-size_t CORD_len(CORD x);
-
-/* Cords may be represented by functions defining the ith character */
-typedef char (* CORD_fn)(size_t i, void * client_data);
-
-/* Turn a functional description into a cord. */
-CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len);
-
-/* Return the substring (subcord really) of x with length at most n, */
-/* starting at position i. (The initial character has position 0.) */
-CORD CORD_substr(CORD x, size_t i, size_t n);
-
-/* Return the argument, but rebalanced to allow more efficient */
-/* character retrieval, substring operations, and comparisons. */
-/* This is useful only for cords that were built using repeated */
-/* concatenation. Guarantees log time access to the result, unless */
-/* x was obtained through a large number of repeated substring ops */
-/* or the embedded functional descriptions take longer to evaluate. */
-/* May reallocate significant parts of the cord. The argument is not */
-/* modified; only the result is balanced. */
-CORD CORD_balance(CORD x);
-
-/* The following traverse a cord by applying a function to each */
-/* character. This is occasionally appropriate, especially where */
-/* speed is crucial. But, since C doesn't have nested functions, */
-/* clients of this sort of traversal are clumsy to write. Consider */
-/* the functions that operate on cord positions instead. */
-
-/* Function to iteratively apply to individual characters in cord. */
-typedef int (* CORD_iter_fn)(char c, void * client_data);
-
-/* Function to apply to substrings of a cord. Each substring is a */
-/* a C character string, not a general cord. */
-typedef int (* CORD_batched_iter_fn)(const char * s, void * client_data);
-# define CORD_NO_FN ((CORD_batched_iter_fn)0)
-
-/* Apply f1 to each character in the cord, in ascending order, */
-/* starting at position i. If */
-/* f2 is not CORD_NO_FN, then multiple calls to f1 may be replaced by */
-/* a single call to f2. The parameter f2 is provided only to allow */
-/* some optimization by the client. This terminates when the right */
-/* end of this string is reached, or when f1 or f2 return != 0. In the */
-/* latter case CORD_iter returns != 0. Otherwise it returns 0. */
-/* The specified value of i must be < CORD_len(x). */
-int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1,
- CORD_batched_iter_fn f2, void * client_data);
-
-/* A simpler version that starts at 0, and without f2: */
-int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data);
-# define CORD_iter(x, f1, cd) CORD_iter5(x, 0, f1, CORD_NO_FN, cd)
-
-/* Similar to CORD_iter5, but end-to-beginning. No provisions for */
-/* CORD_batched_iter_fn. */
-int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data);
-
-/* A simpler version that starts at the end: */
-int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data);
-
-/* Functions that operate on cord positions. The easy way to traverse */
-/* cords. A cord position is logically a pair consisting of a cord */
-/* and an index into that cord. But it is much faster to retrieve a */
-/* charcter based on a position than on an index. Unfortunately, */
-/* positions are big (order of a few 100 bytes), so allocate them with */
-/* caution. */
-/* Things in cord_pos.h should be treated as opaque, except as */
-/* described below. Also note that */
-/* CORD_pos_fetch, CORD_next and CORD_prev have both macro and function */
-/* definitions. The former may evaluate their argument more than once. */
-# include "private/cord_pos.h"
-
-/*
- Visible definitions from above:
-
- typedef <OPAQUE but fairly big> CORD_pos[1];
-
- * Extract the cord from a position:
- CORD CORD_pos_to_cord(CORD_pos p);
-
- * Extract the current index from a position:
- size_t CORD_pos_to_index(CORD_pos p);
-
- * Fetch the character located at the given position:
- char CORD_pos_fetch(CORD_pos p);
-
- * Initialize the position to refer to the given cord and index.
- * Note that this is the most expensive function on positions:
- void CORD_set_pos(CORD_pos p, CORD x, size_t i);
-
- * Advance the position to the next character.
- * P must be initialized and valid.
- * Invalidates p if past end:
- void CORD_next(CORD_pos p);
-
- * Move the position to the preceding character.
- * P must be initialized and valid.
- * Invalidates p if past beginning:
- void CORD_prev(CORD_pos p);
-
- * Is the position valid, i.e. inside the cord?
- int CORD_pos_valid(CORD_pos p);
-*/
-# define CORD_FOR(pos, cord) \
- for (CORD_set_pos(pos, cord, 0); CORD_pos_valid(pos); CORD_next(pos))
-
-
-/* An out of memory handler to call. May be supplied by client. */
-/* Must not return. */
-extern void (* CORD_oom_fn)(void);
-
-/* Dump the representation of x to stdout in an implementation defined */
-/* manner. Intended for debugging only. */
-void CORD_dump(CORD x);
-
-/* The following could easily be implemented by the client. They are */
-/* provided in cordxtra.c for convenience. */
-
-/* Concatenate a character to the end of a cord. */
-CORD CORD_cat_char(CORD x, char c);
-
-/* Concatenate n cords. */
-CORD CORD_catn(int n, /* CORD */ ...);
-
-/* Return the character in CORD_substr(x, i, 1) */
-char CORD_fetch(CORD x, size_t i);
-
-/* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y */
-int CORD_cmp(CORD x, CORD y);
-
-/* A generalization that takes both starting positions for the */
-/* comparison, and a limit on the number of characters to be compared. */
-int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len);
-
-/* Find the first occurrence of s in x at position start or later. */
-/* Return the position of the first character of s in x, or */
-/* CORD_NOT_FOUND if there is none. */
-size_t CORD_str(CORD x, size_t start, CORD s);
-
-/* Return a cord consisting of i copies of (possibly NUL) c. Dangerous */
-/* in conjunction with CORD_to_char_star. */
-/* The resulting representation takes constant space, independent of i. */
-CORD CORD_chars(char c, size_t i);
-# define CORD_nul(i) CORD_chars('\0', (i))
-
-/* Turn a file into cord. The file must be seekable. Its contents */
-/* must remain constant. The file may be accessed as an immediate */
-/* result of this call and/or as a result of subsequent accesses to */
-/* the cord. Short files are likely to be immediately read, but */
-/* long files are likely to be read on demand, possibly relying on */
-/* stdio for buffering. */
-/* We must have exclusive access to the descriptor f, i.e. we may */
-/* read it at any time, and expect the file pointer to be */
-/* where we left it. Normally this should be invoked as */
-/* CORD_from_file(fopen(...)) */
-/* CORD_from_file arranges to close the file descriptor when it is no */
-/* longer needed (e.g. when the result becomes inaccessible). */
-/* The file f must be such that ftell reflects the actual character */
-/* position in the file, i.e. the number of characters that can be */
-/* or were read with fread. On UNIX systems this is always true. On */
-/* MS Windows systems, f must be opened in binary mode. */
-CORD CORD_from_file(FILE * f);
-
-/* Equivalent to the above, except that the entire file will be read */
-/* and the file pointer will be closed immediately. */
-/* The binary mode restriction from above does not apply. */
-CORD CORD_from_file_eager(FILE * f);
-
-/* Equivalent to the above, except that the file will be read on demand.*/
-/* The binary mode restriction applies. */
-CORD CORD_from_file_lazy(FILE * f);
-
-/* Turn a cord into a C string. The result shares no structure with */
-/* x, and is thus modifiable. */
-char * CORD_to_char_star(CORD x);
-
-/* Turn a C string into a CORD. The C string is copied, and so may */
-/* subsequently be modified. */
-CORD CORD_from_char_star(const char *s);
-
-/* Identical to the above, but the result may share structure with */
-/* the argument and is thus not modifiable. */
-const char * CORD_to_const_char_star(CORD x);
-
-/* Write a cord to a file, starting at the current position. No */
-/* trailing NULs are newlines are added. */
-/* Returns EOF if a write error occurs, 1 otherwise. */
-int CORD_put(CORD x, FILE * f);
-
-/* "Not found" result for the following two functions. */
-# define CORD_NOT_FOUND ((size_t)(-1))
-
-/* A vague analog of strchr. Returns the position (an integer, not */
-/* a pointer) of the first occurrence of (char) c inside x at position */
-/* i or later. The value i must be < CORD_len(x). */
-size_t CORD_chr(CORD x, size_t i, int c);
-
-/* A vague analog of strrchr. Returns index of the last occurrence */
-/* of (char) c inside x at position i or earlier. The value i */
-/* must be < CORD_len(x). */
-size_t CORD_rchr(CORD x, size_t i, int c);
-
-
-/* The following are also not primitive, but are implemented in */
-/* cordprnt.c. They provide functionality similar to the ANSI C */
-/* functions with corresponding names, but with the following */
-/* additions and changes: */
-/* 1. A %r conversion specification specifies a CORD argument. Field */
-/* width, precision, etc. have the same semantics as for %s. */
-/* (Note that %c,%C, and %S were already taken.) */
-/* 2. The format string is represented as a CORD. */
-/* 3. CORD_sprintf and CORD_vsprintf assign the result through the 1st */ /* argument. Unlike their ANSI C versions, there is no need to guess */
-/* the correct buffer size. */
-/* 4. Most of the conversions are implement through the native */
-/* vsprintf. Hence they are usually no faster, and */
-/* idiosyncracies of the native printf are preserved. However, */
-/* CORD arguments to CORD_sprintf and CORD_vsprintf are NOT copied; */
-/* the result shares the original structure. This may make them */
-/* very efficient in some unusual applications. */
-/* The format string is copied. */
-/* All functions return the number of characters generated or -1 on */
-/* error. This complies with the ANSI standard, but is inconsistent */
-/* with some older implementations of sprintf. */
-
-/* The implementation of these is probably less portable than the rest */
-/* of this package. */
-
-#ifndef CORD_NO_IO
-
-#include <stdarg.h>
-
-int CORD_sprintf(CORD * out, CORD format, ...);
-int CORD_vsprintf(CORD * out, CORD format, va_list args);
-int CORD_fprintf(FILE * f, CORD format, ...);
-int CORD_vfprintf(FILE * f, CORD format, va_list args);
-int CORD_printf(CORD format, ...);
-int CORD_vprintf(CORD format, va_list args);
-
-#endif /* CORD_NO_IO */
-
-# endif /* CORD_H */
diff --git a/gc/cord/cordprnt.c b/gc/cord/cordprnt.c
@@ -233,7 +233,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args)
if (width == NONE && prec == NONE) {
register char c;
- c = va_arg(args, char);
+ c = va_arg(args, int);
CORD_ec_append(result, c);
goto done;
}
diff --git a/gc/cord/cordtest.c b/gc/cord/cordtest.c
@@ -14,6 +14,7 @@
# include "cord.h"
# include <string.h>
# include <stdio.h>
+# include <stdlib.h>
/* This is a very incomplete test of the cord package. It knows about */
/* a few internals of the package (e.g. when C strings are returned) */
/* that real clients shouldn't rely on. */
diff --git a/gc/cord/ec.h b/gc/cord/ec.h
@@ -1,70 +0,0 @@
-# ifndef EC_H
-# define EC_H
-
-# ifndef CORD_H
-# include "cord.h"
-# endif
-
-/* Extensible cords are strings that may be destructively appended to. */
-/* They allow fast construction of cords from characters that are */
-/* being read from a stream. */
-/*
- * A client might look like:
- *
- * {
- * CORD_ec x;
- * CORD result;
- * char c;
- * FILE *f;
- *
- * ...
- * CORD_ec_init(x);
- * while(...) {
- * c = getc(f);
- * ...
- * CORD_ec_append(x, c);
- * }
- * result = CORD_balance(CORD_ec_to_cord(x));
- *
- * If a C string is desired as the final result, the call to CORD_balance
- * may be replaced by a call to CORD_to_char_star.
- */
-
-# ifndef CORD_BUFSZ
-# define CORD_BUFSZ 128
-# endif
-
-typedef struct CORD_ec_struct {
- CORD ec_cord;
- char * ec_bufptr;
- char ec_buf[CORD_BUFSZ+1];
-} CORD_ec[1];
-
-/* This structure represents the concatenation of ec_cord with */
-/* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */
-
-/* Flush the buffer part of the extended chord into ec_cord. */
-/* Note that this is almost the only real function, and it is */
-/* implemented in 6 lines in cordxtra.c */
-void CORD_ec_flush_buf(CORD_ec x);
-
-/* Convert an extensible cord to a cord. */
-# define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)
-
-/* Initialize an extensible cord. */
-# define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf)
-
-/* Append a character to an extensible cord. */
-# define CORD_ec_append(x, c) \
- { \
- if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \
- CORD_ec_flush_buf(x); \
- } \
- *((x)[0].ec_bufptr)++ = (c); \
- }
-
-/* Append a cord to an extensible cord. Structure remains shared with */
-/* original. */
-void CORD_ec_append_cord(CORD_ec x, CORD s);
-
-# endif /* EC_H */
diff --git a/gc/cord/gc.h b/gc/cord/gc.h
@@ -1,754 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
- * Copyright 1996 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-/*
- * Note that this defines a large number of tuning hooks, which can
- * safely be ignored in nearly all cases. For normal use it suffices
- * to call only GC_MALLOC and perhaps GC_REALLOC.
- * For better performance, also look at GC_MALLOC_ATOMIC, and
- * GC_enable_incremental. If you need an action to be performed
- * immediately before an object is collected, look at GC_register_finalizer.
- * If you are using Solaris threads, look at the end of this file.
- * Everything else is best ignored unless you encounter performance
- * problems.
- */
-
-#ifndef _GC_H
-
-# define _GC_H
-# define __GC
-# include <stddef.h>
-
-#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
-#include "libgc_globals.h"
-#endif
-
-#if defined(_MSC_VER) && defined(_DLL)
-# ifdef GC_BUILD
-# define GC_API __declspec(dllexport)
-# else
-# define GC_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined(__WATCOMC__) && defined(GC_DLL)
-# ifdef GC_BUILD
-# define GC_API extern __declspec(dllexport)
-# else
-# define GC_API extern __declspec(dllimport)
-# endif
-#endif
-
-#ifndef GC_API
-#define GC_API extern
-#endif
-
-# if defined(__STDC__) || defined(__cplusplus)
-# define GC_PROTO(args) args
- typedef void * GC_PTR;
-# else
-# define GC_PROTO(args) ()
- typedef char * GC_PTR;
-# endif
-
-# ifdef __cplusplus
- extern "C" {
-# endif
-
-
-/* Define word and signed_word to be unsigned and signed types of the */
-/* size as char * or void *. There seems to be no way to do this */
-/* even semi-portably. The following is probably no better/worse */
-/* than almost anything else. */
-/* The ANSI standard suggests that size_t and ptr_diff_t might be */
-/* better choices. But those appear to have incorrect definitions */
-/* on may systems. Notably "typedef int size_t" seems to be both */
-/* frequent and WRONG. */
-typedef unsigned long GC_word;
-typedef long GC_signed_word;
-
-/* Public read-only variables */
-
-GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
- /* Includes empty GCs at startup. */
-
-
-/* Public R/W variables */
-
-GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
- /* When there is insufficient memory to satisfy */
- /* an allocation request, we return */
- /* (*GC_oom_fn)(). By default this just */
- /* returns 0. */
- /* If it returns, it must return 0 or a valid */
- /* pointer to a previously allocated heap */
- /* object. */
-
-GC_API int GC_find_leak;
- /* Do not actually garbage collect, but simply */
- /* report inaccessible memory that was not */
- /* deallocated with GC_free. Initial value */
- /* is determined by FIND_LEAK macro. */
-
-GC_API int GC_quiet; /* Disable statistics output. Only matters if */
- /* collector has been compiled with statistics */
- /* enabled. This involves a performance cost, */
- /* and is thus not the default. */
-
-GC_API int GC_finalize_on_demand;
- /* If nonzero, finalizers will only be run in */
- /* response to an eplit GC_invoke_finalizers */
- /* call. The default is determined by whether */
- /* the FINALIZE_ON_DEMAND macro is defined */
- /* when the collector is built. */
-
-GC_API int GC_java_finalization;
- /* Mark objects reachable from finalizable */
- /* objects in a separate postpass. This makes */
- /* it a bit safer to use non-topologically- */
- /* ordered finalization. Default value is */
- /* determined by JAVA_FINALIZATION macro. */
-
-GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
- /* because it's not safe. */
-
-GC_API int GC_dont_expand;
- /* Dont expand heap unless explicitly requested */
- /* or forced to. */
-
-GC_API int GC_full_freq; /* Number of partial collections between */
- /* full collections. Matters only if */
- /* GC_incremental is set. */
-
-GC_API GC_word GC_non_gc_bytes;
- /* Bytes not considered candidates for collection. */
- /* Used only to control scheduling of collections. */
-
-GC_API GC_word GC_free_space_divisor;
- /* We try to make sure that we allocate at */
- /* least N/GC_free_space_divisor bytes between */
- /* collections, where N is the heap size plus */
- /* a rough estimate of the root set size. */
- /* Initially, GC_free_space_divisor = 4. */
- /* Increasing its value will use less space */
- /* but more collection time. Decreasing it */
- /* will appreciably decrease collection time */
- /* at the expense of space. */
- /* GC_free_space_divisor = 1 will effectively */
- /* disable collections. */
-
-GC_API GC_word GC_max_retries;
- /* The maximum number of GCs attempted before */
- /* reporting out of memory after heap */
- /* expansion fails. Initially 0. */
-
-
-GC_API char *GC_stackbottom; /* Cool end of user stack. */
- /* May be set in the client prior to */
- /* calling any GC_ routines. This */
- /* avoids some overhead, and */
- /* potentially some signals that can */
- /* confuse debuggers. Otherwise the */
- /* collector attempts to set it */
- /* automatically. */
- /* For multithreaded code, this is the */
- /* cold end of the stack for the */
- /* primordial thread. */
-
-/* Public procedures */
-/*
- * general purpose allocation routines, with roughly malloc calling conv.
- * The atomic versions promise that no relevant pointers are contained
- * in the object. The nonatomic versions guarantee that the new object
- * is cleared. GC_malloc_stubborn promises that no changes to the object
- * will occur after GC_end_stubborn_change has been called on the
- * result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
- * that is scanned for pointers to collectable objects, but is not itself
- * collectable. GC_malloc_uncollectable and GC_free called on the resulting
- * object implicitly update GC_non_gc_bytes appropriately.
- */
-GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
-
-/* The following is only defined if the library has been suitably */
-/* compiled: */
-GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
-
-/* Explicitly deallocate an object. Dangerous if used incorrectly. */
-/* Requires a pointer to the base of an object. */
-/* If the argument is stubborn, it should not be changeable when freed. */
-/* An object should not be enable for finalization when it is */
-/* explicitly deallocated. */
-/* GC_free(0) is a no-op, as required by ANSI C for free. */
-GC_API void GC_free GC_PROTO((GC_PTR object_addr));
-
-/*
- * Stubborn objects may be changed only if the collector is explicitly informed.
- * The collector is implicitly informed of coming change when such
- * an object is first allocated. The following routines inform the
- * collector that an object will no longer be changed, or that it will
- * once again be changed. Only nonNIL pointer stores into the object
- * are considered to be changes. The argument to GC_end_stubborn_change
- * must be exacly the value returned by GC_malloc_stubborn or passed to
- * GC_change_stubborn. (In the second case it may be an interior pointer
- * within 512 bytes of the beginning of the objects.)
- * There is a performance penalty for allowing more than
- * one stubborn object to be changed at once, but it is acceptable to
- * do so. The same applies to dropping stubborn objects that are still
- * changeable.
- */
-GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
-GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
-
-/* Return a pointer to the base (lowest address) of an object given */
-/* a pointer to a location within the object. */
-/* Return 0 if displaced_pointer doesn't point to within a valid */
-/* object. */
-GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
-
-/* Given a pointer to the base of an object, return its size in bytes. */
-/* The returned size may be slightly larger than what was originally */
-/* requested. */
-GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
-
-/* For compatibility with C library. This is occasionally faster than */
-/* a malloc followed by a bcopy. But if you rely on that, either here */
-/* or with the standard C library, your code is broken. In my */
-/* opinion, it shouldn't have been invented, but now we're stuck. -HB */
-/* The resulting object has the same kind as the original. */
-/* If the argument is stubborn, the result will have changes enabled. */
-/* It is an error to have changes enabled for the original object. */
-/* Follows ANSI comventions for NULL old_object. */
-GC_API GC_PTR GC_realloc
- GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes));
-
-/* Explicitly increase the heap size. */
-/* Returns 0 on failure, 1 on success. */
-GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
-
-/* Limit the heap size to n bytes. Useful when you're debugging, */
-/* especially on systems that don't handle running out of memory well. */
-/* n == 0 ==> unbounded. This is the default. */
-GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
-
-/* Inform the collector that a certain section of statically allocated */
-/* memory contains no pointers to garbage collected memory. Thus it */
-/* need not be scanned. This is sometimes important if the application */
-/* maps large read/write files into the address space, which could be */
-/* mistaken for dynamic library data segments on some systems. */
-GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
-
-/* Clear the set of root segments. Wizards only. */
-GC_API void GC_clear_roots GC_PROTO((void));
-
-/* Add a root segment. Wizards only. */
-GC_API void GC_add_roots GC_PROTO((char * low_address,
- char * high_address_plus_1));
-
-/* Add a displacement to the set of those considered valid by the */
-/* collector. GC_register_displacement(n) means that if p was returned */
-/* by GC_malloc, then (char *)p + n will be considered to be a valid */
-/* pointer to n. N must be small and less than the size of p. */
-/* (All pointers to the interior of objects from the stack are */
-/* considered valid in any case. This applies to heap objects and */
-/* static data.) */
-/* Preferably, this should be called before any other GC procedures. */
-/* Calling it later adds to the probability of excess memory */
-/* retention. */
-/* This is a no-op if the collector was compiled with recognition of */
-/* arbitrary interior pointers enabled, which is now the default. */
-GC_API void GC_register_displacement GC_PROTO((GC_word n));
-
-/* The following version should be used if any debugging allocation is */
-/* being done. */
-GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
-
-/* Explicitly trigger a full, world-stop collection. */
-GC_API void GC_gcollect GC_PROTO((void));
-
-/* Trigger a full world-stopped collection. Abort the collection if */
-/* and when stop_func returns a nonzero value. Stop_func will be */
-/* called frequently, and should be reasonably fast. This works even */
-/* if virtual dirty bits, and hence incremental collection is not */
-/* available for this architecture. Collections can be aborted faster */
-/* than normal pause times for incremental collection. However, */
-/* aborted collections do no useful work; the next collection needs */
-/* to start from the beginning. */
-/* Return 0 if the collection was aborted, 1 if it succeeded. */
-typedef int (* GC_stop_func) GC_PROTO((void));
-GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
-
-/* Return the number of bytes in the heap. Excludes collector private */
-/* data structures. Includes empty blocks and fragmentation loss. */
-/* Includes some pages that were allocated but never written. */
-GC_API size_t GC_get_heap_size GC_PROTO((void));
-
-/* Return the number of bytes allocated since the last collection. */
-GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
-
-/* Enable incremental/generational collection. */
-/* Not advisable unless dirty bits are */
-/* available or most heap objects are */
-/* pointerfree(atomic) or immutable. */
-/* Don't use in leak finding mode. */
-/* Ignored if GC_dont_gc is true. */
-GC_API void GC_enable_incremental GC_PROTO((void));
-
-/* Perform some garbage collection work, if appropriate. */
-/* Return 0 if there is no more work to be done. */
-/* Typically performs an amount of work corresponding roughly */
-/* to marking from one page. May do more work if further */
-/* progress requires it, e.g. if incremental collection is */
-/* disabled. It is reasonable to call this in a wait loop */
-/* until it returns 0. */
-GC_API int GC_collect_a_little GC_PROTO((void));
-
-/* Allocate an object of size lb bytes. The client guarantees that */
-/* as long as the object is live, it will be referenced by a pointer */
-/* that points to somewhere within the first 256 bytes of the object. */
-/* (This should normally be declared volatile to prevent the compiler */
-/* from invalidating this assertion.) This routine is only useful */
-/* if a large array is being allocated. It reduces the chance of */
-/* accidentally retaining such an array as a result of scanning an */
-/* integer that happens to be an address inside the array. (Actually, */
-/* it reduces the chance of the allocator not finding space for such */
-/* an array, since it will try hard to avoid introducing such a false */
-/* reference.) On a SunOS 4.X or MS Windows system this is recommended */
-/* for arrays likely to be larger than 100K or so. For other systems, */
-/* or if the collector is not configured to recognize all interior */
-/* pointers, the threshold is normally much higher. */
-GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
-GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
-
-#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
-# define GC_ADD_CALLER
-# define GC_RETURN_ADDR (GC_word)__return_address
-#endif
-
-#ifdef GC_ADD_CALLER
-# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
-# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
-#else
-# define GC_EXTRAS __FILE__, __LINE__
-# define GC_EXTRA_PARAMS char * descr_string, int descr_int
-#endif
-
-/* Debugging (annotated) allocation. GC_gcollect will check */
-/* objects allocated in this way for overwrites, etc. */
-GC_API GC_PTR GC_debug_malloc
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_atomic
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_uncollectable
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_stubborn
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
-GC_API GC_PTR GC_debug_realloc
- GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
- GC_EXTRA_PARAMS));
-
-GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
-GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
-# ifdef GC_DEBUG
-# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
-# define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
-# define GC_MALLOC_UNCOLLECTABLE(sz) GC_debug_malloc_uncollectable(sz, \
- GC_EXTRAS)
-# define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
-# define GC_FREE(p) GC_debug_free(p)
-# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
- GC_debug_register_finalizer(p, f, d, of, od)
-# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
- GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
-# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
-# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
-# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
-# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
- GC_general_register_disappearing_link(link, GC_base(obj))
-# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
-# else
-# define GC_MALLOC(sz) GC_malloc(sz)
-# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
-# define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
-# define GC_REALLOC(old, sz) GC_realloc(old, sz)
-# define GC_FREE(p) GC_free(p)
-# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
- GC_register_finalizer(p, f, d, of, od)
-# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
- GC_register_finalizer_ignore_self(p, f, d, of, od)
-# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
-# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
-# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
-# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
- GC_general_register_disappearing_link(link, obj)
-# define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
-# endif
-/* The following are included because they are often convenient, and */
-/* reduce the chance for a misspecifed size argument. But calls may */
-/* expand to something syntactically incorrect if t is a complicated */
-/* type expression. */
-# define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
-# define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
-# define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
-# define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
-
-/* Finalization. Some of these primitives are grossly unsafe. */
-/* The idea is to make them both cheap, and sufficient to build */
-/* a safer layer, closer to PCedar finalization. */
-/* The interface represents my conclusions from a long discussion */
-/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
-/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
-/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */
-typedef void (*GC_finalization_proc)
- GC_PROTO((GC_PTR obj, GC_PTR client_data));
-
-GC_API void GC_register_finalizer
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-GC_API void GC_debug_register_finalizer
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
- /* When obj is no longer accessible, invoke */
- /* (*fn)(obj, cd). If a and b are inaccessible, and */
- /* a points to b (after disappearing links have been */
- /* made to disappear), then only a will be */
- /* finalized. (If this does not create any new */
- /* pointers to b, then b will be finalized after the */
- /* next collection.) Any finalizable object that */
- /* is reachable from itself by following one or more */
- /* pointers will not be finalized (or collected). */
- /* Thus cycles involving finalizable objects should */
- /* be avoided, or broken by disappearing links. */
- /* All but the last finalizer registered for an object */
- /* is ignored. */
- /* Finalization may be removed by passing 0 as fn. */
- /* Finalizers are implicitly unregistered just before */
- /* they are invoked. */
- /* The old finalizer and client data are stored in */
- /* *ofn and *ocd. */
- /* Fn is never invoked on an accessible object, */
- /* provided hidden pointers are converted to real */
- /* pointers only if the allocation lock is held, and */
- /* such conversions are not performed by finalization */
- /* routines. */
- /* If GC_register_finalizer is aborted as a result of */
- /* a signal, the object may be left with no */
- /* finalization, even if neither the old nor new */
- /* finalizer were NULL. */
- /* Obj should be the nonNULL starting address of an */
- /* object allocated by GC_malloc or friends. */
- /* Note that any garbage collectable object referenced */
- /* by cd will be considered accessible until the */
- /* finalizer is invoked. */
-
-/* Another versions of the above follow. It ignores */
-/* self-cycles, i.e. pointers from a finalizable object to */
-/* itself. There is a stylistic argument that this is wrong, */
-/* but it's unavoidable for C++, since the compiler may */
-/* silently introduce these. It's also benign in that specific */
-/* case. */
-GC_API void GC_register_finalizer_ignore_self
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-GC_API void GC_debug_register_finalizer_ignore_self
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-
-/* The following routine may be used to break cycles between */
-/* finalizable objects, thus causing cyclic finalizable */
-/* objects to be finalized in the correct order. Standard */
-/* use involves calling GC_register_disappearing_link(&p), */
-/* where p is a pointer that is not followed by finalization */
-/* code, and should not be considered in determining */
-/* finalization order. */
-GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
- /* Link should point to a field of a heap allocated */
- /* object obj. *link will be cleared when obj is */
- /* found to be inaccessible. This happens BEFORE any */
- /* finalization code is invoked, and BEFORE any */
- /* decisions about finalization order are made. */
- /* This is useful in telling the finalizer that */
- /* some pointers are not essential for proper */
- /* finalization. This may avoid finalization cycles. */
- /* Note that obj may be resurrected by another */
- /* finalizer, and thus the clearing of *link may */
- /* be visible to non-finalization code. */
- /* There's an argument that an arbitrary action should */
- /* be allowed here, instead of just clearing a pointer. */
- /* But this causes problems if that action alters, or */
- /* examines connectivity. */
- /* Returns 1 if link was already registered, 0 */
- /* otherwise. */
- /* Only exists for backward compatibility. See below: */
-
-GC_API int GC_general_register_disappearing_link
- GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
- /* A slight generalization of the above. *link is */
- /* cleared when obj first becomes inaccessible. This */
- /* can be used to implement weak pointers easily and */
- /* safely. Typically link will point to a location */
- /* holding a disguised pointer to obj. (A pointer */
- /* inside an "atomic" object is effectively */
- /* disguised.) In this way soft */
- /* pointers are broken before any object */
- /* reachable from them are finalized. Each link */
- /* May be registered only once, i.e. with one obj */
- /* value. This was added after a long email discussion */
- /* with John Ellis. */
- /* Obj must be a pointer to the first word of an object */
- /* we allocated. It is unsafe to explicitly deallocate */
- /* the object containing link. Explicitly deallocating */
- /* obj may or may not cause link to eventually be */
- /* cleared. */
-GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
- /* Returns 0 if link was not actually registered. */
- /* Undoes a registration by either of the above two */
- /* routines. */
-
-/* Auxiliary fns to make finalization work correctly with displaced */
-/* pointers introduced by the debugging allocators. */
-GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
-GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
-
-GC_API int GC_invoke_finalizers GC_PROTO((void));
- /* Run finalizers for all objects that are ready to */
- /* be finalized. Return the number of finalizers */
- /* that were run. Normally this is also called */
- /* implicitly during some allocations. If */
- /* GC-finalize_on_demand is nonzero, it must be called */
- /* explicitly. */
-
-/* GC_set_warn_proc can be used to redirect or filter warning messages. */
-/* p may not be a NULL pointer. */
-typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
-GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
- /* Returns old warning procedure. */
-
-/* The following is intended to be used by a higher level */
-/* (e.g. cedar-like) finalization facility. It is expected */
-/* that finalization code will arrange for hidden pointers to */
-/* disappear. Otherwise objects can be accessed after they */
-/* have been collected. */
-/* Note that putting pointers in atomic objects or in */
-/* nonpointer slots of "typed" objects is equivalent to */
-/* disguising them in this way, and may have other advantages. */
-# if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
- typedef GC_word GC_hidden_pointer;
-# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
-# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
- /* Converting a hidden pointer to a real pointer requires verifying */
- /* that the object still exists. This involves acquiring the */
- /* allocator lock to avoid a race with the collector. */
-# endif /* I_HIDE_POINTERS */
-
-typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
-GC_API GC_PTR GC_call_with_alloc_lock
- GC_PROTO((GC_fn_type fn, GC_PTR client_data));
-
-/* Check that p and q point to the same object. */
-/* Fail conspicuously if they don't. */
-/* Returns the first argument. */
-/* Succeeds if neither p nor q points to the heap. */
-/* May succeed if both p and q point to between heap objects. */
-GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
-
-/* Checked pointer pre- and post- increment operations. Note that */
-/* the second argument is in units of bytes, not multiples of the */
-/* object size. This should either be invoked from a macro, or the */
-/* call should be automatically generated. */
-GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
-GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
-
-/* Check that p is visible */
-/* to the collector as a possibly pointer containing location. */
-/* If it isn't fail conspicuously. */
-/* Returns the argument in all cases. May erroneously succeed */
-/* in hard cases. (This is intended for debugging use with */
-/* untyped allocations. The idea is that it should be possible, though */
-/* slow, to add such a call to all indirect pointer stores.) */
-/* Currently useless for multithreaded worlds. */
-GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
-
-/* Check that if p is a pointer to a heap page, then it points to */
-/* a valid displacement within a heap object. */
-/* Fail conspicuously if this property does not hold. */
-/* Uninteresting with ALL_INTERIOR_POINTERS. */
-/* Always returns its argument. */
-GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
-
-/* Safer, but slow, pointer addition. Probably useful mainly with */
-/* a preprocessor. Useful only for heap pointers. */
-#ifdef GC_DEBUG
-# define GC_PTR_ADD3(x, n, type_of_result) \
- ((type_of_result)GC_same_obj((x)+(n), (x)))
-# define GC_PRE_INCR3(x, n, type_of_result) \
- ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
-# define GC_POST_INCR2(x, type_of_result) \
- ((type_of_result)GC_post_incr(&(x), sizeof(*x))
-# ifdef __GNUC__
-# define GC_PTR_ADD(x, n) \
- GC_PTR_ADD3(x, n, typeof(x))
-# define GC_PRE_INCR(x, n) \
- GC_PRE_INCR3(x, n, typeof(x))
-# define GC_POST_INCR(x, n) \
- GC_POST_INCR3(x, typeof(x))
-# else
- /* We can't do this right without typeof, which ANSI */
- /* decided was not sufficiently useful. Repeatedly */
- /* mentioning the arguments seems too dangerous to be */
- /* useful. So does not casting the result. */
-# define GC_PTR_ADD(x, n) ((x)+(n))
-# endif
-#else /* !GC_DEBUG */
-# define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
-# define GC_PTR_ADD(x, n) ((x)+(n))
-# define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
-# define GC_PRE_INCR(x, n) ((x) += (n))
-# define GC_POST_INCR2(x, n, type_of_result) ((x)++)
-# define GC_POST_INCR(x, n) ((x)++)
-#endif
-
-/* Safer assignment of a pointer to a nonstack location. */
-#ifdef GC_DEBUG
-# ifdef __STDC__
-# define GC_PTR_STORE(p, q) \
- (*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
-# else
-# define GC_PTR_STORE(p, q) \
- (*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
-# endif
-#else /* !GC_DEBUG */
-# define GC_PTR_STORE(p, q) *((p) = (q))
-#endif
-
-/* Fynctions called to report pointer checking errors */
-GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
-
-GC_API void (*GC_is_valid_displacement_print_proc)
- GC_PROTO((GC_PTR p));
-
-GC_API void (*GC_is_visible_print_proc)
- GC_PROTO((GC_PTR p));
-
-#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
-# define SOLARIS_THREADS
-#endif
-
-#ifdef SOLARIS_THREADS
-/* We need to intercept calls to many of the threads primitives, so */
-/* that we can locate thread stacks and stop the world. */
-/* Note also that the collector cannot see thread specific data. */
-/* Thread specific data should generally consist of pointers to */
-/* uncollectable objects, which are deallocated using the destructor */
-/* facility in thr_keycreate. */
-# include <thread.h>
-# include <signal.h>
- int GC_thr_create(void *stack_base, size_t stack_size,
- void *(*start_routine)(void *), void *arg, long flags,
- thread_t *new_thread);
- int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
- int GC_thr_suspend(thread_t target_thread);
- int GC_thr_continue(thread_t target_thread);
- void * GC_dlopen(const char *path, int mode);
-
-# ifdef _SOLARIS_PTHREADS
-# include <pthread.h>
- extern int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void * (*thread_execp)(void *), void *arg);
- extern int GC_pthread_join(pthread_t wait_for, void **status);
-
-# undef thread_t
-
-# define pthread_join GC_pthread_join
-# define pthread_create GC_pthread_create
-#endif
-
-# define thr_create GC_thr_create
-# define thr_join GC_thr_join
-# define thr_suspend GC_thr_suspend
-# define thr_continue GC_thr_continue
-# define dlopen GC_dlopen
-
-# endif /* SOLARIS_THREADS */
-
-
-#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
-/* We treat these similarly. */
-# include <pthread.h>
-# include <signal.h>
-
- int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void *(*start_routine)(void *), void *arg);
- int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
- int GC_pthread_join(pthread_t thread, void **retval);
-
-# define pthread_create GC_pthread_create
-# define pthread_sigmask GC_pthread_sigmask
-# define pthread_join GC_pthread_join
-
-#endif /* IRIX_THREADS || LINUX_THREADS */
-
-# if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
- defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
- defined(IRIX_JDK_THREADS)
- /* Any flavor of threads except SRC_M3. */
-/* This returns a list of objects, linked through their first */
-/* word. Its use can greatly reduce lock contention problems, since */
-/* the allocation lock can be acquired and released many fewer times. */
-/* lb must be large enough to hold the pointer field. */
-GC_PTR GC_malloc_many(size_t lb);
-#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
- /* in returned list. */
-extern void GC_thr_init(); /* Needed for Solaris/X86 */
-
-#endif /* THREADS && !SRC_M3 */
-
-/*
- * If you are planning on putting
- * the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
- * from the statically loaded program section.
- * This circumvents a Solaris 2.X (X<=4) linker bug.
- */
-#if defined(sparc) || defined(__sparc)
-# define GC_INIT() { extern end, etext; \
- GC_noop(&end, &etext); }
-#else
-# if defined(__CYGWIN32__) && defined(GC_USE_DLL)
- /*
- * Similarly gnu-win32 DLLs need explicit initialization
- */
-# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
-# else
-# define GC_INIT()
-# endif
-#endif
-
-#if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32)
- /* win32S may not free all resources on process exit. */
- /* This explicitly deallocates the heap. */
- GC_API void GC_win32_free_heap ();
-#endif
-
-#ifdef __cplusplus
- } /* end of extern "C" */
-#endif
-
-#endif /* _GC_H */
diff --git a/gc/cord/private/cord_pos.h b/gc/cord/private/cord_pos.h
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/* Boehm, May 19, 1994 2:23 pm PDT */
-# ifndef CORD_POSITION_H
-
-/* The representation of CORD_position. This is private to the */
-/* implementation, but the size is known to clients. Also */
-/* the implementation of some exported macros relies on it. */
-/* Don't use anything defined here and not in cord.h. */
-
-# define MAX_DEPTH 48
- /* The maximum depth of a balanced cord + 1. */
- /* We don't let cords get deeper than MAX_DEPTH. */
-
-struct CORD_pe {
- CORD pe_cord;
- size_t pe_start_pos;
-};
-
-/* A structure describing an entry on the path from the root */
-/* to current position. */
-typedef struct CORD_Pos {
- size_t cur_pos;
- int path_len;
-# define CORD_POS_INVALID (0x55555555)
- /* path_len == INVALID <==> position invalid */
- const char *cur_leaf; /* Current leaf, if it is a string. */
- /* If the current leaf is a function, */
- /* then this may point to function_buf */
- /* containing the next few characters. */
- /* Always points to a valid string */
- /* containing the current character */
- /* unless cur_end is 0. */
- size_t cur_start; /* Start position of cur_leaf */
- size_t cur_end; /* Ending position of cur_leaf */
- /* 0 if cur_leaf is invalid. */
- struct CORD_pe path[MAX_DEPTH + 1];
- /* path[path_len] is the leaf corresponding to cur_pos */
- /* path[0].pe_cord is the cord we point to. */
-# define FUNCTION_BUF_SZ 8
- char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */
- /* from function node. */
-} CORD_pos[1];
-
-/* Extract the cord from a position: */
-CORD CORD_pos_to_cord(CORD_pos p);
-
-/* Extract the current index from a position: */
-size_t CORD_pos_to_index(CORD_pos p);
-
-/* Fetch the character located at the given position: */
-char CORD_pos_fetch(CORD_pos p);
-
-/* Initialize the position to refer to the give cord and index. */
-/* Note that this is the most expensive function on positions: */
-void CORD_set_pos(CORD_pos p, CORD x, size_t i);
-
-/* Advance the position to the next character. */
-/* P must be initialized and valid. */
-/* Invalidates p if past end: */
-void CORD_next(CORD_pos p);
-
-/* Move the position to the preceding character. */
-/* P must be initialized and valid. */
-/* Invalidates p if past beginning: */
-void CORD_prev(CORD_pos p);
-
-/* Is the position valid, i.e. inside the cord? */
-int CORD_pos_valid(CORD_pos p);
-
-char CORD__pos_fetch(CORD_pos);
-void CORD__next(CORD_pos);
-void CORD__prev(CORD_pos);
-
-#define CORD_pos_fetch(p) \
- (((p)[0].cur_end != 0)? \
- (p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \
- : CORD__pos_fetch(p))
-
-#define CORD_next(p) \
- (((p)[0].cur_pos + 1 < (p)[0].cur_end)? \
- (p)[0].cur_pos++ \
- : (CORD__next(p), 0))
-
-#define CORD_prev(p) \
- (((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \
- (p)[0].cur_pos-- \
- : (CORD__prev(p), 0))
-
-#define CORD_pos_to_index(p) ((p)[0].cur_pos)
-
-#define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord)
-
-#define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID)
-
-/* Some grubby stuff for performance-critical friends: */
-#define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos))
- /* Number of characters in cache. <= 0 ==> none */
-
-#define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p))
- /* Advance position by n characters */
- /* 0 < n < CORD_pos_chars_left(p) */
-
-#define CORD_pos_cur_char_addr(p) \
- (p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start)
- /* address of current character in cache. */
-
-#endif
diff --git a/gc/dbg_mlc.c b/gc/dbg_mlc.c
@@ -2,6 +2,7 @@
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
* Copyright (c) 1997 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999-2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -12,69 +13,26 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-# define I_HIDE_POINTERS
-# include "gc_priv.h"
-# ifdef KEEP_BACK_PTRS
-# include "backptr.h"
-# endif
+
+#include "private/dbg_mlc.h"
void GC_default_print_heap_obj_proc();
GC_API void GC_register_finalizer_no_order
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
-/* Do we want to and know how to save the call stack at the time of */
-/* an allocation? How much space do we want to use in each object? */
-
-# define START_FLAG ((word)0xfedcedcb)
-# define END_FLAG ((word)0xbcdecdef)
- /* Stored both one past the end of user object, and one before */
- /* the end of the object as seen by the allocator. */
-
-
-/* Object header */
-typedef struct {
-# ifdef KEEP_BACK_PTRS
- ptr_t oh_back_ptr;
-# define MARKED_FOR_FINALIZATION (ptr_t)(-1)
- /* Object was marked because it is finalizable. */
-# ifdef ALIGN_DOUBLE
- word oh_dummy;
-# endif
-# endif
- char * oh_string; /* object descriptor string */
- word oh_int; /* object descriptor integers */
-# ifdef NEED_CALLINFO
- struct callinfo oh_ci[NFRAMES];
-# endif
- word oh_sz; /* Original malloc arg. */
- word oh_sf; /* start flag */
-} oh;
-/* The size of the above structure is assumed not to dealign things, */
-/* and to be a multiple of the word length. */
-
-#define DEBUG_BYTES (sizeof (oh) + sizeof (word))
-#undef ROUNDED_UP_WORDS
-#define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)
-
-
-#ifdef SAVE_CALL_CHAIN
-# define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci)
-# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
-#else
-# ifdef GC_ADD_CALLER
-# define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra)
-# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
-# else
-# define ADD_CALL_CHAIN(base, ra)
-# define PRINT_CALL_CHAIN(base)
-# endif
-#endif
+#ifndef SHORT_DBG_HDRS
/* Check whether object with base pointer p has debugging info */
/* p is assumed to point to a legitimate object in our part */
/* of the heap. */
-GC_bool GC_has_debug_info(p)
+/* This excludes the check as to whether the back pointer is */
+/* odd, which is added by the GC_HAS_DEBUG_INFO macro. */
+/* Note that if DBG_HDRS_ALL is set, uncollectable objects */
+/* on free lists may not have debug information set. Thus it's */
+/* not always safe to return TRUE, even if the client does */
+/* its part. */
+GC_bool GC_has_other_debug_info(p)
ptr_t p;
{
register oh * ohdr = (oh *)p;
@@ -95,8 +53,19 @@ ptr_t p;
}
return(FALSE);
}
+#endif
#ifdef KEEP_BACK_PTRS
+
+# include <stdlib.h>
+
+# if defined(LINUX) || defined(SUNOS4) || defined(SUNOS5) \
+ || defined(HPUX) || defined(IRIX) || defined(OSF1)
+# define RANDOM() random()
+# else
+# define RANDOM() (long)rand()
+# endif
+
/* Store back pointer to source in dest, if that appears to be possible. */
/* This is not completely safe, since we may mistakenly conclude that */
/* dest has a debugging wrapper. But the error probability is very */
@@ -105,8 +74,8 @@ ptr_t p;
/* be a pointer to the interior of an object. */
void GC_store_back_pointer(ptr_t source, ptr_t dest)
{
- if (GC_has_debug_info(dest)) {
- ((oh *)dest) -> oh_back_ptr = (ptr_t)HIDE_POINTER(source);
+ if (GC_HAS_DEBUG_INFO(dest)) {
+ ((oh *)dest) -> oh_back_ptr = HIDE_BACK_PTR(source);
}
}
@@ -116,7 +85,7 @@ ptr_t p;
/* Store information about the object referencing dest in *base_p */
/* and *offset_p. */
- /* source is root ==> *base_p = 0, *offset_p = address */
+ /* source is root ==> *base_p = address, *offset_p = 0 */
/* source is heap object ==> *base_p != 0, *offset_p = offset */
/* Returns 1 on success, 0 if source couldn't be determined. */
/* Dest can be any address within a heap object. */
@@ -125,18 +94,34 @@ ptr_t p;
oh * hdr = (oh *)GC_base(dest);
ptr_t bp;
ptr_t bp_base;
- if (!GC_has_debug_info((ptr_t) hdr)) return GC_NO_SPACE;
- bp = hdr -> oh_back_ptr;
+ if (!GC_HAS_DEBUG_INFO((ptr_t) hdr)) return GC_NO_SPACE;
+ bp = REVEAL_POINTER(hdr -> oh_back_ptr);
if (MARKED_FOR_FINALIZATION == bp) return GC_FINALIZER_REFD;
- if (0 == bp) return GC_UNREFERENCED;
- bp = REVEAL_POINTER(bp);
+ if (MARKED_FROM_REGISTER == bp) return GC_REFD_FROM_REG;
+ if (NOT_MARKED == bp) return GC_UNREFERENCED;
+# if ALIGNMENT == 1
+ /* Heuristically try to fix off by 1 errors we introduced by */
+ /* insisting on even addresses. */
+ {
+ ptr_t alternate_ptr = bp + 1;
+ ptr_t target = *(ptr_t *)bp;
+ ptr_t alternate_target = *(ptr_t *)alternate_ptr;
+
+ if (alternate_target >= GC_least_plausible_heap_addr
+ && alternate_target <= GC_greatest_plausible_heap_addr
+ && (target < GC_least_plausible_heap_addr
+ || target > GC_greatest_plausible_heap_addr)) {
+ bp = alternate_ptr;
+ }
+ }
+# endif
bp_base = GC_base(bp);
if (0 == bp_base) {
*base_p = bp;
*offset_p = 0;
return GC_REFD_FROM_ROOT;
} else {
- if (GC_has_debug_info(bp_base)) bp_base += sizeof(oh);
+ if (GC_HAS_DEBUG_INFO(bp_base)) bp_base += sizeof(oh);
*base_p = bp_base;
*offset_p = bp - bp_base;
return GC_REFD_FROM_HEAP;
@@ -149,7 +134,15 @@ ptr_t p;
void *GC_generate_random_heap_address(void)
{
int i;
- int heap_offset = random() % GC_heapsize;
+ long heap_offset = RANDOM();
+ if (GC_heapsize > RAND_MAX) {
+ heap_offset *= RAND_MAX;
+ heap_offset += RANDOM();
+ }
+ heap_offset %= GC_heapsize;
+ /* This doesn't yield a uniform distribution, especially if */
+ /* e.g. RAND_MAX = 1.5* GC_heapsize. But for typical cases, */
+ /* it's not too bad. */
for (i = 0; i < GC_n_heap_sects; ++ i) {
int size = GC_heap_sects[i].hs_bytes;
if (heap_offset < size) {
@@ -177,18 +170,15 @@ ptr_t p;
}
}
- /* Force a garbage collection and generate a backtrace from a */
- /* random heap address. */
- void GC_generate_random_backtrace(void)
+ /* Print back trace for p */
+ void GC_print_backtrace(void *p)
{
- void * current;
+ void *current = p;
int i;
- void * base;
- size_t offset;
GC_ref_kind source;
- GC_gcollect();
- current = GC_generate_random_valid_address();
- GC_printf1("Chose address 0x%lx in object\n", (unsigned long)current);
+ size_t offset;
+ void *base;
+
GC_print_heap_obj(GC_base(current));
GC_err_printf0("\n");
for (i = 0; ; ++i) {
@@ -207,6 +197,9 @@ ptr_t p;
case GC_REFD_FROM_ROOT:
GC_err_printf1("root at 0x%lx\n", (unsigned long)base);
goto out;
+ case GC_REFD_FROM_REG:
+ GC_err_printf0("root in register\n");
+ goto out;
case GC_FINALIZER_REFD:
GC_err_printf0("list of finalizable objects\n");
goto out;
@@ -221,6 +214,17 @@ ptr_t p;
}
out:;
}
+
+ /* Force a garbage collection and generate a backtrace from a */
+ /* random heap address. */
+ void GC_generate_random_backtrace(void)
+ {
+ void * current;
+ GC_gcollect();
+ current = GC_generate_random_valid_address();
+ GC_printf1("Chose address 0x%lx in object\n", (unsigned long)current);
+ GC_print_backtrace(current);
+ }
#endif /* KEEP_BACK_PTRS */
@@ -229,7 +233,7 @@ ptr_t p;
ptr_t GC_store_debug_info(p, sz, string, integer)
register ptr_t p; /* base pointer */
word sz; /* bytes */
-char * string;
+GC_CONST char * string;
word integer;
{
register word * result = (word *)((oh *)p + 1);
@@ -240,18 +244,50 @@ word integer;
/* inconsistent while we're in the handler. */
LOCK();
# ifdef KEEP_BACK_PTRS
- ((oh *)p) -> oh_back_ptr = 0;
+ ((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
# endif
((oh *)p) -> oh_string = string;
((oh *)p) -> oh_int = integer;
- ((oh *)p) -> oh_sz = sz;
- ((oh *)p) -> oh_sf = START_FLAG ^ (word)result;
- ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
- result[ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
+# ifndef SHORT_DBG_HDRS
+ ((oh *)p) -> oh_sz = sz;
+ ((oh *)p) -> oh_sf = START_FLAG ^ (word)result;
+ ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
+ result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
+# endif
UNLOCK();
return((ptr_t)result);
}
+#ifdef DBG_HDRS_ALL
+/* Store debugging info into p. Return displaced pointer. */
+/* This version assumes we do hold the allocation lock. */
+ptr_t GC_store_debug_info_inner(p, sz, string, integer)
+register ptr_t p; /* base pointer */
+word sz; /* bytes */
+char * string;
+word integer;
+{
+ register word * result = (word *)((oh *)p + 1);
+
+ /* There is some argument that we should disable signals here. */
+ /* But that's expensive. And this way things should only appear */
+ /* inconsistent while we're in the handler. */
+# ifdef KEEP_BACK_PTRS
+ ((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
+# endif
+ ((oh *)p) -> oh_string = string;
+ ((oh *)p) -> oh_int = integer;
+# ifndef SHORT_DBG_HDRS
+ ((oh *)p) -> oh_sz = sz;
+ ((oh *)p) -> oh_sf = START_FLAG ^ (word)result;
+ ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
+ result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
+# endif
+ return((ptr_t)result);
+}
+#endif
+
+#ifndef SHORT_DBG_HDRS
/* Check the object with debugging info at ohdr */
/* return NIL if it's OK. Else return clobbered */
/* address. */
@@ -269,12 +305,13 @@ register oh * ohdr;
if (((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1] != (END_FLAG ^ (word)body)) {
return((ptr_t)((word *)ohdr + BYTES_TO_WORDS(gc_sz)-1));
}
- if (((word *)body)[ROUNDED_UP_WORDS(ohdr -> oh_sz)]
+ if (((word *)body)[SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)]
!= (END_FLAG ^ (word)body)) {
- return((ptr_t)((word *)body + ROUNDED_UP_WORDS(ohdr -> oh_sz)));
+ return((ptr_t)((word *)body + SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)));
}
return(0);
}
+#endif /* !SHORT_DBG_HDRS */
void GC_print_obj(p)
ptr_t p;
@@ -283,21 +320,30 @@ ptr_t p;
GC_err_printf1("0x%lx (", ((unsigned long)ohdr + sizeof(oh)));
GC_err_puts(ohdr -> oh_string);
- GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
- (unsigned long)(ohdr -> oh_sz));
+# ifdef SHORT_DBG_HDRS
+ GC_err_printf1(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int));
+# else
+ GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
+ (unsigned long)(ohdr -> oh_sz));
+# endif
PRINT_CALL_CHAIN(ohdr);
}
-void GC_debug_print_heap_obj_proc(p)
-ptr_t p;
+# if defined(__STDC__) || defined(__cplusplus)
+ void GC_debug_print_heap_obj_proc(ptr_t p)
+# else
+ void GC_debug_print_heap_obj_proc(p)
+ ptr_t p;
+# endif
{
- if (GC_has_debug_info(p)) {
+ if (GC_HAS_DEBUG_INFO(p)) {
GC_print_obj(p);
} else {
GC_default_print_heap_obj_proc(p);
}
}
+#ifndef SHORT_DBG_HDRS
void GC_print_smashed_obj(p, clobbered_addr)
ptr_t p, clobbered_addr;
{
@@ -320,12 +366,19 @@ ptr_t p, clobbered_addr;
PRINT_CALL_CHAIN(ohdr);
}
}
+#endif
+
+void GC_check_heap_proc GC_PROTO((void));
-void GC_check_heap_proc();
+void GC_do_nothing() {}
void GC_start_debugging()
{
- GC_check_heap = GC_check_heap_proc;
+# ifndef SHORT_DBG_HDRS
+ GC_check_heap = GC_check_heap_proc;
+# else
+ GC_check_heap = GC_do_nothing;
+# endif
GC_print_heap_obj = GC_debug_print_heap_obj_proc;
GC_debugging_started = TRUE;
GC_register_displacement((word)sizeof(oh));
@@ -342,16 +395,8 @@ void GC_start_debugging()
GC_register_displacement((word)sizeof(oh) + offset);
}
-# ifdef GC_ADD_CALLER
-# define EXTRA_ARGS word ra, char * s, int i
-# define OPT_RA ra,
-# else
-# define EXTRA_ARGS char * s, int i
-# define OPT_RA
-# endif
-
# ifdef __STDC__
- GC_PTR GC_debug_malloc(size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_malloc(lb, s, i)
size_t lb;
@@ -378,9 +423,46 @@ void GC_start_debugging()
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
+# ifdef DBG_HDRS_ALL
+/*
+ * An allocation function for internal use.
+ * Normally internally allocated objects do not have debug information.
+ * But in this case, we need to make sure that all objects have debug
+ * headers.
+ * We assume debugging was started in collector initialization,
+ * and we already hold the GC lock.
+ */
+ GC_PTR GC_debug_generic_malloc_inner(size_t lb, int k)
+ {
+ GC_PTR result = GC_generic_malloc_inner(lb + DEBUG_BYTES, k);
+
+ if (result == 0) {
+ GC_err_printf1("GC internal allocation (%ld bytes) returning NIL\n",
+ (unsigned long) lb);
+ return(0);
+ }
+ ADD_CALL_CHAIN(result, ra);
+ return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0));
+ }
+
+ GC_PTR GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k)
+ {
+ GC_PTR result = GC_generic_malloc_inner_ignore_off_page(
+ lb + DEBUG_BYTES, k);
+
+ if (result == 0) {
+ GC_err_printf1("GC internal allocation (%ld bytes) returning NIL\n",
+ (unsigned long) lb);
+ return(0);
+ }
+ ADD_CALL_CHAIN(result, ra);
+ return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0));
+ }
+# endif
+
#ifdef STUBBORN_ALLOC
# ifdef __STDC__
- GC_PTR GC_debug_malloc_stubborn(size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_malloc_stubborn(lb, s, i)
size_t lb;
@@ -444,10 +526,34 @@ GC_PTR p;
GC_end_stubborn_change(q);
}
-#endif /* STUBBORN_ALLOC */
+#else /* !STUBBORN_ALLOC */
# ifdef __STDC__
- GC_PTR GC_debug_malloc_atomic(size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
+# else
+ GC_PTR GC_debug_malloc_stubborn(lb, s, i)
+ size_t lb;
+ char * s;
+ int i;
+# endif
+{
+ return GC_debug_malloc(lb, OPT_RA s, i);
+}
+
+void GC_debug_change_stubborn(p)
+GC_PTR p;
+{
+}
+
+void GC_debug_end_stubborn_change(p)
+GC_PTR p;
+{
+}
+
+#endif /* !STUBBORN_ALLOC */
+
+# ifdef __STDC__
+ GC_PTR GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_malloc_atomic(lb, s, i)
size_t lb;
@@ -472,7 +578,7 @@ GC_PTR p;
}
# ifdef __STDC__
- GC_PTR GC_debug_malloc_uncollectable(size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_malloc_uncollectable(lb, s, i)
size_t lb;
@@ -498,7 +604,7 @@ GC_PTR p;
#ifdef ATOMIC_UNCOLLECTABLE
# ifdef __STDC__
- GC_PTR GC_debug_malloc_atomic_uncollectable(size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_malloc_atomic_uncollectable(size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_malloc_atomic_uncollectable(lb, s, i)
size_t lb;
@@ -531,31 +637,35 @@ GC_PTR p;
GC_PTR p;
# endif
{
- register GC_PTR base = GC_base(p);
+ register GC_PTR base;
register ptr_t clobbered;
+ if (0 == p) return;
+ base = GC_base(p);
if (base == 0) {
GC_err_printf1("Attempt to free invalid pointer %lx\n",
(unsigned long)p);
- if (p != 0) ABORT("free(invalid pointer)");
+ ABORT("free(invalid pointer)");
}
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
GC_err_printf1(
"GC_debug_free called on pointer %lx wo debugging info\n",
(unsigned long)p);
} else {
- clobbered = GC_check_annotated_obj((oh *)base);
- if (clobbered != 0) {
- if (((oh *)base) -> oh_sz == GC_size(base)) {
+# ifndef SHORT_DBG_HDRS
+ clobbered = GC_check_annotated_obj((oh *)base);
+ if (clobbered != 0) {
+ if (((oh *)base) -> oh_sz == GC_size(base)) {
GC_err_printf0(
"GC_debug_free: found previously deallocated (?) object at ");
- } else {
+ } else {
GC_err_printf0("GC_debug_free: found smashed location at ");
+ }
+ GC_print_smashed_obj(p, clobbered);
}
- GC_print_smashed_obj(p, clobbered);
- }
- /* Invalidate size */
- ((oh *)base) -> oh_sz = GC_size(base);
+ /* Invalidate size */
+ ((oh *)base) -> oh_sz = GC_size(base);
+# endif /* SHORT_DBG_HDRS */
}
if (GC_find_leak) {
GC_free(base);
@@ -575,8 +685,19 @@ GC_PTR p;
} /* !GC_find_leak */
}
+#ifdef THREADS
+
+extern void GC_free_inner(GC_PTR p);
+
+/* Used internally; we assume it's called correctly. */
+void GC_debug_free_inner(GC_PTR p)
+{
+ GC_free_inner(GC_base(p));
+}
+#endif
+
# ifdef __STDC__
- GC_PTR GC_debug_realloc(GC_PTR p, size_t lb, EXTRA_ARGS)
+ GC_PTR GC_debug_realloc(GC_PTR p, size_t lb, GC_EXTRA_PARAMS)
# else
GC_PTR GC_debug_realloc(p, lb, s, i)
GC_PTR p;
@@ -629,12 +750,16 @@ GC_PTR p;
GC_err_printf0("GC_debug_realloc: encountered bad kind\n");
ABORT("bad kind");
}
- clobbered = GC_check_annotated_obj((oh *)base);
- if (clobbered != 0) {
+# ifdef SHORT_DBG_HDRS
+ old_sz = GC_size(base) - sizeof(oh);
+# else
+ clobbered = GC_check_annotated_obj((oh *)base);
+ if (clobbered != 0) {
GC_err_printf0("GC_debug_realloc: found smashed location at ");
GC_print_smashed_obj(p, clobbered);
- }
- old_sz = ((oh *)base) -> oh_sz;
+ }
+ old_sz = ((oh *)base) -> oh_sz;
+# endif
if (old_sz < copy_sz) copy_sz = old_sz;
if (result == 0) return(0);
BCOPY(p, result, copy_sz);
@@ -642,11 +767,16 @@ GC_PTR p;
return(result);
}
+#ifndef SHORT_DBG_HDRS
/* Check all marked objects in the given block for validity */
/*ARGSUSED*/
-void GC_check_heap_block(hbp, dummy)
-register struct hblk *hbp; /* ptr to current heap block */
-word dummy;
+# if defined(__STDC__) || defined(__cplusplus)
+ void GC_check_heap_block(register struct hblk *hbp, word dummy)
+# else
+ void GC_check_heap_block(hbp, dummy)
+ register struct hblk *hbp; /* ptr to current heap block */
+ word dummy;
+# endif
{
register struct hblkhdr * hhdr = HDR(hbp);
register word sz = hhdr -> hb_sz;
@@ -654,7 +784,7 @@ word dummy;
register word *p, *plim;
p = (word *)(hbp->hb_body);
- word_no = HDR_WORDS;
+ word_no = 0;
if (sz > MAXOBJSZ) {
plim = p;
} else {
@@ -663,7 +793,7 @@ word dummy;
/* go through all words in block */
while( p <= plim ) {
if( mark_bit_from_hdr(hhdr, word_no)
- && GC_has_debug_info((ptr_t)p)) {
+ && GC_HAS_DEBUG_INFO((ptr_t)p)) {
ptr_t clobbered = GC_check_annotated_obj((oh *)p);
if (clobbered != 0) {
@@ -690,6 +820,8 @@ void GC_check_heap_proc()
GC_apply_to_all_blocks(GC_check_heap_block, (word)0);
}
+#endif /* !SHORT_DBG_HDRS */
+
struct closure {
GC_finalization_proc cl_fn;
GC_PTR cl_data;
@@ -704,7 +836,12 @@ struct closure {
# endif
{
struct closure * result =
- (struct closure *) GC_malloc(sizeof (struct closure));
+# ifdef DBG_HDRS_ALL
+ (struct closure *) GC_debug_malloc(sizeof (struct closure),
+ GC_EXTRAS);
+# else
+ (struct closure *) GC_malloc(sizeof (struct closure));
+# endif
result -> cl_fn = fn;
result -> cl_data = data;
@@ -797,3 +934,22 @@ struct closure {
GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer,
GC_make_closure(fn,cd), ofn, ocd);
}
+
+#ifdef GC_ADD_CALLER
+# define RA GC_RETURN_ADDR,
+#else
+# define RA
+#endif
+
+GC_PTR GC_debug_malloc_replacement(lb)
+size_t lb;
+{
+ return GC_debug_malloc(lb, RA "unknown", 0);
+}
+
+GC_PTR GC_debug_realloc_replacement(p, lb)
+GC_PTR p;
+size_t lb;
+{
+ return GC_debug_realloc(p, lb, RA "unknown", 0);
+}
diff --git a/gc/digimars.mak b/gc/digimars.mak
@@ -0,0 +1,90 @@
+# Makefile to build Hans Boehm garbage collector using the Digital Mars
+# compiler from www.digitalmars.com
+# Written by Walter Bright
+
+
+DEFINES=-DNDEBUG -DSILENT -DGC_BUILD -D_WINDOWS -DGC_DLL -DALL_INTERIOR_POINTERS -D__STDC__ -DWIN32_THREADS
+CFLAGS=-Iinclude $(DEFINES) -wx -g
+LFLAGS=/ma/implib/co
+CC=sc
+
+.c.obj:
+ $(CC) -c $(CFLAGS) $*
+
+.cpp.obj:
+ $(CC) -c $(CFLAGS) -Aa $*
+
+OBJS= \
+ allchblk.obj\
+ alloc.obj\
+ blacklst.obj\
+ checksums.obj\
+ dbg_mlc.obj\
+ dyn_load.obj\
+ finalize.obj\
+ gc_cpp.obj\
+ headers.obj\
+ mach_dep.obj\
+ malloc.obj\
+ mallocx.obj\
+ mark.obj\
+ mark_rts.obj\
+ misc.obj\
+ new_hblk.obj\
+ obj_map.obj\
+ os_dep.obj\
+ ptr_chck.obj\
+ reclaim.obj\
+ stubborn.obj\
+ typd_mlc.obj\
+ win32_threads.obj
+
+targets: gc.dll gc.lib gctest.exe
+
+gc.dll: $(OBJS) gc.def digimars.mak
+ sc -ogc.dll $(OBJS) -L$(LFLAGS) gc.def kernel32.lib user32.lib
+
+gc.def: digimars.mak
+ echo LIBRARY GC >gc.def
+ echo DESCRIPTION "Hans Boehm Garbage Collector" >>gc.def
+ echo EXETYPE NT >>gc.def
+ echo EXPORTS >>gc.def
+ echo GC_is_visible_print_proc >>gc.def
+ echo GC_is_valid_displacement_print_proc >>gc.def
+
+clean:
+ del gc.def
+ del $(OBJS)
+
+
+gctest.exe : gc.lib tests\test.obj
+ sc -ogctest.exe tests\test.obj gc.lib
+
+tests\test.obj : tests\test.c
+ $(CC) -c -g -DNDEBUG -DSILENT -DGC_BUILD -D_WINDOWS -DGC_DLL \
+ -DALL_INTERIOR_POINTERS -DWIN32_THREADS \
+ -Iinclude tests\test.c -otests\test.obj
+
+allchblk.obj: allchblk.c
+alloc.obj: alloc.c
+blacklst.obj: blacklst.c
+checksums.obj: checksums.c
+dbg_mlc.obj: dbg_mlc.c
+dyn_load.obj: dyn_load.c
+finalize.obj: finalize.c
+gc_cpp.obj: gc_cpp.cpp
+headers.obj: headers.c
+mach_dep.obj: mach_dep.c
+malloc.obj: malloc.c
+mallocx.obj: mallocx.c
+mark.obj: mark.c
+mark_rts.obj: mark_rts.c
+misc.obj: misc.c
+new_hblk.obj: new_hblk.c
+obj_map.obj: obj_map.c
+os_dep.obj: os_dep.c
+ptr_chck.obj: ptr_chck.c
+reclaim.obj: reclaim.c
+stubborn.obj: stubborn.c
+typd_mlc.obj: typd_mlc.c
+win32_threads.obj: win32_threads.c
diff --git a/gc/dyn_load.c b/gc/dyn_load.c
@@ -26,13 +26,15 @@
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
-#ifndef MACOS
+#if !defined(MACOS) && !defined(_WIN32_WCE)
# include <sys/types.h>
#endif
-#include "gc_priv.h"
+#include "private/gc_priv.h"
/* BTL: avoid circular redefinition of dlopen if SOLARIS_THREADS defined */
-# if defined(SOLARIS_THREADS) && defined(dlopen)
+# if (defined(LINUX_THREADS) || defined(SOLARIS_THREADS) \
+ || defined(HPUX_THREADS) || defined(IRIX_THREADS)) && defined(dlopen) \
+ && !defined(GC_USE_LD_WRAP)
/* To support threads in Solaris, gc.h interposes on dlopen by */
/* defining "dlopen" to be "GC_dlopen", which is implemented below. */
/* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */
@@ -44,11 +46,14 @@
# undef GC_must_restore_redefined_dlopen
# endif
-#if (defined(DYNAMIC_LOADING) || defined(MSWIN32)) && !defined(PCR)
+#if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE)) \
+ && !defined(PCR)
#if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
- !defined(MSWIN32) && !(defined(ALPHA) && defined(OSF1)) && \
- !defined(HP_PA) && !(defined(LINUX) && defined(__ELF__)) && \
- !defined(RS6000) && !defined(SCO_ELF)
+ !defined(MSWIN32) && !defined(MSWINCE) && \
+ !(defined(ALPHA) && defined(OSF1)) && \
+ !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \
+ !defined(RS6000) && !defined(SCO_ELF) && \
+ !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
--> hard to add.
@@ -119,6 +124,11 @@ GC_FirstDLOpenedLinkMap()
#endif /* SUNOS5DL ... */
+/* BTL: added to fix circular dlopen definition if SOLARIS_THREADS defined */
+# if defined(GC_must_restore_redefined_dlopen)
+# define dlopen GC_dlopen
+# endif
+
#if defined(SUNOS4) && !defined(USE_PROC_FOR_LIBRARIES)
#ifdef LINT
@@ -167,34 +177,6 @@ static ptr_t GC_first_common()
# endif /* We assume M3 programs don't call dlopen for now */
# endif
-# ifdef SOLARIS_THREADS
- /* Redefine dlopen to guarantee mutual exclusion with */
- /* GC_register_dynamic_libraries. */
- /* assumes that dlopen doesn't need to call GC_malloc */
- /* and friends. */
-# include <thread.h>
-# include <synch.h>
-
-void * GC_dlopen(const char *path, int mode)
-{
- void * result;
-
-# ifndef USE_PROC_FOR_LIBRARIES
- mutex_lock(&GC_allocate_ml);
-# endif
- result = dlopen(path, mode);
-# ifndef USE_PROC_FOR_LIBRARIES
- mutex_unlock(&GC_allocate_ml);
-# endif
- return(result);
-}
-# endif /* SOLARIS_THREADS */
-
-/* BTL: added to fix circular dlopen definition if SOLARIS_THREADS defined */
-# if defined(GC_must_restore_redefined_dlopen)
-# define dlopen GC_dlopen
-# endif
-
# ifndef USE_PROC_FOR_LIBRARIES
void GC_register_dynamic_libraries()
{
@@ -260,14 +242,193 @@ void GC_register_dynamic_libraries()
# endif /* !USE_PROC ... */
# endif /* SUNOS */
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+ (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+
+
+#ifdef USE_PROC_FOR_LIBRARIES
+
+#include <string.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define MAPS_BUF_SIZE (32*1024)
+
+extern ssize_t GC_repeat_read(int fd, char *buf, size_t count);
+ /* Repeatedly read until buffer is filled, or EOF is encountered */
+ /* Defined in os_dep.c. */
+
+static char *parse_map_entry(char *buf_ptr, word *start, word *end,
+ char *prot_buf, unsigned int *maj_dev);
+
+void GC_register_dynamic_libraries()
+{
+ int f;
+ int result;
+ char prot_buf[5];
+ int maps_size;
+ char maps_temp[32768];
+ char *maps_buf;
+ char *buf_ptr;
+ int count;
+ word start, end;
+ unsigned int maj_dev, min_dev;
+ word least_ha, greatest_ha;
+ unsigned i;
+ word datastart = (word)(DATASTART);
+
+ /* Read /proc/self/maps */
+ /* Note that we may not allocate, and thus can't use stdio. */
+ f = open("/proc/self/maps", O_RDONLY);
+ if (-1 == f) ABORT("Couldn't open /proc/self/maps");
+ /* stat() doesn't work for /proc/self/maps, so we have to
+ read it to find out how large it is... */
+ maps_size = 0;
+ do {
+ result = GC_repeat_read(f, maps_temp, sizeof(maps_temp));
+ if (result <= 0) ABORT("Couldn't read /proc/self/maps");
+ maps_size += result;
+ } while (result == sizeof(maps_temp));
+
+ if (maps_size > sizeof(maps_temp)) {
+ /* If larger than our buffer, close and re-read it. */
+ close(f);
+ f = open("/proc/self/maps", O_RDONLY);
+ if (-1 == f) ABORT("Couldn't open /proc/self/maps");
+ maps_buf = alloca(maps_size);
+ if (NULL == maps_buf) ABORT("/proc/self/maps alloca failed");
+ result = GC_repeat_read(f, maps_buf, maps_size);
+ if (result <= 0) ABORT("Couldn't read /proc/self/maps");
+ } else {
+ /* Otherwise use the fixed size buffer */
+ maps_buf = maps_temp;
+ }
+
+ close(f);
+ maps_buf[result] = '\0';
+ buf_ptr = maps_buf;
+ /* Compute heap bounds. Should be done by add_to_heap? */
+ least_ha = (word)(-1);
+ greatest_ha = 0;
+ for (i = 0; i < GC_n_heap_sects; ++i) {
+ word sect_start = (word)GC_heap_sects[i].hs_start;
+ word sect_end = sect_start + GC_heap_sects[i].hs_bytes;
+ if (sect_start < least_ha) least_ha = sect_start;
+ if (sect_end > greatest_ha) greatest_ha = sect_end;
+ }
+ if (greatest_ha < (word)GC_scratch_last_end_ptr)
+ greatest_ha = (word)GC_scratch_last_end_ptr;
+ for (;;) {
+
+ buf_ptr = parse_map_entry(buf_ptr, &start, &end, prot_buf, &maj_dev);
+ if (buf_ptr == NULL) return;
+
+ if (prot_buf[1] == 'w') {
+ /* This is a writable mapping. Add it to */
+ /* the root set unless it is already otherwise */
+ /* accounted for. */
+ if (start <= (word)GC_stackbottom && end >= (word)GC_stackbottom) {
+ /* Stack mapping; discard */
+ continue;
+ }
+ if (start <= datastart && end > datastart && maj_dev != 0) {
+ /* Main data segment; discard */
+ continue;
+ }
+# ifdef THREADS
+ if (GC_segment_is_thread_stack(start, end)) continue;
+# endif
+ /* The rest of this assumes that there is no mapping */
+ /* spanning the beginning of the data segment, or extending */
+ /* beyond the entire heap at both ends. */
+ /* Empirically these assumptions hold. */
+
+ if (start < (word)DATAEND && end > (word)DATAEND) {
+ /* Rld may use space at the end of the main data */
+ /* segment. Thus we add that in. */
+ start = (word)DATAEND;
+ }
+ if (start < least_ha && end > least_ha) {
+ end = least_ha;
+ }
+ if (start < greatest_ha && end > greatest_ha) {
+ start = greatest_ha;
+ }
+ if (start >= least_ha && end <= greatest_ha) continue;
+ GC_add_roots_inner((char *)start, (char *)end, TRUE);
+ }
+ }
+}
+
+//
+// parse_map_entry parses an entry from /proc/self/maps so we can
+// locate all writable data segments that belong to shared libraries.
+// The format of one of these entries and the fields we care about
+// is as follows:
+// XXXXXXXX-XXXXXXXX r-xp 00000000 30:05 260537 name of mapping...\n
+// ^^^^^^^^ ^^^^^^^^ ^^^^ ^^
+// start end prot maj_dev
+// 0 9 18 32
+//
+// The parser is called with a pointer to the entry and the return value
+// is either NULL or is advanced to the next entry(the byte after the
+// trailing '\n'.)
+//
+#define OFFSET_MAP_START 0
+#define OFFSET_MAP_END 9
+#define OFFSET_MAP_PROT 18
+#define OFFSET_MAP_MAJDEV 32
+
+static char *parse_map_entry(char *buf_ptr, word *start, word *end,
+ char *prot_buf, unsigned int *maj_dev)
+{
+ int i;
+ unsigned int val;
+ char *tok;
+
+ if (buf_ptr == NULL || *buf_ptr == '\0') {
+ return NULL;
+ }
+
+ memcpy(prot_buf, buf_ptr+OFFSET_MAP_PROT, 4); // do the protections first
+ prot_buf[4] = '\0';
+
+ if (prot_buf[1] == 'w') { // we can skip all of this if it's not writable
+
+ tok = buf_ptr;
+ buf_ptr[OFFSET_MAP_START+8] = '\0';
+ *start = strtoul(tok, NULL, 16);
+
+ tok = buf_ptr+OFFSET_MAP_END;
+ buf_ptr[OFFSET_MAP_END+8] = '\0';
+ *end = strtoul(tok, NULL, 16);
+
+ buf_ptr += OFFSET_MAP_MAJDEV;
+ tok = buf_ptr;
+ while (*buf_ptr != ':') buf_ptr++;
+ *buf_ptr++ = '\0';
+ *maj_dev = strtoul(tok, NULL, 16);
+ }
+
+ while (*buf_ptr && *buf_ptr++ != '\n');
+
+ return buf_ptr;
+}
+
+#else /* !USE_PROC_FOR_LIBRARIES */
/* Dynamic loading code for Linux running ELF. Somewhat tested on
* Linux/x86, untested but hopefully should work on Linux/Alpha.
* This code was derived from the Solaris/ELF support. Thanks to
* whatever kind soul wrote that. - Patrick Bridges */
-#include <elf.h>
+#if defined(NETBSD)
+# include <sys/exec_elf.h>
+#else
+# include <elf.h>
+#endif
#include <link.h>
/* Newer versions of Linux/Alpha and Linux/x86 define this macro. We
@@ -342,21 +503,26 @@ void GC_register_dynamic_libraries()
}
}
-#endif
+#endif /* !USE_PROC_FOR_LIBRARIES */
+
+#endif /* LINUX */
-#if defined(IRIX5) || defined(USE_PROC_FOR_LIBRARIES)
+#if defined(IRIX5) || (defined(USE_PROC_FOR_LIBRARIES) && !defined(LINUX))
#include <sys/procfs.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <elf.h>
#include <errno.h>
+#include <signal.h> /* Only for the following test. */
+#ifndef _sigargs
+# define IRIX6
+#endif
extern void * GC_roots_present();
/* The type is a lie, since the real type doesn't make sense here, */
/* and we only test for NULL. */
-extern ptr_t GC_scratch_last_end_ptr; /* End of GC_scratch_alloc arena */
/* We use /proc to track down all parts of the address space that are */
/* mapped by the process, and throw out regions we know we shouldn't */
@@ -413,7 +579,8 @@ void GC_register_dynamic_libraries()
if ((flags & (MA_BREAK | MA_STACK | MA_PHYS)) != 0) goto irrelevant;
if ((flags & (MA_READ | MA_WRITE)) != (MA_READ | MA_WRITE))
goto irrelevant;
- /* The latter test is empirically useless. Other than the */
+ /* The latter test is empirically useless in very old Irix */
+ /* versions. Other than the */
/* main data and stack segments, everything appears to be */
/* mapped readable, writable, executable, and shared(!!). */
/* This makes no sense to me. - HB */
@@ -426,7 +593,11 @@ void GC_register_dynamic_libraries()
# endif /* MMAP_STACKS */
limit = start + addr_map[i].pr_size;
- if (addr_map[i].pr_off == 0 && strncmp(start, ELFMAG, 4) == 0) {
+ /* The following seemed to be necessary for very old versions */
+ /* of Irix, but it has been reported to discard relevant */
+ /* segments under Irix 6.5. */
+# ifndef IRIX6
+ if (addr_map[i].pr_off == 0 && strncmp(start, ELFMAG, 4) == 0) {
/* Discard text segments, i.e. 0-offset mappings against */
/* executable files which appear to have ELF headers. */
caddr_t arg;
@@ -453,7 +624,8 @@ void GC_register_dynamic_libraries()
goto irrelevant;
}
}
- }
+ }
+# endif /* !IRIX6 */
GC_add_roots_inner(start, limit, TRUE);
irrelevant: ;
}
@@ -465,7 +637,7 @@ void GC_register_dynamic_libraries()
# endif /* USE_PROC || IRIX5 */
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
# define WIN32_LEAN_AND_MEAN
# define NOSERVICE
@@ -474,86 +646,97 @@ void GC_register_dynamic_libraries()
/* We traverse the entire address space and register all segments */
/* that could possibly have been written to. */
- DWORD GC_allocation_granularity;
extern GC_bool GC_is_heap_base (ptr_t p);
# ifdef WIN32_THREADS
extern void GC_get_next_stack(char *start, char **lo, char **hi);
-# endif
-
- void GC_cond_add_roots(char *base, char * limit)
- {
- char dummy;
- char * stack_top
- = (char *) ((word)(&dummy) & ~(GC_allocation_granularity-1));
- if (base == limit) return;
-# ifdef WIN32_THREADS
+ void GC_cond_add_roots(char *base, char * limit)
{
- char * curr_base = base;
- char * next_stack_lo;
- char * next_stack_hi;
-
- for(;;) {
- GC_get_next_stack(curr_base, &next_stack_lo, &next_stack_hi);
- if (next_stack_lo >= limit) break;
- GC_add_roots_inner(curr_base, next_stack_lo, TRUE);
- curr_base = next_stack_hi;
- }
- if (curr_base < limit) GC_add_roots_inner(curr_base, limit, TRUE);
+ char * curr_base = base;
+ char * next_stack_lo;
+ char * next_stack_hi;
+
+ if (base == limit) return;
+ for(;;) {
+ GC_get_next_stack(curr_base, &next_stack_lo, &next_stack_hi);
+ if (next_stack_lo >= limit) break;
+ GC_add_roots_inner(curr_base, next_stack_lo, TRUE);
+ curr_base = next_stack_hi;
+ }
+ if (curr_base < limit) GC_add_roots_inner(curr_base, limit, TRUE);
}
-# else
- if (limit > stack_top && base < GC_stackbottom) {
- /* Part of the stack; ignore it. */
- return;
- }
- GC_add_roots_inner(base, limit, TRUE);
-# endif
- }
-
+# else
+ void GC_cond_add_roots(char *base, char * limit)
+ {
+ char dummy;
+ char * stack_top
+ = (char *) ((word)(&dummy) & ~(GC_sysinfo.dwAllocationGranularity-1));
+ if (base == limit) return;
+ if (limit > stack_top && base < GC_stackbottom) {
+ /* Part of the stack; ignore it. */
+ return;
+ }
+ GC_add_roots_inner(base, limit, TRUE);
+ }
+# endif
+
+# ifndef MSWINCE
extern GC_bool GC_win32s;
+# endif
void GC_register_dynamic_libraries()
{
MEMORY_BASIC_INFORMATION buf;
- SYSTEM_INFO sysinfo;
DWORD result;
DWORD protect;
LPVOID p;
char * base;
char * limit, * new_limit;
-
- if (GC_win32s) return;
- GetSystemInfo(&sysinfo);
- base = limit = p = sysinfo.lpMinimumApplicationAddress;
- GC_allocation_granularity = sysinfo.dwAllocationGranularity;
- while (p < sysinfo.lpMaximumApplicationAddress) {
+
+# ifdef MSWIN32
+ if (GC_win32s) return;
+# endif
+ base = limit = p = GC_sysinfo.lpMinimumApplicationAddress;
+# if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION)
+ /* Only the first 32 MB of address space belongs to the current process */
+ while (p < (LPVOID)0x02000000) {
result = VirtualQuery(p, &buf, sizeof(buf));
- if (result != sizeof(buf)) {
- ABORT("Weird VirtualQuery result");
- }
- new_limit = (char *)p + buf.RegionSize;
- protect = buf.Protect;
- if (buf.State == MEM_COMMIT
- && (protect == PAGE_EXECUTE_READWRITE
- || protect == PAGE_READWRITE)
- && !GC_is_heap_base(buf.AllocationBase)) {
- if ((char *)p == limit) {
- limit = new_limit;
- } else {
- GC_cond_add_roots(base, limit);
- base = p;
- limit = new_limit;
- }
- }
+ if (result == 0) {
+ /* Page is free; advance to the next possible allocation base */
+ new_limit = (char *)
+ (((DWORD) p + GC_sysinfo.dwAllocationGranularity)
+ & ~(GC_sysinfo.dwAllocationGranularity-1));
+ } else
+# else
+ while (p < GC_sysinfo.lpMaximumApplicationAddress) {
+ result = VirtualQuery(p, &buf, sizeof(buf));
+# endif
+ {
+ if (result != sizeof(buf)) {
+ ABORT("Weird VirtualQuery result");
+ }
+ new_limit = (char *)p + buf.RegionSize;
+ protect = buf.Protect;
+ if (buf.State == MEM_COMMIT
+ && (protect == PAGE_EXECUTE_READWRITE
+ || protect == PAGE_READWRITE)
+ && !GC_is_heap_base(buf.AllocationBase)) {
+ if ((char *)p != limit) {
+ GC_cond_add_roots(base, limit);
+ base = p;
+ }
+ limit = new_limit;
+ }
+ }
if (p > (LPVOID)new_limit /* overflow */) break;
p = (LPVOID)new_limit;
}
GC_cond_add_roots(base, limit);
}
-#endif /* MSWIN32 */
-
+#endif /* MSWIN32 || MSWINCE */
+
#if defined(ALPHA) && defined(OSF1)
#include <loader.h>
@@ -658,7 +841,7 @@ void GC_register_dynamic_libraries()
}
#endif
-#if defined(HP_PA)
+#if defined(HPUX)
#include <errno.h>
#include <dl.h>
@@ -681,6 +864,11 @@ void GC_register_dynamic_libraries()
/* Check if this is the end of the list or if some error occured */
if (status != 0) {
+# ifdef HPUX_THREADS
+ /* I've seen errno values of 0. The man page is not clear */
+ /* as to whether errno should get set on a -1 return. */
+ break;
+# else
if (errno == EINVAL) {
break; /* Moved past end of shared library list --> finished */
} else {
@@ -691,6 +879,7 @@ void GC_register_dynamic_libraries()
}
ABORT("shl_get failed");
}
+# endif
}
# ifdef VERBOSE
@@ -713,7 +902,7 @@ void GC_register_dynamic_libraries()
index++;
}
}
-#endif /* HP_PA */
+#endif /* HPUX */
#ifdef RS6000
#pragma alloca
diff --git a/gc/finalize.c b/gc/finalize.c
@@ -14,8 +14,7 @@
*/
/* Boehm, February 1, 1996 1:19 pm PST */
# define I_HIDE_POINTERS
-# include "gc_priv.h"
-# include "gc_mark.h"
+# include "private/gc_pmark.h"
# ifdef FINALIZE_ON_DEMAND
int GC_finalize_on_demand = 1;
@@ -86,13 +85,13 @@ static signed_word log_fo_table_size = -1;
word GC_fo_entries = 0;
-# ifdef SRC_M3
-void GC_push_finalizer_structures()
+void GC_push_finalizer_structures GC_PROTO((void))
{
GC_push_all((ptr_t)(&dl_head), (ptr_t)(&dl_head) + sizeof(word));
GC_push_all((ptr_t)(&fo_head), (ptr_t)(&fo_head) + sizeof(word));
+ GC_push_all((ptr_t)(&GC_finalize_now),
+ (ptr_t)(&GC_finalize_now) + sizeof(word));
}
-# endif
/* Double the size of a hash table. *size_ptr is the log of its current */
/* size. May be a noop. */
@@ -110,7 +109,7 @@ signed_word * log_size_ptr;
word old_size = ((log_old_size == -1)? 0: (1 << log_old_size));
register word new_size = 1 << log_new_size;
struct hash_chain_entry **new_table = (struct hash_chain_entry **)
- GC_generic_malloc_inner_ignore_off_page(
+ GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
(size_t)new_size * sizeof(struct hash_chain_entry *), NORMAL);
if (new_table == 0) {
@@ -179,9 +178,11 @@ signed_word * log_size_ptr;
# endif
GC_grow_table((struct hash_chain_entry ***)(&dl_head),
&log_dl_table_size);
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Grew dl table to %lu entries\n",
(unsigned long)(1 << log_dl_table_size));
+ }
# endif
# ifndef THREADS
ENABLE_SIGNALS();
@@ -199,22 +200,29 @@ signed_word * log_size_ptr;
return(1);
}
}
-# ifdef THREADS
- new_dl = (struct disappearing_link *)
- GC_generic_malloc_inner(sizeof(struct disappearing_link),NORMAL);
-# else
- new_dl = (struct disappearing_link *)
- GC_malloc(sizeof(struct disappearing_link));
-# endif
- if (new_dl != 0) {
- new_dl -> dl_hidden_obj = HIDE_POINTER(obj);
- new_dl -> dl_hidden_link = HIDE_POINTER(link);
- dl_set_next(new_dl, dl_head[index]);
- dl_head[index] = new_dl;
- GC_dl_entries++;
- } else {
- GC_finalization_failures++;
+ new_dl = (struct disappearing_link *)
+ GC_INTERNAL_MALLOC(sizeof(struct disappearing_link),NORMAL);
+ if (0 == new_dl) {
+# ifdef THREADS
+ UNLOCK();
+ ENABLE_SIGNALS();
+# endif
+ new_dl == GC_oom_fn(sizeof(struct disappearing_link));
+ if (0 == new_dl) {
+ GC_finalization_failures++;
+ return(0);
+ }
+ /* It's not likely we'll make it here, but ... */
+# ifdef THREADS
+ DISABLE_SIGNALS();
+ LOCK();
+# endif
}
+ new_dl -> dl_hidden_obj = HIDE_POINTER(obj);
+ new_dl -> dl_hidden_link = HIDE_POINTER(link);
+ dl_set_next(new_dl, dl_head[index]);
+ dl_head[index] = new_dl;
+ GC_dl_entries++;
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
@@ -248,7 +256,11 @@ signed_word * log_size_ptr;
GC_dl_entries--;
UNLOCK();
ENABLE_SIGNALS();
- GC_free((GC_PTR)curr_dl);
+# ifdef DBG_HDRS_ALL
+ dl_set_next(curr_dl, 0);
+# else
+ GC_free((GC_PTR)curr_dl);
+# endif
return(1);
}
prev_dl = curr_dl;
@@ -283,7 +295,7 @@ ptr_t p;
ptr_t scan_limit;
ptr_t target_limit = p + WORDS_TO_BYTES(hhdr -> hb_sz) - 1;
- if ((descr & DS_TAGS) == DS_LENGTH) {
+ if ((descr & GC_DS_TAGS) == GC_DS_LENGTH) {
scan_limit = p + descr - sizeof(word);
} else {
scan_limit = target_limit + 1 - sizeof(word);
@@ -324,6 +336,7 @@ finalization_mark_proc * mp;
struct finalizable_object * curr_fo, * prev_fo;
int index;
struct finalizable_object *new_fo;
+ hdr *hhdr;
DCL_LOCK_STATE;
# ifdef THREADS
@@ -337,9 +350,11 @@ finalization_mark_proc * mp;
# endif
GC_grow_table((struct hash_chain_entry ***)(&fo_head),
&log_fo_table_size);
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Grew fo table to %lu entries\n",
(unsigned long)(1 << log_fo_table_size));
+ }
# endif
# ifndef THREADS
ENABLE_SIGNALS();
@@ -369,7 +384,7 @@ finalization_mark_proc * mp;
/* May not happen if we get a signal. But a high */
/* estimate will only make the table larger than */
/* necessary. */
-# ifndef THREADS
+# if !defined(THREADS) && !defined(DBG_HDRS_ALL)
GC_free((GC_PTR)curr_fo);
# endif
} else {
@@ -402,25 +417,41 @@ finalization_mark_proc * mp;
# endif
return;
}
-# ifdef THREADS
- new_fo = (struct finalizable_object *)
- GC_generic_malloc_inner(sizeof(struct finalizable_object),NORMAL);
-# else
- new_fo = (struct finalizable_object *)
- GC_malloc(sizeof(struct finalizable_object));
-# endif
- if (new_fo != 0) {
- new_fo -> fo_hidden_base = (word)HIDE_POINTER(base);
- new_fo -> fo_fn = fn;
- new_fo -> fo_client_data = (ptr_t)cd;
- new_fo -> fo_object_size = GC_size(base);
- new_fo -> fo_mark_proc = mp;
- fo_set_next(new_fo, fo_head[index]);
- GC_fo_entries++;
- fo_head[index] = new_fo;
- } else {
- GC_finalization_failures++;
+ GET_HDR(base, hhdr);
+ if (0 == hhdr) {
+ /* We won't collect it, hence finalizer wouldn't be run. */
+# ifdef THREADS
+ UNLOCK();
+ ENABLE_SIGNALS();
+# endif
+ return;
+ }
+ new_fo = (struct finalizable_object *)
+ GC_INTERNAL_MALLOC(sizeof(struct finalizable_object),NORMAL);
+ if (0 == new_fo) {
+# ifdef THREADS
+ UNLOCK();
+ ENABLE_SIGNALS();
+# endif
+ new_fo == GC_oom_fn(sizeof(struct finalizable_object));
+ if (0 == new_fo) {
+ GC_finalization_failures++;
+ return;
+ }
+ /* It's not likely we'll make it here, but ... */
+# ifdef THREADS
+ DISABLE_SIGNALS();
+ LOCK();
+# endif
}
+ new_fo -> fo_hidden_base = (word)HIDE_POINTER(base);
+ new_fo -> fo_fn = fn;
+ new_fo -> fo_client_data = (ptr_t)cd;
+ new_fo -> fo_object_size = hhdr -> hb_sz;
+ new_fo -> fo_mark_proc = mp;
+ fo_set_next(new_fo, fo_head[index]);
+ GC_fo_entries++;
+ fo_head[index] = new_fo;
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
@@ -478,6 +509,34 @@ finalization_mark_proc * mp;
ocd, GC_null_finalize_mark_proc);
}
+#ifndef NO_DEBUGGING
+void GC_dump_finalization()
+{
+ struct disappearing_link * curr_dl;
+ struct finalizable_object * curr_fo;
+ ptr_t real_ptr, real_link;
+ int dl_size = (log_dl_table_size == -1 ) ? 0 : (1 << log_dl_table_size);
+ int fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size);
+ int i;
+
+ GC_printf0("Disappearing links:\n");
+ for (i = 0; i < dl_size; i++) {
+ for (curr_dl = dl_head[i]; curr_dl != 0; curr_dl = dl_next(curr_dl)) {
+ real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj);
+ real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link);
+ GC_printf2("Object: 0x%lx, Link:0x%lx\n", real_ptr, real_link);
+ }
+ }
+ GC_printf0("Finalizers:\n");
+ for (i = 0; i < fo_size; i++) {
+ for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) {
+ real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
+ GC_printf1("Finalizable object: 0x%lx\n", real_ptr);
+ }
+ }
+}
+#endif
+
/* Called with world stopped. Cause disappearing links to disappear, */
/* and invoke finalizers. */
void GC_finalize()
@@ -515,9 +574,7 @@ void GC_finalize()
}
/* Mark all objects reachable via chains of 1 or more pointers */
/* from finalizable objects. */
-# ifdef PRINTSTATS
- if (GC_mark_state != MS_NONE) ABORT("Bad mark state");
-# endif
+ GC_ASSERT(GC_mark_state == MS_NONE);
for (i = 0; i < fo_size; i++) {
for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) {
real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
@@ -560,11 +617,7 @@ void GC_finalize()
GC_words_finalized +=
ALIGNED_WORDS(curr_fo -> fo_object_size)
+ ALIGNED_WORDS(sizeof(struct finalizable_object));
-# ifdef PRINTSTATS
- if (!GC_is_marked((ptr_t)curr_fo)) {
- ABORT("GC_finalize: found accessible unmarked object\n");
- }
-# endif
+ GC_ASSERT(GC_is_marked(GC_base((ptr_t)curr_fo)));
curr_fo = next_fo;
} else {
prev_fo = curr_fo;
@@ -619,7 +672,7 @@ void GC_finalize()
void GC_enqueue_all_finalizers()
{
struct finalizable_object * curr_fo, * prev_fo, * next_fo;
- ptr_t real_ptr, real_link;
+ ptr_t real_ptr;
register int i;
int fo_size;
@@ -694,6 +747,14 @@ GC_API void GC_finalize_all()
}
#endif
+/* Returns true if it is worth calling GC_invoke_finalizers. (Useful if */
+/* finalizers can only be called from some kind of `safe state' and */
+/* getting into that safe state is expensive.) */
+int GC_should_invoke_finalizers GC_PROTO((void))
+{
+ return GC_finalize_now != 0;
+}
+
/* Invoke finalizers for all objects that are ready to be finalized. */
/* Should be called without allocation lock. */
int GC_invoke_finalizers()
@@ -731,6 +792,25 @@ int GC_invoke_finalizers()
return count;
}
+void (* GC_finalizer_notifier)() = (void (*) GC_PROTO((void)))0;
+
+static GC_word last_finalizer_notification = 0;
+
+void GC_notify_or_invoke_finalizers GC_PROTO((void))
+{
+ if (GC_finalize_now == 0) return;
+ if (!GC_finalize_on_demand) {
+ (void) GC_invoke_finalizers();
+ GC_ASSERT(GC_finalize_now == 0);
+ return;
+ }
+ if (GC_finalizer_notifier != (void (*) GC_PROTO((void)))0
+ && last_finalizer_notification != GC_gc_no) {
+ last_finalizer_notification = GC_gc_no;
+ GC_finalizer_notifier();
+ }
+}
+
# ifdef __STDC__
GC_PTR GC_call_with_alloc_lock(GC_fn_type fn,
GC_PTR client_data)
@@ -750,7 +830,9 @@ int GC_invoke_finalizers()
# endif
result = (*fn)(client_data);
# ifdef THREADS
- UNSET_LOCK_HOLDER();
+# ifndef GC_ASSERTIONS
+ UNSET_LOCK_HOLDER();
+# endif /* o.w. UNLOCK() does it implicitly */
UNLOCK();
ENABLE_SIGNALS();
# endif
diff --git a/gc/gc.h b/gc/gc.h
@@ -1,754 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
- * Copyright 1996 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-/*
- * Note that this defines a large number of tuning hooks, which can
- * safely be ignored in nearly all cases. For normal use it suffices
- * to call only GC_MALLOC and perhaps GC_REALLOC.
- * For better performance, also look at GC_MALLOC_ATOMIC, and
- * GC_enable_incremental. If you need an action to be performed
- * immediately before an object is collected, look at GC_register_finalizer.
- * If you are using Solaris threads, look at the end of this file.
- * Everything else is best ignored unless you encounter performance
- * problems.
- */
-
-#ifndef _GC_H
-
-# define _GC_H
-# define __GC
-# include <stddef.h>
-
-#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
-#include "libgc_globals.h"
-#endif
-
-#if defined(_MSC_VER) && defined(_DLL)
-# ifdef GC_BUILD
-# define GC_API __declspec(dllexport)
-# else
-# define GC_API __declspec(dllimport)
-# endif
-#endif
-
-#if defined(__WATCOMC__) && defined(GC_DLL)
-# ifdef GC_BUILD
-# define GC_API extern __declspec(dllexport)
-# else
-# define GC_API extern __declspec(dllimport)
-# endif
-#endif
-
-#ifndef GC_API
-#define GC_API extern
-#endif
-
-# if defined(__STDC__) || defined(__cplusplus)
-# define GC_PROTO(args) args
- typedef void * GC_PTR;
-# else
-# define GC_PROTO(args) ()
- typedef char * GC_PTR;
-# endif
-
-# ifdef __cplusplus
- extern "C" {
-# endif
-
-
-/* Define word and signed_word to be unsigned and signed types of the */
-/* size as char * or void *. There seems to be no way to do this */
-/* even semi-portably. The following is probably no better/worse */
-/* than almost anything else. */
-/* The ANSI standard suggests that size_t and ptr_diff_t might be */
-/* better choices. But those appear to have incorrect definitions */
-/* on may systems. Notably "typedef int size_t" seems to be both */
-/* frequent and WRONG. */
-typedef unsigned long GC_word;
-typedef long GC_signed_word;
-
-/* Public read-only variables */
-
-GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
- /* Includes empty GCs at startup. */
-
-
-/* Public R/W variables */
-
-GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
- /* When there is insufficient memory to satisfy */
- /* an allocation request, we return */
- /* (*GC_oom_fn)(). By default this just */
- /* returns 0. */
- /* If it returns, it must return 0 or a valid */
- /* pointer to a previously allocated heap */
- /* object. */
-
-GC_API int GC_find_leak;
- /* Do not actually garbage collect, but simply */
- /* report inaccessible memory that was not */
- /* deallocated with GC_free. Initial value */
- /* is determined by FIND_LEAK macro. */
-
-GC_API int GC_quiet; /* Disable statistics output. Only matters if */
- /* collector has been compiled with statistics */
- /* enabled. This involves a performance cost, */
- /* and is thus not the default. */
-
-GC_API int GC_finalize_on_demand;
- /* If nonzero, finalizers will only be run in */
- /* response to an eplit GC_invoke_finalizers */
- /* call. The default is determined by whether */
- /* the FINALIZE_ON_DEMAND macro is defined */
- /* when the collector is built. */
-
-GC_API int GC_java_finalization;
- /* Mark objects reachable from finalizable */
- /* objects in a separate postpass. This makes */
- /* it a bit safer to use non-topologically- */
- /* ordered finalization. Default value is */
- /* determined by JAVA_FINALIZATION macro. */
-
-GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
- /* because it's not safe. */
-
-GC_API int GC_dont_expand;
- /* Dont expand heap unless explicitly requested */
- /* or forced to. */
-
-GC_API int GC_full_freq; /* Number of partial collections between */
- /* full collections. Matters only if */
- /* GC_incremental is set. */
-
-GC_API GC_word GC_non_gc_bytes;
- /* Bytes not considered candidates for collection. */
- /* Used only to control scheduling of collections. */
-
-GC_API GC_word GC_free_space_divisor;
- /* We try to make sure that we allocate at */
- /* least N/GC_free_space_divisor bytes between */
- /* collections, where N is the heap size plus */
- /* a rough estimate of the root set size. */
- /* Initially, GC_free_space_divisor = 4. */
- /* Increasing its value will use less space */
- /* but more collection time. Decreasing it */
- /* will appreciably decrease collection time */
- /* at the expense of space. */
- /* GC_free_space_divisor = 1 will effectively */
- /* disable collections. */
-
-GC_API GC_word GC_max_retries;
- /* The maximum number of GCs attempted before */
- /* reporting out of memory after heap */
- /* expansion fails. Initially 0. */
-
-
-GC_API char *GC_stackbottom; /* Cool end of user stack. */
- /* May be set in the client prior to */
- /* calling any GC_ routines. This */
- /* avoids some overhead, and */
- /* potentially some signals that can */
- /* confuse debuggers. Otherwise the */
- /* collector attempts to set it */
- /* automatically. */
- /* For multithreaded code, this is the */
- /* cold end of the stack for the */
- /* primordial thread. */
-
-/* Public procedures */
-/*
- * general purpose allocation routines, with roughly malloc calling conv.
- * The atomic versions promise that no relevant pointers are contained
- * in the object. The nonatomic versions guarantee that the new object
- * is cleared. GC_malloc_stubborn promises that no changes to the object
- * will occur after GC_end_stubborn_change has been called on the
- * result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
- * that is scanned for pointers to collectable objects, but is not itself
- * collectable. GC_malloc_uncollectable and GC_free called on the resulting
- * object implicitly update GC_non_gc_bytes appropriately.
- */
-GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
-GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
-
-/* The following is only defined if the library has been suitably */
-/* compiled: */
-GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
-
-/* Explicitly deallocate an object. Dangerous if used incorrectly. */
-/* Requires a pointer to the base of an object. */
-/* If the argument is stubborn, it should not be changeable when freed. */
-/* An object should not be enable for finalization when it is */
-/* explicitly deallocated. */
-/* GC_free(0) is a no-op, as required by ANSI C for free. */
-GC_API void GC_free GC_PROTO((GC_PTR object_addr));
-
-/*
- * Stubborn objects may be changed only if the collector is explicitly informed.
- * The collector is implicitly informed of coming change when such
- * an object is first allocated. The following routines inform the
- * collector that an object will no longer be changed, or that it will
- * once again be changed. Only nonNIL pointer stores into the object
- * are considered to be changes. The argument to GC_end_stubborn_change
- * must be exacly the value returned by GC_malloc_stubborn or passed to
- * GC_change_stubborn. (In the second case it may be an interior pointer
- * within 512 bytes of the beginning of the objects.)
- * There is a performance penalty for allowing more than
- * one stubborn object to be changed at once, but it is acceptable to
- * do so. The same applies to dropping stubborn objects that are still
- * changeable.
- */
-GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
-GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
-
-/* Return a pointer to the base (lowest address) of an object given */
-/* a pointer to a location within the object. */
-/* Return 0 if displaced_pointer doesn't point to within a valid */
-/* object. */
-GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
-
-/* Given a pointer to the base of an object, return its size in bytes. */
-/* The returned size may be slightly larger than what was originally */
-/* requested. */
-GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
-
-/* For compatibility with C library. This is occasionally faster than */
-/* a malloc followed by a bcopy. But if you rely on that, either here */
-/* or with the standard C library, your code is broken. In my */
-/* opinion, it shouldn't have been invented, but now we're stuck. -HB */
-/* The resulting object has the same kind as the original. */
-/* If the argument is stubborn, the result will have changes enabled. */
-/* It is an error to have changes enabled for the original object. */
-/* Follows ANSI comventions for NULL old_object. */
-GC_API GC_PTR GC_realloc
- GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes));
-
-/* Explicitly increase the heap size. */
-/* Returns 0 on failure, 1 on success. */
-GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
-
-/* Limit the heap size to n bytes. Useful when you're debugging, */
-/* especially on systems that don't handle running out of memory well. */
-/* n == 0 ==> unbounded. This is the default. */
-GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
-
-/* Inform the collector that a certain section of statically allocated */
-/* memory contains no pointers to garbage collected memory. Thus it */
-/* need not be scanned. This is sometimes important if the application */
-/* maps large read/write files into the address space, which could be */
-/* mistaken for dynamic library data segments on some systems. */
-GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
-
-/* Clear the set of root segments. Wizards only. */
-GC_API void GC_clear_roots GC_PROTO((void));
-
-/* Add a root segment. Wizards only. */
-GC_API void GC_add_roots GC_PROTO((char * low_address,
- char * high_address_plus_1));
-
-/* Add a displacement to the set of those considered valid by the */
-/* collector. GC_register_displacement(n) means that if p was returned */
-/* by GC_malloc, then (char *)p + n will be considered to be a valid */
-/* pointer to n. N must be small and less than the size of p. */
-/* (All pointers to the interior of objects from the stack are */
-/* considered valid in any case. This applies to heap objects and */
-/* static data.) */
-/* Preferably, this should be called before any other GC procedures. */
-/* Calling it later adds to the probability of excess memory */
-/* retention. */
-/* This is a no-op if the collector was compiled with recognition of */
-/* arbitrary interior pointers enabled, which is now the default. */
-GC_API void GC_register_displacement GC_PROTO((GC_word n));
-
-/* The following version should be used if any debugging allocation is */
-/* being done. */
-GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
-
-/* Explicitly trigger a full, world-stop collection. */
-GC_API void GC_gcollect GC_PROTO((void));
-
-/* Trigger a full world-stopped collection. Abort the collection if */
-/* and when stop_func returns a nonzero value. Stop_func will be */
-/* called frequently, and should be reasonably fast. This works even */
-/* if virtual dirty bits, and hence incremental collection is not */
-/* available for this architecture. Collections can be aborted faster */
-/* than normal pause times for incremental collection. However, */
-/* aborted collections do no useful work; the next collection needs */
-/* to start from the beginning. */
-/* Return 0 if the collection was aborted, 1 if it succeeded. */
-typedef int (* GC_stop_func) GC_PROTO((void));
-GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
-
-/* Return the number of bytes in the heap. Excludes collector private */
-/* data structures. Includes empty blocks and fragmentation loss. */
-/* Includes some pages that were allocated but never written. */
-GC_API size_t GC_get_heap_size GC_PROTO((void));
-
-/* Return the number of bytes allocated since the last collection. */
-GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
-
-/* Enable incremental/generational collection. */
-/* Not advisable unless dirty bits are */
-/* available or most heap objects are */
-/* pointerfree(atomic) or immutable. */
-/* Don't use in leak finding mode. */
-/* Ignored if GC_dont_gc is true. */
-GC_API void GC_enable_incremental GC_PROTO((void));
-
-/* Perform some garbage collection work, if appropriate. */
-/* Return 0 if there is no more work to be done. */
-/* Typically performs an amount of work corresponding roughly */
-/* to marking from one page. May do more work if further */
-/* progress requires it, e.g. if incremental collection is */
-/* disabled. It is reasonable to call this in a wait loop */
-/* until it returns 0. */
-GC_API int GC_collect_a_little GC_PROTO((void));
-
-/* Allocate an object of size lb bytes. The client guarantees that */
-/* as long as the object is live, it will be referenced by a pointer */
-/* that points to somewhere within the first 256 bytes of the object. */
-/* (This should normally be declared volatile to prevent the compiler */
-/* from invalidating this assertion.) This routine is only useful */
-/* if a large array is being allocated. It reduces the chance of */
-/* accidentally retaining such an array as a result of scanning an */
-/* integer that happens to be an address inside the array. (Actually, */
-/* it reduces the chance of the allocator not finding space for such */
-/* an array, since it will try hard to avoid introducing such a false */
-/* reference.) On a SunOS 4.X or MS Windows system this is recommended */
-/* for arrays likely to be larger than 100K or so. For other systems, */
-/* or if the collector is not configured to recognize all interior */
-/* pointers, the threshold is normally much higher. */
-GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
-GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
-
-#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
-# define GC_ADD_CALLER
-# define GC_RETURN_ADDR (GC_word)__return_address
-#endif
-
-#ifdef GC_ADD_CALLER
-# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
-# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
-#else
-# define GC_EXTRAS __FILE__, __LINE__
-# define GC_EXTRA_PARAMS char * descr_string, int descr_int
-#endif
-
-/* Debugging (annotated) allocation. GC_gcollect will check */
-/* objects allocated in this way for overwrites, etc. */
-GC_API GC_PTR GC_debug_malloc
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_atomic
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_uncollectable
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API GC_PTR GC_debug_malloc_stubborn
- GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
-GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
-GC_API GC_PTR GC_debug_realloc
- GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
- GC_EXTRA_PARAMS));
-
-GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
-GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
-# ifdef GC_DEBUG
-# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
-# define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
-# define GC_MALLOC_UNCOLLECTABLE(sz) GC_debug_malloc_uncollectable(sz, \
- GC_EXTRAS)
-# define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
-# define GC_FREE(p) GC_debug_free(p)
-# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
- GC_debug_register_finalizer(p, f, d, of, od)
-# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
- GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
-# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
-# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
-# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
-# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
- GC_general_register_disappearing_link(link, GC_base(obj))
-# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
-# else
-# define GC_MALLOC(sz) GC_malloc(sz)
-# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
-# define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
-# define GC_REALLOC(old, sz) GC_realloc(old, sz)
-# define GC_FREE(p) GC_free(p)
-# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
- GC_register_finalizer(p, f, d, of, od)
-# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
- GC_register_finalizer_ignore_self(p, f, d, of, od)
-# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
-# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
-# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
-# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
- GC_general_register_disappearing_link(link, obj)
-# define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
-# endif
-/* The following are included because they are often convenient, and */
-/* reduce the chance for a misspecifed size argument. But calls may */
-/* expand to something syntactically incorrect if t is a complicated */
-/* type expression. */
-# define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
-# define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
-# define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
-# define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
-
-/* Finalization. Some of these primitives are grossly unsafe. */
-/* The idea is to make them both cheap, and sufficient to build */
-/* a safer layer, closer to PCedar finalization. */
-/* The interface represents my conclusions from a long discussion */
-/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
-/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
-/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */
-typedef void (*GC_finalization_proc)
- GC_PROTO((GC_PTR obj, GC_PTR client_data));
-
-GC_API void GC_register_finalizer
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-GC_API void GC_debug_register_finalizer
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
- /* When obj is no longer accessible, invoke */
- /* (*fn)(obj, cd). If a and b are inaccessible, and */
- /* a points to b (after disappearing links have been */
- /* made to disappear), then only a will be */
- /* finalized. (If this does not create any new */
- /* pointers to b, then b will be finalized after the */
- /* next collection.) Any finalizable object that */
- /* is reachable from itself by following one or more */
- /* pointers will not be finalized (or collected). */
- /* Thus cycles involving finalizable objects should */
- /* be avoided, or broken by disappearing links. */
- /* All but the last finalizer registered for an object */
- /* is ignored. */
- /* Finalization may be removed by passing 0 as fn. */
- /* Finalizers are implicitly unregistered just before */
- /* they are invoked. */
- /* The old finalizer and client data are stored in */
- /* *ofn and *ocd. */
- /* Fn is never invoked on an accessible object, */
- /* provided hidden pointers are converted to real */
- /* pointers only if the allocation lock is held, and */
- /* such conversions are not performed by finalization */
- /* routines. */
- /* If GC_register_finalizer is aborted as a result of */
- /* a signal, the object may be left with no */
- /* finalization, even if neither the old nor new */
- /* finalizer were NULL. */
- /* Obj should be the nonNULL starting address of an */
- /* object allocated by GC_malloc or friends. */
- /* Note that any garbage collectable object referenced */
- /* by cd will be considered accessible until the */
- /* finalizer is invoked. */
-
-/* Another versions of the above follow. It ignores */
-/* self-cycles, i.e. pointers from a finalizable object to */
-/* itself. There is a stylistic argument that this is wrong, */
-/* but it's unavoidable for C++, since the compiler may */
-/* silently introduce these. It's also benign in that specific */
-/* case. */
-GC_API void GC_register_finalizer_ignore_self
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-GC_API void GC_debug_register_finalizer_ignore_self
- GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
- GC_finalization_proc *ofn, GC_PTR *ocd));
-
-/* The following routine may be used to break cycles between */
-/* finalizable objects, thus causing cyclic finalizable */
-/* objects to be finalized in the correct order. Standard */
-/* use involves calling GC_register_disappearing_link(&p), */
-/* where p is a pointer that is not followed by finalization */
-/* code, and should not be considered in determining */
-/* finalization order. */
-GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
- /* Link should point to a field of a heap allocated */
- /* object obj. *link will be cleared when obj is */
- /* found to be inaccessible. This happens BEFORE any */
- /* finalization code is invoked, and BEFORE any */
- /* decisions about finalization order are made. */
- /* This is useful in telling the finalizer that */
- /* some pointers are not essential for proper */
- /* finalization. This may avoid finalization cycles. */
- /* Note that obj may be resurrected by another */
- /* finalizer, and thus the clearing of *link may */
- /* be visible to non-finalization code. */
- /* There's an argument that an arbitrary action should */
- /* be allowed here, instead of just clearing a pointer. */
- /* But this causes problems if that action alters, or */
- /* examines connectivity. */
- /* Returns 1 if link was already registered, 0 */
- /* otherwise. */
- /* Only exists for backward compatibility. See below: */
-
-GC_API int GC_general_register_disappearing_link
- GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
- /* A slight generalization of the above. *link is */
- /* cleared when obj first becomes inaccessible. This */
- /* can be used to implement weak pointers easily and */
- /* safely. Typically link will point to a location */
- /* holding a disguised pointer to obj. (A pointer */
- /* inside an "atomic" object is effectively */
- /* disguised.) In this way soft */
- /* pointers are broken before any object */
- /* reachable from them are finalized. Each link */
- /* May be registered only once, i.e. with one obj */
- /* value. This was added after a long email discussion */
- /* with John Ellis. */
- /* Obj must be a pointer to the first word of an object */
- /* we allocated. It is unsafe to explicitly deallocate */
- /* the object containing link. Explicitly deallocating */
- /* obj may or may not cause link to eventually be */
- /* cleared. */
-GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
- /* Returns 0 if link was not actually registered. */
- /* Undoes a registration by either of the above two */
- /* routines. */
-
-/* Auxiliary fns to make finalization work correctly with displaced */
-/* pointers introduced by the debugging allocators. */
-GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
-GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
-
-GC_API int GC_invoke_finalizers GC_PROTO((void));
- /* Run finalizers for all objects that are ready to */
- /* be finalized. Return the number of finalizers */
- /* that were run. Normally this is also called */
- /* implicitly during some allocations. If */
- /* GC-finalize_on_demand is nonzero, it must be called */
- /* explicitly. */
-
-/* GC_set_warn_proc can be used to redirect or filter warning messages. */
-/* p may not be a NULL pointer. */
-typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
-GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
- /* Returns old warning procedure. */
-
-/* The following is intended to be used by a higher level */
-/* (e.g. cedar-like) finalization facility. It is expected */
-/* that finalization code will arrange for hidden pointers to */
-/* disappear. Otherwise objects can be accessed after they */
-/* have been collected. */
-/* Note that putting pointers in atomic objects or in */
-/* nonpointer slots of "typed" objects is equivalent to */
-/* disguising them in this way, and may have other advantages. */
-# if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
- typedef GC_word GC_hidden_pointer;
-# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
-# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
- /* Converting a hidden pointer to a real pointer requires verifying */
- /* that the object still exists. This involves acquiring the */
- /* allocator lock to avoid a race with the collector. */
-# endif /* I_HIDE_POINTERS */
-
-typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
-GC_API GC_PTR GC_call_with_alloc_lock
- GC_PROTO((GC_fn_type fn, GC_PTR client_data));
-
-/* Check that p and q point to the same object. */
-/* Fail conspicuously if they don't. */
-/* Returns the first argument. */
-/* Succeeds if neither p nor q points to the heap. */
-/* May succeed if both p and q point to between heap objects. */
-GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
-
-/* Checked pointer pre- and post- increment operations. Note that */
-/* the second argument is in units of bytes, not multiples of the */
-/* object size. This should either be invoked from a macro, or the */
-/* call should be automatically generated. */
-GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
-GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
-
-/* Check that p is visible */
-/* to the collector as a possibly pointer containing location. */
-/* If it isn't fail conspicuously. */
-/* Returns the argument in all cases. May erroneously succeed */
-/* in hard cases. (This is intended for debugging use with */
-/* untyped allocations. The idea is that it should be possible, though */
-/* slow, to add such a call to all indirect pointer stores.) */
-/* Currently useless for multithreaded worlds. */
-GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
-
-/* Check that if p is a pointer to a heap page, then it points to */
-/* a valid displacement within a heap object. */
-/* Fail conspicuously if this property does not hold. */
-/* Uninteresting with ALL_INTERIOR_POINTERS. */
-/* Always returns its argument. */
-GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
-
-/* Safer, but slow, pointer addition. Probably useful mainly with */
-/* a preprocessor. Useful only for heap pointers. */
-#ifdef GC_DEBUG
-# define GC_PTR_ADD3(x, n, type_of_result) \
- ((type_of_result)GC_same_obj((x)+(n), (x)))
-# define GC_PRE_INCR3(x, n, type_of_result) \
- ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
-# define GC_POST_INCR2(x, type_of_result) \
- ((type_of_result)GC_post_incr(&(x), sizeof(*x))
-# ifdef __GNUC__
-# define GC_PTR_ADD(x, n) \
- GC_PTR_ADD3(x, n, typeof(x))
-# define GC_PRE_INCR(x, n) \
- GC_PRE_INCR3(x, n, typeof(x))
-# define GC_POST_INCR(x, n) \
- GC_POST_INCR3(x, typeof(x))
-# else
- /* We can't do this right without typeof, which ANSI */
- /* decided was not sufficiently useful. Repeatedly */
- /* mentioning the arguments seems too dangerous to be */
- /* useful. So does not casting the result. */
-# define GC_PTR_ADD(x, n) ((x)+(n))
-# endif
-#else /* !GC_DEBUG */
-# define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
-# define GC_PTR_ADD(x, n) ((x)+(n))
-# define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
-# define GC_PRE_INCR(x, n) ((x) += (n))
-# define GC_POST_INCR2(x, n, type_of_result) ((x)++)
-# define GC_POST_INCR(x, n) ((x)++)
-#endif
-
-/* Safer assignment of a pointer to a nonstack location. */
-#ifdef GC_DEBUG
-# ifdef __STDC__
-# define GC_PTR_STORE(p, q) \
- (*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
-# else
-# define GC_PTR_STORE(p, q) \
- (*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
-# endif
-#else /* !GC_DEBUG */
-# define GC_PTR_STORE(p, q) *((p) = (q))
-#endif
-
-/* Fynctions called to report pointer checking errors */
-GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
-
-GC_API void (*GC_is_valid_displacement_print_proc)
- GC_PROTO((GC_PTR p));
-
-GC_API void (*GC_is_visible_print_proc)
- GC_PROTO((GC_PTR p));
-
-#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
-# define SOLARIS_THREADS
-#endif
-
-#ifdef SOLARIS_THREADS
-/* We need to intercept calls to many of the threads primitives, so */
-/* that we can locate thread stacks and stop the world. */
-/* Note also that the collector cannot see thread specific data. */
-/* Thread specific data should generally consist of pointers to */
-/* uncollectable objects, which are deallocated using the destructor */
-/* facility in thr_keycreate. */
-# include <thread.h>
-# include <signal.h>
- int GC_thr_create(void *stack_base, size_t stack_size,
- void *(*start_routine)(void *), void *arg, long flags,
- thread_t *new_thread);
- int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
- int GC_thr_suspend(thread_t target_thread);
- int GC_thr_continue(thread_t target_thread);
- void * GC_dlopen(const char *path, int mode);
-
-# ifdef _SOLARIS_PTHREADS
-# include <pthread.h>
- extern int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void * (*thread_execp)(void *), void *arg);
- extern int GC_pthread_join(pthread_t wait_for, void **status);
-
-# undef thread_t
-
-# define pthread_join GC_pthread_join
-# define pthread_create GC_pthread_create
-#endif
-
-# define thr_create GC_thr_create
-# define thr_join GC_thr_join
-# define thr_suspend GC_thr_suspend
-# define thr_continue GC_thr_continue
-# define dlopen GC_dlopen
-
-# endif /* SOLARIS_THREADS */
-
-
-#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
-/* We treat these similarly. */
-# include <pthread.h>
-# include <signal.h>
-
- int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void *(*start_routine)(void *), void *arg);
- int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
- int GC_pthread_join(pthread_t thread, void **retval);
-
-# define pthread_create GC_pthread_create
-# define pthread_sigmask GC_pthread_sigmask
-# define pthread_join GC_pthread_join
-
-#endif /* IRIX_THREADS || LINUX_THREADS */
-
-# if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
- defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
- defined(IRIX_JDK_THREADS)
- /* Any flavor of threads except SRC_M3. */
-/* This returns a list of objects, linked through their first */
-/* word. Its use can greatly reduce lock contention problems, since */
-/* the allocation lock can be acquired and released many fewer times. */
-/* lb must be large enough to hold the pointer field. */
-GC_PTR GC_malloc_many(size_t lb);
-#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
- /* in returned list. */
-extern void GC_thr_init(); /* Needed for Solaris/X86 */
-
-#endif /* THREADS && !SRC_M3 */
-
-/*
- * If you are planning on putting
- * the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
- * from the statically loaded program section.
- * This circumvents a Solaris 2.X (X<=4) linker bug.
- */
-#if defined(sparc) || defined(__sparc)
-# define GC_INIT() { extern end, etext; \
- GC_noop(&end, &etext); }
-#else
-# if defined(__CYGWIN32__) && defined(GC_USE_DLL)
- /*
- * Similarly gnu-win32 DLLs need explicit initialization
- */
-# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
-# else
-# define GC_INIT()
-# endif
-#endif
-
-#if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32)
- /* win32S may not free all resources on process exit. */
- /* This explicitly deallocates the heap. */
- GC_API void GC_win32_free_heap ();
-#endif
-
-#ifdef __cplusplus
- } /* end of extern "C" */
-#endif
-
-#endif /* _GC_H */
diff --git a/gc/gc.mak b/gc/gc.mak
@@ -1,5 +1,6 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
-# ** DO NOT EDIT **
+# This has been hand-edited way too many times.
+# A clean, manually generated makefile would be an improvement.
# TARGTYPE "Win32 (x86) Application" 0x0101
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
@@ -72,6 +73,8 @@ CLEAN :
-@erase ".\Release\finalize.obj"
-@erase ".\Release\finalize.sbr"
-@erase ".\Release\gc.bsc"
+ -@erase ".\Release\gc_cpp.obj"
+ -@erase ".\Release\gc_cpp.sbr"
-@erase ".\Release\gc.dll"
-@erase ".\Release\gc.exp"
-@erase ".\Release\gc.lib"
@@ -111,8 +114,8 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D\
+# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D\
"WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
"WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
@@ -155,6 +158,7 @@ BSC32_SBRS= \
".\Release\dbg_mlc.sbr" \
".\Release\dyn_load.sbr" \
".\Release\finalize.sbr" \
+ ".\Release\gc_cpp.sbr" \
".\Release\headers.sbr" \
".\Release\mach_dep.sbr" \
".\Release\malloc.sbr" \
@@ -192,6 +196,7 @@ LINK32_OBJS= \
".\Release\dbg_mlc.obj" \
".\Release\dyn_load.obj" \
".\Release\finalize.obj" \
+ ".\Release\gc_cpp.obj" \
".\Release\headers.obj" \
".\Release\mach_dep.obj" \
".\Release\malloc.obj" \
@@ -245,6 +250,8 @@ CLEAN :
-@erase ".\Debug\dyn_load.sbr"
-@erase ".\Debug\finalize.obj"
-@erase ".\Debug\finalize.sbr"
+ -@erase ".\Debug\gc_cpp.obj"
+ -@erase ".\Debug\gc_cpp.sbr"
-@erase ".\Debug\gc.bsc"
-@erase ".\Debug\gc.dll"
-@erase ".\Debug\gc.exp"
@@ -289,8 +296,8 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "SILENT" /D "GC_BUILD"\
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD"\
/D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
"WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
@@ -334,6 +341,7 @@ BSC32_SBRS= \
".\Debug\dbg_mlc.sbr" \
".\Debug\dyn_load.sbr" \
".\Debug\finalize.sbr" \
+ ".\Debug\gc_cpp.sbr" \
".\Debug\headers.sbr" \
".\Debug\mach_dep.sbr" \
".\Debug\malloc.sbr" \
@@ -371,6 +379,7 @@ LINK32_OBJS= \
".\Debug\dbg_mlc.obj" \
".\Debug\dyn_load.obj" \
".\Debug\finalize.obj" \
+ ".\Debug\gc_cpp.obj" \
".\Debug\headers.obj" \
".\Debug\mach_dep.obj" \
".\Debug\malloc.obj" \
@@ -416,10 +425,13 @@ CLEAN :
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+test.c : tests\test.c
+ copy tests\test.c test.c
+
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /YX /c
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /YX /c
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS"\
/Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\gctest\Release/
@@ -505,7 +517,7 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR /YX /c
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
/D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "WIN32_THREADS" /FR"$(INTDIR)/"\
/Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\gctest\Debug/
@@ -596,7 +608,7 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\cord\Release/
CPP_SBRS=.\.
@@ -688,7 +700,7 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D\
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I include /D "_DEBUG" /D "WIN32" /D\
"_WINDOWS" /D "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX\
/Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\cord\Debug/
@@ -763,15 +775,65 @@ LINK32_OBJS= \
################################################################################
# Begin Source File
+SOURCE=.\gc_cpp.cpp
+
+!IF "$(CFG)" == "gc - Win32 Release"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_cpp.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Release\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Release\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ELSEIF "$(CFG)" == "gc - Win32 Debug"
+
+DEP_CPP_RECLA=\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_cpp.h"\
+ {$(INCLUDE)}"\sys\TYPES.H"\
+
+NODEP_CPP_RECLA=\
+ ".\th\PCR_Th.h"\
+ ".\th\PCR_ThCrSec.h"\
+ ".\th\PCR_ThCtl.h"\
+
+
+".\Debug\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+".\Debug\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
SOURCE=.\reclaim.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_RECLA=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_RECLA=\
@@ -788,10 +850,10 @@ NODEP_CPP_RECLA=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_RECLA=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_RECLA=\
@@ -808,6 +870,7 @@ NODEP_CPP_RECLA=\
!ENDIF
# End Source File
+
################################################################################
# Begin Source File
@@ -816,10 +879,10 @@ SOURCE=.\os_dep.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_OS_DE=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\STAT.H"\
{$(INCLUDE)}"\sys\TYPES.H"\
@@ -840,10 +903,10 @@ NODEP_CPP_OS_DE=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_OS_DE=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\STAT.H"\
{$(INCLUDE)}"\sys\TYPES.H"\
@@ -872,10 +935,10 @@ SOURCE=.\misc.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MISC_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MISC_=\
@@ -893,10 +956,10 @@ NODEP_CPP_MISC_=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MISC_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MISC_=\
@@ -922,10 +985,10 @@ SOURCE=.\mark_rts.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MARK_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MARK_=\
@@ -942,10 +1005,10 @@ NODEP_CPP_MARK_=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MARK_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MARK_=\
@@ -970,10 +1033,10 @@ SOURCE=.\mach_dep.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MACH_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MACH_=\
@@ -990,10 +1053,10 @@ NODEP_CPP_MACH_=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MACH_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MACH_=\
@@ -1018,10 +1081,10 @@ SOURCE=.\headers.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_HEADE=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_HEADE=\
@@ -1038,10 +1101,10 @@ NODEP_CPP_HEADE=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_HEADE=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_HEADE=\
@@ -1066,10 +1129,10 @@ SOURCE=.\alloc.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_ALLOC=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_ALLOC=\
@@ -1086,10 +1149,10 @@ NODEP_CPP_ALLOC=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_ALLOC=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_ALLOC=\
@@ -1114,10 +1177,10 @@ SOURCE=.\allchblk.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_ALLCH=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_ALLCH=\
@@ -1134,10 +1197,10 @@ NODEP_CPP_ALLCH=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_ALLCH=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_ALLCH=\
@@ -1162,10 +1225,10 @@ SOURCE=.\stubborn.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_STUBB=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_STUBB=\
@@ -1182,10 +1245,10 @@ NODEP_CPP_STUBB=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_STUBB=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_STUBB=\
@@ -1210,10 +1273,10 @@ SOURCE=.\obj_map.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_OBJ_M=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_OBJ_M=\
@@ -1230,10 +1293,10 @@ NODEP_CPP_OBJ_M=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_OBJ_M=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_OBJ_M=\
@@ -1258,10 +1321,10 @@ SOURCE=.\new_hblk.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_NEW_H=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_NEW_H=\
@@ -1278,10 +1341,10 @@ NODEP_CPP_NEW_H=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_NEW_H=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_NEW_H=\
@@ -1306,11 +1369,12 @@ SOURCE=.\mark.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MARK_C=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MARK_C=\
@@ -1327,11 +1391,12 @@ NODEP_CPP_MARK_C=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MARK_C=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MARK_C=\
@@ -1356,10 +1421,10 @@ SOURCE=.\malloc.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MALLO=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MALLO=\
@@ -1376,10 +1441,10 @@ NODEP_CPP_MALLO=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MALLO=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MALLO=\
@@ -1404,10 +1469,10 @@ SOURCE=.\mallocx.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_MALLX=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MALLX=\
@@ -1424,10 +1489,10 @@ NODEP_CPP_MALLX=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_MALLX=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_MALLX=\
@@ -1452,11 +1517,12 @@ SOURCE=.\finalize.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_FINAL=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_FINAL=\
@@ -1473,11 +1539,12 @@ NODEP_CPP_FINAL=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_FINAL=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_FINAL=\
@@ -1502,10 +1569,10 @@ SOURCE=.\dbg_mlc.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_DBG_M=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_DBG_M=\
@@ -1522,10 +1589,10 @@ NODEP_CPP_DBG_M=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_DBG_M=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_DBG_M=\
@@ -1550,10 +1617,10 @@ SOURCE=.\blacklst.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_BLACK=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_BLACK=\
@@ -1570,10 +1637,10 @@ NODEP_CPP_BLACK=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_BLACK=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_BLACK=\
@@ -1598,12 +1665,13 @@ SOURCE=.\typd_mlc.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_TYPD_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
- ".\gc_typed.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_TYPD_=\
@@ -1620,12 +1688,13 @@ NODEP_CPP_TYPD_=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_TYPD_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
- ".\gc_typed.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_TYPD_=\
@@ -1650,11 +1719,12 @@ SOURCE=.\ptr_chck.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_PTR_C=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_PTR_C=\
@@ -1671,11 +1741,12 @@ NODEP_CPP_PTR_C=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_PTR_C=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_mark.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_pmark.h"\
+ ".\include\gc_mark.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_PTR_C=\
@@ -1700,10 +1771,10 @@ SOURCE=.\dyn_load.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_DYN_L=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\STAT.H"\
{$(INCLUDE)}"\sys\TYPES.H"\
@@ -1723,10 +1794,10 @@ NODEP_CPP_DYN_L=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_DYN_L=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\STAT.H"\
{$(INCLUDE)}"\sys\TYPES.H"\
@@ -1754,10 +1825,10 @@ SOURCE=.\win32_threads.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_WIN32=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_WIN32=\
@@ -1774,10 +1845,10 @@ NODEP_CPP_WIN32=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_WIN32=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_WIN32=\
@@ -1802,10 +1873,10 @@ SOURCE=.\checksums.c
!IF "$(CFG)" == "gc - Win32 Release"
DEP_CPP_CHECK=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_CHECK=\
@@ -1822,10 +1893,10 @@ NODEP_CPP_CHECK=\
!ELSEIF "$(CFG)" == "gc - Win32 Debug"
DEP_CPP_CHECK=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_CHECK=\
@@ -1876,13 +1947,13 @@ NODEP_CPP_CHECK=\
################################################################################
# Begin Source File
-SOURCE=.\test.c
+SOURCE=.\tests\test.c
DEP_CPP_TEST_=\
- ".\gcconfig.h"\
- ".\gc.h"\
- ".\gc_hdrs.h"\
- ".\gc_priv.h"\
- ".\gc_typed.h"\
+ ".\include\private\gcconfig.h"\
+ ".\include\gc.h"\
+ ".\include\private\gc_hdrs.h"\
+ ".\include\private\gc_priv.h"\
+ ".\include\gc_typed.h"\
{$(INCLUDE)}"\sys\TYPES.H"\
NODEP_CPP_TEST_=\
@@ -1944,13 +2015,13 @@ NODEP_CPP_TEST_=\
SOURCE=.\cord\de_win.c
DEP_CPP_DE_WI=\
- ".\cord\cord.h"\
+ ".\include\cord.h"\
".\cord\de_cmds.h"\
".\cord\de_win.h"\
- ".\cord\private\cord_pos.h"\
+ ".\include\private\cord_pos.h"\
NODEP_CPP_DE_WI=\
- ".\cord\gc.h"\
+ ".\include\gc.h"\
!IF "$(CFG)" == "cord - Win32 Release"
@@ -1975,13 +2046,13 @@ NODEP_CPP_DE_WI=\
SOURCE=.\cord\de.c
DEP_CPP_DE_C2e=\
- ".\cord\cord.h"\
+ ".\include\cord.h"\
".\cord\de_cmds.h"\
".\cord\de_win.h"\
- ".\cord\private\cord_pos.h"\
+ ".\include\private\cord_pos.h"\
NODEP_CPP_DE_C2e=\
- ".\cord\gc.h"\
+ ".\include\gc.h"\
!IF "$(CFG)" == "cord - Win32 Release"
@@ -2006,12 +2077,12 @@ NODEP_CPP_DE_C2e=\
SOURCE=.\cord\cordxtra.c
DEP_CPP_CORDX=\
- ".\cord\cord.h"\
- ".\cord\ec.h"\
- ".\cord\private\cord_pos.h"\
+ ".\include\cord.h"\
+ ".\include\ec.h"\
+ ".\include\private\cord_pos.h"\
NODEP_CPP_CORDX=\
- ".\cord\gc.h"\
+ ".\include\gc.h"\
!IF "$(CFG)" == "cord - Win32 Release"
@@ -2036,11 +2107,11 @@ NODEP_CPP_CORDX=\
SOURCE=.\cord\cordbscs.c
DEP_CPP_CORDB=\
- ".\cord\cord.h"\
- ".\cord\private\cord_pos.h"\
+ ".\include\cord.h"\
+ ".\include\private\cord_pos.h"\
NODEP_CPP_CORDB=\
- ".\cord\gc.h"\
+ ".\include\gc.h"\
!IF "$(CFG)" == "cord - Win32 Release"
diff --git a/gc/gc.man b/gc/gc.man
@@ -1,80 +0,0 @@
-.TH GC_MALLOC 1L "12 February 1996"
-.SH NAME
-GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement
-.SH SYNOPSIS
-#include "gc.h"
-.br
-# define malloc(n) GC_malloc(n)
-.br
-... malloc(...) ...
-.br
-.sp
-cc ... gc.a
-.LP
-.SH DESCRIPTION
-.I GC_malloc
-and
-.I GC_free
-are plug-in replacements for standard malloc and free. However,
-.I
-GC_malloc
-will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by
-.I
-GC_malloc
-or friends.
-.LP
-See the documentation in the include file gc_cpp.h for an alternate, C++ specific interface to the garbage collector.
-.LP
-Unlike the standard implementations of malloc,
-.I
-GC_malloc
-clears the newly allocated storage.
-.I
-GC_malloc_atomic
-does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector.
-.LP
-.I
-GC_free
-can be used to deallocate objects, but its use is optional, and generally discouraged.
-.I
-GC_realloc
-has the standard realloc semantics. It preserves pointer-free-ness.
-.I
-GC_register_finalizer
-allows for registration of functions that are invoked when an object becomes inaccessible.
-.LP
-The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning.
-.LP
-.I
-GC_malloc_ignore_off_page
-and
-.I
-GC_malloc_atomic_ignore_off_page
-inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.)
-.LP
-It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed.
-.LP
-The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with
-.I
-GC_set_warn_proc.
-This is recommended for production code. See gc.h for details.
-.LP
-Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions.
-.LP
-On some machines, collection will be performed incrementally after a call to
-.I
-GC_enable_incremental.
-This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap.
-.LP
-Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
-.LP
-.SH "SEE ALSO"
-The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.)
-.LP
-Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
-\fISoftware Practice & Experience\fP, September 1988, pp. 807-820.
-.LP
-The malloc(3) man page.
-.LP
-.SH AUTHOR
-Hans-J. Boehm (boehm@parc.xerox.com). Some of the code was written by others, most notably Alan Demers.
diff --git a/gc/gc_alloc.h b/gc/gc_alloc.h
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-//
-// This is a C++ header file that is intended to replace the SGI STL
-// alloc.h. This assumes SGI STL version < 3.0.
-//
-// This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE
-// and -DALL_INTERIOR_POINTERS. We also recommend
-// -DREDIRECT_MALLOC=GC_uncollectable_malloc.
-//
-// Some of this could be faster in the explicit deallocation case. In particular,
-// we spend too much time clearing objects on the free lists. That could be avoided.
-//
-// This uses template classes with static members, and hence does not work
-// with g++ 2.7.2 and earlier.
-//
-
-#include "gc.h"
-
-#ifndef GC_ALLOC_H
-
-#define GC_ALLOC_H
-#define __ALLOC_H // Prevent inclusion of the default version. Ugly.
-#define __SGI_STL_ALLOC_H
-#define __SGI_STL_INTERNAL_ALLOC_H
-
-#ifndef __ALLOC
-# define __ALLOC alloc
-#endif
-
-#include <stddef.h>
-#include <string.h>
-
-// The following is just replicated from the conventional SGI alloc.h:
-
-template<class T, class alloc>
-class simple_alloc {
-
-public:
- static T *allocate(size_t n)
- { return 0 == n? 0 : (T*) alloc::allocate(n * sizeof (T)); }
- static T *allocate(void)
- { return (T*) alloc::allocate(sizeof (T)); }
- static void deallocate(T *p, size_t n)
- { if (0 != n) alloc::deallocate(p, n * sizeof (T)); }
- static void deallocate(T *p)
- { alloc::deallocate(p, sizeof (T)); }
-};
-
-#include "gc.h"
-
-// The following need to match collector data structures.
-// We can't include gc_priv.h, since that pulls in way too much stuff.
-// This should eventually be factored out into another include file.
-
-extern "C" {
- extern void ** const GC_objfreelist_ptr;
- extern void ** const GC_aobjfreelist_ptr;
- extern void ** const GC_uobjfreelist_ptr;
- extern void ** const GC_auobjfreelist_ptr;
-
- extern void GC_incr_words_allocd(size_t words);
- extern void GC_incr_mem_freed(size_t words);
-
- extern char * GC_generic_malloc_words_small(size_t word, int kind);
-}
-
-// Object kinds; must match PTRFREE, NORMAL, UNCOLLECTABLE, and
-// AUNCOLLECTABLE in gc_priv.h.
-
-enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2,
- GC_AUNCOLLECTABLE = 3 };
-
-enum { GC_max_fast_bytes = 255 };
-
-enum { GC_bytes_per_word = sizeof(char *) };
-
-enum { GC_byte_alignment = 8 };
-
-enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word };
-
-inline void * &GC_obj_link(void * p)
-{ return *(void **)p; }
-
-// Compute a number of words >= n+1 bytes.
-// The +1 allows for pointers one past the end.
-inline size_t GC_round_up(size_t n)
-{
- return ((n + GC_byte_alignment)/GC_byte_alignment)*GC_word_alignment;
-}
-
-// The same but don't allow for extra byte.
-inline size_t GC_round_up_uncollectable(size_t n)
-{
- return ((n + GC_byte_alignment - 1)/GC_byte_alignment)*GC_word_alignment;
-}
-
-template <int dummy>
-class GC_aux_template {
-public:
- // File local count of allocated words. Occasionally this is
- // added into the global count. A separate count is necessary since the
- // real one must be updated with a procedure call.
- static size_t GC_words_recently_allocd;
-
- // Same for uncollectable mmory. Not yet reflected in either
- // GC_words_recently_allocd or GC_non_gc_bytes.
- static size_t GC_uncollectable_words_recently_allocd;
-
- // Similar counter for explicitly deallocated memory.
- static size_t GC_mem_recently_freed;
-
- // Again for uncollectable memory.
- static size_t GC_uncollectable_mem_recently_freed;
-
- static void * GC_out_of_line_malloc(size_t nwords, int kind);
-};
-
-template <int dummy>
-size_t GC_aux_template<dummy>::GC_words_recently_allocd = 0;
-
-template <int dummy>
-size_t GC_aux_template<dummy>::GC_uncollectable_words_recently_allocd = 0;
-
-template <int dummy>
-size_t GC_aux_template<dummy>::GC_mem_recently_freed = 0;
-
-template <int dummy>
-size_t GC_aux_template<dummy>::GC_uncollectable_mem_recently_freed = 0;
-
-template <int dummy>
-void * GC_aux_template<dummy>::GC_out_of_line_malloc(size_t nwords, int kind)
-{
- GC_words_recently_allocd += GC_uncollectable_words_recently_allocd;
- GC_non_gc_bytes +=
- GC_bytes_per_word * GC_uncollectable_words_recently_allocd;
- GC_uncollectable_words_recently_allocd = 0;
-
- GC_mem_recently_freed += GC_uncollectable_mem_recently_freed;
- GC_non_gc_bytes -=
- GC_bytes_per_word * GC_uncollectable_mem_recently_freed;
- GC_uncollectable_mem_recently_freed = 0;
-
- GC_incr_words_allocd(GC_words_recently_allocd);
- GC_words_recently_allocd = 0;
-
- GC_incr_mem_freed(GC_mem_recently_freed);
- GC_mem_recently_freed = 0;
-
- return GC_generic_malloc_words_small(nwords, kind);
-}
-
-typedef GC_aux_template<0> GC_aux;
-
-// A fast, single-threaded, garbage-collected allocator
-// We assume the first word will be immediately overwritten.
-// In this version, deallocation is not a noop, and explicit
-// deallocation is likely to help performance.
-template <int dummy>
-class single_client_gc_alloc_template {
- public:
- static void * allocate(size_t n)
- {
- size_t nwords = GC_round_up(n);
- void ** flh;
- void * op;
-
- if (n > GC_max_fast_bytes) return GC_malloc(n);
- flh = GC_objfreelist_ptr + nwords;
- if (0 == (op = *flh)) {
- return GC_aux::GC_out_of_line_malloc(nwords, GC_NORMAL);
- }
- *flh = GC_obj_link(op);
- GC_aux::GC_words_recently_allocd += nwords;
- return op;
- }
- static void * ptr_free_allocate(size_t n)
- {
- size_t nwords = GC_round_up(n);
- void ** flh;
- void * op;
-
- if (n > GC_max_fast_bytes) return GC_malloc_atomic(n);
- flh = GC_aobjfreelist_ptr + nwords;
- if (0 == (op = *flh)) {
- return GC_aux::GC_out_of_line_malloc(nwords, GC_PTRFREE);
- }
- *flh = GC_obj_link(op);
- GC_aux::GC_words_recently_allocd += nwords;
- return op;
- }
- static void deallocate(void *p, size_t n)
- {
- size_t nwords = GC_round_up(n);
- void ** flh;
-
- if (n > GC_max_fast_bytes) {
- GC_free(p);
- } else {
- flh = GC_objfreelist_ptr + nwords;
- GC_obj_link(p) = *flh;
- memset((char *)p + GC_bytes_per_word, 0,
- GC_bytes_per_word * (nwords - 1));
- *flh = p;
- GC_aux::GC_mem_recently_freed += nwords;
- }
- }
- static void ptr_free_deallocate(void *p, size_t n)
- {
- size_t nwords = GC_round_up(n);
- void ** flh;
-
- if (n > GC_max_fast_bytes) {
- GC_free(p);
- } else {
- flh = GC_aobjfreelist_ptr + nwords;
- GC_obj_link(p) = *flh;
- *flh = p;
- GC_aux::GC_mem_recently_freed += nwords;
- }
- }
-};
-
-typedef single_client_gc_alloc_template<0> single_client_gc_alloc;
-
-// Once more, for uncollectable objects.
-template <int dummy>
-class single_client_alloc_template {
- public:
- static void * allocate(size_t n)
- {
- size_t nwords = GC_round_up_uncollectable(n);
- void ** flh;
- void * op;
-
- if (n > GC_max_fast_bytes) return GC_malloc_uncollectable(n);
- flh = GC_uobjfreelist_ptr + nwords;
- if (0 == (op = *flh)) {
- return GC_aux::GC_out_of_line_malloc(nwords, GC_UNCOLLECTABLE);
- }
- *flh = GC_obj_link(op);
- GC_aux::GC_uncollectable_words_recently_allocd += nwords;
- return op;
- }
- static void * ptr_free_allocate(size_t n)
- {
- size_t nwords = GC_round_up_uncollectable(n);
- void ** flh;
- void * op;
-
- if (n > GC_max_fast_bytes) return GC_malloc_atomic_uncollectable(n);
- flh = GC_auobjfreelist_ptr + nwords;
- if (0 == (op = *flh)) {
- return GC_aux::GC_out_of_line_malloc(nwords, GC_AUNCOLLECTABLE);
- }
- *flh = GC_obj_link(op);
- GC_aux::GC_uncollectable_words_recently_allocd += nwords;
- return op;
- }
- static void deallocate(void *p, size_t n)
- {
- size_t nwords = GC_round_up_uncollectable(n);
- void ** flh;
-
- if (n > GC_max_fast_bytes) {
- GC_free(p);
- } else {
- flh = GC_uobjfreelist_ptr + nwords;
- GC_obj_link(p) = *flh;
- *flh = p;
- GC_aux::GC_uncollectable_mem_recently_freed += nwords;
- }
- }
- static void ptr_free_deallocate(void *p, size_t n)
- {
- size_t nwords = GC_round_up_uncollectable(n);
- void ** flh;
-
- if (n > GC_max_fast_bytes) {
- GC_free(p);
- } else {
- flh = GC_auobjfreelist_ptr + nwords;
- GC_obj_link(p) = *flh;
- *flh = p;
- GC_aux::GC_uncollectable_mem_recently_freed += nwords;
- }
- }
-};
-
-typedef single_client_alloc_template<0> single_client_alloc;
-
-template < int dummy >
-class gc_alloc_template {
- public:
- static void * allocate(size_t n) { return GC_malloc(n); }
- static void * ptr_free_allocate(size_t n)
- { return GC_malloc_atomic(n); }
- static void deallocate(void *, size_t) { }
- static void ptr_free_deallocate(void *, size_t) { }
-};
-
-typedef gc_alloc_template < 0 > gc_alloc;
-
-template < int dummy >
-class alloc_template {
- public:
- static void * allocate(size_t n) { return GC_malloc_uncollectable(n); }
- static void * ptr_free_allocate(size_t n)
- { return GC_malloc_atomic_uncollectable(n); }
- static void deallocate(void *p, size_t) { GC_free(p); }
- static void ptr_free_deallocate(void *p, size_t) { GC_free(p); }
-};
-
-typedef alloc_template < 0 > alloc;
-
-#ifdef _SGI_SOURCE
-
-// We want to specialize simple_alloc so that it does the right thing
-// for all pointerfree types. At the moment there is no portable way to
-// even approximate that. The following approximation should work for
-// SGI compilers, and perhaps some others.
-
-# define __GC_SPECIALIZE(T,alloc) \
-class simple_alloc<T, alloc> { \
-public: \
- static T *allocate(size_t n) \
- { return 0 == n? 0 : \
- (T*) alloc::ptr_free_allocate(n * sizeof (T)); } \
- static T *allocate(void) \
- { return (T*) alloc::ptr_free_allocate(sizeof (T)); } \
- static void deallocate(T *p, size_t n) \
- { if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \
- static void deallocate(T *p) \
- { alloc::ptr_free_deallocate(p, sizeof (T)); } \
-};
-
-__GC_SPECIALIZE(char, gc_alloc)
-__GC_SPECIALIZE(int, gc_alloc)
-__GC_SPECIALIZE(unsigned, gc_alloc)
-__GC_SPECIALIZE(float, gc_alloc)
-__GC_SPECIALIZE(double, gc_alloc)
-
-__GC_SPECIALIZE(char, alloc)
-__GC_SPECIALIZE(int, alloc)
-__GC_SPECIALIZE(unsigned, alloc)
-__GC_SPECIALIZE(float, alloc)
-__GC_SPECIALIZE(double, alloc)
-
-__GC_SPECIALIZE(char, single_client_gc_alloc)
-__GC_SPECIALIZE(int, single_client_gc_alloc)
-__GC_SPECIALIZE(unsigned, single_client_gc_alloc)
-__GC_SPECIALIZE(float, single_client_gc_alloc)
-__GC_SPECIALIZE(double, single_client_gc_alloc)
-
-__GC_SPECIALIZE(char, single_client_alloc)
-__GC_SPECIALIZE(int, single_client_alloc)
-__GC_SPECIALIZE(unsigned, single_client_alloc)
-__GC_SPECIALIZE(float, single_client_alloc)
-__GC_SPECIALIZE(double, single_client_alloc)
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-???copy stuff from stl_alloc.h or remove it to a different file ???
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-#endif /* _SGI_SOURCE */
-
-#endif /* GC_ALLOC_H */
diff --git a/gc/gc_copy_descr.h b/gc/gc_copy_descr.h
@@ -1,26 +0,0 @@
-
-/*
- * Copyright (c) 1999 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/* Descriptor for allocation request. May be redefined by client. */
-typedef struct {
- GC_word bitmap; /* Bitmap describing pointer locations. */
- /* High order bit correspond to 0th */
- /* word. 2 lsbs must be 0. */
- size_t length; /* In bytes, must be multiple of word */
- /* size. Must be >0, <= 512 */
-} * GC_copy_descriptor;
-
-/* The collector accesses descriptors only through these two macros. */
-#define GC_SIZE_FROM_DESCRIPTOR(d) ((d) -> length)
-#define GC_BIT_MAP_FROM_DESCRIPTOR(d) ((d) -> bitmap)
-
diff --git a/gc/gc_cpp.cc b/gc/gc_cpp.cc
@@ -26,27 +26,14 @@ Authors: John R. Ellis and Jesse Hull
#include "gc_cpp.h"
+#ifndef _MSC_VER
+/* In the Visual C++ case, we moved this into the header. */
void* operator new( size_t size ) {
return GC_MALLOC_UNCOLLECTABLE( size );}
void operator delete( void* obj ) {
GC_FREE( obj );}
-#ifdef _MSC_VER
-// This new operator is used by VC++ in case of Debug builds !
-void* operator new( size_t size,
- int ,//nBlockUse,
- const char * szFileName,
- int nLine
- ) {
-# ifndef GC_DEBUG
- return GC_malloc_uncollectable( size );
-# else
- return GC_debug_malloc_uncollectable(size, szFileName, nLine);
-# endif
-}
-#endif
-
#ifdef OPERATOR_NEW_ARRAY
void* operator new[]( size_t size ) {
@@ -57,4 +44,6 @@ void operator delete[]( void* obj ) {
#endif /* OPERATOR_NEW_ARRAY */
+#endif /* _MSC_VER */
+
diff --git a/gc/gc_cpp.cpp b/gc/gc_cpp.cpp
@@ -0,0 +1,2 @@
+// Visual C++ seems to prefer a .cpp extension to .cc
+#include "gc_cpp.cc"
diff --git a/gc/gc_cpp.h b/gc/gc_cpp.h
@@ -1,290 +0,0 @@
-#ifndef GC_CPP_H
-#define GC_CPP_H
-/****************************************************************************
-Copyright (c) 1994 by Xerox Corporation. All rights reserved.
-
-THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-
-Permission is hereby granted to use or copy this program for any
-purpose, provided the above notices are retained on all copies.
-Permission to modify the code and to distribute modified code is
-granted, provided the above notices are retained, and a notice that
-the code was modified is included with the above copyright notice.
-****************************************************************************
-
-C++ Interface to the Boehm Collector
-
- John R. Ellis and Jesse Hull
- Last modified on Mon Jul 24 15:43:42 PDT 1995 by ellis
-
-This interface provides access to the Boehm collector. It provides
-basic facilities similar to those described in "Safe, Efficient
-Garbage Collection for C++", by John R. Elis and David L. Detlefs
-(ftp.parc.xerox.com:/pub/ellis/gc).
-
-All heap-allocated objects are either "collectable" or
-"uncollectable". Programs must explicitly delete uncollectable
-objects, whereas the garbage collector will automatically delete
-collectable objects when it discovers them to be inaccessible.
-Collectable objects may freely point at uncollectable objects and vice
-versa.
-
-Objects allocated with the built-in "::operator new" are uncollectable.
-
-Objects derived from class "gc" are collectable. For example:
-
- class A: public gc {...};
- A* a = new A; // a is collectable.
-
-Collectable instances of non-class types can be allocated using the GC
-placement:
-
- typedef int A[ 10 ];
- A* a = new (GC) A;
-
-Uncollectable instances of classes derived from "gc" can be allocated
-using the NoGC placement:
-
- class A: public gc {...};
- A* a = new (NoGC) A; // a is uncollectable.
-
-Both uncollectable and collectable objects can be explicitly deleted
-with "delete", which invokes an object's destructors and frees its
-storage immediately.
-
-A collectable object may have a clean-up function, which will be
-invoked when the collector discovers the object to be inaccessible.
-An object derived from "gc_cleanup" or containing a member derived
-from "gc_cleanup" has a default clean-up function that invokes the
-object's destructors. Explicit clean-up functions may be specified as
-an additional placement argument:
-
- A* a = ::new (GC, MyCleanup) A;
-
-An object is considered "accessible" by the collector if it can be
-reached by a path of pointers from static variables, automatic
-variables of active functions, or from some object with clean-up
-enabled; pointers from an object to itself are ignored.
-
-Thus, if objects A and B both have clean-up functions, and A points at
-B, B is considered accessible. After A's clean-up is invoked and its
-storage released, B will then become inaccessible and will have its
-clean-up invoked. If A points at B and B points to A, forming a
-cycle, then that's considered a storage leak, and neither will be
-collectable. See the interface gc.h for low-level facilities for
-handling such cycles of objects with clean-up.
-
-The collector cannot guarrantee that it will find all inaccessible
-objects. In practice, it finds almost all of them.
-
-
-Cautions:
-
-1. Be sure the collector has been augmented with "make c++".
-
-2. If your compiler supports the new "operator new[]" syntax, then
-add -DOPERATOR_NEW_ARRAY to the Makefile.
-
-If your compiler doesn't support "operator new[]", beware that an
-array of type T, where T is derived from "gc", may or may not be
-allocated as a collectable object (it depends on the compiler). Use
-the explicit GC placement to make the array collectable. For example:
-
- class A: public gc {...};
- A* a1 = new A[ 10 ]; // collectable or uncollectable?
- A* a2 = new (GC) A[ 10 ]; // collectable
-
-3. The destructors of collectable arrays of objects derived from
-"gc_cleanup" will not be invoked properly. For example:
-
- class A: public gc_cleanup {...};
- A* a = new (GC) A[ 10 ]; // destructors not invoked correctly
-
-Typically, only the destructor for the first element of the array will
-be invoked when the array is garbage-collected. To get all the
-destructors of any array executed, you must supply an explicit
-clean-up function:
-
- A* a = new (GC, MyCleanUp) A[ 10 ];
-
-(Implementing clean-up of arrays correctly, portably, and in a way
-that preserves the correct exception semantics requires a language
-extension, e.g. the "gc" keyword.)
-
-4. Compiler bugs:
-
-* Solaris 2's CC (SC3.0) doesn't implement t->~T() correctly, so the
-destructors of classes derived from gc_cleanup won't be invoked.
-You'll have to explicitly register a clean-up function with
-new-placement syntax.
-
-* Evidently cfront 3.0 does not allow destructors to be explicitly
-invoked using the ANSI-conforming syntax t->~T(). If you're using
-cfront 3.0, you'll have to comment out the class gc_cleanup, which
-uses explicit invocation.
-
-****************************************************************************/
-
-#include "gc.h"
-
-#ifndef THINK_CPLUS
-#define _cdecl
-#endif
-
-#if ! defined( OPERATOR_NEW_ARRAY ) \
- && (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6) \
- || __WATCOMC__ >= 1050)
-# define OPERATOR_NEW_ARRAY
-#endif
-
-enum GCPlacement {GC, NoGC, PointerFreeGC};
-
-class gc {public:
- inline void* operator new( size_t size );
- inline void* operator new( size_t size, GCPlacement gcp );
- inline void operator delete( void* obj );
-
-#ifdef OPERATOR_NEW_ARRAY
- inline void* operator new[]( size_t size );
- inline void* operator new[]( size_t size, GCPlacement gcp );
- inline void operator delete[]( void* obj );
-#endif /* OPERATOR_NEW_ARRAY */
- };
- /*
- Instances of classes derived from "gc" will be allocated in the
- collected heap by default, unless an explicit NoGC placement is
- specified. */
-
-class gc_cleanup: virtual public gc {public:
- inline gc_cleanup();
- inline virtual ~gc_cleanup();
-private:
- inline static void _cdecl cleanup( void* obj, void* clientData );};
- /*
- Instances of classes derived from "gc_cleanup" will be allocated
- in the collected heap by default. When the collector discovers an
- inaccessible object derived from "gc_cleanup" or containing a
- member derived from "gc_cleanup", its destructors will be
- invoked. */
-
-extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
-
-inline void* operator new(
- size_t size,
- GCPlacement gcp,
- GCCleanUpFunc cleanup = 0,
- void* clientData = 0 );
- /*
- Allocates a collectable or uncollected object, according to the
- value of "gcp".
-
- For collectable objects, if "cleanup" is non-null, then when the
- allocated object "obj" becomes inaccessible, the collector will
- invoke the function "cleanup( obj, clientData )" but will not
- invoke the object's destructors. It is an error to explicitly
- delete an object allocated with a non-null "cleanup".
-
- It is an error to specify a non-null "cleanup" with NoGC or for
- classes derived from "gc_cleanup" or containing members derived
- from "gc_cleanup". */
-
-#ifdef OPERATOR_NEW_ARRAY
-
-inline void* operator new[](
- size_t size,
- GCPlacement gcp,
- GCCleanUpFunc cleanup = 0,
- void* clientData = 0 );
- /*
- The operator new for arrays, identical to the above. */
-
-#endif /* OPERATOR_NEW_ARRAY */
-
-/****************************************************************************
-
-Inline implementation
-
-****************************************************************************/
-
-inline void* gc::operator new( size_t size ) {
- return GC_MALLOC( size );}
-
-inline void* gc::operator new( size_t size, GCPlacement gcp ) {
- if (gcp == GC)
- return GC_MALLOC( size );
- else if (gcp == PointerFreeGC)
- return GC_MALLOC_ATOMIC( size );
- else
- return GC_MALLOC_UNCOLLECTABLE( size );}
-
-inline void gc::operator delete( void* obj ) {
- GC_FREE( obj );}
-
-
-#ifdef OPERATOR_NEW_ARRAY
-
-inline void* gc::operator new[]( size_t size ) {
- return gc::operator new( size );}
-
-inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
- return gc::operator new( size, gcp );}
-
-inline void gc::operator delete[]( void* obj ) {
- gc::operator delete( obj );}
-
-#endif /* OPERATOR_NEW_ARRAY */
-
-
-inline gc_cleanup::~gc_cleanup() {
- GC_REGISTER_FINALIZER_IGNORE_SELF( GC_base(this), 0, 0, 0, 0 );}
-
-inline void gc_cleanup::cleanup( void* obj, void* displ ) {
- ((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
-
-inline gc_cleanup::gc_cleanup() {
- GC_finalization_proc oldProc;
- void* oldData;
- void* base = GC_base( (void *) this );
- if (0 == base) return;
- GC_REGISTER_FINALIZER_IGNORE_SELF(
- base, cleanup, (void*) ((char*) this - (char*) base),
- &oldProc, &oldData );
- if (0 != oldProc) {
- GC_REGISTER_FINALIZER_IGNORE_SELF( base, oldProc, oldData, 0, 0 );}}
-
-inline void* operator new(
- size_t size,
- GCPlacement gcp,
- GCCleanUpFunc cleanup,
- void* clientData )
-{
- void* obj;
-
- if (gcp == GC) {
- obj = GC_MALLOC( size );
- if (cleanup != 0)
- GC_REGISTER_FINALIZER_IGNORE_SELF(
- obj, cleanup, clientData, 0, 0 );}
- else if (gcp == PointerFreeGC) {
- obj = GC_MALLOC_ATOMIC( size );}
- else {
- obj = GC_MALLOC_UNCOLLECTABLE( size );};
- return obj;}
-
-
-#ifdef OPERATOR_NEW_ARRAY
-
-inline void* operator new[](
- size_t size,
- GCPlacement gcp,
- GCCleanUpFunc cleanup,
- void* clientData )
-{
- return ::operator new( size, gcp, cleanup, clientData );}
-
-#endif /* OPERATOR_NEW_ARRAY */
-
-
-#endif /* GC_CPP_H */
-
diff --git a/gc/gc_dlopen.c b/gc/gc_dlopen.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1997 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Original author: Bill Janssen
+ * Heavily modified by Hans Boehm and others
+ */
+
+/*
+ * This used to be in dyn_load.c. It was extracted into a separate file
+ * to avoid having to link against libdl.{a,so} if the client doesn't call
+ * dlopen. -HB
+ */
+
+#include "private/gc_priv.h"
+
+# if defined(LINUX_THREADS) || defined(SOLARIS_THREADS) \
+ || defined(HPUX_THREADS) || defined(IRIX_THREADS)
+
+# if defined(dlopen) && !defined(GC_USE_LD_WRAP)
+ /* To support various threads pkgs, gc.h interposes on dlopen by */
+ /* defining "dlopen" to be "GC_dlopen", which is implemented below. */
+ /* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */
+ /* real system dlopen() in their implementation. We first remove */
+ /* gc.h's dlopen definition and restore it later, after GC_dlopen(). */
+# undef dlopen
+# endif
+
+ /* Make sure we're not in the middle of a collection, and make */
+ /* sure we don't start any. Returns previous value of GC_dont_gc. */
+ /* This is invoked prior to a dlopen call to avoid synchronization */
+ /* issues. We can't just acquire the allocation lock, since startup */
+ /* code in dlopen may try to allocate. */
+ /* This solution risks heap growth in the presence of many dlopen */
+ /* calls in either a multithreaded environment, or if the library */
+ /* initialization code allocates substantial amounts of GC'ed memory. */
+ /* But I don't know of a better solution. */
+ /* This can still deadlock if the client explicitly starts a GC */
+ /* during the dlopen. He shouldn't do that. */
+ static GC_bool disable_gc_for_dlopen()
+ {
+ GC_bool result;
+ LOCK();
+ result = GC_dont_gc;
+ while (GC_incremental && GC_collection_in_progress()) {
+ GC_collect_a_little_inner(1000);
+ }
+ GC_dont_gc = TRUE;
+ UNLOCK();
+ return(result);
+ }
+
+ /* Redefine dlopen to guarantee mutual exclusion with */
+ /* GC_register_dynamic_libraries. */
+ /* Should probably happen for other operating systems, too. */
+
+#include <dlfcn.h>
+
+#ifdef GC_USE_LD_WRAP
+ void * __wrap_dlopen(const char *path, int mode)
+#else
+ void * GC_dlopen(path, mode)
+ GC_CONST char * path;
+ int mode;
+#endif
+{
+ void * result;
+ GC_bool dont_gc_save;
+
+# ifndef USE_PROC_FOR_LIBRARIES
+ dont_gc_save = disable_gc_for_dlopen();
+# endif
+# ifdef GC_USE_LD_WRAP
+ result = (void *)__real_dlopen(path, mode);
+# else
+ result = dlopen(path, mode);
+# endif
+# ifndef USE_PROC_FOR_LIBRARIES
+ GC_dont_gc = dont_gc_save;
+# endif
+ return(result);
+}
+# endif /* LINUX_THREADS || SOLARIS_THREADS || ... */
+
+
+
diff --git a/gc/gc_hdrs.h b/gc/gc_hdrs.h
@@ -1,135 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/* Boehm, July 11, 1995 11:54 am PDT */
-# ifndef GC_HEADERS_H
-# define GC_HEADERS_H
-typedef struct hblkhdr hdr;
-
-# if CPP_WORDSZ != 32 && CPP_WORDSZ < 36
- --> Get a real machine.
-# endif
-
-/*
- * The 2 level tree data structure that is used to find block headers.
- * If there are more than 32 bits in a pointer, the top level is a hash
- * table.
- */
-
-# if CPP_WORDSZ > 32
-# define HASH_TL
-# endif
-
-/* Define appropriate out-degrees for each of the two tree levels */
-# ifdef SMALL_CONFIG
-# define LOG_BOTTOM_SZ 11
- /* Keep top index size reasonable with smaller blocks. */
-# else
-# define LOG_BOTTOM_SZ 10
-# endif
-# ifndef HASH_TL
-# define LOG_TOP_SZ (WORDSZ - LOG_BOTTOM_SZ - LOG_HBLKSIZE)
-# else
-# define LOG_TOP_SZ 11
-# endif
-# define TOP_SZ (1 << LOG_TOP_SZ)
-# define BOTTOM_SZ (1 << LOG_BOTTOM_SZ)
-
-typedef struct bi {
- hdr * index[BOTTOM_SZ];
- /*
- * The bottom level index contains one of three kinds of values:
- * 0 means we're not responsible for this block,
- * or this is a block other than the first one in a free block.
- * 1 < (long)X <= MAX_JUMP means the block starts at least
- * X * HBLKSIZE bytes before the current address.
- * A valid pointer points to a hdr structure. (The above can't be
- * valid pointers due to the GET_MEM return convention.)
- */
- struct bi * asc_link; /* All indices are linked in */
- /* ascending order... */
- struct bi * desc_link; /* ... and in descending order. */
- word key; /* high order address bits. */
-# ifdef HASH_TL
- struct bi * hash_link; /* Hash chain link. */
-# endif
-} bottom_index;
-
-/* extern bottom_index GC_all_nils; - really part of GC_arrays */
-
-/* extern bottom_index * GC_top_index []; - really part of GC_arrays */
- /* Each entry points to a bottom_index. */
- /* On a 32 bit machine, it points to */
- /* the index for a set of high order */
- /* bits equal to the index. For longer */
- /* addresses, we hash the high order */
- /* bits to compute the index in */
- /* GC_top_index, and each entry points */
- /* to a hash chain. */
- /* The last entry in each chain is */
- /* GC_all_nils. */
-
-
-# define MAX_JUMP (HBLKSIZE - 1)
-
-# define HDR_FROM_BI(bi, p) \
- ((bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)])
-# ifndef HASH_TL
-# define BI(p) (GC_top_index \
- [(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE)])
-# define HDR_INNER(p) HDR_FROM_BI(BI(p),p)
-# ifdef SMALL_CONFIG
-# define HDR(p) GC_find_header((ptr_t)(p))
-# else
-# define HDR(p) HDR_INNER(p)
-# endif
-# define GET_BI(p, bottom_indx) (bottom_indx) = BI(p)
-# define GET_HDR(p, hhdr) (hhdr) = HDR(p)
-# define SET_HDR(p, hhdr) HDR_INNER(p) = (hhdr)
-# define GET_HDR_ADDR(p, ha) (ha) = &(HDR_INNER(p))
-# else /* hash */
-/* Hash function for tree top level */
-# define TL_HASH(hi) ((hi) & (TOP_SZ - 1))
-/* Set bottom_indx to point to the bottom index for address p */
-# define GET_BI(p, bottom_indx) \
- { \
- register word hi = \
- (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
- register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
- \
- while (_bi -> key != hi && _bi != GC_all_nils) \
- _bi = _bi -> hash_link; \
- (bottom_indx) = _bi; \
- }
-# define GET_HDR_ADDR(p, ha) \
- { \
- register bottom_index * bi; \
- \
- GET_BI(p, bi); \
- (ha) = &(HDR_FROM_BI(bi, p)); \
- }
-# define GET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
- (hhdr) = *_ha; }
-# define SET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
- *_ha = (hhdr); }
-# define HDR(p) GC_find_header((ptr_t)(p))
-# endif
-
-/* Is the result a forwarding address to someplace closer to the */
-/* beginning of the block or NIL? */
-# define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((unsigned long) (hhdr) <= MAX_JUMP)
-
-/* Get an HBLKSIZE aligned address closer to the beginning of the block */
-/* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */
-# define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (unsigned long)(hhdr))
-# endif /* GC_HEADERS_H */
diff --git a/gc/gc_mark.h b/gc/gc_mark.h
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- *
- */
-/* Boehm, November 7, 1994 4:56 pm PST */
-
-/*
- * Declarations of mark stack. Needed by marker and client supplied mark
- * routines. To be included after gc_priv.h.
- */
-#ifndef GC_MARK_H
-# define GC_MARK_H
-
-/* A client supplied mark procedure. Returns new mark stack pointer. */
-/* Primary effect should be to push new entries on the mark stack. */
-/* Mark stack pointer values are passed and returned explicitly. */
-/* Global variables decribing mark stack are not necessarily valid. */
-/* (This usually saves a few cycles by keeping things in registers.) */
-/* Assumed to scan about PROC_BYTES on average. If it needs to do */
-/* much more work than that, it should do it in smaller pieces by */
-/* pushing itself back on the mark stack. */
-/* Note that it should always do some work (defined as marking some */
-/* objects) before pushing more than one entry on the mark stack. */
-/* This is required to ensure termination in the event of mark stack */
-/* overflows. */
-/* This procedure is always called with at least one empty entry on the */
-/* mark stack. */
-/* Currently we require that mark procedures look for pointers in a */
-/* subset of the places the conservative marker would. It must be safe */
-/* to invoke the normal mark procedure instead. */
-# define PROC_BYTES 100
-/* The real declarations of the following are in gc_priv.h, so that */
-/* we can avoid scanning the following table. */
-/*
-typedef struct ms_entry * (*mark_proc)( word * addr, mark_stack_ptr,
- mark_stack_limit, env );
-
-# define LOG_MAX_MARK_PROCS 6
-# define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS)
-extern mark_proc GC_mark_procs[MAX_MARK_PROCS];
-*/
-
-extern word GC_n_mark_procs;
-
-/* Object descriptors on mark stack or in objects. Low order two */
-/* bits are tags distinguishing among the following 4 possibilities */
-/* for the high order 30 bits. */
-#define DS_TAG_BITS 2
-#define DS_TAGS ((1 << DS_TAG_BITS) - 1)
-#define DS_LENGTH 0 /* The entire word is a length in bytes that */
- /* must be a multiple of 4. */
-#define DS_BITMAP 1 /* 30 bits are a bitmap describing pointer */
- /* fields. The msb is 1 iff the first word */
- /* is a pointer. */
- /* (This unconventional ordering sometimes */
- /* makes the marker slightly faster.) */
- /* Zeroes indicate definite nonpointers. Ones */
- /* indicate possible pointers. */
- /* Only usable if pointers are word aligned. */
-# define BITMAP_BITS (WORDSZ - DS_TAG_BITS)
-#define DS_PROC 2
- /* The objects referenced by this object can be */
- /* pushed on the mark stack by invoking */
- /* PROC(descr). ENV(descr) is passed as the */
- /* last argument. */
-# define PROC(descr) \
- (GC_mark_procs[((descr) >> DS_TAG_BITS) & (MAX_MARK_PROCS-1)])
-# define ENV(descr) \
- ((descr) >> (DS_TAG_BITS + LOG_MAX_MARK_PROCS))
-# define MAX_ENV \
- (((word)1 << (WORDSZ - DS_TAG_BITS - LOG_MAX_MARK_PROCS)) - 1)
-# define MAKE_PROC(proc_index, env) \
- (((((env) << LOG_MAX_MARK_PROCS) | (proc_index)) << DS_TAG_BITS) \
- | DS_PROC)
-#define DS_PER_OBJECT 3 /* The real descriptor is at the */
- /* byte displacement from the beginning of the */
- /* object given by descr & ~DS_TAGS */
-
-typedef struct ms_entry {
- word * mse_start; /* First word of object */
- word mse_descr; /* Descriptor; low order two bits are tags, */
- /* identifying the upper 30 bits as one of the */
- /* following: */
-} mse;
-
-extern word GC_mark_stack_size;
-
-extern mse * GC_mark_stack_top;
-
-extern mse * GC_mark_stack;
-
-word GC_find_start();
-
-mse * GC_signal_mark_stack_overflow();
-
-# ifdef GATHERSTATS
-# define ADD_TO_ATOMIC(sz) GC_atomic_in_use += (sz)
-# define ADD_TO_COMPOSITE(sz) GC_composite_in_use += (sz)
-# else
-# define ADD_TO_ATOMIC(sz)
-# define ADD_TO_COMPOSITE(sz)
-# endif
-
-/* Push the object obj with corresponding heap block header hhdr onto */
-/* the mark stack. */
-# define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \
-{ \
- register word _descr = (hhdr) -> hb_descr; \
- \
- if (_descr == 0) { \
- ADD_TO_ATOMIC((hhdr) -> hb_sz); \
- } else { \
- ADD_TO_COMPOSITE((hhdr) -> hb_sz); \
- mark_stack_top++; \
- if (mark_stack_top >= mark_stack_limit) { \
- mark_stack_top = GC_signal_mark_stack_overflow(mark_stack_top); \
- } \
- mark_stack_top -> mse_start = (obj); \
- mark_stack_top -> mse_descr = _descr; \
- } \
-}
-
-#ifdef PRINT_BLACK_LIST
-# define GC_FIND_START(current, hhdr, source) \
- GC_find_start(current, hhdr, source)
-#else
-# define GC_FIND_START(current, hhdr, source) \
- GC_find_start(current, hhdr)
-#endif
-
-/* Push the contents of current onto the mark stack if it is a valid */
-/* ptr to a currently unmarked object. Mark it. */
-/* If we assumed a standard-conforming compiler, we could probably */
-/* generate the exit_label transparently. */
-# define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \
- source, exit_label) \
-{ \
- register int displ; /* Displacement in block; first bytes, then words */ \
- register hdr * hhdr; \
- register map_entry_type map_entry; \
- \
- GET_HDR(current,hhdr); \
- if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { \
- current = GC_FIND_START(current, hhdr, (word)source); \
- if (current == 0) goto exit_label; \
- hhdr = HDR(current); \
- } \
- displ = HBLKDISPL(current); \
- map_entry = MAP_ENTRY((hhdr -> hb_map), displ); \
- if (map_entry == OBJ_INVALID) { \
- GC_ADD_TO_BLACK_LIST_NORMAL(current, source); goto exit_label; \
- } \
- displ = BYTES_TO_WORDS(displ); \
- displ -= map_entry; \
- \
- { \
- register word * mark_word_addr = hhdr -> hb_marks + divWORDSZ(displ); \
- register word mark_word = *mark_word_addr; \
- register word mark_bit = (word)1 << modWORDSZ(displ); \
- \
- if (mark_word & mark_bit) { \
- /* Mark bit is already set */ \
- goto exit_label; \
- } \
- GC_STORE_BACK_PTR((ptr_t)source, (ptr_t)HBLKPTR(current) \
- + WORDS_TO_BYTES(displ)); \
- *mark_word_addr = mark_word | mark_bit; \
- } \
- PUSH_OBJ(((word *)(HBLKPTR(current)) + displ), hhdr, \
- mark_stack_top, mark_stack_limit) \
- exit_label: ; \
-}
-
-#ifdef PRINT_BLACK_LIST
-# define PUSH_ONE_CHECKED(p, ip, source) \
- GC_push_one_checked(p, ip, (ptr_t)(source))
-#else
-# define PUSH_ONE_CHECKED(p, ip, source) \
- GC_push_one_checked(p, ip)
-#endif
-
-/*
- * Push a single value onto mark stack. Mark from the object pointed to by p.
- * P is considered valid even if it is an interior pointer.
- * Previously marked objects are not pushed. Hence we make progress even
- * if the mark stack overflows.
- */
-# define GC_PUSH_ONE_STACK(p, source) \
- if ((ptr_t)(p) >= GC_least_plausible_heap_addr \
- && (ptr_t)(p) < GC_greatest_plausible_heap_addr) { \
- PUSH_ONE_CHECKED(p, TRUE, source); \
- }
-
-/*
- * As above, but interior pointer recognition as for
- * normal for heap pointers.
- */
-# ifdef ALL_INTERIOR_POINTERS
-# define AIP TRUE
-# else
-# define AIP FALSE
-# endif
-# define GC_PUSH_ONE_HEAP(p,source) \
- if ((ptr_t)(p) >= GC_least_plausible_heap_addr \
- && (ptr_t)(p) < GC_greatest_plausible_heap_addr) { \
- PUSH_ONE_CHECKED(p,AIP,source); \
- }
-
-/*
- * Mark from one finalizable object using the specified
- * mark proc. May not mark the object pointed to by
- * real_ptr. That is the job of the caller, if appropriate
- */
-# define GC_MARK_FO(real_ptr, mark_proc) \
-{ \
- (*(mark_proc))(real_ptr); \
- while (!GC_mark_stack_empty()) GC_mark_from_mark_stack(); \
- if (GC_mark_state != MS_NONE) { \
- GC_set_mark_bit(real_ptr); \
- while (!GC_mark_some((ptr_t)0)); \
- } \
-}
-
-extern GC_bool GC_mark_stack_too_small;
- /* We need a larger mark stack. May be */
- /* set by client supplied mark routines.*/
-
-typedef int mark_state_t; /* Current state of marking, as follows:*/
- /* Used to remember where we are during */
- /* concurrent marking. */
-
- /* We say something is dirty if it was */
- /* written since the last time we */
- /* retrieved dirty bits. We say it's */
- /* grungy if it was marked dirty in the */
- /* last set of bits we retrieved. */
-
- /* Invariant I: all roots and marked */
- /* objects p are either dirty, or point */
- /* to objects q that are either marked */
- /* or a pointer to q appears in a range */
- /* on the mark stack. */
-
-# define MS_NONE 0 /* No marking in progress. I holds. */
- /* Mark stack is empty. */
-
-# define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */
- /* being pushed. I holds, except */
- /* that grungy roots may point to */
- /* unmarked objects, as may marked */
- /* grungy objects above scan_ptr. */
-
-# define MS_PUSH_UNCOLLECTABLE 2
- /* I holds, except that marked */
- /* uncollectable objects above scan_ptr */
- /* may point to unmarked objects. */
- /* Roots may point to unmarked objects */
-
-# define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */
-
-# define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */
- /* overflow. However marked heap */
- /* objects below scan_ptr point to */
- /* marked or stacked objects. */
-
-# define MS_INVALID 5 /* I may not hold. */
-
-extern mark_state_t GC_mark_state;
-
-#endif /* GC_MARK_H */
-
diff --git a/gc/gc_priv.h b/gc/gc_priv.h
@@ -1,1748 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/* Boehm, February 16, 1996 2:30 pm PST */
-
-
-# ifndef GC_PRIVATE_H
-# define GC_PRIVATE_H
-
-#if defined(mips) && defined(SYSTYPE_BSD) && defined(sony_news)
- /* sony RISC NEWS, NEWSOS 4 */
-# define BSD_TIME
-/* typedef long ptrdiff_t; -- necessary on some really old systems */
-#endif
-
-#if defined(mips) && defined(SYSTYPE_BSD43)
- /* MIPS RISCOS 4 */
-# define BSD_TIME
-#endif
-
-#ifdef BSD_TIME
-# include <sys/types.h>
-# include <sys/time.h>
-# include <sys/resource.h>
-#endif /* BSD_TIME */
-
-# ifndef GC_H
-# include "gc.h"
-# endif
-
-typedef GC_word word;
-typedef GC_signed_word signed_word;
-
-# ifndef CONFIG_H
-# include "gcconfig.h"
-# endif
-
-# ifndef HEADERS_H
-# include "gc_hdrs.h"
-# endif
-
-typedef int GC_bool;
-# define TRUE 1
-# define FALSE 0
-
-typedef char * ptr_t; /* A generic pointer to which we can add */
- /* byte displacements. */
- /* Preferably identical to caddr_t, if it */
- /* exists. */
-
-#if defined(__STDC__)
-# include <stdlib.h>
-# if !(defined( sony_news ) )
-# include <stddef.h>
-# endif
-# define VOLATILE volatile
-# define CONST const
-#else
-# ifdef MSWIN32
-# include <stdlib.h>
-# endif
-# define VOLATILE
-# define CONST
-#endif
-
-#if 0 /* was once defined for AMIGA */
-# define GC_FAR __far
-#else
-# define GC_FAR
-#endif
-
-/*********************************/
-/* */
-/* Definitions for conservative */
-/* collector */
-/* */
-/*********************************/
-
-/*********************************/
-/* */
-/* Easily changeable parameters */
-/* */
-/*********************************/
-
-#define STUBBORN_ALLOC /* Define stubborn allocation primitives */
-#if defined(SRC_M3) || defined(SMALL_CONFIG)
-# undef STUBBORN_ALLOC
-#endif
-
-
-/* #define ALL_INTERIOR_POINTERS */
- /* Forces all pointers into the interior of an */
- /* object to be considered valid. Also causes the */
- /* sizes of all objects to be inflated by at least */
- /* one byte. This should suffice to guarantee */
- /* that in the presence of a compiler that does */
- /* not perform garbage-collector-unsafe */
- /* optimizations, all portable, strictly ANSI */
- /* conforming C programs should be safely usable */
- /* with malloc replaced by GC_malloc and free */
- /* calls removed. There are several disadvantages: */
- /* 1. There are probably no interesting, portable, */
- /* strictly ANSI conforming C programs. */
- /* 2. This option makes it hard for the collector */
- /* to allocate space that is not ``pointed to'' */
- /* by integers, etc. Under SunOS 4.X with a */
- /* statically linked libc, we empiricaly */
- /* observed that it would be difficult to */
- /* allocate individual objects larger than 100K. */
- /* Even if only smaller objects are allocated, */
- /* more swap space is likely to be needed. */
- /* Fortunately, much of this will never be */
- /* touched. */
- /* If you can easily avoid using this option, do. */
- /* If not, try to keep individual objects small. */
-
-#define PRINTSTATS /* Print garbage collection statistics */
- /* For less verbose output, undefine in reclaim.c */
-
-#define PRINTTIMES /* Print the amount of time consumed by each garbage */
- /* collection. */
-
-#define PRINTBLOCKS /* Print object sizes associated with heap blocks, */
- /* whether the objects are atomic or composite, and */
- /* whether or not the block was found to be empty */
- /* during the reclaim phase. Typically generates */
- /* about one screenful per garbage collection. */
-#undef PRINTBLOCKS
-
-#ifdef SILENT
-# ifdef PRINTSTATS
-# undef PRINTSTATS
-# endif
-# ifdef PRINTTIMES
-# undef PRINTTIMES
-# endif
-# ifdef PRINTNBLOCKS
-# undef PRINTNBLOCKS
-# endif
-#endif
-
-#if defined(PRINTSTATS) && !defined(GATHERSTATS)
-# define GATHERSTATS
-#endif
-
-#ifdef FINALIZE_ON_DEMAND
-# define GC_INVOKE_FINALIZERS()
-#else
-# define GC_INVOKE_FINALIZERS() (void)GC_invoke_finalizers()
-#endif
-
-#define MERGE_SIZES /* Round up some object sizes, so that fewer distinct */
- /* free lists are actually maintained. This applies */
- /* only to the top level routines in misc.c, not to */
- /* user generated code that calls GC_allocobj and */
- /* GC_allocaobj directly. */
- /* Slows down average programs slightly. May however */
- /* substantially reduce fragmentation if allocation */
- /* request sizes are widely scattered. */
- /* May save significant amounts of space for obj_map */
- /* entries. */
-
-#ifndef OLD_BLOCK_ALLOC
- /* Macros controlling large block allocation strategy. */
-# define EXACT_FIRST /* Make a complete pass through the large object */
- /* free list before splitting a block */
-# define PRESERVE_LAST /* Do not divide last allocated heap segment */
- /* unless we would otherwise need to expand the */
- /* heap. */
-#endif
-
-/* ALIGN_DOUBLE requires MERGE_SIZES at present. */
-# if defined(ALIGN_DOUBLE) && !defined(MERGE_SIZES)
-# define MERGE_SIZES
-# endif
-
-#if defined(ALL_INTERIOR_POINTERS) && !defined(DONT_ADD_BYTE_AT_END)
-# define ADD_BYTE_AT_END
-#endif
-
-
-# ifndef LARGE_CONFIG
-# define MINHINCR 16 /* Minimum heap increment, in blocks of HBLKSIZE */
- /* Must be multiple of largest page size. */
-# define MAXHINCR 512 /* Maximum heap increment, in blocks */
-# else
-# define MINHINCR 64
-# define MAXHINCR 4096
-# endif
-
-# define TIME_LIMIT 50 /* We try to keep pause times from exceeding */
- /* this by much. In milliseconds. */
-
-# define BL_LIMIT GC_black_list_spacing
- /* If we need a block of N bytes, and we have */
- /* a block of N + BL_LIMIT bytes available, */
- /* and N > BL_LIMIT, */
- /* but all possible positions in it are */
- /* blacklisted, we just use it anyway (and */
- /* print a warning, if warnings are enabled). */
- /* This risks subsequently leaking the block */
- /* due to a false reference. But not using */
- /* the block risks unreasonable immediate */
- /* heap growth. */
-
-/*********************************/
-/* */
-/* Stack saving for debugging */
-/* */
-/*********************************/
-
-#ifdef SAVE_CALL_CHAIN
-
-/*
- * Number of frames and arguments to save in objects allocated by
- * debugging allocator.
- */
-# define NFRAMES 6 /* Number of frames to save. Even for */
- /* alignment reasons. */
-# define NARGS 2 /* Mumber of arguments to save for each call. */
-
-# define NEED_CALLINFO
-
-/* Fill in the pc and argument information for up to NFRAMES of my */
-/* callers. Ignore my frame and my callers frame. */
-void GC_save_callers (/* struct callinfo info[NFRAMES] */);
-
-void GC_print_callers (/* struct callinfo info[NFRAMES] */);
-
-#else
-
-# ifdef GC_ADD_CALLER
-# define NFRAMES 1
-# define NARGS 0
-# define NEED_CALLINFO
-# endif
-
-#endif
-
-#ifdef NEED_CALLINFO
- struct callinfo {
- word ci_pc;
-# if NARGS > 0
- word ci_arg[NARGS]; /* bit-wise complement to avoid retention */
-# endif
-# if defined(ALIGN_DOUBLE) && (NFRAMES * (NARGS + 1)) % 2 == 1
- /* Likely alignment problem. */
- word ci_dummy;
-# endif
- };
-#endif
-
-
-/*********************************/
-/* */
-/* OS interface routines */
-/* */
-/*********************************/
-
-#ifdef BSD_TIME
-# undef CLOCK_TYPE
-# undef GET_TIME
-# undef MS_TIME_DIFF
-# define CLOCK_TYPE struct timeval
-# define GET_TIME(x) { struct rusage rusage; \
- getrusage (RUSAGE_SELF, &rusage); \
- x = rusage.ru_utime; }
-# define MS_TIME_DIFF(a,b) ((double) (a.tv_sec - b.tv_sec) * 1000.0 \
- + (double) (a.tv_usec - b.tv_usec) / 1000.0)
-#else /* !BSD_TIME */
-# include <time.h>
-# if !defined(__STDC__) && defined(SPARC) && defined(SUNOS4)
- clock_t clock(); /* Not in time.h, where it belongs */
-# endif
-# if defined(FREEBSD) && !defined(CLOCKS_PER_SEC)
-# include <machine/limits.h>
-# define CLOCKS_PER_SEC CLK_TCK
-# endif
-# if !defined(CLOCKS_PER_SEC)
-# define CLOCKS_PER_SEC 1000000
-/*
- * This is technically a bug in the implementation. ANSI requires that
- * CLOCKS_PER_SEC be defined. But at least under SunOS4.1.1, it isn't.
- * Also note that the combination of ANSI C and POSIX is incredibly gross
- * here. The type clock_t is used by both clock() and times(). But on
- * some machines these use different notions of a clock tick, CLOCKS_PER_SEC
- * seems to apply only to clock. Hence we use it here. On many machines,
- * including SunOS, clock actually uses units of microseconds (which are
- * not really clock ticks).
- */
-# endif
-# define CLOCK_TYPE clock_t
-# define GET_TIME(x) x = clock()
-# define MS_TIME_DIFF(a,b) ((unsigned long) \
- (1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC))
-#endif /* !BSD_TIME */
-
-/* We use bzero and bcopy internally. They may not be available. */
-# if defined(SPARC) && defined(SUNOS4)
-# define BCOPY_EXISTS
-# endif
-# if defined(M68K) && defined(AMIGA)
-# define BCOPY_EXISTS
-# endif
-# if defined(M68K) && defined(NEXT)
-# define BCOPY_EXISTS
-# endif
-# if defined(VAX)
-# define BCOPY_EXISTS
-# endif
-# if defined(AMIGA)
-# include <string.h>
-# define BCOPY_EXISTS
-# endif
-
-# ifndef BCOPY_EXISTS
-# include <string.h>
-# define BCOPY(x,y,n) memcpy(y, x, (size_t)(n))
-# define BZERO(x,n) memset(x, 0, (size_t)(n))
-# else
-# define BCOPY(x,y,n) bcopy((char *)(x),(char *)(y),(int)(n))
-# define BZERO(x,n) bzero((char *)(x),(int)(n))
-# endif
-
-/* HBLKSIZE aligned allocation. 0 is taken to mean failure */
-/* space is assumed to be cleared. */
-/* In the case os USE_MMAP, the argument must also be a */
-/* physical page size. */
-/* GET_MEM is currently not assumed to retrieve 0 filled space, */
-/* though we should perhaps take advantage of the case in which */
-/* does. */
-# ifdef PCR
- char * real_malloc();
-# define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
- + GC_page_size-1)
-# else
-# ifdef OS2
- void * os2_alloc(size_t bytes);
-# define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
- + GC_page_size) \
- + GC_page_size-1)
-# else
-# if defined(AMIGA) || defined(NEXT) || defined(MACOSX) || defined(DOS4GW)
-# define GET_MEM(bytes) HBLKPTR((size_t) \
- calloc(1, (size_t)bytes + GC_page_size) \
- + GC_page_size-1)
-# else
-# ifdef MSWIN32
- extern ptr_t GC_win32_get_mem();
-# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
-# else
-# ifdef MACOS
-# if defined(USE_TEMPORARY_MEMORY)
- extern Ptr GC_MacTemporaryNewPtr(size_t size,
- Boolean clearMemory);
-# define GET_MEM(bytes) HBLKPTR( \
- GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
- + GC_page_size-1)
-# else
-# define GET_MEM(bytes) HBLKPTR( \
- NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
-# endif
-# else
- extern ptr_t GC_unix_get_mem();
-# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
-# endif
-# endif
-# endif
-# endif
-# endif
-
-/*
- * Mutual exclusion between allocator/collector routines.
- * Needed if there is more than one allocator thread.
- * FASTLOCK() is assumed to try to acquire the lock in a cheap and
- * dirty way that is acceptable for a few instructions, e.g. by
- * inhibiting preemption. This is assumed to have succeeded only
- * if a subsequent call to FASTLOCK_SUCCEEDED() returns TRUE.
- * FASTUNLOCK() is called whether or not FASTLOCK_SUCCEEDED().
- * If signals cannot be tolerated with the FASTLOCK held, then
- * FASTLOCK should disable signals. The code executed under
- * FASTLOCK is otherwise immune to interruption, provided it is
- * not restarted.
- * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK
- * and/or DISABLE_SIGNALS and ENABLE_SIGNALS and/or FASTLOCK.
- * (There is currently no equivalent for FASTLOCK.)
- */
-# ifdef THREADS
-# ifdef PCR_OBSOLETE /* Faster, but broken with multiple lwp's */
-# include "th/PCR_Th.h"
-# include "th/PCR_ThCrSec.h"
- extern struct PCR_Th_MLRep GC_allocate_ml;
-# define DCL_LOCK_STATE PCR_sigset_t GC_old_sig_mask
-# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
-# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
-# define FASTLOCK() PCR_ThCrSec_EnterSys()
- /* Here we cheat (a lot): */
-# define FASTLOCK_SUCCEEDED() (*(int *)(&GC_allocate_ml) == 0)
- /* TRUE if nobody currently holds the lock */
-# define FASTUNLOCK() PCR_ThCrSec_ExitSys()
-# endif
-# ifdef PCR
-# include <base/PCR_Base.h>
-# include <th/PCR_Th.h>
- extern PCR_Th_ML GC_allocate_ml;
-# define DCL_LOCK_STATE \
- PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask
-# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
-# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
-# define FASTLOCK() (GC_fastLockRes = PCR_Th_ML_Try(&GC_allocate_ml))
-# define FASTLOCK_SUCCEEDED() (GC_fastLockRes == PCR_ERes_okay)
-# define FASTUNLOCK() {\
- if( FASTLOCK_SUCCEEDED() ) PCR_Th_ML_Release(&GC_allocate_ml); }
-# endif
-# ifdef SRC_M3
- extern word RT0u__inCritical;
-# define LOCK() RT0u__inCritical++
-# define UNLOCK() RT0u__inCritical--
-# endif
-# ifdef SOLARIS_THREADS
-# include <thread.h>
-# include <signal.h>
- extern mutex_t GC_allocate_ml;
-# define LOCK() mutex_lock(&GC_allocate_ml);
-# define UNLOCK() mutex_unlock(&GC_allocate_ml);
-# endif
-# ifdef LINUX_THREADS
-# include <pthread.h>
-# ifdef __i386__
- inline static int GC_test_and_set(volatile unsigned int *addr) {
- int oldval;
- /* Note: the "xchg" instruction does not need a "lock" prefix */
- __asm__ __volatile__("xchgl %0, %1"
- : "=r"(oldval), "=m"(*(addr))
- : "0"(1), "m"(*(addr)));
- return oldval;
- }
-# else
- -- > Need implementation of GC_test_and_set()
-# endif
-# define GC_clear(addr) (*(addr) = 0)
-
- extern volatile unsigned int GC_allocate_lock;
- /* This is not a mutex because mutexes that obey the (optional) */
- /* POSIX scheduling rules are subject to convoys in high contention */
- /* applications. This is basically a spin lock. */
- extern pthread_t GC_lock_holder;
- extern void GC_lock(void);
- /* Allocation lock holder. Only set if acquired by client through */
- /* GC_call_with_alloc_lock. */
-# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
-# define NO_THREAD (pthread_t)(-1)
-# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
-# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
-# ifdef UNDEFINED
-# define LOCK() pthread_mutex_lock(&GC_allocate_ml)
-# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
-# else
-# define LOCK() \
- { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); }
-# define UNLOCK() \
- GC_clear(&GC_allocate_lock)
-# endif
- extern GC_bool GC_collecting;
-# define ENTER_GC() \
- { \
- GC_collecting = 1; \
- }
-# define EXIT_GC() GC_collecting = 0;
-# endif /* LINUX_THREADS */
-# if defined(IRIX_THREADS) || defined(IRIX_JDK_THREADS)
-# include <pthread.h>
-# include <mutex.h>
-
-# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) \
- || !defined(_COMPILER_VERSION) || _COMPILER_VERSION < 700
-# define GC_test_and_set(addr, v) test_and_set(addr,v)
-# else
-# define GC_test_and_set(addr, v) __test_and_set(addr,v)
-# endif
- extern unsigned long GC_allocate_lock;
- /* This is not a mutex because mutexes that obey the (optional) */
- /* POSIX scheduling rules are subject to convoys in high contention */
- /* applications. This is basically a spin lock. */
- extern pthread_t GC_lock_holder;
- extern void GC_lock(void);
- /* Allocation lock holder. Only set if acquired by client through */
- /* GC_call_with_alloc_lock. */
-# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
-# define NO_THREAD (pthread_t)(-1)
-# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
-# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
-# ifdef UNDEFINED
-# define LOCK() pthread_mutex_lock(&GC_allocate_ml)
-# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
-# else
-# define LOCK() { if (GC_test_and_set(&GC_allocate_lock, 1)) GC_lock(); }
-# if __mips >= 3 && (defined (_ABIN32) || defined(_ABI64)) \
- && defined(_COMPILER_VERSION) && _COMPILER_VERSION >= 700
-# define UNLOCK() __lock_release(&GC_allocate_lock)
-# else
- /* The function call in the following should prevent the */
- /* compiler from moving assignments to below the UNLOCK. */
- /* This is probably not necessary for ucode or gcc 2.8. */
- /* It may be necessary for Ragnarok and future gcc */
- /* versions. */
-# define UNLOCK() { GC_noop1(&GC_allocate_lock); \
- *(volatile unsigned long *)(&GC_allocate_lock) = 0; }
-# endif
-# endif
- extern GC_bool GC_collecting;
-# define ENTER_GC() \
- { \
- GC_collecting = 1; \
- }
-# define EXIT_GC() GC_collecting = 0;
-# endif /* IRIX_THREADS || IRIX_JDK_THREADS */
-# ifdef WIN32_THREADS
-# include <windows.h>
- GC_API CRITICAL_SECTION GC_allocate_ml;
-# define LOCK() EnterCriticalSection(&GC_allocate_ml);
-# define UNLOCK() LeaveCriticalSection(&GC_allocate_ml);
-# endif
-# ifndef SET_LOCK_HOLDER
-# define SET_LOCK_HOLDER()
-# define UNSET_LOCK_HOLDER()
-# define I_HOLD_LOCK() FALSE
- /* Used on platforms were locks can be reacquired, */
- /* so it doesn't matter if we lie. */
-# endif
-# else
-# define LOCK()
-# define UNLOCK()
-# endif
-# ifndef SET_LOCK_HOLDER
-# define SET_LOCK_HOLDER()
-# define UNSET_LOCK_HOLDER()
-# define I_HOLD_LOCK() FALSE
- /* Used on platforms were locks can be reacquired, */
- /* so it doesn't matter if we lie. */
-# endif
-# ifndef ENTER_GC
-# define ENTER_GC()
-# define EXIT_GC()
-# endif
-
-# ifndef DCL_LOCK_STATE
-# define DCL_LOCK_STATE
-# endif
-# ifndef FASTLOCK
-# define FASTLOCK() LOCK()
-# define FASTLOCK_SUCCEEDED() TRUE
-# define FASTUNLOCK() UNLOCK()
-# endif
-
-/* Delay any interrupts or signals that may abort this thread. Data */
-/* structures are in a consistent state outside this pair of calls. */
-/* ANSI C allows both to be empty (though the standard isn't very */
-/* clear on that point). Standard malloc implementations are usually */
-/* neither interruptable nor thread-safe, and thus correspond to */
-/* empty definitions. */
-# ifdef PCR
-# define DISABLE_SIGNALS() \
- PCR_Th_SetSigMask(PCR_allSigsBlocked,&GC_old_sig_mask)
-# define ENABLE_SIGNALS() \
- PCR_Th_SetSigMask(&GC_old_sig_mask, NIL)
-# else
-# if defined(SRC_M3) || defined(AMIGA) || defined(SOLARIS_THREADS) \
- || defined(MSWIN32) || defined(MACOS) || defined(DJGPP) \
- || defined(NO_SIGNALS) || defined(IRIX_THREADS) \
- || defined(IRIX_JDK_THREADS) || defined(LINUX_THREADS)
- /* Also useful for debugging. */
- /* Should probably use thr_sigsetmask for SOLARIS_THREADS. */
-# define DISABLE_SIGNALS()
-# define ENABLE_SIGNALS()
-# else
-# define DISABLE_SIGNALS() GC_disable_signals()
- void GC_disable_signals();
-# define ENABLE_SIGNALS() GC_enable_signals()
- void GC_enable_signals();
-# endif
-# endif
-
-/*
- * Stop and restart mutator threads.
- */
-# ifdef PCR
-# include "th/PCR_ThCtl.h"
-# define STOP_WORLD() \
- PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_stopNormal, \
- PCR_allSigsBlocked, \
- PCR_waitForever)
-# define START_WORLD() \
- PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_null, \
- PCR_allSigsBlocked, \
- PCR_waitForever);
-# else
-# if defined(SOLARIS_THREADS) || defined(WIN32_THREADS) \
- || defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(IRIX_JDK_THREADS)
- void GC_stop_world();
- void GC_start_world();
-# define STOP_WORLD() GC_stop_world()
-# define START_WORLD() GC_start_world()
-# else
-# define STOP_WORLD()
-# define START_WORLD()
-# endif
-# endif
-
-/* Abandon ship */
-# ifdef PCR
-# define ABORT(s) PCR_Base_Panic(s)
-# else
-# ifdef SMALL_CONFIG
-# define ABORT(msg) abort();
-# else
- GC_API void GC_abort();
-# define ABORT(msg) GC_abort(msg);
-# endif
-# endif
-
-/* Exit abnormally, but without making a mess (e.g. out of memory) */
-# ifdef PCR
-# define EXIT() PCR_Base_Exit(1,PCR_waitForever)
-# else
-# define EXIT() (void)exit(1)
-# endif
-
-/* Print warning message, e.g. almost out of memory. */
-# define WARN(msg,arg) (*GC_current_warn_proc)(msg, (GC_word)(arg))
-extern GC_warn_proc GC_current_warn_proc;
-
-/*********************************/
-/* */
-/* Word-size-dependent defines */
-/* */
-/*********************************/
-
-#if CPP_WORDSZ == 32
-# define WORDS_TO_BYTES(x) ((x)<<2)
-# define BYTES_TO_WORDS(x) ((x)>>2)
-# define LOGWL ((word)5) /* log[2] of CPP_WORDSZ */
-# define modWORDSZ(n) ((n) & 0x1f) /* n mod size of word */
-# if ALIGNMENT != 4
-# define UNALIGNED
-# endif
-#endif
-
-#if CPP_WORDSZ == 64
-# define WORDS_TO_BYTES(x) ((x)<<3)
-# define BYTES_TO_WORDS(x) ((x)>>3)
-# define LOGWL ((word)6) /* log[2] of CPP_WORDSZ */
-# define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */
-# if ALIGNMENT != 8
-# define UNALIGNED
-# endif
-#endif
-
-#define WORDSZ ((word)CPP_WORDSZ)
-#define SIGNB ((word)1 << (WORDSZ-1))
-#define BYTES_PER_WORD ((word)(sizeof (word)))
-#define ONES ((word)(-1))
-#define divWORDSZ(n) ((n) >> LOGWL) /* divide n by size of word */
-
-/*********************/
-/* */
-/* Size Parameters */
-/* */
-/*********************/
-
-/* heap block size, bytes. Should be power of 2 */
-
-#ifndef HBLKSIZE
-# ifdef SMALL_CONFIG
-# define CPP_LOG_HBLKSIZE 10
-# else
-# if CPP_WORDSZ == 32
-# define CPP_LOG_HBLKSIZE 12
-# else
-# define CPP_LOG_HBLKSIZE 13
-# endif
-# endif
-#else
-# if HBLKSIZE == 512
-# define CPP_LOG_HBLKSIZE 9
-# endif
-# if HBLKSIZE == 1024
-# define CPP_LOG_HBLKSIZE 10
-# endif
-# if HBLKSIZE == 2048
-# define CPP_LOG_HBLKSIZE 11
-# endif
-# if HBLKSIZE == 4096
-# define CPP_LOG_HBLKSIZE 12
-# endif
-# if HBLKSIZE == 8192
-# define CPP_LOG_HBLKSIZE 13
-# endif
-# if HBLKSIZE == 16384
-# define CPP_LOG_HBLKSIZE 14
-# endif
-# ifndef CPP_LOG_HBLKSIZE
- --> fix HBLKSIZE
-# endif
-# undef HBLKSIZE
-#endif
-# define CPP_HBLKSIZE (1 << CPP_LOG_HBLKSIZE)
-# define LOG_HBLKSIZE ((word)CPP_LOG_HBLKSIZE)
-# define HBLKSIZE ((word)CPP_HBLKSIZE)
-
-
-/* max size objects supported by freelist (larger objects may be */
-/* allocated, but less efficiently) */
-
-#define CPP_MAXOBJSZ BYTES_TO_WORDS(CPP_HBLKSIZE/2)
-#define MAXOBJSZ ((word)CPP_MAXOBJSZ)
-
-# define divHBLKSZ(n) ((n) >> LOG_HBLKSIZE)
-
-# define HBLK_PTR_DIFF(p,q) divHBLKSZ((ptr_t)p - (ptr_t)q)
- /* Equivalent to subtracting 2 hblk pointers. */
- /* We do it this way because a compiler should */
- /* find it hard to use an integer division */
- /* instead of a shift. The bundled SunOS 4.1 */
- /* o.w. sometimes pessimizes the subtraction to */
- /* involve a call to .div. */
-
-# define modHBLKSZ(n) ((n) & (HBLKSIZE-1))
-
-# define HBLKPTR(objptr) ((struct hblk *)(((word) (objptr)) & ~(HBLKSIZE-1)))
-
-# define HBLKDISPL(objptr) (((word) (objptr)) & (HBLKSIZE-1))
-
-/* Round up byte allocation requests to integral number of words, etc. */
-# ifdef ADD_BYTE_AT_END
-# define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1))
-# ifdef ALIGN_DOUBLE
-# define ALIGNED_WORDS(n) (BYTES_TO_WORDS((n) + WORDS_TO_BYTES(2)) & ~1)
-# else
-# define ALIGNED_WORDS(n) ROUNDED_UP_WORDS(n)
-# endif
-# define SMALL_OBJ(bytes) ((bytes) < WORDS_TO_BYTES(MAXOBJSZ))
-# define ADD_SLOP(bytes) ((bytes)+1)
-# else
-# define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + (WORDS_TO_BYTES(1) - 1))
-# ifdef ALIGN_DOUBLE
-# define ALIGNED_WORDS(n) \
- (BYTES_TO_WORDS((n) + WORDS_TO_BYTES(2) - 1) & ~1)
-# else
-# define ALIGNED_WORDS(n) ROUNDED_UP_WORDS(n)
-# endif
-# define SMALL_OBJ(bytes) ((bytes) <= WORDS_TO_BYTES(MAXOBJSZ))
-# define ADD_SLOP(bytes) (bytes)
-# endif
-
-
-/*
- * Hash table representation of sets of pages. This assumes it is
- * OK to add spurious entries to sets.
- * Used by black-listing code, and perhaps by dirty bit maintenance code.
- */
-
-# ifdef LARGE_CONFIG
-# define LOG_PHT_ENTRIES 17
-# else
-# define LOG_PHT_ENTRIES 14 /* Collisions are likely if heap grows */
- /* to more than 16K hblks = 64MB. */
- /* Each hash table occupies 2K bytes. */
-# endif
-# define PHT_ENTRIES ((word)1 << LOG_PHT_ENTRIES)
-# define PHT_SIZE (PHT_ENTRIES >> LOGWL)
-typedef word page_hash_table[PHT_SIZE];
-
-# define PHT_HASH(addr) ((((word)(addr)) >> LOG_HBLKSIZE) & (PHT_ENTRIES - 1))
-
-# define get_pht_entry_from_index(bl, index) \
- (((bl)[divWORDSZ(index)] >> modWORDSZ(index)) & 1)
-# define set_pht_entry_from_index(bl, index) \
- (bl)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
-# define clear_pht_entry_from_index(bl, index) \
- (bl)[divWORDSZ(index)] &= ~((word)1 << modWORDSZ(index))
-
-
-
-/********************************************/
-/* */
-/* H e a p B l o c k s */
-/* */
-/********************************************/
-
-/* heap block header */
-#define HBLKMASK (HBLKSIZE-1)
-
-#define BITS_PER_HBLK (HBLKSIZE * 8)
-
-#define MARK_BITS_PER_HBLK (BITS_PER_HBLK/CPP_WORDSZ)
- /* upper bound */
- /* We allocate 1 bit/word. Only the first word */
- /* in each object is actually marked. */
-
-# ifdef ALIGN_DOUBLE
-# define MARK_BITS_SZ (((MARK_BITS_PER_HBLK + 2*CPP_WORDSZ - 1) \
- / (2*CPP_WORDSZ))*2)
-# else
-# define MARK_BITS_SZ ((MARK_BITS_PER_HBLK + CPP_WORDSZ - 1)/CPP_WORDSZ)
-# endif
- /* Upper bound on number of mark words per heap block */
-
-struct hblkhdr {
- word hb_sz; /* If in use, size in words, of objects in the block. */
- /* if free, the size in bytes of the whole block */
- struct hblk * hb_next; /* Link field for hblk free list */
- /* and for lists of chunks waiting to be */
- /* reclaimed. */
- struct hblk * hb_prev; /* Backwards link for free list. */
- word hb_descr; /* object descriptor for marking. See */
- /* mark.h. */
- char* hb_map; /* A pointer to a pointer validity map of the block. */
- /* See GC_obj_map. */
- /* Valid for all blocks with headers. */
- /* Free blocks point to GC_invalid_map. */
- unsigned char hb_obj_kind;
- /* Kind of objects in the block. Each kind */
- /* identifies a mark procedure and a set of */
- /* list headers. Sometimes called regions. */
- unsigned char hb_flags;
-# define IGNORE_OFF_PAGE 1 /* Ignore pointers that do not */
- /* point to the first page of */
- /* this object. */
-# define WAS_UNMAPPED 2 /* This is a free block, which has */
- /* been unmapped from the address */
- /* space. */
- /* GC_remap must be invoked on it */
- /* before it can be reallocated. */
- /* Only set with USE_MUNMAP. */
- unsigned short hb_last_reclaimed;
- /* Value of GC_gc_no when block was */
- /* last allocated or swept. May wrap. */
- /* For a free block, this is maintained */
- /* unly for USE_MUNMAP, and indicates */
- /* when the header was allocated, or */
- /* when the size of the block last */
- /* changed. */
- word hb_marks[MARK_BITS_SZ];
- /* Bit i in the array refers to the */
- /* object starting at the ith word (header */
- /* INCLUDED) in the heap block. */
- /* The lsb of word 0 is numbered 0. */
-};
-
-/* heap block body */
-
-# define DISCARD_WORDS 0
- /* Number of words to be dropped at the beginning of each block */
- /* Must be a multiple of WORDSZ. May reasonably be nonzero */
- /* on machines that don't guarantee longword alignment of */
- /* pointers, so that the number of false hits is minimized. */
- /* 0 and WORDSZ are probably the only reasonable values. */
-
-# define BODY_SZ ((HBLKSIZE-WORDS_TO_BYTES(DISCARD_WORDS))/sizeof(word))
-
-struct hblk {
-# if (DISCARD_WORDS != 0)
- word garbage[DISCARD_WORDS];
-# endif
- word hb_body[BODY_SZ];
-};
-
-# define HDR_WORDS ((word)DISCARD_WORDS)
-# define HDR_BYTES ((word)WORDS_TO_BYTES(DISCARD_WORDS))
-
-# define OBJ_SZ_TO_BLOCKS(sz) \
- divHBLKSZ(HDR_BYTES + WORDS_TO_BYTES(sz) + HBLKSIZE-1)
- /* Size of block (in units of HBLKSIZE) needed to hold objects of */
- /* given sz (in words). */
-
-/* Object free list link */
-# define obj_link(p) (*(ptr_t *)(p))
-
-/* The type of mark procedures. This really belongs in gc_mark.h. */
-/* But we put it here, so that we can avoid scanning the mark proc */
-/* table. */
-typedef struct ms_entry * (*mark_proc)(/* word * addr, mark_stack_ptr,
- mark_stack_limit, env */);
-# define LOG_MAX_MARK_PROCS 6
-# define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS)
-
-/* Root sets. Logically private to mark_rts.c. But we don't want the */
-/* tables scanned, so we put them here. */
-/* MAX_ROOT_SETS is the maximum number of ranges that can be */
-/* registered as static roots. */
-# ifdef LARGE_CONFIG
-# define MAX_ROOT_SETS 4096
-# else
-# ifdef PCR
-# define MAX_ROOT_SETS 1024
-# else
-# ifdef MSWIN32
-# define MAX_ROOT_SETS 512
- /* Under NT, we add only written pages, which can result */
- /* in many small root sets. */
-# else
-# define MAX_ROOT_SETS 64
-# endif
-# endif
-# endif
-
-# define MAX_EXCLUSIONS (MAX_ROOT_SETS/4)
-/* Maximum number of segments that can be excluded from root sets. */
-
-/*
- * Data structure for excluded static roots.
- */
-struct exclusion {
- ptr_t e_start;
- ptr_t e_end;
-};
-
-/* Data structure for list of root sets. */
-/* We keep a hash table, so that we can filter out duplicate additions. */
-/* Under Win32, we need to do a better job of filtering overlaps, so */
-/* we resort to sequential search, and pay the price. */
-struct roots {
- ptr_t r_start;
- ptr_t r_end;
-# ifndef MSWIN32
- struct roots * r_next;
-# endif
- GC_bool r_tmp;
- /* Delete before registering new dynamic libraries */
-};
-
-#ifndef MSWIN32
- /* Size of hash table index to roots. */
-# define LOG_RT_SIZE 6
-# define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */
-#endif
-
-/* Lists of all heap blocks and free lists */
-/* as well as other random data structures */
-/* that should not be scanned by the */
-/* collector. */
-/* These are grouped together in a struct */
-/* so that they can be easily skipped by the */
-/* GC_mark routine. */
-/* The ordering is weird to make GC_malloc */
-/* faster by keeping the important fields */
-/* sufficiently close together that a */
-/* single load of a base register will do. */
-/* Scalars that could easily appear to */
-/* be pointers are also put here. */
-/* The main fields should precede any */
-/* conditionally included fields, so that */
-/* gc_inl.h will work even if a different set */
-/* of macros is defined when the client is */
-/* compiled. */
-
-struct _GC_arrays {
- word _heapsize;
- word _max_heapsize;
- ptr_t _last_heap_addr;
- ptr_t _prev_heap_addr;
- word _large_free_bytes;
- /* Total bytes contained in blocks on large object free */
- /* list. */
- word _words_allocd_before_gc;
- /* Number of words allocated before this */
- /* collection cycle. */
- word _words_allocd;
- /* Number of words allocated during this collection cycle */
- word _words_wasted;
- /* Number of words wasted due to internal fragmentation */
- /* in large objects, or due to dropping blacklisted */
- /* blocks, since last gc. Approximate. */
- word _words_finalized;
- /* Approximate number of words in objects (and headers) */
- /* That became ready for finalization in the last */
- /* collection. */
- word _non_gc_bytes_at_gc;
- /* Number of explicitly managed bytes of storage */
- /* at last collection. */
- word _mem_freed;
- /* Number of explicitly deallocated words of memory */
- /* since last collection. */
- mark_proc _mark_procs[MAX_MARK_PROCS];
- /* Table of user-defined mark procedures. There is */
- /* a small number of these, which can be referenced */
- /* by DS_PROC mark descriptors. See gc_mark.h. */
- ptr_t _objfreelist[MAXOBJSZ+1];
- /* free list for objects */
- ptr_t _aobjfreelist[MAXOBJSZ+1];
- /* free list for atomic objs */
-
- ptr_t _uobjfreelist[MAXOBJSZ+1];
- /* uncollectable but traced objs */
- /* objects on this and auobjfreelist */
- /* are always marked, except during */
- /* garbage collections. */
-# ifdef ATOMIC_UNCOLLECTABLE
- ptr_t _auobjfreelist[MAXOBJSZ+1];
-# endif
- /* uncollectable but traced objs */
-
-# ifdef GATHERSTATS
- word _composite_in_use;
- /* Number of words in accessible composite */
- /* objects. */
- word _atomic_in_use;
- /* Number of words in accessible atomic */
- /* objects. */
-# endif
-# ifdef USE_MUNMAP
- word _unmapped_bytes;
-# endif
-# ifdef MERGE_SIZES
- unsigned _size_map[WORDS_TO_BYTES(MAXOBJSZ+1)];
- /* Number of words to allocate for a given allocation request in */
- /* bytes. */
-# endif
-
-# ifdef STUBBORN_ALLOC
- ptr_t _sobjfreelist[MAXOBJSZ+1];
-# endif
- /* free list for immutable objects */
- ptr_t _obj_map[MAXOBJSZ+1];
- /* If not NIL, then a pointer to a map of valid */
- /* object addresses. _obj_map[sz][i] is j if the */
- /* address block_start+i is a valid pointer */
- /* to an object at */
- /* block_start+i&~3 - WORDS_TO_BYTES(j). */
- /* (If ALL_INTERIOR_POINTERS is defined, then */
- /* instead ((short *)(hb_map[sz])[i] is j if */
- /* block_start+WORDS_TO_BYTES(i) is in the */
- /* interior of an object starting at */
- /* block_start+WORDS_TO_BYTES(i-j)). */
- /* It is OBJ_INVALID if */
- /* block_start+WORDS_TO_BYTES(i) is not */
- /* valid as a pointer to an object. */
- /* We assume all values of j <= OBJ_INVALID. */
- /* The zeroth entry corresponds to large objects.*/
-# ifdef ALL_INTERIOR_POINTERS
-# define map_entry_type short
-# define OBJ_INVALID 0x7fff
-# define MAP_ENTRY(map, bytes) \
- (((map_entry_type *)(map))[BYTES_TO_WORDS(bytes)])
-# define MAP_ENTRIES BYTES_TO_WORDS(HBLKSIZE)
-# define MAP_SIZE (MAP_ENTRIES * sizeof(map_entry_type))
-# define OFFSET_VALID(displ) TRUE
-# define CPP_MAX_OFFSET (HBLKSIZE - HDR_BYTES - 1)
-# define MAX_OFFSET ((word)CPP_MAX_OFFSET)
-# else
-# define map_entry_type char
-# define OBJ_INVALID 0x7f
-# define MAP_ENTRY(map, bytes) \
- (map)[bytes]
-# define MAP_ENTRIES HBLKSIZE
-# define MAP_SIZE MAP_ENTRIES
-# define CPP_MAX_OFFSET (WORDS_TO_BYTES(OBJ_INVALID) - 1)
-# define MAX_OFFSET ((word)CPP_MAX_OFFSET)
-# define VALID_OFFSET_SZ \
- (CPP_MAX_OFFSET > WORDS_TO_BYTES(CPP_MAXOBJSZ)? \
- CPP_MAX_OFFSET+1 \
- : WORDS_TO_BYTES(CPP_MAXOBJSZ)+1)
- char _valid_offsets[VALID_OFFSET_SZ];
- /* GC_valid_offsets[i] == TRUE ==> i */
- /* is registered as a displacement. */
-# define OFFSET_VALID(displ) GC_valid_offsets[displ]
- char _modws_valid_offsets[sizeof(word)];
- /* GC_valid_offsets[i] ==> */
- /* GC_modws_valid_offsets[i%sizeof(word)] */
-# endif
-# ifdef STUBBORN_ALLOC
- page_hash_table _changed_pages;
- /* Stubborn object pages that were changes since last call to */
- /* GC_read_changed. */
- page_hash_table _prev_changed_pages;
- /* Stubborn object pages that were changes before last call to */
- /* GC_read_changed. */
-# endif
-# if defined(PROC_VDB) || defined(MPROTECT_VDB)
- page_hash_table _grungy_pages; /* Pages that were dirty at last */
- /* GC_read_dirty. */
-# endif
-# ifdef MPROTECT_VDB
- VOLATILE page_hash_table _dirty_pages;
- /* Pages dirtied since last GC_read_dirty. */
-# endif
-# ifdef PROC_VDB
- page_hash_table _written_pages; /* Pages ever dirtied */
-# endif
-# ifdef LARGE_CONFIG
-# if CPP_WORDSZ > 32
-# define MAX_HEAP_SECTS 4096 /* overflows at roughly 64 GB */
-# else
-# define MAX_HEAP_SECTS 768 /* Separately added heap sections. */
-# endif
-# else
-# define MAX_HEAP_SECTS 256
-# endif
- struct HeapSect {
- ptr_t hs_start; word hs_bytes;
- } _heap_sects[MAX_HEAP_SECTS];
-# ifdef MSWIN32
- ptr_t _heap_bases[MAX_HEAP_SECTS];
- /* Start address of memory regions obtained from kernel. */
-# endif
- struct roots _static_roots[MAX_ROOT_SETS];
-# ifndef MSWIN32
- struct roots * _root_index[RT_SIZE];
-# endif
- struct exclusion _excl_table[MAX_EXCLUSIONS];
- /* Block header index; see gc_headers.h */
- bottom_index * _all_nils;
- bottom_index * _top_index [TOP_SZ];
-#ifdef SAVE_CALL_CHAIN
- struct callinfo _last_stack[NFRAMES]; /* Stack at last garbage collection.*/
- /* Useful for debugging mysterious */
- /* object disappearances. */
- /* In the multithreaded case, we */
- /* currently only save the calling */
- /* stack. */
-#endif
-};
-
-GC_API GC_FAR struct _GC_arrays GC_arrays;
-
-# define GC_objfreelist GC_arrays._objfreelist
-# define GC_aobjfreelist GC_arrays._aobjfreelist
-# define GC_uobjfreelist GC_arrays._uobjfreelist
-# ifdef ATOMIC_UNCOLLECTABLE
-# define GC_auobjfreelist GC_arrays._auobjfreelist
-# endif
-# define GC_sobjfreelist GC_arrays._sobjfreelist
-# define GC_valid_offsets GC_arrays._valid_offsets
-# define GC_modws_valid_offsets GC_arrays._modws_valid_offsets
-# ifdef STUBBORN_ALLOC
-# define GC_changed_pages GC_arrays._changed_pages
-# define GC_prev_changed_pages GC_arrays._prev_changed_pages
-# endif
-# define GC_obj_map GC_arrays._obj_map
-# define GC_last_heap_addr GC_arrays._last_heap_addr
-# define GC_prev_heap_addr GC_arrays._prev_heap_addr
-# define GC_words_allocd GC_arrays._words_allocd
-# define GC_words_wasted GC_arrays._words_wasted
-# define GC_large_free_bytes GC_arrays._large_free_bytes
-# define GC_words_finalized GC_arrays._words_finalized
-# define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc
-# define GC_mem_freed GC_arrays._mem_freed
-# define GC_mark_procs GC_arrays._mark_procs
-# define GC_heapsize GC_arrays._heapsize
-# define GC_max_heapsize GC_arrays._max_heapsize
-# define GC_words_allocd_before_gc GC_arrays._words_allocd_before_gc
-# define GC_heap_sects GC_arrays._heap_sects
-# define GC_last_stack GC_arrays._last_stack
-# ifdef USE_MUNMAP
-# define GC_unmapped_bytes GC_arrays._unmapped_bytes
-# endif
-# ifdef MSWIN32
-# define GC_heap_bases GC_arrays._heap_bases
-# endif
-# define GC_static_roots GC_arrays._static_roots
-# define GC_root_index GC_arrays._root_index
-# define GC_excl_table GC_arrays._excl_table
-# define GC_all_nils GC_arrays._all_nils
-# define GC_top_index GC_arrays._top_index
-# if defined(PROC_VDB) || defined(MPROTECT_VDB)
-# define GC_grungy_pages GC_arrays._grungy_pages
-# endif
-# ifdef MPROTECT_VDB
-# define GC_dirty_pages GC_arrays._dirty_pages
-# endif
-# ifdef PROC_VDB
-# define GC_written_pages GC_arrays._written_pages
-# endif
-# ifdef GATHERSTATS
-# define GC_composite_in_use GC_arrays._composite_in_use
-# define GC_atomic_in_use GC_arrays._atomic_in_use
-# endif
-# ifdef MERGE_SIZES
-# define GC_size_map GC_arrays._size_map
-# endif
-
-# define beginGC_arrays ((ptr_t)(&GC_arrays))
-# define endGC_arrays (((ptr_t)(&GC_arrays)) + (sizeof GC_arrays))
-
-/* Object kinds: */
-# define MAXOBJKINDS 16
-
-extern struct obj_kind {
- ptr_t *ok_freelist; /* Array of free listheaders for this kind of object */
- /* Point either to GC_arrays or to storage allocated */
- /* with GC_scratch_alloc. */
- struct hblk **ok_reclaim_list;
- /* List headers for lists of blocks waiting to be */
- /* swept. */
- word ok_descriptor; /* Descriptor template for objects in this */
- /* block. */
- GC_bool ok_relocate_descr;
- /* Add object size in bytes to descriptor */
- /* template to obtain descriptor. Otherwise */
- /* template is used as is. */
- GC_bool ok_init; /* Clear objects before putting them on the free list. */
-} GC_obj_kinds[MAXOBJKINDS];
-
-# define endGC_obj_kinds (((ptr_t)(&GC_obj_kinds)) + (sizeof GC_obj_kinds))
-
-# define end_gc_area ((ptr_t)endGC_arrays == (ptr_t)(&GC_obj_kinds) ? \
- endGC_obj_kinds : endGC_arrays)
-
-/* Predefined kinds: */
-# define PTRFREE 0
-# define NORMAL 1
-# define UNCOLLECTABLE 2
-# ifdef ATOMIC_UNCOLLECTABLE
-# define AUNCOLLECTABLE 3
-# define STUBBORN 4
-# define IS_UNCOLLECTABLE(k) (((k) & ~1) == UNCOLLECTABLE)
-# else
-# define STUBBORN 3
-# define IS_UNCOLLECTABLE(k) ((k) == UNCOLLECTABLE)
-# endif
-
-extern int GC_n_kinds;
-
-GC_API word GC_fo_entries;
-
-extern word GC_n_heap_sects; /* Number of separately added heap */
- /* sections. */
-
-extern word GC_page_size;
-
-# ifdef MSWIN32
-extern word GC_n_heap_bases; /* See GC_heap_bases. */
-# endif
-
-extern word GC_total_stack_black_listed;
- /* Number of bytes on stack blacklist. */
-
-extern word GC_black_list_spacing;
- /* Average number of bytes between blacklisted */
- /* blocks. Approximate. */
- /* Counts only blocks that are */
- /* "stack-blacklisted", i.e. that are */
- /* problematic in the interior of an object. */
-
-extern char * GC_invalid_map;
- /* Pointer to the nowhere valid hblk map */
- /* Blocks pointing to this map are free. */
-
-extern struct hblk * GC_hblkfreelist[];
- /* List of completely empty heap blocks */
- /* Linked through hb_next field of */
- /* header structure associated with */
- /* block. */
-
-extern GC_bool GC_is_initialized; /* GC_init() has been run. */
-
-extern GC_bool GC_objects_are_marked; /* There are marked objects in */
- /* the heap. */
-
-#ifndef SMALL_CONFIG
- extern GC_bool GC_incremental;
- /* Using incremental/generational collection. */
-#else
-# define GC_incremental TRUE
- /* Hopefully allow optimizer to remove some code. */
-#endif
-
-extern GC_bool GC_dirty_maintained;
- /* Dirty bits are being maintained, */
- /* either for incremental collection, */
- /* or to limit the root set. */
-
-extern word GC_root_size; /* Total size of registered root sections */
-
-extern GC_bool GC_debugging_started; /* GC_debug_malloc has been called. */
-
-extern ptr_t GC_least_plausible_heap_addr;
-extern ptr_t GC_greatest_plausible_heap_addr;
- /* Bounds on the heap. Guaranteed valid */
- /* Likely to include future heap expansion. */
-
-/* Operations */
-# ifndef abs
-# define abs(x) ((x) < 0? (-(x)) : (x))
-# endif
-
-
-/* Marks are in a reserved area in */
-/* each heap block. Each word has one mark bit associated */
-/* with it. Only those corresponding to the beginning of an */
-/* object are used. */
-
-
-/* Mark bit operations */
-
-/*
- * Retrieve, set, clear the mark bit corresponding
- * to the nth word in a given heap block.
- *
- * (Recall that bit n corresponds to object beginning at word n
- * relative to the beginning of the block, including unused words)
- */
-
-# define mark_bit_from_hdr(hhdr,n) (((hhdr)->hb_marks[divWORDSZ(n)] \
- >> (modWORDSZ(n))) & (word)1)
-# define set_mark_bit_from_hdr(hhdr,n) (hhdr)->hb_marks[divWORDSZ(n)] \
- |= (word)1 << modWORDSZ(n)
-
-# define clear_mark_bit_from_hdr(hhdr,n) (hhdr)->hb_marks[divWORDSZ(n)] \
- &= ~((word)1 << modWORDSZ(n))
-
-/* Important internal collector routines */
-
-ptr_t GC_approx_sp();
-
-GC_bool GC_should_collect();
-#ifdef PRESERVE_LAST
- GC_bool GC_in_last_heap_sect(/* ptr_t */);
- /* In last added heap section? If so, avoid breaking up. */
-#endif
-void GC_apply_to_all_blocks(/*fn, client_data*/);
- /* Invoke fn(hbp, client_data) for each */
- /* allocated heap block. */
-struct hblk * GC_next_used_block(/* struct hblk * h */);
- /* Return first in-use block >= h */
-struct hblk * GC_prev_block(/* struct hblk * h */);
- /* Return last block <= h. Returned block */
- /* is managed by GC, but may or may not be in */
- /* use. */
-void GC_mark_init();
-void GC_clear_marks(); /* Clear mark bits for all heap objects. */
-void GC_invalidate_mark_state(); /* Tell the marker that marked */
- /* objects may point to unmarked */
- /* ones, and roots may point to */
- /* unmarked objects. */
- /* Reset mark stack. */
-void GC_mark_from_mark_stack(); /* Mark from everything on the mark stack. */
- /* Return after about one pages worth of */
- /* work. */
-GC_bool GC_mark_stack_empty();
-GC_bool GC_mark_some(/* cold_gc_frame */);
- /* Perform about one pages worth of marking */
- /* work of whatever kind is needed. Returns */
- /* quickly if no collection is in progress. */
- /* Return TRUE if mark phase finished. */
-void GC_initiate_gc(); /* initiate collection. */
- /* If the mark state is invalid, this */
- /* becomes full colleection. Otherwise */
- /* it's partial. */
-void GC_push_all(/*b,t*/); /* Push everything in a range */
- /* onto mark stack. */
-void GC_push_dirty(/*b,t*/); /* Push all possibly changed */
- /* subintervals of [b,t) onto */
- /* mark stack. */
-#ifndef SMALL_CONFIG
- void GC_push_conditional(/* ptr_t b, ptr_t t, GC_bool all*/);
-#else
-# define GC_push_conditional(b, t, all) GC_push_all(b, t)
-#endif
- /* Do either of the above, depending */
- /* on the third arg. */
-void GC_push_all_stack(/*b,t*/); /* As above, but consider */
- /* interior pointers as valid */
-void GC_push_all_eager(/*b,t*/); /* Same as GC_push_all_stack, but */
- /* ensures that stack is scanned */
- /* immediately, not just scheduled */
- /* for scanning. */
-#ifndef THREADS
- void GC_push_all_stack_partially_eager(/* bottom, top, cold_gc_frame */);
- /* Similar to GC_push_all_eager, but only the */
- /* part hotter than cold_gc_frame is scanned */
- /* immediately. Needed to endure that callee- */
- /* save registers are not missed. */
-#else
- /* In the threads case, we push part of the current thread stack */
- /* with GC_push_all_eager when we push the registers. This gets the */
- /* callee-save registers that may disappear. The remainder of the */
- /* stacks are scheduled for scanning in *GC_push_other_roots, which */
- /* is thread-package-specific. */
-#endif
-void GC_push_current_stack(/* ptr_t cold_gc_frame */);
- /* Push enough of the current stack eagerly to */
- /* ensure that callee-save registers saved in */
- /* GC frames are scanned. */
- /* In the non-threads case, schedule entire */
- /* stack for scanning. */
-void GC_push_roots(/* GC_bool all, ptr_t cold_gc_frame */);
- /* Push all or dirty roots. */
-extern void (*GC_push_other_roots)();
- /* Push system or application specific roots */
- /* onto the mark stack. In some environments */
- /* (e.g. threads environments) this is */
- /* predfined to be non-zero. A client supplied */
- /* replacement should also call the original */
- /* function. */
-extern void (*GC_start_call_back)(/* void */);
- /* Called at start of full collections. */
- /* Not called if 0. Called with allocation */
- /* lock held. */
- /* 0 by default. */
-void GC_push_regs(); /* Push register contents onto mark stack. */
-void GC_remark(); /* Mark from all marked objects. Used */
- /* only if we had to drop something. */
-# if defined(MSWIN32)
- void __cdecl GC_push_one();
-# else
- void GC_push_one(/*p*/); /* If p points to an object, mark it */
- /* and push contents on the mark stack */
-# endif
-void GC_push_one_checked(/*p*/); /* Ditto, omits plausibility test */
-void GC_push_marked(/* struct hblk h, hdr * hhdr */);
- /* Push contents of all marked objects in h onto */
- /* mark stack. */
-#ifdef SMALL_CONFIG
-# define GC_push_next_marked_dirty(h) GC_push_next_marked(h)
-#else
- struct hblk * GC_push_next_marked_dirty(/* h */);
- /* Invoke GC_push_marked on next dirty block above h. */
- /* Return a pointer just past the end of this block. */
-#endif /* !SMALL_CONFIG */
-struct hblk * GC_push_next_marked(/* h */);
- /* Ditto, but also mark from clean pages. */
-struct hblk * GC_push_next_marked_uncollectable(/* h */);
- /* Ditto, but mark only from uncollectable pages. */
-GC_bool GC_stopped_mark(); /* Stop world and mark from all roots */
- /* and rescuers. */
-void GC_clear_hdr_marks(/* hhdr */); /* Clear the mark bits in a header */
-void GC_set_hdr_marks(/* hhdr */); /* Set the mark bits in a header */
-void GC_add_roots_inner();
-GC_bool GC_is_static_root(/* ptr_t p */);
- /* Is the address p in one of the registered static */
- /* root sections? */
-void GC_register_dynamic_libraries();
- /* Add dynamic library data sections to the root set. */
-
-/* Machine dependent startup routines */
-ptr_t GC_get_stack_base();
-void GC_register_data_segments();
-
-/* Black listing: */
-void GC_bl_init();
-# ifndef ALL_INTERIOR_POINTERS
- void GC_add_to_black_list_normal(/* bits, maybe source */);
- /* Register bits as a possible future false */
- /* reference from the heap or static data */
-# ifdef PRINT_BLACK_LIST
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_normal(bits, source)
-# else
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_normal(bits)
-# endif
-# else
-# ifdef PRINT_BLACK_LIST
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_stack(bits, source)
-# else
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_stack(bits)
-# endif
-# endif
-
-void GC_add_to_black_list_stack(/* bits, maybe source */);
-struct hblk * GC_is_black_listed(/* h, len */);
- /* If there are likely to be false references */
- /* to a block starting at h of the indicated */
- /* length, then return the next plausible */
- /* starting location for h that might avoid */
- /* these false references. */
-void GC_promote_black_lists();
- /* Declare an end to a black listing phase. */
-void GC_unpromote_black_lists();
- /* Approximately undo the effect of the above. */
- /* This actually loses some information, but */
- /* only in a reasonably safe way. */
-word GC_number_stack_black_listed(/*struct hblk *start, struct hblk *endp1 */);
- /* Return the number of (stack) blacklisted */
- /* blocks in the range for statistical */
- /* purposes. */
-
-ptr_t GC_scratch_alloc(/*bytes*/);
- /* GC internal memory allocation for */
- /* small objects. Deallocation is not */
- /* possible. */
-
-/* Heap block layout maps: */
-void GC_invalidate_map(/* hdr */);
- /* Remove the object map associated */
- /* with the block. This identifies */
- /* the block as invalid to the mark */
- /* routines. */
-GC_bool GC_add_map_entry(/*sz*/);
- /* Add a heap block map for objects of */
- /* size sz to obj_map. */
- /* Return FALSE on failure. */
-void GC_register_displacement_inner(/*offset*/);
- /* Version of GC_register_displacement */
- /* that assumes lock is already held */
- /* and signals are already disabled. */
-
-/* hblk allocation: */
-void GC_new_hblk(/*size_in_words, kind*/);
- /* Allocate a new heap block, and build */
- /* a free list in it. */
-struct hblk * GC_allochblk(/*size_in_words, kind*/);
- /* Allocate a heap block, clear it if */
- /* for composite objects, inform */
- /* the marker that block is valid */
- /* for objects of indicated size. */
- /* sz < 0 ==> atomic. */
-void GC_freehblk(); /* Deallocate a heap block and mark it */
- /* as invalid. */
-
-/* Misc GC: */
-void GC_init_inner();
-GC_bool GC_expand_hp_inner();
-void GC_start_reclaim(/*abort_if_found*/);
- /* Restore unmarked objects to free */
- /* lists, or (if abort_if_found is */
- /* TRUE) report them. */
- /* Sweeping of small object pages is */
- /* largely deferred. */
-void GC_continue_reclaim(/*size, kind*/);
- /* Sweep pages of the given size and */
- /* kind, as long as possible, and */
- /* as long as the corr. free list is */
- /* empty. */
-void GC_reclaim_or_delete_all();
- /* Arrange for all reclaim lists to be */
- /* empty. Judiciously choose between */
- /* sweeping and discarding each page. */
-GC_bool GC_reclaim_all(/* GC_stop_func f*/);
- /* Reclaim all blocks. Abort (in a */
- /* consistent state) if f returns TRUE. */
-GC_bool GC_block_empty(/* hhdr */); /* Block completely unmarked? */
-GC_bool GC_never_stop_func(); /* Returns FALSE. */
-GC_bool GC_try_to_collect_inner(/* GC_stop_func f */);
- /* Collect; caller must have acquired */
- /* lock and disabled signals. */
- /* Collection is aborted if f returns */
- /* TRUE. Returns TRUE if it completes */
- /* successfully. */
-# define GC_gcollect_inner() \
- (void) GC_try_to_collect_inner(GC_never_stop_func)
-void GC_finish_collection(); /* Finish collection. Mark bits are */
- /* consistent and lock is still held. */
-GC_bool GC_collect_or_expand(/* needed_blocks */);
- /* Collect or expand heap in an attempt */
- /* make the indicated number of free */
- /* blocks available. Should be called */
- /* until the blocks are available or */
- /* until it fails by returning FALSE. */
-GC_API void GC_init(); /* Initialize collector. */
-void GC_collect_a_little_inner(/* int n */);
- /* Do n units worth of garbage */
- /* collection work, if appropriate. */
- /* A unit is an amount appropriate for */
- /* HBLKSIZE bytes of allocation. */
-ptr_t GC_generic_malloc(/* bytes, kind */);
- /* Allocate an object of the given */
- /* kind. By default, there are only */
- /* a few kinds: composite(pointerfree), */
- /* atomic, uncollectable, etc. */
- /* We claim it's possible for clever */
- /* client code that understands GC */
- /* internals to add more, e.g. to */
- /* communicate object layout info */
- /* to the collector. */
-ptr_t GC_generic_malloc_ignore_off_page(/* bytes, kind */);
- /* As above, but pointers past the */
- /* first page of the resulting object */
- /* are ignored. */
-ptr_t GC_generic_malloc_inner(/* bytes, kind */);
- /* Ditto, but I already hold lock, etc. */
-ptr_t GC_generic_malloc_words_small GC_PROTO((size_t words, int kind));
- /* As above, but size in units of words */
- /* Bypasses MERGE_SIZES. Assumes */
- /* words <= MAXOBJSZ. */
-ptr_t GC_generic_malloc_inner_ignore_off_page(/* bytes, kind */);
- /* Allocate an object, where */
- /* the client guarantees that there */
- /* will always be a pointer to the */
- /* beginning of the object while the */
- /* object is live. */
-ptr_t GC_allocobj(/* sz_inn_words, kind */);
- /* Make the indicated */
- /* free list nonempty, and return its */
- /* head. */
-
-void GC_init_headers();
-GC_bool GC_install_header(/*h*/);
- /* Install a header for block h. */
- /* Return FALSE on failure. */
-GC_bool GC_install_counts(/*h, sz*/);
- /* Set up forwarding counts for block */
- /* h of size sz. */
- /* Return FALSE on failure. */
-void GC_remove_header(/*h*/);
- /* Remove the header for block h. */
-void GC_remove_counts(/*h, sz*/);
- /* Remove forwarding counts for h. */
-hdr * GC_find_header(/*p*/); /* Debugging only. */
-
-void GC_finalize(); /* Perform all indicated finalization actions */
- /* on unmarked objects. */
- /* Unreachable finalizable objects are enqueued */
- /* for processing by GC_invoke_finalizers. */
- /* Invoked with lock. */
-
-void GC_add_to_heap(/*p, bytes*/);
- /* Add a HBLKSIZE aligned chunk to the heap. */
-
-void GC_print_obj(/* ptr_t p */);
- /* P points to somewhere inside an object with */
- /* debugging info. Print a human readable */
- /* description of the object to stderr. */
-extern void (*GC_check_heap)();
- /* Check that all objects in the heap with */
- /* debugging info are intact. Print */
- /* descriptions of any that are not. */
-extern void (*GC_print_heap_obj)(/* ptr_t p */);
- /* If possible print s followed by a more */
- /* detailed description of the object */
- /* referred to by p. */
-
-/* Memory unmapping: */
-#ifdef USE_MUNMAP
- void GC_unmap_old(void);
- void GC_merge_unmapped(void);
- void GC_unmap(ptr_t start, word bytes);
- void GC_remap(ptr_t start, word bytes);
- void GC_unmap_gap(ptr_t start1, word bytes1, ptr_t start2, word bytes2);
-#endif
-
-/* Virtual dirty bit implementation: */
-/* Each implementation exports the following: */
-void GC_read_dirty(); /* Retrieve dirty bits. */
-GC_bool GC_page_was_dirty(/* struct hblk * h */);
- /* Read retrieved dirty bits. */
-GC_bool GC_page_was_ever_dirty(/* struct hblk * h */);
- /* Could the page contain valid heap pointers? */
-void GC_is_fresh(/* struct hblk * h, word number_of_blocks */);
- /* Assert the region currently contains no */
- /* valid pointers. */
-void GC_write_hint(/* struct hblk * h */);
- /* h is about to be written. */
-void GC_dirty_init();
-
-/* Slow/general mark bit manipulation: */
-GC_API GC_bool GC_is_marked();
-void GC_clear_mark_bit();
-void GC_set_mark_bit();
-
-/* Stubborn objects: */
-void GC_read_changed(); /* Analogous to GC_read_dirty */
-GC_bool GC_page_was_changed(/* h */); /* Analogous to GC_page_was_dirty */
-void GC_clean_changing_list(); /* Collect obsolete changing list entries */
-void GC_stubborn_init();
-
-/* Debugging print routines: */
-void GC_print_block_list();
-void GC_print_hblkfreelist();
-void GC_print_heap_sects();
-void GC_print_static_roots();
-void GC_dump();
-
-#ifdef KEEP_BACK_PTRS
- void GC_store_back_pointer(ptr_t source, ptr_t dest);
- void GC_marked_for_finalization(ptr_t dest);
-# define GC_STORE_BACK_PTR(source, dest) GC_store_back_pointer(source, dest)
-# define GC_MARKED_FOR_FINALIZATION(dest) GC_marked_for_finalization(dest)
-#else
-# define GC_STORE_BACK_PTR(source, dest)
-# define GC_MARKED_FOR_FINALIZATION(dest)
-#endif
-
-/* Make arguments appear live to compiler */
-# ifdef __WATCOMC__
- void GC_noop(void*, ...);
-# else
- GC_API void GC_noop();
-# endif
-
-void GC_noop1(/* word arg */);
-
-/* Logging and diagnostic output: */
-GC_API void GC_printf GC_PROTO((char * format, long, long, long, long, long, long));
- /* A version of printf that doesn't allocate, */
- /* is restricted to long arguments, and */
- /* (unfortunately) doesn't use varargs for */
- /* portability. Restricted to 6 args and */
- /* 1K total output length. */
- /* (We use sprintf. Hopefully that doesn't */
- /* allocate for long arguments.) */
-# define GC_printf0(f) GC_printf(f, 0l, 0l, 0l, 0l, 0l, 0l)
-# define GC_printf1(f,a) GC_printf(f, (long)a, 0l, 0l, 0l, 0l, 0l)
-# define GC_printf2(f,a,b) GC_printf(f, (long)a, (long)b, 0l, 0l, 0l, 0l)
-# define GC_printf3(f,a,b,c) GC_printf(f, (long)a, (long)b, (long)c, 0l, 0l, 0l)
-# define GC_printf4(f,a,b,c,d) GC_printf(f, (long)a, (long)b, (long)c, \
- (long)d, 0l, 0l)
-# define GC_printf5(f,a,b,c,d,e) GC_printf(f, (long)a, (long)b, (long)c, \
- (long)d, (long)e, 0l)
-# define GC_printf6(f,a,b,c,d,e,g) GC_printf(f, (long)a, (long)b, (long)c, \
- (long)d, (long)e, (long)g)
-
-void GC_err_printf(/* format, a, b, c, d, e, f */);
-# define GC_err_printf0(f) GC_err_puts(f)
-# define GC_err_printf1(f,a) GC_err_printf(f, (long)a, 0l, 0l, 0l, 0l, 0l)
-# define GC_err_printf2(f,a,b) GC_err_printf(f, (long)a, (long)b, 0l, 0l, 0l, 0l)
-# define GC_err_printf3(f,a,b,c) GC_err_printf(f, (long)a, (long)b, (long)c, \
- 0l, 0l, 0l)
-# define GC_err_printf4(f,a,b,c,d) GC_err_printf(f, (long)a, (long)b, \
- (long)c, (long)d, 0l, 0l)
-# define GC_err_printf5(f,a,b,c,d,e) GC_err_printf(f, (long)a, (long)b, \
- (long)c, (long)d, \
- (long)e, 0l)
-# define GC_err_printf6(f,a,b,c,d,e,g) GC_err_printf(f, (long)a, (long)b, \
- (long)c, (long)d, \
- (long)e, (long)g)
- /* Ditto, writes to stderr. */
-
-void GC_err_puts(/* char *s */);
- /* Write s to stderr, don't buffer, don't add */
- /* newlines, don't ... */
-
-
-# ifdef GC_ASSERTIONS
-# define GC_ASSERT(expr) if(!(expr)) {\
- GC_err_printf2("Assertion failure: %s:%ld\n", \
- __FILE__, (unsigned long)__LINE__); \
- ABORT("assertion failure"); }
-# else
-# define GC_ASSERT(expr)
-# endif
-
-# endif /* GC_PRIVATE_H */
diff --git a/gc/gc_private.h b/gc/gc_private.h
@@ -1 +0,0 @@
-# include "gc_priv.h"
diff --git a/gc/gc_typed.h b/gc/gc_typed.h
@@ -1,91 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- * Copyright 1996 Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/*
- * Some simple primitives for allocation with explicit type information.
- * Facilities for dynamic type inference may be added later.
- * Should be used only for extremely performance critical applications,
- * or if conservative collector leakage is otherwise a problem (unlikely).
- * Note that this is implemented completely separately from the rest
- * of the collector, and is not linked in unless referenced.
- * This does not currently support GC_DEBUG in any interesting way.
- */
-/* Boehm, May 19, 1994 2:13 pm PDT */
-
-#ifndef _GC_TYPED_H
-# define _GC_TYPED_H
-# ifndef _GC_H
-# include "gc.h"
-# endif
-
-typedef GC_word * GC_bitmap;
- /* The least significant bit of the first word is one if */
- /* the first word in the object may be a pointer. */
-
-# define GC_get_bit(bm, index) \
- (((bm)[divWORDSZ(index)] >> modWORDSZ(index)) & 1)
-# define GC_set_bit(bm, index) \
- (bm)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
-
-typedef GC_word GC_descr;
-
-GC_API GC_descr GC_make_descriptor GC_PROTO((GC_bitmap bm, size_t len));
- /* Return a type descriptor for the object whose layout */
- /* is described by the argument. */
- /* The least significant bit of the first word is one */
- /* if the first word in the object may be a pointer. */
- /* The second argument specifies the number of */
- /* meaningful bits in the bitmap. The actual object */
- /* may be larger (but not smaller). Any additional */
- /* words in the object are assumed not to contain */
- /* pointers. */
- /* Returns a conservative approximation in the */
- /* (unlikely) case of insufficient memory to build */
- /* the descriptor. Calls to GC_make_descriptor */
- /* may consume some amount of a finite resource. This */
- /* is intended to be called once per type, not once */
- /* per allocation. */
-
-GC_API GC_PTR GC_malloc_explicitly_typed
- GC_PROTO((size_t size_in_bytes, GC_descr d));
- /* Allocate an object whose layout is described by d. */
- /* The resulting object MAY NOT BE PASSED TO REALLOC. */
-
-GC_API GC_PTR GC_malloc_explicitly_typed_ignore_off_page
- GC_PROTO((size_t size_in_bytes, GC_descr d));
-
-GC_API GC_PTR GC_calloc_explicitly_typed
- GC_PROTO((size_t nelements,
- size_t element_size_in_bytes,
- GC_descr d));
- /* Allocate an array of nelements elements, each of the */
- /* given size, and with the given descriptor. */
- /* The elemnt size must be a multiple of the byte */
- /* alignment required for pointers. E.g. on a 32-bit */
- /* machine with 16-bit aligned pointers, size_in_bytes */
- /* must be a multiple of 2. */
-
-#ifdef GC_DEBUG
-# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) GC_MALLOC(bytes)
-# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes)
-#else
-# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) \
- GC_malloc_explicitly_typed(bytes, d)
-# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) \
- GC_calloc_explicitly_typed(n, bytes, d)
-#endif /* !GC_DEBUG */
-
-
-#endif /* _GC_TYPED_H */
-
diff --git a/gc/gcconfig.h b/gc/gcconfig.h
@@ -1,1110 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-#ifndef CONFIG_H
-
-# define CONFIG_H
-
-/* Machine dependent parameters. Some tuning parameters can be found */
-/* near the top of gc_private.h. */
-
-/* Machine specific parts contributed by various people. See README file. */
-
-/* First a unified test for Linux: */
-# if defined(linux) || defined(__linux__)
-# define LINUX
-# endif
-
-/* Determine the machine type: */
-# if defined(sun) && defined(mc68000)
-# define M68K
-# define SUNOS4
-# define mach_type_known
-# endif
-# if defined(hp9000s300)
-# define M68K
-# define HP
-# define mach_type_known
-# endif
-# if defined(__OpenBSD__) && defined(m68k)
-# define M68K
-# define OPENBSD
-# define mach_type_known
-# endif
-# if defined(__OpenBSD__) && defined(__sparc__)
-# define SPARC
-# define OPENBSD
-# define mach_type_known
-# endif
-# if defined(__NetBSD__) && defined(m68k)
-# define M68K
-# define NETBSD
-# define mach_type_known
-# endif
-# if defined(vax)
-# define VAX
-# ifdef ultrix
-# define ULTRIX
-# else
-# define BSD
-# endif
-# define mach_type_known
-# endif
-# if defined(mips) || defined(__mips)
-# define MIPS
-# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
-# define ULTRIX
-# else
-# if !defined(LINUX)
-# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
-# define IRIX5 /* or IRIX 6.X */
-# else
-# define RISCOS /* or IRIX 4.X */
-# endif
-# endif
-# endif
-# define mach_type_known
-# endif
-# if defined(sequent) && defined(i386)
-# define I386
-# define SEQUENT
-# define mach_type_known
-# endif
-# if defined(sun) && defined(i386)
-# define I386
-# define SUNOS5
-# define mach_type_known
-# endif
-# if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
-# define I386
-# define OS2
-# define mach_type_known
-# endif
-# if defined(ibm032)
-# define RT
-# define mach_type_known
-# endif
-# if defined(sun) && (defined(sparc) || defined(__sparc))
-# define SPARC
- /* Test for SunOS 5.x */
-# include <errno.h>
-# ifdef ECHRNG
-# define SUNOS5
-# else
-# define SUNOS4
-# endif
-# define mach_type_known
-# endif
-# if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
- && !defined(__OpenBSD__)
-# define SPARC
-# define DRSNX
-# define mach_type_known
-# endif
-# if defined(_IBMR2)
-# define RS6000
-# define mach_type_known
-# endif
-# if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
- /* The above test may need refinement */
-# define I386
-# if defined(_SCO_ELF)
-# define SCO_ELF
-# else
-# define SCO
-# endif
-# define mach_type_known
-# endif
-# if defined(_AUX_SOURCE)
-# define M68K
-# define SYSV
-# define mach_type_known
-# endif
-# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
- || defined(hppa) || defined(__hppa__)
-# define HP_PA
-# define mach_type_known
-# endif
-# if defined(LINUX) && (defined(i386) || defined(__i386__))
-# define I386
-# define mach_type_known
-# endif
-# if defined(LINUX) && defined(powerpc)
-# define POWERPC
-# define mach_type_known
-# endif
-# if defined(LINUX) && defined(__mc68000__)
-# define M68K
-# define mach_type_known
-# endif
-# if defined(LINUX) && defined(sparc)
-# define SPARC
-# define mach_type_known
-# endif
-# if defined(__alpha) || defined(__alpha__)
-# define ALPHA
-# if !defined(LINUX)
-# define OSF1 /* a.k.a Digital Unix */
-# endif
-# define mach_type_known
-# endif
-# if defined(_AMIGA) && !defined(AMIGA)
-# define AMIGA
-# endif
-# ifdef AMIGA
-# define M68K
-# define mach_type_known
-# endif
-# if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
-# define M68K
-# define MACOS
-# define mach_type_known
-# endif
-# if defined(__MWERKS__) && defined(__powerc)
-# define POWERPC
-# define MACOS
-# define mach_type_known
-# endif
-# if defined(macosx)
-# define MACOSX
-# define POWERPC
-# define mach_type_known
-# endif
-# if defined(NeXT) && defined(mc68000)
-# define M68K
-# define NEXT
-# define mach_type_known
-# endif
-# if defined(NeXT) && defined(i386)
-# define I386
-# define NEXT
-# define mach_type_known
-# endif
-# if defined(__OpenBSD__) && defined(i386)
-# define I386
-# define OPENBSD
-# define mach_type_known
-# endif
-# if defined(__FreeBSD__) && defined(i386)
-# define I386
-# define FREEBSD
-# define mach_type_known
-# endif
-# if defined(__NetBSD__) && defined(i386)
-# define I386
-# define NETBSD
-# define mach_type_known
-# endif
-# if defined(bsdi) && defined(i386)
-# define I386
-# define BSDI
-# define mach_type_known
-# endif
-# if !defined(mach_type_known) && defined(__386BSD__)
-# define I386
-# define THREE86BSD
-# define mach_type_known
-# endif
-# if defined(_CX_UX) && defined(_M88K)
-# define M88K
-# define CX_UX
-# define mach_type_known
-# endif
-# if defined(DGUX)
-# define M88K
- /* DGUX defined */
-# define mach_type_known
-# endif
-# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
-# define I386
-# define MSWIN32 /* or Win32s */
-# define mach_type_known
-# endif
-# if defined(__DJGPP__)
-# define I386
-# ifndef DJGPP
-# define DJGPP /* MSDOS running the DJGPP port of GCC */
-# endif
-# define mach_type_known
-# endif
-# if defined(__CYGWIN32__) || defined(__CYGWIN__)
-# define I386
-# define CYGWIN32
-# define mach_type_known
-# endif
-# if defined(__BORLANDC__)
-# define I386
-# define MSWIN32
-# define mach_type_known
-# endif
-# if defined(_UTS) && !defined(mach_type_known)
-# define S370
-# define UTS4
-# define mach_type_known
-# endif
-/* Ivan Demakov */
-# if defined(__WATCOMC__) && defined(__386__)
-# define I386
-# if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
-# if defined(__OS2__)
-# define OS2
-# else
-# if defined(__WINDOWS_386__) || defined(__NT__)
-# define MSWIN32
-# else
-# define DOS4GW
-# endif
-# endif
-# endif
-# define mach_type_known
-# endif
-
-/* Feel free to add more clauses here */
-
-/* Or manually define the machine type here. A machine type is */
-/* characterized by the architecture. Some */
-/* machine types are further subdivided by OS. */
-/* the macros ULTRIX, RISCOS, and BSD to distinguish. */
-/* Note that SGI IRIX is treated identically to RISCOS. */
-/* SYSV on an M68K actually means A/UX. */
-/* The distinction in these cases is usually the stack starting address */
-# ifndef mach_type_known
- --> unknown machine type
-# endif
- /* Mapping is: M68K ==> Motorola 680X0 */
- /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
- /* MACOS and AMIGA variants) */
- /* I386 ==> Intel 386 */
- /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
- /* FREEBSD, THREE86BSD, MSWIN32, */
- /* BSDI,SUNOS5, NEXT, other variants) */
- /* NS32K ==> Encore Multimax */
- /* MIPS ==> R2000 or R3000 */
- /* (RISCOS, ULTRIX variants) */
- /* VAX ==> DEC VAX */
- /* (BSD, ULTRIX variants) */
- /* RS6000 ==> IBM RS/6000 AIX3.X */
- /* RT ==> IBM PC/RT */
- /* HP_PA ==> HP9000/700 & /800 */
- /* HP/UX */
- /* SPARC ==> SPARC under SunOS */
- /* (SUNOS4, SUNOS5, */
- /* DRSNX variants) */
- /* ALPHA ==> DEC Alpha */
- /* (OSF1 and LINUX variants) */
- /* M88K ==> Motorola 88XX0 */
- /* (CX_UX and DGUX) */
- /* S370 ==> 370-like machine */
- /* running Amdahl UTS4 */
-
-
-/*
- * For each architecture and OS, the following need to be defined:
- *
- * CPP_WORD_SZ is a simple integer constant representing the word size.
- * in bits. We assume byte addressibility, where a byte has 8 bits.
- * We also assume CPP_WORD_SZ is either 32 or 64.
- * (We care about the length of pointers, not hardware
- * bus widths. Thus a 64 bit processor with a C compiler that uses
- * 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
- *
- * MACH_TYPE is a string representation of the machine type.
- * OS_TYPE is analogous for the OS.
- *
- * ALIGNMENT is the largest N, such that
- * all pointer are guaranteed to be aligned on N byte boundaries.
- * defining it to be 1 will always work, but perform poorly.
- *
- * DATASTART is the beginning of the data segment.
- * On UNIX systems, the collector will scan the area between DATASTART
- * and DATAEND for root pointers.
- *
- * DATAEND, if not &end.
- *
- * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
- * the pointer size.
- *
- * STACKBOTTOM is the cool end of the stack, which is usually the
- * highest address in the stack.
- * Under PCR or OS/2, we have other ways of finding thread stacks.
- * For each machine, the following should:
- * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
- * 2) define exactly one of
- * STACKBOTTOM (should be defined to be an expression)
- * HEURISTIC1
- * HEURISTIC2
- * If either of the last two macros are defined, then STACKBOTTOM is computed
- * during collector startup using one of the following two heuristics:
- * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
- * the next multiple of STACK_GRAN.
- * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
- * in small steps (decrement if STACK_GROWS_UP), and read the value
- * at each location. Remember the value when the first
- * Segmentation violation or Bus error is signalled. Round that
- * to the nearest plausible page boundary, and use that instead
- * of STACKBOTTOM.
- *
- * If no expression for STACKBOTTOM can be found, and neither of the above
- * heuristics are usable, the collector can still be used with all of the above
- * undefined, provided one of the following is done:
- * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
- * without reference to STACKBOTTOM. This is appropriate for use in
- * conjunction with thread packages, since there will be multiple stacks.
- * (Allocating thread stacks in the heap, and treating them as ordinary
- * heap data objects is also possible as a last resort. However, this is
- * likely to introduce significant amounts of excess storage retention
- * unless the dead parts of the thread stacks are periodically cleared.)
- * 2) Client code may set GC_stackbottom before calling any GC_ routines.
- * If the author of the client code controls the main program, this is
- * easily accomplished by introducing a new main program, setting
- * GC_stackbottom to the address of a local variable, and then calling
- * the original main program. The new main program would read something
- * like:
- *
- * # include "gc_private.h"
- *
- * main(argc, argv, envp)
- * int argc;
- * char **argv, **envp;
- * {
- * int dummy;
- *
- * GC_stackbottom = (ptr_t)(&dummy);
- * return(real_main(argc, argv, envp));
- * }
- *
- *
- * Each architecture may also define the style of virtual dirty bit
- * implementation to be used:
- * MPROTECT_VDB: Write protect the heap and catch faults.
- * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
- *
- * An architecture may define DYNAMIC_LOADING if dynamic_load.c
- * defined GC_register_dynamic_libraries() for the architecture.
- */
-
-
-# define STACK_GRAN 0x1000000
-# ifdef M68K
-# define MACH_TYPE "M68K"
-# define ALIGNMENT 2
-# ifdef OPENBSD
-# define OS_TYPE "OPENBSD"
-# define HEURISTIC2
- extern char etext;
-# define DATASTART ((ptr_t)(&etext))
-# endif
-# ifdef NETBSD
-# define OS_TYPE "NETBSD"
-# define HEURISTIC2
- extern char etext;
-# define DATASTART ((ptr_t)(&etext))
-# endif
-# ifdef LINUX
-# define OS_TYPE "LINUX"
-# define STACKBOTTOM ((ptr_t)0xf0000000)
-# define MPROTECT_VDB
-# ifdef __ELF__
-# define DYNAMIC_LOADING
- extern char **__environ;
-# define DATASTART ((ptr_t)(&__environ))
- /* hideous kludge: __environ is the first */
- /* word in crt0.o, and delimits the start */
- /* of the data segment, no matter which */
- /* ld options were passed through. */
- /* We could use _etext instead, but that */
- /* would include .rodata, which may */
- /* contain large read-only data tables */
- /* that we'd rather not scan. */
- extern int _end;
-# define DATAEND (&_end)
-# else
- extern int etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
-# endif
-# endif
-# ifdef SUNOS4
-# define OS_TYPE "SUNOS4"
- extern char etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
-# define HEURISTIC1 /* differs */
-# define DYNAMIC_LOADING
-# endif
-# ifdef HP
-# define OS_TYPE "HP"
- extern char etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
-# define STACKBOTTOM ((ptr_t) 0xffeffffc)
- /* empirically determined. seems to work. */
-# include <unistd.h>
-# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
-# endif
-# ifdef SYSV
-# define OS_TYPE "SYSV"
- extern etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
- & ~0x3fffff) \
- +((word)&etext & 0x1fff))
- /* This only works for shared-text binaries with magic number 0413.
- The other sorts of SysV binaries put the data at the end of the text,
- in which case the default of &etext would work. Unfortunately,
- handling both would require having the magic-number available.
- -- Parag
- */
-# define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
- /* The stack starts at the top of memory, but */
- /* 0x0 cannot be used as setjump_test complains */
- /* that the stack direction is incorrect. Two */
- /* bytes down from 0x0 should be safe enough. */
- /* --Parag */
-# include <sys/mmu.h>
-# define GETPAGESIZE() PAGESIZE /* Is this still right? */
-# endif
-# ifdef AMIGA
-# define OS_TYPE "AMIGA"
- /* STACKBOTTOM and DATASTART handled specially */
- /* in os_dep.c */
-# define DATAEND /* not needed */
-# define GETPAGESIZE() 4096
-# endif
-# ifdef MACOS
-# ifndef __LOWMEM__
-# include <LowMem.h>
-# endif
-# define OS_TYPE "MACOS"
- /* see os_dep.c for details of global data segments. */
-# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
-# define DATAEND /* not needed */
-# define GETPAGESIZE() 4096
-# endif
-# ifdef NEXT
-# define OS_TYPE "NEXT"
-# define DATASTART ((ptr_t) get_etext())
-# define STACKBOTTOM ((ptr_t) 0x4000000)
-# define DATAEND /* not needed */
-# endif
-# endif
-
-# ifdef POWERPC
-# define MACH_TYPE "POWERPC"
-# ifdef MACOS
-# define ALIGNMENT 2 /* Still necessary? Could it be 4? */
-# ifndef __LOWMEM__
-# include <LowMem.h>
-# endif
-# define OS_TYPE "MACOS"
- /* see os_dep.c for details of global data segments. */
-# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
-# define DATAEND /* not needed */
-# endif
-# ifdef LINUX
-# define ALIGNMENT 4 /* Guess. Can someone verify? */
- /* This was 2, but that didn't sound right. */
-# define OS_TYPE "LINUX"
-# define HEURISTIC1
-# undef STACK_GRAN
-# define STACK_GRAN 0x10000000
- /* Stack usually starts at 0x80000000 */
-# define DATASTART GC_data_start
- extern int _end;
-# define DATAEND (&_end)
-# endif
-# ifdef MACOSX
-# define ALIGNMENT 4
-# define OS_TYPE "MACOSX"
-# define DATASTART ((ptr_t) get_etext())
-# define STACKBOTTOM ((ptr_t) 0xc0000000)
-# define DATAEND /* not needed */
-# endif
-# endif
-
-# ifdef VAX
-# define MACH_TYPE "VAX"
-# define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
- extern char etext;
-# define DATASTART ((ptr_t)(&etext))
-# ifdef BSD
-# define OS_TYPE "BSD"
-# define HEURISTIC1
- /* HEURISTIC2 may be OK, but it's hard to test. */
-# endif
-# ifdef ULTRIX
-# define OS_TYPE "ULTRIX"
-# define STACKBOTTOM ((ptr_t) 0x7fffc800)
-# endif
-# endif
-
-# ifdef RT
-# define MACH_TYPE "RT"
-# define ALIGNMENT 4
-# define DATASTART ((ptr_t) 0x10000000)
-# define STACKBOTTOM ((ptr_t) 0x1fffd800)
-# endif
-
-# ifdef SPARC
-# define MACH_TYPE "SPARC"
-# define ALIGNMENT 4 /* Required by hardware */
-# define ALIGN_DOUBLE
- extern int etext;
-# ifdef SUNOS5
-# define OS_TYPE "SUNOS5"
- extern int _etext;
- extern int _end;
- extern char * GC_SysVGetDataStart();
-# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
-# define DATAEND (&_end)
-# ifndef USE_MMAP
-# define USE_MMAP
-# endif
-# ifdef USE_MMAP
-# define HEAP_START (ptr_t)0x40000000
-# else
-# define HEAP_START DATAEND
-# endif
-# define PROC_VDB
-/* HEURISTIC1 reportedly no longer works under 2.7. Thus we */
-/* switched to HEURISTIC2, eventhough it creates some debugging */
-/* issues. */
-# define HEURISTIC2
-# include <unistd.h>
-# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
- /* getpagesize() appeared to be missing from at least one */
- /* Solaris 5.4 installation. Weird. */
-# define DYNAMIC_LOADING
-# endif
-# ifdef SUNOS4
-# define OS_TYPE "SUNOS4"
- /* [If you have a weak stomach, don't read this.] */
- /* We would like to use: */
-/* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
- /* This fails occasionally, due to an ancient, but very */
- /* persistent ld bug. &etext is set 32 bytes too high. */
- /* We instead read the text segment size from the a.out */
- /* header, which happens to be mapped into our address space */
- /* at the start of the text segment. The detective work here */
- /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
- /* Serpette of INRIA. */
- /* This assumes ZMAGIC, i.e. demand-loadable executables. */
-# define TEXTSTART 0x2000
-# define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
-# define MPROTECT_VDB
-# define HEURISTIC1
-# define DYNAMIC_LOADING
-# endif
-# ifdef DRSNX
-# define CPP_WORDSZ 32
-# define OS_TYPE "DRSNX"
- extern char * GC_SysVGetDataStart();
- extern int etext;
-# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
-# define MPROTECT_VDB
-# define STACKBOTTOM ((ptr_t) 0xdfff0000)
-# define DYNAMIC_LOADING
-# endif
-# ifdef LINUX
-# define OS_TYPE "LINUX"
-# ifdef __ELF__
-# define DATASTART GC_data_start
-# define DYNAMIC_LOADING
-# else
- Linux Sparc non elf ?
-# endif
- extern int _end;
-# define DATAEND (&_end)
-# define SVR4
-# define STACKBOTTOM ((ptr_t) 0xf0000000)
-# endif
-# ifdef OPENBSD
-# define OS_TYPE "OPENBSD"
-# define STACKBOTTOM ((ptr_t) 0xf8000000)
-# define DATASTART ((ptr_t)(&etext))
-# endif
-# endif
-
-# ifdef I386
-# define MACH_TYPE "I386"
-# define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
- /* except Borland. The -a4 option fixes */
- /* Borland. */
- /* Ivan Demakov: For Watcom the option is -zp4. */
-# ifndef SMALL_CONFIG
-# define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
- /* improvement on Pentiums. */
-# endif
-# ifdef SEQUENT
-# define OS_TYPE "SEQUENT"
- extern int etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
-# define STACKBOTTOM ((ptr_t) 0x3ffff000)
-# endif
-# ifdef SUNOS5
-# define OS_TYPE "SUNOS5"
- extern int etext, _start;
- extern char * GC_SysVGetDataStart();
-# define DATASTART GC_SysVGetDataStart(0x1000, &etext)
-# define STACKBOTTOM ((ptr_t)(&_start))
-/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
-/*# define PROC_VDB*/
-# define DYNAMIC_LOADING
-# ifndef USE_MMAP
-# define USE_MMAP
-# endif
-# ifdef USE_MMAP
-# define HEAP_START (ptr_t)0x40000000
-# else
-# define HEAP_START DATAEND
-# endif
-# endif
-# ifdef SCO
-# define OS_TYPE "SCO"
- extern int etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
- & ~0x3fffff) \
- +((word)&etext & 0xfff))
-# define STACKBOTTOM ((ptr_t) 0x7ffffffc)
-# endif
-# ifdef SCO_ELF
-# define OS_TYPE "SCO_ELF"
- extern int etext;
-# define DATASTART ((ptr_t)(&etext))
-# define STACKBOTTOM ((ptr_t) 0x08048000)
-# define DYNAMIC_LOADING
-# define ELF_CLASS ELFCLASS32
-# endif
-# ifdef LINUX
-# define OS_TYPE "LINUX"
-# define HEURISTIC1
-# undef STACK_GRAN
-# define STACK_GRAN 0x10000000
- /* STACKBOTTOM is usually 0xc0000000, but this changes with */
- /* different kernel configurations. In particular, systems */
- /* with 2GB physical memory will usually move the user */
- /* address space limit, and hence initial SP to 0x80000000. */
-# if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
-# define MPROTECT_VDB
-# else
- /* We seem to get random errors in incremental mode, */
- /* possibly because Linux threads is itself a malloc client */
- /* and can't deal with the signals. */
-# endif
-# ifdef __ELF__
-# define DYNAMIC_LOADING
-# ifdef UNDEFINED /* includes ro data */
- extern int _etext;
-# define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
-# endif
-# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
- extern int __data_start;
-# define DATASTART ((ptr_t)(&__data_start))
-# else
- extern char **__environ;
-# define DATASTART ((ptr_t)(&__environ))
- /* hideous kludge: __environ is the first */
- /* word in crt0.o, and delimits the start */
- /* of the data segment, no matter which */
- /* ld options were passed through. */
- /* We could use _etext instead, but that */
- /* would include .rodata, which may */
- /* contain large read-only data tables */
- /* that we'd rather not scan. */
-# endif
- extern int _end;
-# define DATAEND (&_end)
-# else
- extern int etext;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
-# endif
-# endif
-# ifdef CYGWIN32
-# define OS_TYPE "CYGWIN32"
- extern int _data_start__;
- extern int _data_end__;
- extern int _bss_start__;
- extern int _bss_end__;
- /* For binutils 2.9.1, we have */
- /* DATASTART = _data_start__ */
- /* DATAEND = _bss_end__ */
- /* whereas for some earlier versions it was */
- /* DATASTART = _bss_start__ */
- /* DATAEND = _data_end__ */
- /* To get it right for both, we take the */
- /* minumum/maximum of the two. */
-# define MAX(x,y) ((x) > (y) ? (x) : (y))
-# define MIN(x,y) ((x) < (y) ? (x) : (y))
-# define DATASTART ((ptr_t) MIN(&_data_start__, &_bss_start__))
-# define DATAEND ((ptr_t) MAX(&_data_end__, &_bss_end__))
-# undef STACK_GRAN
-# define STACK_GRAN 0x10000
-# define HEURISTIC1
-# endif
-# ifdef OS2
-# define OS_TYPE "OS2"
- /* STACKBOTTOM and DATASTART are handled specially in */
- /* os_dep.c. OS2 actually has the right */
- /* system call! */
-# define DATAEND /* not needed */
-# endif
-# ifdef MSWIN32
-# define OS_TYPE "MSWIN32"
- /* STACKBOTTOM and DATASTART are handled specially in */
- /* os_dep.c. */
-# ifndef __WATCOMC__
-# define MPROTECT_VDB
-# endif
-# define DATAEND /* not needed */
-# endif
-# ifdef DJGPP
-# define OS_TYPE "DJGPP"
-# include "stubinfo.h"
- extern int etext;
- extern int _stklen;
- extern int __djgpp_stack_limit;
-# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
-/* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
- + _stklen)) */
-# define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
- /* This may not be right. */
-# endif
-# ifdef OPENBSD
-# define OS_TYPE "OPENBSD"
-# endif
-# ifdef FREEBSD
-# define OS_TYPE "FREEBSD"
-# define MPROTECT_VDB
-# endif
-# ifdef NETBSD
-# define OS_TYPE "NETBSD"
-# endif
-# ifdef THREE86BSD
-# define OS_TYPE "THREE86BSD"
-# endif
-# ifdef BSDI
-# define OS_TYPE "BSDI"
-# endif
-# if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
- || defined(THREE86BSD) || defined(BSDI)
-# define HEURISTIC2
- extern char etext;
-# define DATASTART ((ptr_t)(&etext))
-# endif
-# ifdef NEXT
-# define OS_TYPE "NEXT"
-# define DATASTART ((ptr_t) get_etext())
-# define STACKBOTTOM ((ptr_t)0xc0000000)
-# define DATAEND /* not needed */
-# endif
-# ifdef DOS4GW
-# define OS_TYPE "DOS4GW"
- extern long __nullarea;
- extern char _end;
- extern char *_STACKTOP;
- /* Depending on calling conventions Watcom C either precedes
- or does not precedes with undescore names of C-variables.
- Make sure startup code variables always have the same names. */
- #pragma aux __nullarea "*";
- #pragma aux _end "*";
-# define STACKBOTTOM ((ptr_t) _STACKTOP)
- /* confused? me too. */
-# define DATASTART ((ptr_t) &__nullarea)
-# define DATAEND ((ptr_t) &_end)
-# endif
-# endif
-
-# ifdef NS32K
-# define MACH_TYPE "NS32K"
-# define ALIGNMENT 4
- extern char **environ;
-# define DATASTART ((ptr_t)(&environ))
- /* hideous kludge: environ is the first */
- /* word in crt0.o, and delimits the start */
- /* of the data segment, no matter which */
- /* ld options were passed through. */
-# define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
-# endif
-
-# ifdef MIPS
-# define MACH_TYPE "MIPS"
-# ifdef LINUX
-# define OS_TYPE "LINUX"
- extern int __data_start;
-# define DATASTART ((ptr_t)(&__data_start))
-# define ALIGNMENT 4
-# define USE_GENERIC_PUSH_REGS 1
-# define STACKBOTTOM 0x80000000
-# else // LINUX
-# ifndef IRIX5
-# define DATASTART (ptr_t)0x10000000
- /* Could probably be slightly higher since */
- /* startup code allocates lots of stuff. */
-# else // IRIX5
- extern int _fdata;
-# define DATASTART ((ptr_t)(&_fdata))
-# ifdef USE_MMAP
-# define HEAP_START (ptr_t)0x30000000
-# else
-# define HEAP_START DATASTART
-# endif
- /* Lowest plausible heap address. */
- /* In the MMAP case, we map there. */
- /* In either case it is used to identify */
- /* heap sections so they're not */
- /* considered as roots. */
-# endif /* IRIX5 */
-# define HEURISTIC2
-/* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
-# ifdef ULTRIX
-# define OS_TYPE "ULTRIX"
-# define ALIGNMENT 4
-# endif
-# ifdef RISCOS
-# define OS_TYPE "RISCOS"
-# define ALIGNMENT 4 /* Required by hardware */
-# endif
-# ifdef IRIX5
-# define OS_TYPE "IRIX5"
-# define MPROTECT_VDB
-# ifdef _MIPS_SZPTR
-# define CPP_WORDSZ _MIPS_SZPTR
-# define ALIGNMENT (_MIPS_SZPTR/8)
-# if CPP_WORDSZ != 64
-# define ALIGN_DOUBLE
-# endif
-# else
-# define ALIGNMENT 4
-# define ALIGN_DOUBLE
-# endif
-# define DYNAMIC_LOADING
-# endif
-# endif // LINUX
-# endif
-
-# ifdef RS6000
-# define MACH_TYPE "RS6000"
-# define ALIGNMENT 4
-# define DATASTART ((ptr_t)0x20000000)
- extern int errno;
-# define STACKBOTTOM ((ptr_t)((ulong)&errno))
-# define DYNAMIC_LOADING
- /* For really old versions of AIX, this may have to be removed. */
-# endif
-
-# ifdef HP_PA
-# define MACH_TYPE "HP_PA"
-# define ALIGNMENT 4
-# define ALIGN_DOUBLE
- extern int __data_start;
-# define DATASTART ((ptr_t)(&__data_start))
-# if 0
- /* The following appears to work for 7xx systems running HP/UX */
- /* 9.xx Furthermore, it might result in much faster */
- /* collections than HEURISTIC2, which may involve scanning */
- /* segments that directly precede the stack. It is not the */
- /* default, since it may not work on older machine/OS */
- /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
- /* this.) */
-# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
-# else
-# define HEURISTIC2
-# endif
-# define STACK_GROWS_UP
-# define DYNAMIC_LOADING
-# include <unistd.h>
-# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
- /* They misspelled the Posix macro? */
-# endif
-
-# ifdef ALPHA
-# define MACH_TYPE "ALPHA"
-# define ALIGNMENT 8
-# ifdef OSF1
-# define OS_TYPE "OSF1"
-# define DATASTART ((ptr_t) 0x140000000)
- extern _end;
-# define DATAEND ((ptr_t) &_end)
-# define HEURISTIC2
- /* Normally HEURISTIC2 is too conervative, since */
- /* the text segment immediately follows the stack. */
- /* Hence we give an upper pound. */
- extern int __start;
-# define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
-# define CPP_WORDSZ 64
-# define MPROTECT_VDB
-# define DYNAMIC_LOADING
-# endif
-# ifdef LINUX
-# define OS_TYPE "LINUX"
-# define CPP_WORDSZ 64
-# define STACKBOTTOM ((ptr_t) 0x120000000)
-# ifdef __ELF__
-# if 0
- /* __data_start apparently disappeared in some recent releases. */
- extern int __data_start;
-# define DATASTART &__data_start
-# endif
-# define DATASTART GC_data_start
-# define DYNAMIC_LOADING
-# else
-# define DATASTART ((ptr_t) 0x140000000)
-# endif
- extern int _end;
-# define DATAEND (&_end)
-# define MPROTECT_VDB
- /* Has only been superficially tested. May not */
- /* work on all versions. */
-# endif
-# endif
-
-# ifdef M88K
-# define MACH_TYPE "M88K"
-# define ALIGNMENT 4
-# define ALIGN_DOUBLE
- extern int etext;
-# ifdef CX_UX
-# define OS_TYPE "CX_UX"
-# define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
-# endif
-# ifdef DGUX
-# define OS_TYPE "DGUX"
- extern char * GC_SysVGetDataStart();
-# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
-# endif
-# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
-# endif
-
-# ifdef S370
-# define MACH_TYPE "S370"
-# define OS_TYPE "UTS4"
-# define ALIGNMENT 4 /* Required by hardware */
- extern int etext;
- extern int _etext;
- extern int _end;
- extern char * GC_SysVGetDataStart();
-# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
-# define DATAEND (&_end)
-# define HEURISTIC2
-# endif
-
-# ifndef STACK_GROWS_UP
-# define STACK_GROWS_DOWN
-# endif
-
-# ifndef CPP_WORDSZ
-# define CPP_WORDSZ 32
-# endif
-
-# ifndef OS_TYPE
-# define OS_TYPE ""
-# endif
-
-# ifndef DATAEND
- extern int end;
-# define DATAEND (&end)
-# endif
-
-# if defined(SVR4) && !defined(GETPAGESIZE)
-# include <unistd.h>
-# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
-# endif
-
-# ifndef GETPAGESIZE
-# if defined(SUNOS5) || defined(IRIX5)
-# include <unistd.h>
-# endif
-# define GETPAGESIZE() getpagesize()
-# endif
-
-# if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
- /* OS has SVR4 generic features. Probably others also qualify. */
-# define SVR4
-# endif
-
-# if defined(SUNOS5) || defined(DRSNX)
- /* OS has SUNOS5 style semi-undocumented interface to dynamic */
- /* loader. */
-# define SUNOS5DL
- /* OS has SUNOS5 style signal handlers. */
-# define SUNOS5SIGS
-# endif
-
-# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
- -> bad word size
-# endif
-
-# ifdef PCR
-# undef DYNAMIC_LOADING
-# undef STACKBOTTOM
-# undef HEURISTIC1
-# undef HEURISTIC2
-# undef PROC_VDB
-# undef MPROTECT_VDB
-# define PCR_VDB
-# endif
-
-# ifdef SRC_M3
-/* Postponed for now. */
-# undef PROC_VDB
-# undef MPROTECT_VDB
-# endif
-
-# ifdef SMALL_CONFIG
-/* Presumably not worth the space it takes. */
-# undef PROC_VDB
-# undef MPROTECT_VDB
-# endif
-
-# ifdef USE_MUNMAP
-# undef MPROTECT_VDB /* Can't deal with address space holes. */
-# endif
-
-# if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
-# define DEFAULT_VDB
-# endif
-
-# if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
-# define SOLARIS_THREADS
-# endif
-# if defined(IRIX_THREADS) && !defined(IRIX5)
---> inconsistent configuration
-# endif
-# if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
---> inconsistent configuration
-# endif
-# if defined(LINUX_THREADS) && !defined(LINUX)
---> inconsistent configuration
-# endif
-# if defined(SOLARIS_THREADS) && !defined(SUNOS5)
---> inconsistent configuration
-# endif
-# if defined(PCR) || defined(SRC_M3) || \
- defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
- defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
- defined(IRIX_JDK_THREADS)
-# define THREADS
-# endif
-
-# if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
- || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
- /* Use setjmp based hack to mark from callee-save registers. */
-# define USE_GENERIC_PUSH_REGS
-# endif
-# if defined(SPARC) && !defined(LINUX)
-# define SAVE_CALL_CHAIN
-# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
- /* include assembly code to do it well. */
-# endif
-
-# endif
diff --git a/gc/gcj_mlc.c b/gc/gcj_mlc.c
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+/* Boehm, July 31, 1995 5:02 pm PDT */
+
+#ifdef GC_GCJ_SUPPORT
+
+/*
+ * This is an allocator interface tuned for gcj (the GNU static
+ * java compiler).
+ *
+ * Each allocated object has a pointer in its first word to a vtable,
+ * which for our purposes is simply a structure describing the type of
+ * the object.
+ * This descriptor structure contains a GC marking descriptor at offset
+ * MARK_DESCR_OFFSET.
+ *
+ * It is hoped that this interface may also be useful for other systems,
+ * possibly with some tuning of the constants. But the immediate goal
+ * is to get better gcj performance.
+ *
+ * We assume:
+ * 1) We have an ANSI conforming C compiler.
+ * 2) Counting on explicit initialization of this interface is OK.
+ * 3) FASTLOCK is not a significant win.
+ */
+
+#include "private/gc_pmark.h"
+#include "gc_gcj.h"
+#include "private/dbg_mlc.h"
+
+GC_bool GC_gcj_malloc_initialized = FALSE;
+
+int GC_gcj_kind; /* Object kind for objects with descriptors */
+ /* in "vtable". */
+int GC_gcj_debug_kind; /* The kind of objects that is always marked */
+ /* with a mark proc call. */
+
+ptr_t * GC_gcjobjfreelist;
+ptr_t * GC_gcjdebugobjfreelist;
+
+/* Caller does not hold allocation lock. */
+void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
+{
+ register int i;
+ DCL_LOCK_STATE;
+
+ GC_init(); /* In case it's not already done. */
+ DISABLE_SIGNALS();
+ LOCK();
+ if (GC_gcj_malloc_initialized) {
+ UNLOCK();
+ ENABLE_SIGNALS();
+ return;
+ }
+ GC_gcj_malloc_initialized = TRUE;
+ GC_mark_procs[mp_index] = (GC_mark_proc)mp;
+ if (mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index");
+ /* Set up object kind gcj-style indirect descriptor. */
+ GC_gcjobjfreelist = (ptr_t *)
+ GC_INTERNAL_MALLOC((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
+ if (GC_gcjobjfreelist == 0) ABORT("Couldn't allocate GC_gcjobjfreelist");
+ BZERO(GC_gcjobjfreelist, (MAXOBJSZ+1)*sizeof(ptr_t));
+ GC_gcj_kind = GC_n_kinds++;
+ GC_obj_kinds[GC_gcj_kind].ok_freelist = GC_gcjobjfreelist;
+ GC_obj_kinds[GC_gcj_kind].ok_reclaim_list = 0;
+ GC_obj_kinds[GC_gcj_kind].ok_descriptor =
+ (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS)) | GC_DS_PER_OBJECT);
+ GC_obj_kinds[GC_gcj_kind].ok_relocate_descr = FALSE;
+ GC_obj_kinds[GC_gcj_kind].ok_init = TRUE;
+ /* Set up object kind for objects that require mark proc call. */
+ GC_gcjdebugobjfreelist = (ptr_t *)
+ GC_INTERNAL_MALLOC((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
+ if (GC_gcjdebugobjfreelist == 0)
+ ABORT("Couldn't allocate GC_gcjdebugobjfreelist");
+ BZERO(GC_gcjdebugobjfreelist, (MAXOBJSZ+1)*sizeof(ptr_t));
+ GC_gcj_debug_kind = GC_n_kinds++;
+ GC_obj_kinds[GC_gcj_debug_kind].ok_freelist = GC_gcjdebugobjfreelist;
+ GC_obj_kinds[GC_gcj_debug_kind].ok_reclaim_list = 0;
+ GC_obj_kinds[GC_gcj_debug_kind].ok_descriptor =
+ GC_MAKE_PROC(mp_index, 1 /* allocated with debug info */);
+ GC_obj_kinds[GC_gcj_debug_kind].ok_relocate_descr = FALSE;
+ GC_obj_kinds[GC_gcj_debug_kind].ok_init = TRUE;
+ UNLOCK();
+ ENABLE_SIGNALS();
+}
+
+ptr_t GC_clear_stack();
+
+#define GENERAL_MALLOC(lb,k) \
+ (GC_PTR)GC_clear_stack(GC_generic_malloc_inner((word)lb, k))
+
+#define GENERAL_MALLOC_IOP(lb,k) \
+ (GC_PTR)GC_clear_stack(GC_generic_malloc_inner_ignore_off_page(lb, k))
+
+/* Allocate an object, clear it, and store the pointer to the */
+/* type structure (vtable in gcj). */
+/* This adds a byte at the end of the object if GC_malloc would.*/
+void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr)
+{
+register ptr_t op;
+register ptr_t * opp;
+register word lw;
+DCL_LOCK_STATE;
+
+ if( EXPECT(SMALL_OBJ(lb), 1) ) {
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb];
+# else
+ lw = ALIGNED_WORDS(lb);
+# endif
+ opp = &(GC_gcjobjfreelist[lw]);
+ LOCK();
+ op = *opp;
+ if( EXPECT(op == 0, 0)) {
+ op = (ptr_t)GENERAL_MALLOC((word)lb, GC_gcj_kind);
+ if (0 == op) {
+ UNLOCK();
+ return(GC_oom_fn(lb));
+ }
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb]; /* May have been uninitialized. */
+# endif
+ } else {
+ *opp = obj_link(op);
+ GC_words_allocd += lw;
+ }
+ *(void **)op = ptr_to_struct_containing_descr;
+ UNLOCK();
+ } else {
+ LOCK();
+ op = (ptr_t)GENERAL_MALLOC((word)lb, GC_gcj_kind);
+ if (0 == op) {
+ UNLOCK();
+ return(GC_oom_fn(lb));
+ }
+ *(void **)op = ptr_to_struct_containing_descr;
+ UNLOCK();
+ }
+ return((GC_PTR) op);
+}
+
+/* Similar to GC_gcj_malloc, but add debug info. This is allocated */
+/* with GC_gcj_debug_kind. */
+GC_PTR GC_debug_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr,
+ GC_EXTRA_PARAMS)
+{
+ GC_PTR result;
+
+ /* We clone the code from GC_debug_gcj_malloc, so that we */
+ /* dont end up with extra frames on the stack, which could */
+ /* confuse the backtrace. */
+ LOCK();
+ result = GC_generic_malloc_inner(lb + DEBUG_BYTES, GC_gcj_debug_kind);
+ if (result == 0) {
+ UNLOCK();
+ GC_err_printf2("GC_debug_gcj_malloc(%ld, 0x%lx) returning NIL (",
+ (unsigned long) lb,
+ (unsigned long) ptr_to_struct_containing_descr);
+ GC_err_puts(s);
+ GC_err_printf1(":%ld)\n", (unsigned long)i);
+ return(GC_oom_fn(lb));
+ }
+ *((void **)((ptr_t)result + sizeof(oh))) = ptr_to_struct_containing_descr;
+ UNLOCK();
+ if (!GC_debugging_started) {
+ GC_start_debugging();
+ }
+ ADD_CALL_CHAIN(result, ra);
+ return (GC_store_debug_info(result, (word)lb, s, (word)i));
+}
+
+/* Similar to GC_gcj_malloc, but the size is in words, and we don't */
+/* adjust it. The size is assumed to be such that it can be */
+/* allocated as a small object. */
+void * GC_gcj_fast_malloc(size_t lw, void * ptr_to_struct_containing_descr)
+{
+ptr_t op;
+ptr_t * opp;
+DCL_LOCK_STATE;
+
+ opp = &(GC_gcjobjfreelist[lw]);
+ LOCK();
+ op = *opp;
+ if( EXPECT(op == 0, 0) ) {
+ op = (ptr_t)GC_clear_stack(
+ GC_generic_malloc_words_small_inner(lw, GC_gcj_kind));
+ if (0 == op) {
+ UNLOCK();
+ return GC_oom_fn(WORDS_TO_BYTES(lw));
+ }
+ } else {
+ *opp = obj_link(op);
+ GC_words_allocd += lw;
+ }
+ *(void **)op = ptr_to_struct_containing_descr;
+ UNLOCK();
+ return((GC_PTR) op);
+}
+
+/* And a debugging version of the above: */
+void * GC_debug_gcj_fast_malloc(size_t lw,
+ void * ptr_to_struct_containing_descr,
+ GC_EXTRA_PARAMS)
+{
+ GC_PTR result;
+ size_t lb = WORDS_TO_BYTES(lw);
+
+ /* We clone the code from GC_debug_gcj_malloc, so that we */
+ /* dont end up with extra frames on the stack, which could */
+ /* confuse the backtrace. */
+ LOCK();
+ result = GC_generic_malloc_inner(lb + DEBUG_BYTES, GC_gcj_debug_kind);
+ if (result == 0) {
+ UNLOCK();
+ GC_err_printf2("GC_debug_gcj_fast_malloc(%ld, 0x%lx) returning NIL (",
+ (unsigned long) lw,
+ (unsigned long) ptr_to_struct_containing_descr);
+ GC_err_puts(s);
+ GC_err_printf1(":%ld)\n", (unsigned long)i);
+ return GC_oom_fn(WORDS_TO_BYTES(lw));
+ }
+ *((void **)((ptr_t)result + sizeof(oh))) = ptr_to_struct_containing_descr;
+ UNLOCK();
+ if (!GC_debugging_started) {
+ GC_start_debugging();
+ }
+ ADD_CALL_CHAIN(result, ra);
+ return (GC_store_debug_info(result, (word)lb, s, (word)i));
+}
+
+void * GC_gcj_malloc_ignore_off_page(size_t lb,
+ void * ptr_to_struct_containing_descr)
+{
+register ptr_t op;
+register ptr_t * opp;
+register word lw;
+DCL_LOCK_STATE;
+
+ if( SMALL_OBJ(lb) ) {
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb];
+# else
+ lw = ALIGNED_WORDS(lb);
+# endif
+ opp = &(GC_gcjobjfreelist[lw]);
+ LOCK();
+ if( (op = *opp) == 0 ) {
+ op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind);
+# ifdef MERGE_SIZES
+ lw = GC_size_map[lb]; /* May have been uninitialized. */
+# endif
+ } else {
+ *opp = obj_link(op);
+ GC_words_allocd += lw;
+ }
+ *(void **)op = ptr_to_struct_containing_descr;
+ UNLOCK();
+ } else {
+ op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind);
+ if (0 != op) {
+ *(void **)op = ptr_to_struct_containing_descr;
+ }
+ UNLOCK();
+ }
+ return((GC_PTR) op);
+}
+
+#else
+
+char GC_no_gcj_support;
+
+#endif /* GC_GCJ_SUPPORT */
diff --git a/gc/gcname.c b/gc/gcname.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include "version.h"
+
+int main()
+{
+ if (GC_ALPHA_VERSION == GC_NOT_ALPHA) {
+ printf("gc%d.%d", GC_VERSION_MAJOR, GC_VERSION_MINOR);
+ } else {
+ printf("gc%d.%dalpha%d", GC_VERSION_MAJOR,
+ GC_VERSION_MINOR, GC_ALPHA_VERSION);
+ }
+ return 0;
+}
diff --git a/gc/gctest b/gc/gctest
Binary files differ.
diff --git a/gc/headers.c b/gc/headers.c
@@ -22,7 +22,7 @@
* level tree.
*/
-# include "gc_priv.h"
+# include "private/gc_priv.h"
bottom_index * GC_all_bottom_indices = 0;
/* Pointer to first (lowest addr) */
@@ -50,10 +50,8 @@ ptr_t h;
static ptr_t scratch_free_ptr = 0;
-ptr_t GC_scratch_end_ptr = 0;
-
-ptr_t GC_scratch_last_end_ptr = 0;
- /* End point of last obtained scratch area */
+/* GC_scratch_last_end_ptr is end point of last obtained scratch area. */
+/* GC_scratch_end_ptr is end point of current scratch area. */
ptr_t GC_scratch_alloc(bytes)
register word bytes;
@@ -128,6 +126,13 @@ hdr * hhdr;
hhdr -> hb_next = (struct hblk *) hdr_free_list;
hdr_free_list = hhdr;
}
+
+hdr * GC_invalid_header;
+
+#ifdef USE_HDR_CACHE
+ word GC_hdr_cache_hits = 0;
+ word GC_hdr_cache_misses = 0;
+#endif
void GC_init_headers()
{
@@ -138,6 +143,8 @@ void GC_init_headers()
for (i = 0; i < TOP_SZ; i++) {
GC_top_index[i] = GC_all_nils;
}
+ GC_invalid_header = alloc_hdr();
+ GC_invalidate_map(GC_invalid_header);
}
/* Make sure that there is a bottom level index block for address addr */
@@ -191,10 +198,10 @@ word addr;
return(TRUE);
}
-/* Install a header for block h. */
-/* The header is uninitialized. */
-/* Returns FALSE on failure. */
-GC_bool GC_install_header(h)
+/* Install a header for block h. */
+/* The header is uninitialized. */
+/* Returns the header or 0 on failure. */
+struct hblkhdr * GC_install_header(h)
register struct hblk * h;
{
hdr * result;
@@ -205,7 +212,7 @@ register struct hblk * h;
# ifdef USE_MUNMAP
result -> hb_last_reclaimed = GC_gc_no;
# endif
- return(result != 0);
+ return(result);
}
/* Set up forwarding counts for block h of size sz */
@@ -253,7 +260,7 @@ register word sz; /* bytes */
/* Apply fn to all allocated blocks */
/*VARARGS1*/
void GC_apply_to_all_blocks(fn, client_data)
-void (*fn)(/* struct hblk *h, word client_data */);
+void (*fn) GC_PROTO((struct hblk *h, word client_data));
word client_data;
{
register int j;
diff --git a/gc/hpux_test_and_clear.s b/gc/hpux_test_and_clear.s
@@ -0,0 +1,21 @@
+ .SPACE $PRIVATE$
+ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
+ .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
+ .SPACE $TEXT$
+ .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
+ .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
+ .IMPORT $global$,DATA
+ .IMPORT $$dyncall,MILLICODE
+ .SPACE $TEXT$
+ .SUBSPA $CODE$
+
+ .align 4
+ .EXPORT GC_test_and_clear,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR
+GC_test_and_clear
+ .PROC
+ .CALLINFO FRAME=0,NO_CALLS
+ .ENTRY
+ ldcw,co (%r26),%r28
+ bv,n 0(%r2)
+ .EXIT
+ .PROCEND
diff --git a/gc/if_mach b/gc/if_mach
Binary files differ.
diff --git a/gc/if_mach.c b/gc/if_mach.c
@@ -1,7 +1,9 @@
/* Conditionally execute a command based on machine and OS from gcconfig.h */
-# include "gcconfig.h"
+# include "private/gcconfig.h"
# include <stdio.h>
+# include <string.h>
+# include <unistd.h>
int main(argc, argv, envp)
int argc;
@@ -13,6 +15,7 @@ char ** envp;
if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0
&& strcmp(OS_TYPE, argv[2]) != 0) return(0);
printf("^^^^Starting command^^^^\n");
+ fflush(stdout);
execvp(argv[3], argv+3);
perror("Couldn't execute");
diff --git a/gc/if_not_there b/gc/if_not_there
Binary files differ.
diff --git a/gc/if_not_there.c b/gc/if_not_there.c
@@ -1,7 +1,9 @@
/* Conditionally execute a command based if the file argv[1] doesn't exist */
/* Except for execvp, we stick to ANSI C. */
-# include "gcconfig.h"
+# include "private/gcconfig.h"
# include <stdio.h>
+# include <stdlib.h>
+# include <unistd.h>
int main(argc, argv, envp)
int argc;
@@ -16,6 +18,7 @@ char ** envp;
return(0);
}
printf("^^^^Starting command^^^^\n");
+ fflush(stdout);
execvp(argv[2], argv+2);
exit(1);
diff --git a/gc/include/backptr.h b/gc/include/backptr.h
@@ -1,56 +0,0 @@
-/*
- * This is a simple API to implement pointer back tracing, i.e.
- * to answer questions such as "who is pointing to this" or
- * "why is this object being retained by the collector"
- *
- * This API assumes that we have an ANSI C compiler.
- *
- * Most of these calls yield useful information on only after
- * a garbage collection. Usually the client will first force
- * a full collection and then gather information, preferably
- * before much intervening allocation.
- *
- * The implementation of the interface is only about 99.9999%
- * correct. It is intended to be good enough for profiling,
- * but is not intended to be used with production code.
- *
- * Results are likely to be much more useful if all allocation is
- * accomplished through the debugging allocators.
- *
- * The implementation idea is due to A. Demers.
- */
-
-/* Store information about the object referencing dest in *base_p */
-/* and *offset_p. */
-/* If multiple objects or roots point to dest, the one reported */
-/* will be the last on used by the garbage collector to trace the */
-/* object. */
-/* source is root ==> *base_p = address, *offset_p = 0 */
-/* source is heap object ==> *base_p != 0, *offset_p = offset */
-/* Returns 1 on success, 0 if source couldn't be determined. */
-/* Dest can be any address within a heap object. */
-typedef enum { GC_UNREFERENCED, /* No refence info available. */
- GC_NO_SPACE, /* Dest not allocated with debug alloc */
- GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */
- GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */
- GC_FINALIZER_REFD /* Finalizable and hence accessible. */
-} GC_ref_kind;
-
-GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p);
-
-/* Generate a random heap address. */
-/* The resulting address is in the heap, but */
-/* not necessarily inside a valid object. */
-void * GC_generate_random_heap_address(void);
-
-/* Generate a random address inside a valid marked heap object. */
-void * GC_generate_random_valid_address(void);
-
-/* Force a garbage collection and generate a backtrace from a */
-/* random heap address. */
-/* This uses the GC logging mechanism (GC_printf) to produce */
-/* output. It can often be called from a debugger. The */
-/* source in dbg_mlc.c also serves as a sample client. */
-void GC_generate_random_backtrace(void);
-
-
diff --git a/gc/include/cord.h b/gc/include/cord.h
@@ -41,7 +41,7 @@
* This interface is fairly big, largely for performance reasons.
* The most basic constants and functions:
*
- * CORD - the type fo a cord;
+ * CORD - the type of a cord;
* CORD_EMPTY - empty cord;
* CORD_len(cord) - length of a cord;
* CORD_cat(cord1,cord2) - concatenation of two cords;
diff --git a/gc/include/gc.h b/gc/include/gc.h
@@ -1,7 +1,8 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
- * Copyright 1996 by Silicon Graphics. All rights reserved.
+ * Copyright 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -28,16 +29,70 @@
#ifndef _GC_H
# define _GC_H
+
+#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
+# define SOLARIS_THREADS
+#endif
+
+/*
+ * Some tests for old macros. These violate our namespace rules and will
+ * disappear shortly.
+ */
+#if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS)
+# define GC_SOLARIS_THREADS
+#endif
+#if defined(_SOLARIS_PTHREADS)
+# define GC_SOLARIS_PTHREADS
+#endif
+#if defined(IRIX_THREADS)
+# define GC_IRIX_THREADS
+#endif
+#if defined(HPUX_THREADS)
+# define GC_HPUX_THREADS
+#endif
+#if defined(OSF1_THREADS)
+# define GC_OSF1_THREADS
+#endif
+#if defined(LINUX_THREADS)
+# define GC_LINUX_THREADS
+#endif
+#if defined(WIN32_THREADS)
+# define GC_WIN32_THREADS
+#endif
+#if defined(USE_LD_WRAP)
+# define GC_USE_LD_WRAP
+#endif
+
+#if !defined(_REENTRANT) && (defined(GC_SOLARIS_THREADS) \
+ || defined(GC_SOLARIS_PTHREADS) \
+ || defined(GC_HPUX_THREADS) \
+ || defined(GC_LINUX_THREADS))
+# define _REENTRANT
+ /* Better late than never. This fails if system headers that */
+ /* depend on this were previously included. */
+#endif
+
# define __GC
# include <stddef.h>
+# ifdef _WIN32_WCE
+/* Yet more kluges for WinCE */
+# include <stdlib.h> /* size_t is defined here */
+ typedef long ptrdiff_t; /* ptrdiff_t is not defined */
+# endif
-#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
-#include "libgc_globals.h"
+#if defined(__MINGW32__) && defined(WIN32_THREADS)
+# ifdef GC_BUILD
+# define GC_API __declspec(dllexport)
+# else
+# define GC_API __declspec(dllimport)
+# endif
#endif
-#if defined(_MSC_VER) && defined(_DLL)
+#if (defined(__DMC__) || defined(_MSC_VER)) \
+ && (defined(_DLL) && !defined(GC_NOT_DLL) \
+ || defined(GC_DLL))
# ifdef GC_BUILD
-# define GC_API __declspec(dllexport)
+# define GC_API extern __declspec(dllexport)
# else
# define GC_API __declspec(dllimport)
# endif
@@ -58,9 +113,11 @@
# if defined(__STDC__) || defined(__cplusplus)
# define GC_PROTO(args) args
typedef void * GC_PTR;
+# define GC_CONST const
# else
# define GC_PROTO(args) ()
typedef char * GC_PTR;
+# define GC_CONST
# endif
# ifdef __cplusplus
@@ -83,6 +140,16 @@ typedef long GC_signed_word;
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
+
+GC_API int GC_parallel; /* GC is parallelized for performance on */
+ /* multiprocessors. Currently set only */
+ /* implicitly if collector is built with */
+ /* -DPARALLEL_MARK and if either: */
+ /* Env variable GC_NPROC is set to > 1, or */
+ /* GC_NPROC is not set and this is an MP. */
+ /* If GC_parallel is set, incremental */
+ /* collection is aonly partially functional, */
+ /* and may not be desirable. */
/* Public R/W variables */
@@ -102,6 +169,18 @@ GC_API int GC_find_leak;
/* deallocated with GC_free. Initial value */
/* is determined by FIND_LEAK macro. */
+GC_API int GC_all_interior_pointers;
+ /* Arrange for pointers to object interiors to */
+ /* be recognized as valid. May not be changed */
+ /* after GC initialization. */
+ /* Initial value is determined by */
+ /* -DALL_INTERIOR_POINTERS. */
+ /* Unless DONT_ADD_BYTE_AT_END is defined, this */
+ /* also affects whether sizes are increased by */
+ /* at least a byte to allow "off the end" */
+ /* pointer recognition. */
+ /* MUST BE 0 or 1. */
+
GC_API int GC_quiet; /* Disable statistics output. Only matters if */
/* collector has been compiled with statistics */
/* enabled. This involves a performance cost, */
@@ -109,7 +188,7 @@ GC_API int GC_quiet; /* Disable statistics output. Only matters if */
GC_API int GC_finalize_on_demand;
/* If nonzero, finalizers will only be run in */
- /* response to an eplit GC_invoke_finalizers */
+ /* response to an explicit GC_invoke_finalizers */
/* call. The default is determined by whether */
/* the FINALIZE_ON_DEMAND macro is defined */
/* when the collector is built. */
@@ -121,6 +200,15 @@ GC_API int GC_java_finalization;
/* ordered finalization. Default value is */
/* determined by JAVA_FINALIZATION macro. */
+GC_API void (* GC_finalizer_notifier)();
+ /* Invoked by the collector when there are */
+ /* objects to be finalized. Invoked at most */
+ /* once per GC cycle. Never invoked unless */
+ /* GC_finalize_on_demand is set. */
+ /* Typically this will notify a finalization */
+ /* thread, which will call GC_invoke_finalizers */
+ /* in response. */
+
GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
/* because it's not safe. */
@@ -128,13 +216,40 @@ GC_API int GC_dont_expand;
/* Dont expand heap unless explicitly requested */
/* or forced to. */
+GC_API int GC_use_entire_heap;
+ /* Causes the nonincremental collector to use the */
+ /* entire heap before collecting. This was the only */
+ /* option for GC versions < 5.0. This sometimes */
+ /* results in more large block fragmentation, since */
+ /* very larg blocks will tend to get broken up */
+ /* during each GC cycle. It is likely to result in a */
+ /* larger working set, but lower collection */
+ /* frequencies, and hence fewer instructions executed */
+ /* in the collector. */
+
GC_API int GC_full_freq; /* Number of partial collections between */
/* full collections. Matters only if */
/* GC_incremental is set. */
+ /* Full collections are also triggered if */
+ /* the collector detects a substantial */
+ /* increase in the number of in-use heap */
+ /* blocks. Values in the tens are now */
+ /* perfectly reasonable, unlike for */
+ /* earlier GC versions. */
GC_API GC_word GC_non_gc_bytes;
/* Bytes not considered candidates for collection. */
/* Used only to control scheduling of collections. */
+ /* Updated by GC_malloc_uncollectable and GC_free. */
+ /* Wizards only. */
+
+GC_API int GC_no_dls;
+ /* Don't register dynamic library data segments. */
+ /* Wizards only. Should be used only if the */
+ /* application explicitly registers all roots. */
+ /* In Microsoft Windows environments, this will */
+ /* usually also prevent registration of the */
+ /* main data segment as part of the root set. */
GC_API GC_word GC_free_space_divisor;
/* We try to make sure that we allocate at */
@@ -165,8 +280,16 @@ GC_API char *GC_stackbottom; /* Cool end of user stack. */
/* automatically. */
/* For multithreaded code, this is the */
/* cold end of the stack for the */
- /* primordial thread. */
+ /* primordial thread. */
+GC_API int GC_dont_precollect; /* Don't collect as part of */
+ /* initialization. Should be set only */
+ /* if the client wants a chance to */
+ /* manually initialize the root set */
+ /* before the first collection. */
+ /* Interferes with blacklisting. */
+ /* Wizards only. */
+
/* Public procedures */
/*
* general purpose allocation routines, with roughly malloc calling conv.
@@ -176,8 +299,13 @@ GC_API char *GC_stackbottom; /* Cool end of user stack. */
* will occur after GC_end_stubborn_change has been called on the
* result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
* that is scanned for pointers to collectable objects, but is not itself
- * collectable. GC_malloc_uncollectable and GC_free called on the resulting
+ * collectable. The object is scanned even if it does not appear to
+ * be reachable. GC_malloc_uncollectable and GC_free called on the resulting
* object implicitly update GC_non_gc_bytes appropriately.
+ *
+ * Note that the GC_malloc_stubborn support is stubbed out by default
+ * starting in 6.0. GC_malloc_stubborn is an alias for GC_malloc unless
+ * the collector is built with STUBBORN_ALLOC defined.
*/
GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
@@ -216,6 +344,10 @@ GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
+/* I.e. map an interior pointer to the corresponding bas pointer. */
+/* Note that with debugging allocation, this returns a pointer to the */
+/* actual base of the object, i.e. the debug information, not to */
+/* the base of the user object. */
/* Return 0 if displaced_pointer doesn't point to within a valid */
/* object. */
GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
@@ -297,15 +429,24 @@ GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
/* Includes some pages that were allocated but never written. */
GC_API size_t GC_get_heap_size GC_PROTO((void));
+/* Return a lower bound on the number of free bytes in the heap. */
+GC_API size_t GC_get_free_bytes GC_PROTO((void));
+
/* Return the number of bytes allocated since the last collection. */
GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
+/* Return the total number of bytes allocated in this process. */
+/* Never decreases. */
+GC_API size_t GC_get_total_bytes GC_PROTO((void));
+
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
/* available or most heap objects are */
/* pointerfree(atomic) or immutable. */
/* Don't use in leak finding mode. */
/* Ignored if GC_dont_gc is true. */
+/* Only the generational piece of this is */
+/* functional if GC_parallel is TRUE. */
GC_API void GC_enable_incremental GC_PROTO((void));
/* Perform some garbage collection work, if appropriate. */
@@ -341,10 +482,10 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
#ifdef GC_ADD_CALLER
# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
-# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
+# define GC_EXTRA_PARAMS GC_word ra, GC_CONST char * s, int i
#else
# define GC_EXTRAS __FILE__, __LINE__
-# define GC_EXTRA_PARAMS char * descr_string, int descr_int
+# define GC_EXTRA_PARAMS GC_CONST char * s, int i
#endif
/* Debugging (annotated) allocation. GC_gcollect will check */
@@ -375,6 +516,8 @@ GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
GC_debug_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
+# define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
+ GC_debug_register_finalizer_no_order(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
@@ -391,6 +534,8 @@ GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
GC_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_register_finalizer_ignore_self(p, f, d, of, od)
+# define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
+ GC_register_finalizer_no_order(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
@@ -462,6 +607,8 @@ GC_API void GC_debug_register_finalizer
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
/* case. */
+/* Note that cd will still be viewed as accessible, even if it */
+/* refers to the object itself. */
GC_API void GC_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
@@ -469,6 +616,18 @@ GC_API void GC_debug_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
+/* Another version of the above. It ignores all cycles. */
+/* It should probably only be used by Java implementations. */
+/* Note that cd will still be viewed as accessible, even if it */
+/* refers to the object itself. */
+GC_API void GC_register_finalizer_no_order
+ GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
+ GC_finalization_proc *ofn, GC_PTR *ocd));
+GC_API void GC_debug_register_finalizer_no_order
+ GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
+ GC_finalization_proc *ofn, GC_PTR *ocd));
+
+
/* The following routine may be used to break cycles between */
/* finalizable objects, thus causing cyclic finalizable */
/* objects to be finalized in the correct order. Standard */
@@ -525,6 +684,9 @@ GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
+/* Returns !=0 if GC_invoke_finalizers has something to do. */
+GC_API int GC_should_invoke_finalizers GC_PROTO((void));
+
GC_API int GC_invoke_finalizers GC_PROTO((void));
/* Run finalizers for all objects that are ready to */
/* be finalized. Return the number of finalizers */
@@ -540,7 +702,7 @@ GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
/* The following is intended to be used by a higher level */
-/* (e.g. cedar-like) finalization facility. It is expected */
+/* (e.g. Java-like) finalization facility. It is expected */
/* that finalization code will arrange for hidden pointers to */
/* disappear. Otherwise objects can be accessed after they */
/* have been collected. */
@@ -560,6 +722,9 @@ typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
+/* The following routines are primarily intended for use with a */
+/* preprocessor which inserts calls to check C pointer arithmetic. */
+
/* Check that p and q point to the same object. */
/* Fail conspicuously if they don't. */
/* Returns the first argument. */
@@ -587,7 +752,7 @@ GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
/* Fail conspicuously if this property does not hold. */
-/* Uninteresting with ALL_INTERIOR_POINTERS. */
+/* Uninteresting with GC_all_interior_pointers. */
/* Always returns its argument. */
GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
@@ -603,9 +768,9 @@ GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
# ifdef __GNUC__
# define GC_PTR_ADD(x, n) \
GC_PTR_ADD3(x, n, typeof(x))
-# define GC_PRE_INCR(x, n) \
+# define GC_PRE_INCR(x, n) \
GC_PRE_INCR3(x, n, typeof(x))
-# define GC_POST_INCR(x, n) \
+# define GC_POST_INCR(x, n) \
GC_POST_INCR3(x, typeof(x))
# else
/* We can't do this right without typeof, which ANSI */
@@ -645,74 +810,28 @@ GC_API void (*GC_is_valid_displacement_print_proc)
GC_API void (*GC_is_visible_print_proc)
GC_PROTO((GC_PTR p));
-#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
-# define SOLARIS_THREADS
-#endif
-#ifdef SOLARIS_THREADS
-/* We need to intercept calls to many of the threads primitives, so */
-/* that we can locate thread stacks and stop the world. */
-/* Note also that the collector cannot see thread specific data. */
-/* Thread specific data should generally consist of pointers to */
-/* uncollectable objects, which are deallocated using the destructor */
-/* facility in thr_keycreate. */
-# include <thread.h>
-# include <signal.h>
- int GC_thr_create(void *stack_base, size_t stack_size,
- void *(*start_routine)(void *), void *arg, long flags,
- thread_t *new_thread);
- int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
- int GC_thr_suspend(thread_t target_thread);
- int GC_thr_continue(thread_t target_thread);
- void * GC_dlopen(const char *path, int mode);
-
-# ifdef _SOLARIS_PTHREADS
-# include <pthread.h>
- extern int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void * (*thread_execp)(void *), void *arg);
- extern int GC_pthread_join(pthread_t wait_for, void **status);
-
-# undef thread_t
-
-# define pthread_join GC_pthread_join
-# define pthread_create GC_pthread_create
-#endif
+/* For pthread support, we generally need to intercept a number of */
+/* thread library calls. We do that here by macro defining them. */
-# define thr_create GC_thr_create
-# define thr_join GC_thr_join
-# define thr_suspend GC_thr_suspend
-# define thr_continue GC_thr_continue
-# define dlopen GC_dlopen
-
-# endif /* SOLARIS_THREADS */
-
-
-#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
-/* We treat these similarly. */
-# include <pthread.h>
-# include <signal.h>
-
- int GC_pthread_create(pthread_t *new_thread,
- const pthread_attr_t *attr,
- void *(*start_routine)(void *), void *arg);
- int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
- int GC_pthread_join(pthread_t thread, void **retval);
-
-# define pthread_create GC_pthread_create
-# define pthread_sigmask GC_pthread_sigmask
-# define pthread_join GC_pthread_join
-
-#endif /* IRIX_THREADS || LINUX_THREADS */
+#if !defined(GC_USE_LD_WRAP) && \
+ (defined(GC_LINUX_THREADS) || defined(GC_HPUX_THREADS) || \
+ defined(GC_IRIX_THREADS) || defined(GC_SOLARIS_PTHREADS) || \
+ defined(GC_SOLARIS_THREADS) || defined(GC_OSF1_THREADS))
+# include "gc_pthread_redirects.h"
+#endif
-# if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
- defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
- defined(IRIX_JDK_THREADS)
+# if defined(PCR) || defined(GC_SOLARIS_THREADS) || \
+ defined(GC_SOLARIS_PTHREADS) || defined(GC_WIN32_THREADS) || \
+ defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \
+ defined(GC_HPUX_THREADS)
/* Any flavor of threads except SRC_M3. */
/* This returns a list of objects, linked through their first */
/* word. Its use can greatly reduce lock contention problems, since */
/* the allocation lock can be acquired and released many fewer times. */
/* lb must be large enough to hold the pointer field. */
+/* It is used internally by gc_local_alloc.h, which provides a simpler */
+/* programming interface on Linux. */
GC_PTR GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
/* in returned list. */
@@ -720,6 +839,35 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
+#if defined(WIN32_THREADS) && defined(_WIN32_WCE)
+# include <windows.h>
+
+ /*
+ * win32_threads.c implements the real WinMain, which will start a new thread
+ * to call GC_WinMain after initializing the garbage collector.
+ */
+ int WINAPI GC_WinMain(
+ HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPWSTR lpCmdLine,
+ int nCmdShow );
+
+ /*
+ * All threads must be created using GC_CreateThread, so that they will be
+ * recorded in the thread table.
+ */
+ HANDLE WINAPI GC_CreateThread(
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
+
+# ifndef GC_BUILD
+# define WinMain GC_WinMain
+# define CreateThread GC_CreateThread
+# endif
+
+#endif
+
/*
* If you are planning on putting
* the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
@@ -740,13 +888,23 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 */
# endif
#endif
-#if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32)
+#if !defined(_WIN32_WCE) \
+ && ((defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
+ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__))
/* win32S may not free all resources on process exit. */
/* This explicitly deallocates the heap. */
GC_API void GC_win32_free_heap ();
#endif
+#if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) )
+ /* Allocation really goes through GC_amiga_allocwrapper_do */
+# include "gc_amiga_redirects.h"
+#endif
+
+#if defined(GC_REDIRECT_TO_LOCAL) && !defined(GC_LOCAL_ALLOC_H)
+# include "gc_local_alloc.h"
+#endif
+
#ifdef __cplusplus
} /* end of extern "C" */
#endif
diff --git a/gc/include/gc_alloc.h b/gc/include/gc_alloc.h
@@ -25,6 +25,9 @@
// This uses template classes with static members, and hence does not work
// with g++ 2.7.2 and earlier.
//
+// This code assumes that the collector itself has been compiled with a
+// compiler that defines __STDC__ .
+//
#include "gc.h"
diff --git a/gc/include/gc_amiga_redirects.h b/gc/include/gc_amiga_redirects.h
@@ -0,0 +1,30 @@
+#ifndef GC_AMIGA_REDIRECTS_H
+
+# define GC_AMIGA_REDIRECTS_H
+
+# if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) )
+ extern void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes);
+# define GC_realloc(a,b) GC_amiga_realloc(a,b)
+ extern void GC_amiga_set_toany(void (*func)(void));
+ extern int GC_amiga_free_space_divisor_inc;
+ extern void *(*GC_amiga_allocwrapper_do) \
+ (size_t size,void *(*AllocFunction)(size_t size2));
+# define GC_malloc(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc)
+# define GC_malloc_atomic(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic)
+# define GC_malloc_uncollectable(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_uncollectable)
+# define GC_malloc_stubborn(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_stubborn)
+# define GC_malloc_atomic_uncollectable(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_uncollectable)
+# define GC_malloc_ignore_off_page(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_ignore_off_page)
+# define GC_malloc_atomic_ignore_off_page(a) \
+ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_ignore_off_page)
+# endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */
+
+#endif /* GC_AMIGA_REDIRECTS_H */
+
+
diff --git a/gc/include/gc_backptr.h b/gc/include/gc_backptr.h
@@ -0,0 +1,65 @@
+/*
+ * This is a simple API to implement pointer back tracing, i.e.
+ * to answer questions such as "who is pointing to this" or
+ * "why is this object being retained by the collector"
+ *
+ * This API assumes that we have an ANSI C compiler.
+ *
+ * Most of these calls yield useful information on only after
+ * a garbage collection. Usually the client will first force
+ * a full collection and then gather information, preferably
+ * before much intervening allocation.
+ *
+ * The implementation of the interface is only about 99.9999%
+ * correct. It is intended to be good enough for profiling,
+ * but is not intended to be used with production code.
+ *
+ * Results are likely to be much more useful if all allocation is
+ * accomplished through the debugging allocators.
+ *
+ * The implementation idea is due to A. Demers.
+ */
+
+#ifndef GC_BACKPTR_H
+#define GC_BACKPTR_H
+/* Store information about the object referencing dest in *base_p */
+/* and *offset_p. */
+/* If multiple objects or roots point to dest, the one reported */
+/* will be the last on used by the garbage collector to trace the */
+/* object. */
+/* source is root ==> *base_p = address, *offset_p = 0 */
+/* source is heap object ==> *base_p != 0, *offset_p = offset */
+/* Returns 1 on success, 0 if source couldn't be determined. */
+/* Dest can be any address within a heap object. */
+typedef enum { GC_UNREFERENCED, /* No reference info available. */
+ GC_NO_SPACE, /* Dest not allocated with debug alloc */
+ GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */
+ GC_REFD_FROM_REG, /* Referenced from a register, i.e. */
+ /* a root without an address. */
+ GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */
+ GC_FINALIZER_REFD /* Finalizable and hence accessible. */
+} GC_ref_kind;
+
+GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p);
+
+/* Generate a random heap address. */
+/* The resulting address is in the heap, but */
+/* not necessarily inside a valid object. */
+void * GC_generate_random_heap_address(void);
+
+/* Generate a random address inside a valid marked heap object. */
+void * GC_generate_random_valid_address(void);
+
+/* Force a garbage collection and generate a backtrace from a */
+/* random heap address. */
+/* This uses the GC logging mechanism (GC_printf) to produce */
+/* output. It can often be called from a debugger. The */
+/* source in dbg_mlc.c also serves as a sample client. */
+void GC_generate_random_backtrace(void);
+
+/* Print a backtrace from a specific address. Used by the */
+/* above. The client should call GC_gcollect() immediately */
+/* before invocation. */
+void GC_print_backtrace(void *);
+
+#endif /* GC_BACKPTR_H */
diff --git a/gc/include/gc_cpp.h b/gc/include/gc_cpp.h
@@ -16,12 +16,11 @@ the code was modified is included with the above copyright notice.
C++ Interface to the Boehm Collector
John R. Ellis and Jesse Hull
- Last modified on Mon Jul 24 15:43:42 PDT 1995 by ellis
This interface provides access to the Boehm collector. It provides
basic facilities similar to those described in "Safe, Efficient
Garbage Collection for C++", by John R. Elis and David L. Detlefs
-(ftp.parc.xerox.com:/pub/ellis/gc).
+(ftp://ftp.parc.xerox.com/pub/ellis/gc).
All heap-allocated objects are either "collectable" or
"uncollectable". Programs must explicitly delete uncollectable
@@ -38,7 +37,7 @@ Objects derived from class "gc" are collectable. For example:
A* a = new A; // a is collectable.
Collectable instances of non-class types can be allocated using the GC
-placement:
+(or UseGC) placement:
typedef int A[ 10 ];
A* a = new (GC) A;
@@ -84,7 +83,7 @@ Cautions:
1. Be sure the collector has been augmented with "make c++".
2. If your compiler supports the new "operator new[]" syntax, then
-add -DOPERATOR_NEW_ARRAY to the Makefile.
+add -DGC_OPERATOR_NEW_ARRAY to the Makefile.
If your compiler doesn't support "operator new[]", beware that an
array of type T, where T is derived from "gc", may or may not be
@@ -124,6 +123,12 @@ invoked using the ANSI-conforming syntax t->~T(). If you're using
cfront 3.0, you'll have to comment out the class gc_cleanup, which
uses explicit invocation.
+5. GC name conflicts:
+
+Many other systems seem to use the identifier "GC" as an abbreviation
+for "Graphics Context". Since version 5.0, GC placement has been replaced
+by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined.
+
****************************************************************************/
#include "gc.h"
@@ -132,24 +137,35 @@ uses explicit invocation.
#define _cdecl
#endif
-#if ! defined( OPERATOR_NEW_ARRAY ) \
- && (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6) \
- || __WATCOMC__ >= 1050)
-# define OPERATOR_NEW_ARRAY
+#if ! defined( GC_NO_OPERATOR_NEW_ARRAY ) \
+ && !defined(_ENABLE_ARRAYNEW) /* Digimars */ \
+ && (defined(__BORLANDC__) && (__BORLANDC__ < 0x450) \
+ || (defined(__GNUC__) && \
+ (__GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 6)) \
+ || (defined(__WATCOMC__) && __WATCOMC__ < 1050))
+# define GC_NO_OPERATOR_NEW_ARRAY
#endif
-enum GCPlacement {GC, NoGC, PointerFreeGC};
+#if !defined(GC_NO_OPERATOR_NEW_ARRAY) && !defined(GC_OPERATOR_NEW_ARRAY)
+# define GC_OPERATOR_NEW_ARRAY
+#endif
+
+enum GCPlacement {UseGC,
+#ifndef GC_NAME_CONFLICT
+ GC=UseGC,
+#endif
+ NoGC, PointerFreeGC};
class gc {public:
inline void* operator new( size_t size );
inline void* operator new( size_t size, GCPlacement gcp );
inline void operator delete( void* obj );
-#ifdef OPERATOR_NEW_ARRAY
+#ifdef GC_OPERATOR_NEW_ARRAY
inline void* operator new[]( size_t size );
inline void* operator new[]( size_t size, GCPlacement gcp );
inline void operator delete[]( void* obj );
-#endif /* OPERATOR_NEW_ARRAY */
+#endif /* GC_OPERATOR_NEW_ARRAY */
};
/*
Instances of classes derived from "gc" will be allocated in the
@@ -170,6 +186,12 @@ private:
extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
+#ifdef _MSC_VER
+ // Disable warning that "no matching operator delete found; memory will
+ // not be freed if initialization throws an exception"
+# pragma warning(disable:4291)
+#endif
+
inline void* operator new(
size_t size,
GCPlacement gcp,
@@ -189,7 +211,50 @@ inline void* operator new(
classes derived from "gc_cleanup" or containing members derived
from "gc_cleanup". */
-#ifdef OPERATOR_NEW_ARRAY
+#ifdef GC_OPERATOR_NEW_ARRAY
+
+#ifdef _MSC_VER
+ /** This ensures that the system default operator new[] doesn't get
+ * undefined, which is what seems to happen on VC++ 6 for some reason
+ * if we define a multi-argument operator new[].
+ * There seems to be really redirect new in this environment without
+ * including this everywhere.
+ */
+ inline void *operator new[]( size_t size )
+ {
+ return GC_MALLOC_UNCOLLECTABLE( size );
+ }
+
+ inline void operator delete[](void* obj)
+ {
+ GC_FREE(obj);
+ };
+
+ inline void* operator new( size_t size)
+ {
+ return GC_MALLOC_UNCOLLECTABLE( size);
+ };
+
+ inline void operator delete(void* obj)
+ {
+ GC_FREE(obj);
+ };
+
+
+// This new operator is used by VC++ in case of Debug builds !
+ inline void* operator new( size_t size,
+ int ,//nBlockUse,
+ const char * szFileName,
+ int nLine
+ ) {
+# ifndef GC_DEBUG
+ return GC_malloc_uncollectable( size );
+# else
+ return GC_debug_malloc_uncollectable(size, szFileName, nLine);
+# endif
+ }
+
+#endif /* _MSC_VER */
inline void* operator new[](
size_t size,
@@ -199,7 +264,7 @@ inline void* operator new[](
/*
The operator new for arrays, identical to the above. */
-#endif /* OPERATOR_NEW_ARRAY */
+#endif /* GC_OPERATOR_NEW_ARRAY */
/****************************************************************************
@@ -211,7 +276,7 @@ inline void* gc::operator new( size_t size ) {
return GC_MALLOC( size );}
inline void* gc::operator new( size_t size, GCPlacement gcp ) {
- if (gcp == GC)
+ if (gcp == UseGC)
return GC_MALLOC( size );
else if (gcp == PointerFreeGC)
return GC_MALLOC_ATOMIC( size );
@@ -222,7 +287,7 @@ inline void gc::operator delete( void* obj ) {
GC_FREE( obj );}
-#ifdef OPERATOR_NEW_ARRAY
+#ifdef GC_OPERATOR_NEW_ARRAY
inline void* gc::operator new[]( size_t size ) {
return gc::operator new( size );}
@@ -233,7 +298,7 @@ inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
inline void gc::operator delete[]( void* obj ) {
gc::operator delete( obj );}
-#endif /* OPERATOR_NEW_ARRAY */
+#endif /* GC_OPERATOR_NEW_ARRAY */
inline gc_cleanup::~gc_cleanup() {
@@ -246,12 +311,13 @@ inline gc_cleanup::gc_cleanup() {
GC_finalization_proc oldProc;
void* oldData;
void* base = GC_base( (void *) this );
- if (0 == base) return;
- GC_REGISTER_FINALIZER_IGNORE_SELF(
- base, cleanup, (void*) ((char*) this - (char*) base),
+ if (0 != base) {
+ // Don't call the debug version, since this is a real base address.
+ GC_register_finalizer_ignore_self(
+ base, (GC_finalization_proc)cleanup, (void*) ((char*) this - (char*) base),
&oldProc, &oldData );
- if (0 != oldProc) {
- GC_REGISTER_FINALIZER_IGNORE_SELF( base, oldProc, oldData, 0, 0 );}}
+ if (0 != oldProc) {
+ GC_register_finalizer_ignore_self( base, oldProc, oldData, 0, 0 );}}}
inline void* operator new(
size_t size,
@@ -261,7 +327,7 @@ inline void* operator new(
{
void* obj;
- if (gcp == GC) {
+ if (gcp == UseGC) {
obj = GC_MALLOC( size );
if (cleanup != 0)
GC_REGISTER_FINALIZER_IGNORE_SELF(
@@ -273,7 +339,7 @@ inline void* operator new(
return obj;}
-#ifdef OPERATOR_NEW_ARRAY
+#ifdef GC_OPERATOR_NEW_ARRAY
inline void* operator new[](
size_t size,
@@ -283,7 +349,7 @@ inline void* operator new[](
{
return ::operator new( size, gcp, cleanup, clientData );}
-#endif /* OPERATOR_NEW_ARRAY */
+#endif /* GC_OPERATOR_NEW_ARRAY */
#endif /* GC_CPP_H */
diff --git a/gc/include/gc_gcj.h b/gc/include/gc_gcj.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
+ * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+ * Copyright 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright 1999 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* This file assumes the collector has been compiled with GC_GCJ_SUPPORT */
+/* and that an ANSI C compiler is available. */
+
+/*
+ * We allocate objects whose first word contains a pointer to a struct
+ * describing the object type. This struct contains a garbage collector mark
+ * descriptor at offset MARK_DESCR_OFFSET. Alternatively, the objects
+ * may be marked by the mark procedure passed to GC_init_gcj_malloc.
+ */
+
+#ifndef GC_GCJ_H
+
+#define GC_GCJ_H
+
+#ifndef MARK_DESCR_OFFSET
+# define MARK_DESCR_OFFSET sizeof(word)
+#endif
+ /* Gcj keeps GC descriptor as second word of vtable. This */
+ /* probably needs to be adjusted for other clients. */
+ /* We currently assume that this offset is such that: */
+ /* - all objects of this kind are large enough to have */
+ /* a value at that offset, and */
+ /* - it is not zero. */
+ /* These assumptions allow objects on the free list to be */
+ /* marked normally. */
+
+#ifndef _GC_H
+# include "gc.h"
+#endif
+
+/* The following allocators signal an out of memory condition with */
+/* return GC_oom_fn(bytes); */
+
+extern void * (*GC_oom_action)(void);
+
+/* The following function must be called before the gcj allocators */
+/* can be invoked. */
+/* mp_index and mp are the index and mark_proc (see gc_mark.h) */
+/* respectively for the allocated objects. Mark_proc will be */
+/* used to build the descriptor for objects allocated through the */
+/* debugging interface. The mark_proc will be invoked on all such */
+/* objects with an "environment" value of 1. The client may chose */
+/* to use the same mark_proc for some of its generated mark descriptors.*/
+/* In that case, it should use a different "environment" value to */
+/* detect the presence or absence of the debug header. */
+/* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */
+/* want to include that here for namespace pollution reasons. */
+extern void GC_init_gcj_malloc(int mp_index, void * /* really mark_proc */mp);
+
+/* Allocate an object, clear it, and store the pointer to the */
+/* type structure (vtable in gcj). */
+/* This adds a byte at the end of the object if GC_malloc would.*/
+extern void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr);
+/* The debug versions allocate such that the specified mark_proc */
+/* is always invoked. */
+extern void * GC_debug_gcj_malloc(size_t lb,
+ void * ptr_to_struct_containing_descr,
+ GC_EXTRA_PARAMS);
+
+/* Similar to the above, but the size is in words, and we don't */
+/* adjust it. The size is assumed to be such that it can be */
+/* allocated as a small object. */
+/* Unless it is known that the collector is not configured */
+/* with USE_MARK_BYTES and unless it is known that the object */
+/* has weak alignment requirements, lw must be even. */
+extern void * GC_gcj_fast_malloc(size_t lw,
+ void * ptr_to_struct_containing_descr);
+extern void * GC_debug_gcj_fast_malloc(size_t lw,
+ void * ptr_to_struct_containing_descr,
+ GC_EXTRA_PARAMS);
+
+/* Similar to GC_gcj_malloc, but assumes that a pointer to near the */
+/* beginning of the resulting object is always maintained. */
+extern void * GC_gcj_malloc_ignore_off_page(size_t lb,
+ void * ptr_to_struct_containing_descr);
+
+# ifdef GC_DEBUG
+# define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS)
+# define GC_GCJ_FAST_MALLOC(s,d) GC_debug_gcj_fast_malloc(s,d,GC_EXTRAS)
+# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS)
+# else
+# define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d)
+# define GC_GCJ_FAST_MALLOC(s,d) GC_gcj_fast_malloc(s,d)
+# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) \
+ GC_gcj_malloc_ignore_off_page(s,d)
+# endif
+
+#endif /* GC_GCJ_H */
diff --git a/gc/include/gc_inl.h b/gc/include/gc_inl.h
@@ -17,18 +17,22 @@
# include "private/gc_priv.h"
# endif
-/* USE OF THIS FILE IS NOT RECOMMENDED unless the collector has been */
-/* compiled without -DALL_INTERIOR_POINTERS or with */
+/* USE OF THIS FILE IS NOT RECOMMENDED unless GC_all_interior_pointers */
+/* is always set, or the collector has been built with */
/* -DDONT_ADD_BYTE_AT_END, or the specified size includes a pointerfree */
/* word at the end. In the standard collector configuration, */
/* the final word of each object may not be scanned. */
-/* This is most useful for compilers that generate C. */
+/* This iinterface is most useful for compilers that generate C. */
/* Manual use is hereby discouraged. */
/* Allocate n words (NOT BYTES). X is made to point to the result. */
/* It is assumed that n < MAXOBJSZ, and */
/* that n > 0. On machines requiring double word alignment of some */
-/* data, we also assume that n is 1 or even. This bypasses the */
+/* data, we also assume that n is 1 or even. */
+/* If the collector is built with -DUSE_MARK_BYTES or -DPARALLEL_MARK, */
+/* the n = 1 case is also disallowed. */
+/* Effectively this means that portable code should make sure n is even.*/
+/* This bypasses the */
/* MERGE_SIZES mechanism. In order to minimize the number of distinct */
/* free lists that are maintained, the caller should ensure that a */
/* small number of distinct values of n are used. (The MERGE_SIZES */
diff --git a/gc/include/gc_local_alloc.h b/gc/include/gc_local_alloc.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/*
+ * Interface for thread local allocation. Memory obtained
+ * this way can be used by all threads, as though it were obtained
+ * from an allocator like GC_malloc. The difference is that GC_local_malloc
+ * counts the number of allocations of a given size from the current thread,
+ * and uses GC_malloc_many to perform the allocations once a threashold
+ * is exceeded. Thus far less synchronization may be needed.
+ * Allocation of known large objects should not use this interface.
+ * This interface is designed primarily for fast allocation of small
+ * objects on multiprocessors, e.g. for a JVM running on an MP server.
+ *
+ * If this file is included with GC_GCJ_SUPPORT defined, GCJ-style
+ * bitmap allocation primitives will also be included.
+ *
+ * If this file is included with GC_REDIRECT_TO_LOCAL defined, then
+ * GC_MALLOC, GC_MALLOC_ATOMIC, and possibly GC_GCJ_MALLOC will
+ * be redefined to use the thread local allocatoor.
+ *
+ * The interface is available only if the collector is built with
+ * -DTHREAD_LOCAL_ALLOC, which is currently supported only on Linux.
+ *
+ * The debugging allocators use standard, not thread-local allocation.
+ */
+
+#ifndef GC_LOCAL_ALLOC_H
+#define GC_LOCAL_ALLOC_H
+
+#ifndef _GC_H
+# include "gc.h"
+#endif
+
+#if defined(GC_GCJ_SUPPORT) && !defined(GC_GCJ_H)
+# include "gc_gcj.h"
+#endif
+
+/* We assume ANSI C for this interface. */
+
+GC_PTR GC_local_malloc(size_t bytes);
+
+GC_PTR GC_local_malloc_atomic(size_t bytes);
+
+#if defined(GC_GCJ_SUPPORT)
+ GC_PTR GC_local_gcj_malloc(size_t bytes,
+ void * ptr_to_struct_containing_descr);
+#endif
+
+# ifdef GC_DEBUG
+# define GC_LOCAL_MALLOC(s) GC_debug_malloc(s,GC_EXTRAS)
+# define GC_LOCAL_MALLOC_ATOMIC(s) GC_debug_malloc_atomic(s,GC_EXTRAS)
+# ifdef GC_GCJ_SUPPORT
+# define GC_LOCAL_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS)
+# endif
+# else
+# define GC_LOCAL_MALLOC(s) GC_local_malloc(s)
+# define GC_LOCAL_MALLOC_ATOMIC(s) GC_local_malloc_atomic(s)
+# ifdef GC_GCJ_SUPPORT
+# define GC_LOCAL_GCJ_MALLOC(s,d) GC_local_gcj_malloc(s,d)
+# endif
+# endif
+
+# ifdef GC_REDIRECT_TO_LOCAL
+# undef GC_MALLOC
+# define GC_MALLOC(s) GC_LOCAL_MALLOC(s)
+# undef GC_MALLOC_ATOMIC
+# define GC_MALLOC_ATOMIC(s) GC_LOCAL_MALLOC_ATOMIC(s)
+# ifdef GC_GCJ_SUPPORT
+# undef GC_GCJ_MALLOC
+# define GC_GCJ_MALLOC(s,d) GC_LOCAL_GCJ_MALLOC(s,d)
+# endif
+# endif
+
+#endif /* GC_LOCAL_ALLOC_H */
diff --git a/gc/include/gc_mark.h b/gc/include/gc_mark.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * This contains interfaces to the GC marker that are likely to be useful to
+ * clients that provide detailed heap layout information to the collector.
+ * This interface should not be used by normal C or C++ clients.
+ * It will be useful to runtimes for other languages.
+ *
+ * Note that this file is not "namespace-clean", i.e. it introduces names
+ * not prefixed with GC_, which may collide with the client's names. It
+ * should be included only in those few places that directly provide
+ * information to the collector.
+ */
+#ifndef GC_MARK_H
+# define GC_MARK_H
+
+# ifndef GC_H
+# include "gc.h"
+# endif
+
+/* A client supplied mark procedure. Returns new mark stack pointer. */
+/* Primary effect should be to push new entries on the mark stack. */
+/* Mark stack pointer values are passed and returned explicitly. */
+/* Global variables decribing mark stack are not necessarily valid. */
+/* (This usually saves a few cycles by keeping things in registers.) */
+/* Assumed to scan about GC_PROC_BYTES on average. If it needs to do */
+/* much more work than that, it should do it in smaller pieces by */
+/* pushing itself back on the mark stack. */
+/* Note that it should always do some work (defined as marking some */
+/* objects) before pushing more than one entry on the mark stack. */
+/* This is required to ensure termination in the event of mark stack */
+/* overflows. */
+/* This procedure is always called with at least one empty entry on the */
+/* mark stack. */
+/* Currently we require that mark procedures look for pointers in a */
+/* subset of the places the conservative marker would. It must be safe */
+/* to invoke the normal mark procedure instead. */
+/* WARNING: Such a mark procedure may be invoked on an unused object */
+/* residing on a free list. Such objects are cleared, except for a */
+/* free list link field in the first word. Thus mark procedures may */
+/* not count on the presence of a type descriptor, and must handle this */
+/* case correctly somehow. */
+# define GC_PROC_BYTES 100
+struct GC_ms_entry;
+typedef struct GC_ms_entry * (*GC_mark_proc) GC_PROTO((
+ GC_word * addr, struct GC_ms_entry * mark_stack_ptr,
+ struct GC_ms_entry * mark_stack_limit, GC_word env));
+
+# define GC_LOG_MAX_MARK_PROCS 6
+# define GC_MAX_MARK_PROCS (1 << GC_LOG_MAX_MARK_PROCS)
+
+/* In a few cases it's necessary to assign statically known indices to */
+/* certain mark procs. Thus we reserve a few for well known clients. */
+/* (This is necessary if mark descriptors are compiler generated.) */
+#define GC_RESERVED_MARK_PROCS 8
+# define GC_GCJ_RESERVED_MARK_PROC_INDEX 0
+
+/* Object descriptors on mark stack or in objects. Low order two */
+/* bits are tags distinguishing among the following 4 possibilities */
+/* for the high order 30 bits. */
+#define GC_DS_TAG_BITS 2
+#define GC_DS_TAGS ((1 << GC_DS_TAG_BITS) - 1)
+#define GC_DS_LENGTH 0 /* The entire word is a length in bytes that */
+ /* must be a multiple of 4. */
+#define GC_DS_BITMAP 1 /* 30 (62) bits are a bitmap describing pointer */
+ /* fields. The msb is 1 iff the first word */
+ /* is a pointer. */
+ /* (This unconventional ordering sometimes */
+ /* makes the marker slightly faster.) */
+ /* Zeroes indicate definite nonpointers. Ones */
+ /* indicate possible pointers. */
+ /* Only usable if pointers are word aligned. */
+#define GC_DS_PROC 2
+ /* The objects referenced by this object can be */
+ /* pushed on the mark stack by invoking */
+ /* PROC(descr). ENV(descr) is passed as the */
+ /* last argument. */
+# define GC_MAKE_PROC(proc_index, env) \
+ (((((env) << GC_LOG_MAX_MARK_PROCS) \
+ | (proc_index)) << GC_DS_TAG_BITS) | GC_DS_PROC)
+#define GC_DS_PER_OBJECT 3 /* The real descriptor is at the */
+ /* byte displacement from the beginning of the */
+ /* object given by descr & ~DS_TAGS */
+ /* If the descriptor is negative, the real */
+ /* descriptor is at (*<object_start>) - */
+ /* (descr & ~DS_TAGS) - GC_INDIR_PER_OBJ_BIAS */
+ /* The latter alternative can be used if each */
+ /* object contains a type descriptor in the */
+ /* first word. */
+ /* Note that in multithreaded environments */
+ /* per object descriptors maust be located in */
+ /* either the first two or last two words of */
+ /* the object, since only those are guaranteed */
+ /* to be cleared while the allocation lock is */
+ /* held. */
+#define GC_INDIR_PER_OBJ_BIAS 0x10
+
+extern GC_PTR GC_least_plausible_heap_addr;
+extern GC_PTR GC_greatest_plausible_heap_addr;
+ /* Bounds on the heap. Guaranteed valid */
+ /* Likely to include future heap expansion. */
+
+/* Handle nested references in a custom mark procedure. */
+/* Check if obj is a valid object. If so, ensure that it is marked. */
+/* If it was not previously marked, push its contents onto the mark */
+/* stack for future scanning. The object will then be scanned using */
+/* its mark descriptor. */
+/* Returns the new mark stack pointer. */
+/* Handles mark stack overflows correctly. */
+/* Since this marks first, it makes progress even if there are mark */
+/* stack overflows. */
+/* Src is the address of the pointer to obj, which is used only */
+/* for back pointer-based heap debugging. */
+/* It is strongly recommended that most objects be handled without mark */
+/* procedures, e.g. with bitmap descriptors, and that mark procedures */
+/* be reserved for exceptional cases. That will ensure that */
+/* performance of this call is not extremely performance critical. */
+/* (Otherwise we would need to inline GC_mark_and_push completely, */
+/* which would tie the client code to a fixed colllector version.) */
+struct GC_ms_entry *GC_mark_and_push
+ GC_PROTO((GC_PTR obj,
+ struct GC_ms_entry * mark_stack_ptr,
+ struct GC_ms_entry * mark_stack_limit, GC_PTR *src));
+
+#define GC_MARK_AND_PUSH(obj, msp, lim, src) \
+ (((GC_word)obj >= (GC_word)GC_least_plausible_heap_addr && \
+ (GC_word)obj <= (GC_word)GC_greatest_plausible_heap_addr)? \
+ GC_mark_and_push(obj, msp, lim, src) : \
+ msp)
+
+#endif /* GC_MARK_H */
+
diff --git a/gc/include/gc_pthread_redirects.h b/gc/include/gc_pthread_redirects.h
@@ -0,0 +1,69 @@
+/* Our pthread support normally needs to intercept a number of thread */
+/* calls. We arrange to do that here, if appropriate. */
+
+#ifndef GC_PTHREAD_REDIRECTS_H
+
+#define GC_PTHREAD_REDIRECTS_H
+
+#if defined(GC_SOLARIS_THREADS)
+/* We need to intercept calls to many of the threads primitives, so */
+/* that we can locate thread stacks and stop the world. */
+/* Note also that the collector cannot see thread specific data. */
+/* Thread specific data should generally consist of pointers to */
+/* uncollectable objects (allocated with GC_malloc_uncollectable, */
+/* not the system malloc), which are deallocated using the destructor */
+/* facility in thr_keycreate. Alternatively, keep a redundant pointer */
+/* to thread specific data on the thread stack. */
+# include <thread.h>
+ int GC_thr_create(void *stack_base, size_t stack_size,
+ void *(*start_routine)(void *), void *arg, long flags,
+ thread_t *new_thread);
+ int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
+ int GC_thr_suspend(thread_t target_thread);
+ int GC_thr_continue(thread_t target_thread);
+ void * GC_dlopen(const char *path, int mode);
+# define thr_create GC_thr_create
+# define thr_join GC_thr_join
+# define thr_suspend GC_thr_suspend
+# define thr_continue GC_thr_continue
+#endif /* GC_SOLARIS_THREADS */
+
+#if defined(GC_SOLARIS_PTHREADS)
+# include <pthread.h>
+# include <signal.h>
+ extern int GC_pthread_create(pthread_t *new_thread,
+ const pthread_attr_t *attr,
+ void * (*thread_execp)(void *), void *arg);
+ extern int GC_pthread_join(pthread_t wait_for, void **status);
+# define pthread_join GC_pthread_join
+# define pthread_create GC_pthread_create
+#endif
+
+#if defined(GC_SOLARIS_PTHREADS) || defined(GC_SOLARIS_THREADS)
+# define dlopen GC_dlopen
+#endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */
+
+
+#if !defined(GC_USE_LD_WRAP) && \
+ (defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
+ || defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS))
+/* We treat these similarly. */
+# include <pthread.h>
+# include <signal.h>
+
+ int GC_pthread_create(pthread_t *new_thread,
+ const pthread_attr_t *attr,
+ void *(*start_routine)(void *), void *arg);
+ int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
+ int GC_pthread_join(pthread_t thread, void **retval);
+ int GC_pthread_detach(pthread_t thread);
+
+# define pthread_create GC_pthread_create
+# define pthread_sigmask GC_pthread_sigmask
+# define pthread_join GC_pthread_join
+# define pthread_detach GC_pthread_detach
+# define dlopen GC_dlopen
+
+#endif /* GC_xxxxx_THREADS */
+
+#endif /* GC_PTHREAD_REDIRECTS_H */
diff --git a/gc/include/gc_typed.h b/gc/include/gc_typed.h
@@ -61,6 +61,7 @@ GC_API GC_PTR GC_malloc_explicitly_typed
GC_PROTO((size_t size_in_bytes, GC_descr d));
/* Allocate an object whose layout is described by d. */
/* The resulting object MAY NOT BE PASSED TO REALLOC. */
+ /* The returned object is cleared. */
GC_API GC_PTR GC_malloc_explicitly_typed_ignore_off_page
GC_PROTO((size_t size_in_bytes, GC_descr d));
@@ -75,6 +76,7 @@ GC_API GC_PTR GC_calloc_explicitly_typed
/* alignment required for pointers. E.g. on a 32-bit */
/* machine with 16-bit aligned pointers, size_in_bytes */
/* must be a multiple of 2. */
+ /* Returned object is cleared. */
#ifdef GC_DEBUG
# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) GC_MALLOC(bytes)
diff --git a/gc/include/new_gc_alloc.h b/gc/include/new_gc_alloc.h
@@ -20,9 +20,9 @@
// It also doesn't yet understand the new header file names or
// namespaces.
//
-// This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE
-// and -DALL_INTERIOR_POINTERS. We also recommend
-// -DREDIRECT_MALLOC=GC_uncollectable_malloc.
+// This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE.
+// The user should also consider -DREDIRECT_MALLOC=GC_uncollectable_malloc,
+// to ensure that object allocated through malloc are traced.
//
// Some of this could be faster in the explicit deallocation case.
// In particular, we spend too much time clearing objects on the
@@ -43,11 +43,14 @@
// problems. The argument for changing it is that the usual default
// allocator is usually a very bad choice for a garbage collected environment.)
//
+// This code assumes that the collector itself has been compiled with a
+// compiler that defines __STDC__ .
+//
#ifndef GC_ALLOC_H
#include "gc.h"
-#include <alloc.h>
+#include <stack> // A more portable way to get stl_alloc.h .
#define GC_ALLOC_H
@@ -318,12 +321,10 @@ class traceable_alloc_template {
typedef traceable_alloc_template < 0 > traceable_alloc;
-#ifdef _SGI_SOURCE
-
// We want to specialize simple_alloc so that it does the right thing
// for all pointerfree types. At the moment there is no portable way to
// even approximate that. The following approximation should work for
-// SGI compilers, and perhaps some others.
+// SGI compilers, and recent versions of g++.
# define __GC_SPECIALIZE(T,alloc) \
class simple_alloc<T, alloc> { \
@@ -339,6 +340,8 @@ public: \
{ alloc::ptr_free_deallocate(p, sizeof (T)); } \
};
+__STL_BEGIN_NAMESPACE
+
__GC_SPECIALIZE(char, gc_alloc)
__GC_SPECIALIZE(int, gc_alloc)
__GC_SPECIALIZE(unsigned, gc_alloc)
@@ -363,6 +366,8 @@ __GC_SPECIALIZE(unsigned, single_client_traceable_alloc)
__GC_SPECIALIZE(float, single_client_traceable_alloc)
__GC_SPECIALIZE(double, single_client_traceable_alloc)
+__STL_END_NAMESPACE
+
#ifdef __STL_USE_STD_ALLOCATORS
__STL_BEGIN_NAMESPACE
@@ -451,6 +456,4 @@ __STL_END_NAMESPACE
#endif /* __STL_USE_STD_ALLOCATORS */
-#endif /* _SGI_SOURCE */
-
#endif /* GC_ALLOC_H */
diff --git a/gc/include/private/dbg_mlc.h b/gc/include/private/dbg_mlc.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
+ * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1997 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/*
+ * This is mostly an internal header file. Typical clients should
+ * not use it. Clients that define their own object kinds with
+ * debugging allocators will probably want to include this, however.
+ * No attempt is made to keep the namespace clean. This should not be
+ * included from header files that are frequently included by clients.
+ */
+
+#ifndef _DBG_MLC_H
+
+#define _DBG_MLC_H
+
+# define I_HIDE_POINTERS
+# include "gc_priv.h"
+# ifdef KEEP_BACK_PTRS
+# include "gc_backptr.h"
+# endif
+
+#ifndef HIDE_POINTER
+ /* Gc.h was previously included, and hence the I_HIDE_POINTERS */
+ /* definition had no effect. Repeat the gc.h definitions here to */
+ /* get them anyway. */
+ typedef GC_word GC_hidden_pointer;
+# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
+# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
+#endif /* HIDE_POINTER */
+
+# define START_FLAG ((word)0xfedcedcb)
+# define END_FLAG ((word)0xbcdecdef)
+ /* Stored both one past the end of user object, and one before */
+ /* the end of the object as seen by the allocator. */
+
+# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST)
+ /* Pointer "source"s that aren't real locations. */
+ /* Used in oh_back_ptr fields and as "source" */
+ /* argument to some marking functions. */
+# define NOT_MARKED (ptr_t)(0)
+# define MARKED_FOR_FINALIZATION (ptr_t)(2)
+ /* Object was marked because it is finalizable. */
+# define MARKED_FROM_REGISTER (ptr_t)(4)
+ /* Object was marked from a rgister. Hence the */
+ /* source of the reference doesn't have an address. */
+# endif /* KEEP_BACK_PTRS || PRINT_BLACK_LIST */
+
+/* Object header */
+typedef struct {
+# ifdef KEEP_BACK_PTRS
+ GC_hidden_pointer oh_back_ptr;
+ /* We make sure that we only store even valued */
+ /* pointers here, so that the hidden version has */
+ /* the least significant bit set. We never */
+ /* overwrite a value with the least significant */
+ /* bit clear, thus ensuring that we never overwrite */
+ /* a free list link field. */
+ /* Note that blocks dropped by black-listing will */
+ /* also have the lsb clear once debugging has */
+ /* started. */
+ /* The following are special back pointer values. */
+ /* Note that the "hidden" (i.e. bitwise */
+ /* complemented version) of these is actually */
+ /* stored. */
+# if ALIGNMENT == 1
+ /* Fudge back pointer to be even. */
+# define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p))
+# else
+# define HIDE_BACK_PTR(p) HIDE_POINTER(p)
+# endif
+# ifdef ALIGN_DOUBLE
+ word oh_dummy;
+# endif
+# endif
+ GC_CONST char * oh_string; /* object descriptor string */
+ word oh_int; /* object descriptor integers */
+# ifdef NEED_CALLINFO
+ struct callinfo oh_ci[NFRAMES];
+# endif
+# ifndef SHORT_DBG_HDRS
+ word oh_sz; /* Original malloc arg. */
+ word oh_sf; /* start flag */
+# endif /* SHORT_DBG_HDRS */
+} oh;
+/* The size of the above structure is assumed not to dealign things, */
+/* and to be a multiple of the word length. */
+
+#ifdef SHORT_DBG_HDRS
+# define DEBUG_BYTES (sizeof (oh))
+#else
+ /* Add space for END_FLAG, but use any extra space that was already */
+ /* added to catch off-the-end pointers. */
+# define DEBUG_BYTES (sizeof (oh) + sizeof (word) - EXTRA_BYTES)
+#endif
+#define USR_PTR_FROM_BASE(p) ((ptr_t)(p) + sizeof(oh))
+
+/* Round bytes to words without adding extra byte at end. */
+#define SIMPLE_ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)
+
+#ifdef SAVE_CALL_CHAIN
+# define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci)
+# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
+#else
+# ifdef GC_ADD_CALLER
+# define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra)
+# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
+# else
+# define ADD_CALL_CHAIN(base, ra)
+# define PRINT_CALL_CHAIN(base)
+# endif
+#endif
+
+# ifdef GC_ADD_CALLER
+# define OPT_RA ra,
+# else
+# define OPT_RA
+# endif
+
+
+/* Check whether object with base pointer p has debugging info */
+/* p is assumed to point to a legitimate object in our part */
+/* of the heap. */
+#ifdef SHORT_DBG_HDRS
+# define GC_has_other_debug_info(p) TRUE
+#else
+ GC_bool GC_has_other_debug_info(/* p */);
+#endif
+
+#ifdef KEEP_BACK_PTRS
+# define GC_HAS_DEBUG_INFO(p) \
+ ((((oh *)p)->oh_back_ptr & 1) && GC_has_other_debug_info(p))
+#else
+# define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p)
+#endif
+
+/* Store debugging info into p. Return displaced pointer. */
+/* Assumes we don't hold allocation lock. */
+ptr_t GC_store_debug_info(/* p, sz, string, integer */);
+
+#endif /* _DBG_MLC_H */
diff --git a/gc/include/private/gc_hdrs.h b/gc/include/private/gc_hdrs.h
@@ -24,6 +24,15 @@ typedef struct hblkhdr hdr;
* The 2 level tree data structure that is used to find block headers.
* If there are more than 32 bits in a pointer, the top level is a hash
* table.
+ *
+ * This defines HDR, GET_HDR, and SET_HDR, the main macros used to
+ * retrieve and set object headers.
+ *
+ * Since 5.0 alpha 5, we can also take advantage of a header lookup
+ * cache. This is a locally declared direct mapped cache, used inside
+ * the marker. The HC_GET_HDR macro uses and maintains this
+ * cache. Assuming we get reasonable hit rates, this shaves a few
+ * memory references from each pointer validation.
*/
# if CPP_WORDSZ > 32
@@ -45,6 +54,95 @@ typedef struct hblkhdr hdr;
# define TOP_SZ (1 << LOG_TOP_SZ)
# define BOTTOM_SZ (1 << LOG_BOTTOM_SZ)
+#ifndef SMALL_CONFIG
+# define USE_HDR_CACHE
+#endif
+
+/* #define COUNT_HDR_CACHE_HITS */
+
+extern hdr * GC_invalid_header; /* header for an imaginary block */
+ /* containing no objects. */
+
+
+/* Check whether p and corresponding hhdr point to long or invalid */
+/* object. If so, advance hhdr to */
+/* beginning of block, or set hhdr to GC_invalid_header. */
+#define ADVANCE(p, hhdr, source) \
+ { \
+ hdr * new_hdr = GC_invalid_header; \
+ p = GC_FIND_START(p, hhdr, &new_hdr, (word)source); \
+ hhdr = new_hdr; \
+ }
+
+#ifdef USE_HDR_CACHE
+
+# ifdef COUNT_HDR_CACHE_HITS
+ extern word GC_hdr_cache_hits;
+ extern word GC_hdr_cache_misses;
+# define HC_HIT() ++GC_hdr_cache_hits
+# define HC_MISS() ++GC_hdr_cache_misses
+# else
+# define HC_HIT()
+# define HC_MISS()
+# endif
+
+ typedef struct hce {
+ word block_addr; /* right shifted by LOG_HBLKSIZE */
+ hdr * hce_hdr;
+ } hdr_cache_entry;
+
+# define HDR_CACHE_SIZE 8 /* power of 2 */
+
+# define DECLARE_HDR_CACHE \
+ hdr_cache_entry hdr_cache[HDR_CACHE_SIZE]
+
+# define INIT_HDR_CACHE BZERO(hdr_cache, sizeof(hdr_cache));
+
+# define HCE(h) hdr_cache + (((word)(h) >> LOG_HBLKSIZE) & (HDR_CACHE_SIZE-1))
+
+# define HCE_VALID_FOR(hce,h) ((hce) -> block_addr == \
+ ((word)(h) >> LOG_HBLKSIZE))
+
+# define HCE_HDR(h) ((hce) -> hce_hdr)
+
+
+/* Analogous to GET_HDR, except that in the case of large objects, it */
+/* Returns the header for the object beginning, and updates p. */
+/* Returns &GC_bad_header instead of 0. All of this saves a branch */
+/* in the fast path. */
+# define HC_GET_HDR(p, hhdr, source) \
+ { \
+ hdr_cache_entry * hce = HCE(p); \
+ if (HCE_VALID_FOR(hce, p)) { \
+ HC_HIT(); \
+ hhdr = hce -> hce_hdr; \
+ } else { \
+ HC_MISS(); \
+ GET_HDR(p, hhdr); \
+ if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { \
+ ADVANCE(p, hhdr, source); \
+ } else { \
+ hce -> block_addr = (word)(p) >> LOG_HBLKSIZE; \
+ hce -> hce_hdr = hhdr; \
+ } \
+ } \
+ }
+
+#else /* !USE_HDR_CACHE */
+
+# define DECLARE_HDR_CACHE
+
+# define INIT_HDR_CACHE
+
+# define HC_GET_HDR(p, hhdr, source) \
+ { \
+ GET_HDR(p, hhdr); \
+ if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { \
+ ADVANCE(p, hhdr, source); \
+ } \
+ }
+#endif
+
typedef struct bi {
hdr * index[BOTTOM_SZ];
/*
diff --git a/gc/include/private/gc_locks.h b/gc/include/private/gc_locks.h
@@ -0,0 +1,481 @@
+/*
+ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
+ *
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#ifndef GC_LOCKS_H
+#define GC_LOCKS_H
+
+/*
+ * Mutual exclusion between allocator/collector routines.
+ * Needed if there is more than one allocator thread.
+ * FASTLOCK() is assumed to try to acquire the lock in a cheap and
+ * dirty way that is acceptable for a few instructions, e.g. by
+ * inhibiting preemption. This is assumed to have succeeded only
+ * if a subsequent call to FASTLOCK_SUCCEEDED() returns TRUE.
+ * FASTUNLOCK() is called whether or not FASTLOCK_SUCCEEDED().
+ * If signals cannot be tolerated with the FASTLOCK held, then
+ * FASTLOCK should disable signals. The code executed under
+ * FASTLOCK is otherwise immune to interruption, provided it is
+ * not restarted.
+ * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK
+ * and/or DISABLE_SIGNALS and ENABLE_SIGNALS and/or FASTLOCK.
+ * (There is currently no equivalent for FASTLOCK.)
+ *
+ * In the PARALLEL_MARK case, we also need to define a number of
+ * other inline finctions here:
+ * GC_bool GC_compare_and_exchange( volatile GC_word *addr,
+ * GC_word old, GC_word new )
+ * GC_word GC_atomic_add( volatile GC_word *addr, GC_word how_much )
+ * void GC_memory_barrier( )
+ *
+ */
+# ifdef THREADS
+ void GC_noop1 GC_PROTO((word));
+# ifdef PCR_OBSOLETE /* Faster, but broken with multiple lwp's */
+# include "th/PCR_Th.h"
+# include "th/PCR_ThCrSec.h"
+ extern struct PCR_Th_MLRep GC_allocate_ml;
+# define DCL_LOCK_STATE PCR_sigset_t GC_old_sig_mask
+# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
+# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
+# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
+# define FASTLOCK() PCR_ThCrSec_EnterSys()
+ /* Here we cheat (a lot): */
+# define FASTLOCK_SUCCEEDED() (*(int *)(&GC_allocate_ml) == 0)
+ /* TRUE if nobody currently holds the lock */
+# define FASTUNLOCK() PCR_ThCrSec_ExitSys()
+# endif
+# ifdef PCR
+# include <base/PCR_Base.h>
+# include <th/PCR_Th.h>
+ extern PCR_Th_ML GC_allocate_ml;
+# define DCL_LOCK_STATE \
+ PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask
+# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
+# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
+# define FASTLOCK() (GC_fastLockRes = PCR_Th_ML_Try(&GC_allocate_ml))
+# define FASTLOCK_SUCCEEDED() (GC_fastLockRes == PCR_ERes_okay)
+# define FASTUNLOCK() {\
+ if( FASTLOCK_SUCCEEDED() ) PCR_Th_ML_Release(&GC_allocate_ml); }
+# endif
+# ifdef SRC_M3
+ extern GC_word RT0u__inCritical;
+# define LOCK() RT0u__inCritical++
+# define UNLOCK() RT0u__inCritical--
+# endif
+# ifdef SOLARIS_THREADS
+# include <thread.h>
+# include <signal.h>
+ extern mutex_t GC_allocate_ml;
+# define LOCK() mutex_lock(&GC_allocate_ml);
+# define UNLOCK() mutex_unlock(&GC_allocate_ml);
+# endif
+
+/* Try to define GC_TEST_AND_SET and a matching GC_CLEAR for spin lock */
+/* acquisition and release. We need this for correct operation of the */
+/* incremental GC. */
+# ifdef __GNUC__
+# if defined(I386)
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ int oldval;
+ /* Note: the "xchg" instruction does not need a "lock" prefix */
+ __asm__ __volatile__("xchgl %0, %1"
+ : "=r"(oldval), "=m"(*(addr))
+ : "0"(1), "m"(*(addr)) : "memory");
+ return oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+# endif
+# if defined(IA64)
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ long oldval, n = 1;
+ __asm__ __volatile__("xchg4 %0=%1,%2"
+ : "=r"(oldval), "=m"(*addr)
+ : "r"(n), "1"(*addr) : "memory");
+ return oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+ /* Should this handle post-increment addressing?? */
+ inline static void GC_clear(volatile unsigned int *addr) {
+ __asm__ __volatile__("st4.rel %0=r0" : "=m" (*addr) : : "memory");
+ }
+# define GC_CLEAR_DEFINED
+# endif
+# ifdef SPARC
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ int oldval;
+
+ __asm__ __volatile__("ldstub %1,%0"
+ : "=r"(oldval), "=m"(*addr)
+ : "m"(*addr) : "memory");
+ return oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+# endif
+# ifdef M68K
+ /* Contributed by Tony Mantler. I'm not sure how well it was */
+ /* tested. */
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ char oldval; /* this must be no longer than 8 bits */
+
+ /* The return value is semi-phony. */
+ /* 'tas' sets bit 7 while the return */
+ /* value pretends bit 0 was set */
+ __asm__ __volatile__(
+ "tas %1@; sne %0; negb %0"
+ : "=d" (oldval)
+ : "a" (addr) : "memory");
+ return oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+# endif
+# if defined(POWERPC)
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ int oldval;
+ int temp = 1; // locked value
+
+ __asm__ __volatile__(
+ "1:\tlwarx %0,0,%3\n" // load and reserve
+ "\tcmpwi %0, 0\n" // if load is
+ "\tbne 2f\n" // non-zero, return already set
+ "\tstwcx. %2,0,%1\n" // else store conditional
+ "\tbne- 1b\n" // retry if lost reservation
+ "2:\t\n" // oldval is zero if we set
+ : "=&r"(oldval), "=p"(addr)
+ : "r"(temp), "1"(addr)
+ : "memory");
+ return (int)oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+ inline static void GC_clear(volatile unsigned int *addr) {
+ __asm__ __volatile__("eieio" ::: "memory");
+ *(addr) = 0;
+ }
+# define GC_CLEAR_DEFINED
+# endif
+# if defined(ALPHA)
+ inline static int GC_test_and_set(volatile unsigned int * addr)
+ {
+ unsigned long oldvalue;
+ unsigned long temp;
+
+ __asm__ __volatile__(
+ "1: ldl_l %0,%1\n"
+ " and %0,%3,%2\n"
+ " bne %2,2f\n"
+ " xor %0,%3,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,3f\n"
+ " mb\n"
+ "2:\n"
+ ".section .text2,\"ax\"\n"
+ "3: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (*addr), "=&r" (oldvalue)
+ :"Ir" (1), "m" (*addr)
+ :"memory");
+
+ return oldvalue;
+ }
+# define GC_TEST_AND_SET_DEFINED
+ /* Should probably also define GC_clear, since it needs */
+ /* a memory barrier ?? */
+# endif /* ALPHA */
+# ifdef ARM32
+ inline static int GC_test_and_set(volatile unsigned int *addr) {
+ int oldval;
+ /* SWP on ARM is very similar to XCHG on x86. Doesn't lock the
+ * bus because there are no SMP ARM machines. If/when there are,
+ * this code will likely need to be updated. */
+ /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
+ __asm__ __volatile__("swp %0, %1, [%2]"
+ : "=r"(oldval)
+ : "r"(1), "r"(addr)
+ : "memory");
+ return oldval;
+ }
+# define GC_TEST_AND_SET_DEFINED
+# endif /* ARM32 */
+# endif /* __GNUC__ */
+# if (defined(ALPHA) && !defined(__GNUC__))
+# define GC_test_and_set(addr) __cxx_test_and_set_atomic(addr, 1)
+# define GC_TEST_AND_SET_DEFINED
+# endif
+# if defined(MSWIN32)
+# define GC_test_and_set(addr) InterlockedExchange((LPLONG)addr,1)
+# define GC_TEST_AND_SET_DEFINED
+# endif
+# ifdef MIPS
+# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) \
+ || !defined(_COMPILER_VERSION) || _COMPILER_VERSION < 700
+# define GC_test_and_set(addr, v) test_and_set(addr,v)
+# else
+# define GC_test_and_set(addr, v) __test_and_set(addr,v)
+# define GC_clear(addr) __lock_release(addr);
+# define GC_CLEAR_DEFINED
+# endif
+# define GC_TEST_AND_SET_DEFINED
+# endif /* MIPS */
+# if 0 /* defined(HP_PA) */
+ /* The official recommendation seems to be to not use ldcw from */
+ /* user mode. Since multithreaded incremental collection doesn't */
+ /* work anyway on HP_PA, this shouldn't be a major loss. */
+
+ /* "set" means 0 and "clear" means 1 here. */
+# define GC_test_and_set(addr) !GC_test_and_clear(addr);
+# define GC_TEST_AND_SET_DEFINED
+# define GC_clear(addr) GC_noop1((word)(addr)); *(volatile unsigned int *)addr = 1;
+ /* The above needs a memory barrier! */
+# define GC_CLEAR_DEFINED
+# endif
+# if defined(GC_TEST_AND_SET_DEFINED) && !defined(GC_CLEAR_DEFINED)
+# ifdef __GNUC__
+ inline static void GC_clear(volatile unsigned int *addr) {
+ /* Try to discourage gcc from moving anything past this. */
+ __asm__ __volatile__(" " : : : "memory");
+ *(addr) = 0;
+ }
+# else
+ /* The function call in the following should prevent the */
+ /* compiler from moving assignments to below the UNLOCK. */
+# define GC_clear(addr) GC_noop1((word)(addr)); \
+ *((volatile unsigned int *)(addr)) = 0;
+# endif
+# define GC_CLEAR_DEFINED
+# endif /* !GC_CLEAR_DEFINED */
+
+# if !defined(GC_TEST_AND_SET_DEFINED)
+# define USE_PTHREAD_LOCKS
+# endif
+
+# if defined(LINUX_THREADS) || defined(OSF1_THREADS) \
+ || defined(HPUX_THREADS)
+# define NO_THREAD (pthread_t)(-1)
+# include <pthread.h>
+# if defined(PARALLEL_MARK)
+ /* We need compare-and-swap to update mark bits, where it's */
+ /* performance critical. If USE_MARK_BYTES is defined, it is */
+ /* no longer needed for this purpose. However we use it in */
+ /* either case to implement atomic fetch-and-add, though that's */
+ /* less performance critical, and could perhaps be done with */
+ /* a lock. */
+# if defined(GENERIC_COMPARE_AND_SWAP)
+ /* Probably not useful, except for debugging. */
+ /* We do use GENERIC_COMPARE_AND_SWAP on PA_RISC, but we */
+ /* minimize its use. */
+ extern pthread_mutex_t GC_compare_and_swap_lock;
+
+ /* Note that if GC_word updates are not atomic, a concurrent */
+ /* reader should acquire GC_compare_and_swap_lock. On */
+ /* currently supported platforms, such updates are atomic. */
+ extern GC_bool GC_compare_and_exchange(volatile GC_word *addr,
+ GC_word old, GC_word new_val);
+# endif /* GENERIC_COMPARE_AND_SWAP */
+# if defined(I386)
+# if !defined(GENERIC_COMPARE_AND_SWAP)
+ /* Returns TRUE if the comparison succeeded. */
+ inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
+ GC_word old,
+ GC_word new_val)
+ {
+ char result;
+ __asm__ __volatile__("lock; cmpxchgl %2, %0; setz %1"
+ : "=m"(*(addr)), "=r"(result)
+ : "r" (new_val), "0"(*(addr)), "a"(old) : "memory");
+ return (GC_bool) result;
+ }
+# endif /* !GENERIC_COMPARE_AND_SWAP */
+ inline static void GC_memory_write_barrier()
+ {
+ /* We believe the processor ensures at least processor */
+ /* consistent ordering. Thus a compiler barrier */
+ /* should suffice. */
+ __asm__ __volatile__("" : : : "memory");
+ }
+# endif /* I386 */
+# if defined(IA64)
+# if !defined(GENERIC_COMPARE_AND_SWAP)
+ inline static GC_bool GC_compare_and_exchange(volatile GC_word *addr,
+ GC_word old, GC_word new_val)
+ {
+ unsigned long oldval;
+ __asm__ __volatile__("mov ar.ccv=%4 ;; cmpxchg8.rel %0=%1,%2,ar.ccv"
+ : "=r"(oldval), "=m"(*addr)
+ : "r"(new_val), "1"(*addr), "r"(old) : "memory");
+ return (oldval == old);
+ }
+# endif /* !GENERIC_COMPARE_AND_SWAP */
+# if 0
+ /* Shouldn't be needed; we use volatile stores instead. */
+ inline static void GC_memory_write_barrier()
+ {
+ __asm__ __volatile__("mf" : : : "memory");
+ }
+# endif /* 0 */
+# endif /* IA64 */
+# if !defined(GENERIC_COMPARE_AND_SWAP)
+ /* Returns the original value of *addr. */
+ inline static GC_word GC_atomic_add(volatile GC_word *addr,
+ GC_word how_much)
+ {
+ GC_word old;
+ do {
+ old = *addr;
+ } while (!GC_compare_and_exchange(addr, old, old+how_much));
+ return old;
+ }
+# else /* GENERIC_COMPARE_AND_SWAP */
+ /* So long as a GC_word can be atomically updated, it should */
+ /* be OK to read *addr without a lock. */
+ extern GC_word GC_atomic_add(volatile GC_word *addr, GC_word how_much);
+# endif /* GENERIC_COMPARE_AND_SWAP */
+
+# endif /* PARALLEL_MARK */
+
+# if !defined(THREAD_LOCAL_ALLOC) && !defined(USE_PTHREAD_LOCKS)
+ /* In the THREAD_LOCAL_ALLOC case, the allocation lock tends to */
+ /* be held for long periods, if it is held at all. Thus spinning */
+ /* and sleeping for fixed periods are likely to result in */
+ /* significant wasted time. We thus rely mostly on queued locks. */
+# define USE_SPIN_LOCK
+ extern volatile unsigned int GC_allocate_lock;
+ extern void GC_lock(void);
+ /* Allocation lock holder. Only set if acquired by client through */
+ /* GC_call_with_alloc_lock. */
+# ifdef GC_ASSERTIONS
+# define LOCK() \
+ { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); \
+ SET_LOCK_HOLDER(); }
+# define UNLOCK() \
+ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \
+ GC_clear(&GC_allocate_lock); }
+# else
+# define LOCK() \
+ { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); }
+# define UNLOCK() \
+ GC_clear(&GC_allocate_lock)
+# endif /* !GC_ASSERTIONS */
+# if 0
+ /* Another alternative for OSF1 might be: */
+# include <sys/mman.h>
+ extern msemaphore GC_allocate_semaphore;
+# define LOCK() { if (msem_lock(&GC_allocate_semaphore, MSEM_IF_NOWAIT) \
+ != 0) GC_lock(); else GC_allocate_lock = 1; }
+ /* The following is INCORRECT, since the memory model is too weak. */
+ /* Is this true? Presumably msem_unlock has the right semantics? */
+ /* - HB */
+# define UNLOCK() { GC_allocate_lock = 0; \
+ msem_unlock(&GC_allocate_semaphore, 0); }
+# endif /* 0 */
+# else /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */
+# ifndef USE_PTHREAD_LOCKS
+# define USE_PTHREAD_LOCKS
+# endif
+# endif /* THREAD_LOCAL_ALLOC */
+# ifdef USE_PTHREAD_LOCKS
+# include <pthread.h>
+ extern pthread_mutex_t GC_allocate_ml;
+# ifdef GC_ASSERTIONS
+# define LOCK() \
+ { GC_lock(); \
+ SET_LOCK_HOLDER(); }
+# define UNLOCK() \
+ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \
+ pthread_mutex_unlock(&GC_allocate_ml); }
+# else /* !GC_ASSERTIONS */
+# define LOCK() \
+ { if (0 != pthread_mutex_trylock(&GC_allocate_ml)) GC_lock(); }
+# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
+# endif /* !GC_ASSERTIONS */
+# endif /* USE_PTHREAD_LOCKS */
+# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
+# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
+# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
+ extern VOLATILE GC_bool GC_collecting;
+# define ENTER_GC() GC_collecting = 1;
+# define EXIT_GC() GC_collecting = 0;
+ extern void GC_lock(void);
+ extern pthread_t GC_lock_holder;
+# ifdef GC_ASSERTIONS
+ extern pthread_t GC_mark_lock_holder;
+# endif
+# endif /* LINUX_THREADS || OSF1_THREADS || HPUX_THREADS */
+# if defined(IRIX_THREADS)
+# include <pthread.h>
+ /* This probably should never be included, but I can't test */
+ /* on Irix anymore. */
+# include <mutex.h>
+
+ extern unsigned long GC_allocate_lock;
+ /* This is not a mutex because mutexes that obey the (optional) */
+ /* POSIX scheduling rules are subject to convoys in high contention */
+ /* applications. This is basically a spin lock. */
+ extern pthread_t GC_lock_holder;
+ extern void GC_lock(void);
+ /* Allocation lock holder. Only set if acquired by client through */
+ /* GC_call_with_alloc_lock. */
+# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
+# define NO_THREAD (pthread_t)(-1)
+# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
+# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
+# define LOCK() { if (GC_test_and_set(&GC_allocate_lock, 1)) GC_lock(); }
+# define UNLOCK() GC_clear(&GC_allocate_lock);
+ extern VOLATILE GC_bool GC_collecting;
+# define ENTER_GC() \
+ { \
+ GC_collecting = 1; \
+ }
+# define EXIT_GC() GC_collecting = 0;
+# endif /* IRIX_THREADS */
+# ifdef WIN32_THREADS
+# include <windows.h>
+ GC_API CRITICAL_SECTION GC_allocate_ml;
+# define LOCK() EnterCriticalSection(&GC_allocate_ml);
+# define UNLOCK() LeaveCriticalSection(&GC_allocate_ml);
+# endif
+# ifndef SET_LOCK_HOLDER
+# define SET_LOCK_HOLDER()
+# define UNSET_LOCK_HOLDER()
+# define I_HOLD_LOCK() FALSE
+ /* Used on platforms were locks can be reacquired, */
+ /* so it doesn't matter if we lie. */
+# endif
+# else /* !THREADS */
+# define LOCK()
+# define UNLOCK()
+# endif /* !THREADS */
+# ifndef SET_LOCK_HOLDER
+# define SET_LOCK_HOLDER()
+# define UNSET_LOCK_HOLDER()
+# define I_HOLD_LOCK() FALSE
+ /* Used on platforms were locks can be reacquired, */
+ /* so it doesn't matter if we lie. */
+# endif
+# ifndef ENTER_GC
+# define ENTER_GC()
+# define EXIT_GC()
+# endif
+
+# ifndef DCL_LOCK_STATE
+# define DCL_LOCK_STATE
+# endif
+# ifndef FASTLOCK
+# define FASTLOCK() LOCK()
+# define FASTLOCK_SUCCEEDED() TRUE
+# define FASTUNLOCK() UNLOCK()
+# endif
+
+#endif /* GC_LOCKS_H */
diff --git a/gc/include/private/gc_pmark.h b/gc/include/private/gc_pmark.h
@@ -0,0 +1,388 @@
+/*
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/* Private declarations of GC marker data structures and macros */
+
+/*
+ * Declarations of mark stack. Needed by marker and client supplied mark
+ * routines. Transitively include gc_priv.h.
+ * (Note that gc_priv.h should not be included before this, since this
+ * includes dbg_mlc.h, which wants to include gc_priv.h AFTER defining
+ * I_HIDE_POINTERS.)
+ */
+#ifndef GC_PMARK_H
+# define GC_PMARK_H
+
+# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST)
+# include "dbg_mlc.h"
+# endif
+# ifndef GC_MARK_H
+# include "../gc_mark.h"
+# endif
+# ifndef GC_PRIVATE_H
+# include "gc_priv.h"
+# endif
+
+/* The real declarations of the following is in gc_priv.h, so that */
+/* we can avoid scanning the following table. */
+/*
+extern mark_proc GC_mark_procs[MAX_MARK_PROCS];
+*/
+
+/*
+ * Mark descriptor stuff that should remain private for now, mostly
+ * because it's hard to export WORDSZ without including gcconfig.h.
+ */
+# define BITMAP_BITS (WORDSZ - GC_DS_TAG_BITS)
+# define PROC(descr) \
+ (GC_mark_procs[((descr) >> GC_DS_TAG_BITS) & (GC_MAX_MARK_PROCS-1)])
+# define ENV(descr) \
+ ((descr) >> (GC_DS_TAG_BITS + GC_LOG_MAX_MARK_PROCS))
+# define MAX_ENV \
+ (((word)1 << (WORDSZ - GC_DS_TAG_BITS - GC_LOG_MAX_MARK_PROCS)) - 1)
+
+
+extern word GC_n_mark_procs;
+
+/* Number of mark stack entries to discard on overflow. */
+#define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8)
+
+typedef struct GC_ms_entry {
+ GC_word * mse_start; /* First word of object */
+ GC_word mse_descr; /* Descriptor; low order two bits are tags, */
+ /* identifying the upper 30 bits as one of the */
+ /* following: */
+} mse;
+
+extern word GC_mark_stack_size;
+
+extern mse * GC_mark_stack_limit;
+
+#ifdef PARALLEL_MARK
+ extern mse * VOLATILE GC_mark_stack_top;
+#else
+ extern mse * GC_mark_stack_top;
+#endif
+
+extern mse * GC_mark_stack;
+
+#ifdef PARALLEL_MARK
+ /*
+ * Allow multiple threads to participate in the marking process.
+ * This works roughly as follows:
+ * The main mark stack never shrinks, but it can grow.
+ *
+ * The initiating threads holds the GC lock, and sets GC_help_wanted.
+ *
+ * Other threads:
+ * 1) update helper_count (while holding mark_lock.)
+ * 2) allocate a local mark stack
+ * repeatedly:
+ * 3) Steal a global mark stack entry by atomically replacing
+ * its descriptor with 0.
+ * 4) Copy it to the local stack.
+ * 5) Mark on the local stack until it is empty, or
+ * it may be profitable to copy it back.
+ * 6) If necessary, copy local stack to global one,
+ * holding mark lock.
+ * 7) Stop when the global mark stack is empty.
+ * 8) decrement helper_count (holding mark_lock).
+ *
+ * This is an experiment to see if we can do something along the lines
+ * of the University of Tokyo SGC in a less intrusive, though probably
+ * also less performant, way.
+ */
+ void GC_do_parallel_mark();
+ /* inititate parallel marking. */
+
+ extern GC_bool GC_help_wanted; /* Protected by mark lock */
+ extern unsigned GC_helper_count; /* Number of running helpers. */
+ /* Protected by mark lock */
+ extern unsigned GC_active_count; /* Number of active helpers. */
+ /* Protected by mark lock */
+ /* May increase and decrease */
+ /* within each mark cycle. But */
+ /* once it returns to 0, it */
+ /* stays zero for the cycle. */
+ /* GC_mark_stack_top is also protected by mark lock. */
+ extern mse * VOLATILE GC_first_nonempty;
+ /* Lowest entry on mark stack */
+ /* that may be nonempty. */
+ /* Updated only by initiating */
+ /* thread. */
+ /*
+ * GC_notify_all_marker() is used when GC_help_wanted is first set,
+ * when the last helper becomes inactive,
+ * when something is added to the global mark stack, and just after
+ * GC_mark_no is incremented.
+ * This could be split into multiple CVs (and probably should be to
+ * scale to really large numbers of processors.)
+ */
+#endif /* PARALLEL_MARK */
+
+/* Return a pointer to within 1st page of object. */
+/* Set *new_hdr_p to corr. hdr. */
+#ifdef __STDC__
+# ifdef PRINT_BLACK_LIST
+ ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p, word source);
+# else
+ ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p);
+# endif
+#else
+ ptr_t GC_find_start();
+#endif
+
+mse * GC_signal_mark_stack_overflow();
+
+# ifdef GATHERSTATS
+# define ADD_TO_ATOMIC(sz) GC_atomic_in_use += (sz)
+# define ADD_TO_COMPOSITE(sz) GC_composite_in_use += (sz)
+# else
+# define ADD_TO_ATOMIC(sz)
+# define ADD_TO_COMPOSITE(sz)
+# endif
+
+/* Push the object obj with corresponding heap block header hhdr onto */
+/* the mark stack. */
+# define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \
+{ \
+ register word _descr = (hhdr) -> hb_descr; \
+ \
+ if (_descr == 0) { \
+ ADD_TO_ATOMIC((hhdr) -> hb_sz); \
+ } else { \
+ ADD_TO_COMPOSITE((hhdr) -> hb_sz); \
+ mark_stack_top++; \
+ if (mark_stack_top >= mark_stack_limit) { \
+ mark_stack_top = GC_signal_mark_stack_overflow(mark_stack_top); \
+ } \
+ mark_stack_top -> mse_start = (obj); \
+ mark_stack_top -> mse_descr = _descr; \
+ } \
+}
+
+#ifdef PRINT_BLACK_LIST
+# define GC_FIND_START(current, hhdr, new_hdr_p, source) \
+ GC_find_start(current, hhdr, new_hdr_p, source)
+#else
+# define GC_FIND_START(current, hhdr, new_hdr_p, source) \
+ GC_find_start(current, hhdr, new_hdr_p)
+#endif
+
+/* Push the contents of current onto the mark stack if it is a valid */
+/* ptr to a currently unmarked object. Mark it. */
+/* If we assumed a standard-conforming compiler, we could probably */
+/* generate the exit_label transparently. */
+# define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \
+ source, exit_label) \
+{ \
+ hdr * my_hhdr; \
+ ptr_t my_current = current; \
+ \
+ GET_HDR(my_current, my_hhdr); \
+ if (IS_FORWARDING_ADDR_OR_NIL(my_hhdr)) { \
+ hdr * new_hdr = GC_invalid_header; \
+ my_current = GC_FIND_START(my_current, my_hhdr, \
+ &new_hdr, (word)source); \
+ my_hhdr = new_hdr; \
+ } \
+ PUSH_CONTENTS_HDR(my_current, mark_stack_top, mark_stack_limit, \
+ source, exit_label, my_hhdr); \
+exit_label: ; \
+}
+
+/* As above, but use header cache for header lookup. */
+# define HC_PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \
+ source, exit_label) \
+{ \
+ hdr * my_hhdr; \
+ ptr_t my_current = current; \
+ \
+ HC_GET_HDR(my_current, my_hhdr, source); \
+ PUSH_CONTENTS_HDR(my_current, mark_stack_top, mark_stack_limit, \
+ source, exit_label, my_hhdr); \
+exit_label: ; \
+}
+
+/* Set mark bit, exit if it was already set. */
+
+# ifdef USE_MARK_BYTES
+ /* Unlike the mark bit case, there is a race here, and we may set */
+ /* the bit twice in the concurrent case. This can result in the */
+ /* object being pushed twice. But that's only a performance issue. */
+# define SET_MARK_BIT_EXIT_IF_SET(hhdr,displ,exit_label) \
+ { \
+ register VOLATILE char * mark_byte_addr = \
+ hhdr -> hb_marks + ((displ) >> 1); \
+ register char mark_byte = *mark_byte_addr; \
+ \
+ if (mark_byte) goto exit_label; \
+ *mark_byte_addr = 1; \
+ }
+# else
+# define SET_MARK_BIT_EXIT_IF_SET(hhdr,displ,exit_label) \
+ { \
+ register word * mark_word_addr = hhdr -> hb_marks + divWORDSZ(displ); \
+ register word mark_word = *mark_word_addr; \
+ \
+ OR_WORD_EXIT_IF_SET(mark_word_addr, (word)1 << modWORDSZ(displ), \
+ exit_label); \
+ }
+# endif /* USE_MARK_BYTES */
+
+/* If the mark bit corresponding to current is not set, set it, and */
+/* push the contents of the object on the mark stack. For a small */
+/* object we assume that current is the (possibly interior) pointer */
+/* to the object. For large objects we assume that current points */
+/* to somewhere inside the first page of the object. If */
+/* GC_all_interior_pointers is set, it may have been previously */
+/* adjusted to make that true. */
+# define PUSH_CONTENTS_HDR(current, mark_stack_top, mark_stack_limit, \
+ source, exit_label, hhdr) \
+{ \
+ int displ; /* Displacement in block; first bytes, then words */ \
+ int map_entry; \
+ \
+ displ = HBLKDISPL(current); \
+ map_entry = MAP_ENTRY((hhdr -> hb_map), displ); \
+ displ = BYTES_TO_WORDS(displ); \
+ if (map_entry > CPP_MAX_OFFSET) { \
+ if (map_entry == OFFSET_TOO_BIG) { \
+ map_entry = displ % (hhdr -> hb_sz); \
+ displ -= map_entry; \
+ if (displ + (hhdr -> hb_sz) > BYTES_TO_WORDS(HBLKSIZE)) { \
+ GC_ADD_TO_BLACK_LIST_NORMAL((word)current, source); \
+ goto exit_label; \
+ } \
+ } else { \
+ GC_ADD_TO_BLACK_LIST_NORMAL((word)current, source); goto exit_label; \
+ } \
+ } else { \
+ displ -= map_entry; \
+ } \
+ GC_ASSERT(displ >= 0 && displ < MARK_BITS_PER_HBLK); \
+ SET_MARK_BIT_EXIT_IF_SET(hhdr, displ, exit_label); \
+ GC_STORE_BACK_PTR((ptr_t)source, (ptr_t)HBLKPTR(current) \
+ + WORDS_TO_BYTES(displ)); \
+ PUSH_OBJ(((word *)(HBLKPTR(current)) + displ), hhdr, \
+ mark_stack_top, mark_stack_limit) \
+}
+
+#if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS)
+# define PUSH_ONE_CHECKED_STACK(p, source) \
+ GC_mark_and_push_stack(p, (ptr_t)(source))
+#else
+# define PUSH_ONE_CHECKED_STACK(p, source) \
+ GC_mark_and_push_stack(p)
+#endif
+
+/*
+ * Push a single value onto mark stack. Mark from the object pointed to by p.
+ * P is considered valid even if it is an interior pointer.
+ * Previously marked objects are not pushed. Hence we make progress even
+ * if the mark stack overflows.
+ */
+# define GC_PUSH_ONE_STACK(p, source) \
+ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+ PUSH_ONE_CHECKED_STACK(p, source); \
+ }
+
+/*
+ * As above, but interior pointer recognition as for
+ * normal for heap pointers.
+ */
+# define GC_PUSH_ONE_HEAP(p,source) \
+ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \
+ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \
+ GC_mark_stack_top = GC_mark_and_push( \
+ (GC_PTR)(p), GC_mark_stack_top, \
+ GC_mark_stack_limit, (GC_PTR *)(source)); \
+ }
+
+/* Mark starting at mark stack entry top (incl.) down to */
+/* mark stack entry bottom (incl.). Stop after performing */
+/* about one page worth of work. Return the new mark stack */
+/* top entry. */
+mse * GC_mark_from GC_PROTO((mse * top, mse * bottom, mse *limit));
+
+#define MARK_FROM_MARK_STACK() \
+ GC_mark_stack_top = GC_mark_from(GC_mark_stack_top, \
+ GC_mark_stack, \
+ GC_mark_stack + GC_mark_stack_size);
+
+/*
+ * Mark from one finalizable object using the specified
+ * mark proc. May not mark the object pointed to by
+ * real_ptr. That is the job of the caller, if appropriate
+ */
+# define GC_MARK_FO(real_ptr, mark_proc) \
+{ \
+ (*(mark_proc))(real_ptr); \
+ while (!GC_mark_stack_empty()) MARK_FROM_MARK_STACK(); \
+ if (GC_mark_state != MS_NONE) { \
+ GC_set_mark_bit(real_ptr); \
+ while (!GC_mark_some((ptr_t)0)) {} \
+ } \
+}
+
+extern GC_bool GC_mark_stack_too_small;
+ /* We need a larger mark stack. May be */
+ /* set by client supplied mark routines.*/
+
+typedef int mark_state_t; /* Current state of marking, as follows:*/
+ /* Used to remember where we are during */
+ /* concurrent marking. */
+
+ /* We say something is dirty if it was */
+ /* written since the last time we */
+ /* retrieved dirty bits. We say it's */
+ /* grungy if it was marked dirty in the */
+ /* last set of bits we retrieved. */
+
+ /* Invariant I: all roots and marked */
+ /* objects p are either dirty, or point */
+ /* to objects q that are either marked */
+ /* or a pointer to q appears in a range */
+ /* on the mark stack. */
+
+# define MS_NONE 0 /* No marking in progress. I holds. */
+ /* Mark stack is empty. */
+
+# define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */
+ /* being pushed. I holds, except */
+ /* that grungy roots may point to */
+ /* unmarked objects, as may marked */
+ /* grungy objects above scan_ptr. */
+
+# define MS_PUSH_UNCOLLECTABLE 2
+ /* I holds, except that marked */
+ /* uncollectable objects above scan_ptr */
+ /* may point to unmarked objects. */
+ /* Roots may point to unmarked objects */
+
+# define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */
+
+# define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */
+ /* overflow. However marked heap */
+ /* objects below scan_ptr point to */
+ /* marked or stacked objects. */
+
+# define MS_INVALID 5 /* I may not hold. */
+
+extern mark_state_t GC_mark_state;
+
+#endif /* GC_PMARK_H */
+
diff --git a/gc/include/private/gc_priv.h b/gc/include/private/gc_priv.h
@@ -1,6 +1,9 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved.
+ *
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -11,7 +14,6 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, February 16, 1996 2:30 pm PST */
# ifndef GC_PRIVATE_H
@@ -38,16 +40,16 @@
# include "gc.h"
# endif
-typedef GC_word word;
-typedef GC_signed_word signed_word;
+# ifndef GC_MARK_H
+# include "../gc_mark.h"
+# endif
-# ifndef CONFIG_H
+# ifndef GCCONFIG_H
# include "gcconfig.h"
# endif
-# ifndef HEADERS_H
-# include "gc_hdrs.h"
-# endif
+typedef GC_word word;
+typedef GC_signed_word signed_word;
typedef int GC_bool;
# define TRUE 1
@@ -58,27 +60,54 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
/* Preferably identical to caddr_t, if it */
/* exists. */
+# ifndef HEADERS_H
+# include "gc_hdrs.h"
+# endif
+
#if defined(__STDC__)
# include <stdlib.h>
# if !(defined( sony_news ) )
# include <stddef.h>
# endif
# define VOLATILE volatile
-# define CONST const
#else
# ifdef MSWIN32
# include <stdlib.h>
# endif
# define VOLATILE
-# define CONST
#endif
-#if 0 /* was once defined for AMIGA */
+#if 0 /* defined(__GNUC__) doesn't work yet */
+# define EXPECT(expr, outcome) __builtin_expect(expr,outcome)
+ /* Equivalent to (expr), but predict that usually (expr)==outcome. */
+#else
+# define EXPECT(expr, outcome) (expr)
+#endif /* __GNUC__ */
+
+# ifndef GC_LOCKS_H
+# include "gc_locks.h"
+# endif
+
+# ifdef STACK_GROWS_DOWN
+# define COOLER_THAN >
+# define HOTTER_THAN <
+# define MAKE_COOLER(x,y) if ((word)(x)+(y) > (word)(x)) {(x) += (y);} \
+ else {(x) = (word)ONES;}
+# define MAKE_HOTTER(x,y) (x) -= (y)
+# else
+# define COOLER_THAN <
+# define HOTTER_THAN >
+# define MAKE_COOLER(x,y) if ((word)(x)-(y) < (word)(x)) {(x) -= (y);} else {(x) = 0;}
+# define MAKE_HOTTER(x,y) (x) += (y)
+# endif
+
+#if defined(AMIGA) && defined(__SASC)
# define GC_FAR __far
#else
# define GC_FAR
#endif
+
/*********************************/
/* */
/* Definitions for conservative */
@@ -92,11 +121,9 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
/* */
/*********************************/
-#define STUBBORN_ALLOC /* Define stubborn allocation primitives */
-#if defined(SRC_M3) || defined(SMALL_CONFIG)
-# undef STUBBORN_ALLOC
-#endif
-
+/* #define STUBBORN_ALLOC */
+ /* Enable stubborm allocation, and thus a limited */
+ /* form of incremental collection w/o dirty bits. */
/* #define ALL_INTERIOR_POINTERS */
/* Forces all pointers into the interior of an */
@@ -123,6 +150,8 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
/* touched. */
/* If you can easily avoid using this option, do. */
/* If not, try to keep individual objects small. */
+ /* This is now really controlled at startup, */
+ /* through GC_all_interior_pointers. */
#define PRINTSTATS /* Print garbage collection statistics */
/* For less verbose output, undefine in reclaim.c */
@@ -153,12 +182,12 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
# define GATHERSTATS
#endif
-#ifdef FINALIZE_ON_DEMAND
-# define GC_INVOKE_FINALIZERS()
-#else
-# define GC_INVOKE_FINALIZERS() (void)GC_invoke_finalizers()
+#if defined(PRINTSTATS) || !defined(SMALL_CONFIG)
+# define CONDPRINT /* Print some things if GC_print_stats is set */
#endif
+#define GC_INVOKE_FINALIZERS() GC_notify_or_invoke_finalizers()
+
#define MERGE_SIZES /* Round up some object sizes, so that fewer distinct */
/* free lists are actually maintained. This applies */
/* only to the top level routines in misc.c, not to */
@@ -170,13 +199,10 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
/* May save significant amounts of space for obj_map */
/* entries. */
-#ifndef OLD_BLOCK_ALLOC
- /* Macros controlling large block allocation strategy. */
-# define EXACT_FIRST /* Make a complete pass through the large object */
- /* free list before splitting a block */
-# define PRESERVE_LAST /* Do not divide last allocated heap segment */
- /* unless we would otherwise need to expand the */
- /* heap. */
+#if defined(USE_MARK_BYTES) && !defined(ALIGN_DOUBLE)
+# define ALIGN_DOUBLE
+ /* We use one byte for every 2 words, which doesn't allow for */
+ /* odd numbered words to have mark bits. */
#endif
/* ALIGN_DOUBLE requires MERGE_SIZES at present. */
@@ -184,15 +210,17 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
# define MERGE_SIZES
# endif
-#if defined(ALL_INTERIOR_POINTERS) && !defined(DONT_ADD_BYTE_AT_END)
-# define ADD_BYTE_AT_END
+#if !defined(DONT_ADD_BYTE_AT_END)
+# define EXTRA_BYTES GC_all_interior_pointers
+#else
+# define EXTRA_BYTES 0
#endif
# ifndef LARGE_CONFIG
-# define MINHINCR 16 /* Minimum heap increment, in blocks of HBLKSIZE */
- /* Must be multiple of largest page size. */
-# define MAXHINCR 512 /* Maximum heap increment, in blocks */
+# define MINHINCR 16 /* Minimum heap increment, in blocks of HBLKSIZE */
+ /* Must be multiple of largest page size. */
+# define MAXHINCR 2048 /* Maximum heap increment, in blocks */
# else
# define MINHINCR 64
# define MAXHINCR 4096
@@ -225,17 +253,22 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
* Number of frames and arguments to save in objects allocated by
* debugging allocator.
*/
-# define NFRAMES 6 /* Number of frames to save. Even for */
+# ifndef SAVE_CALL_COUNT
+# define NFRAMES 6 /* Number of frames to save. Even for */
/* alignment reasons. */
+# else
+# define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
+# endif
# define NARGS 2 /* Mumber of arguments to save for each call. */
# define NEED_CALLINFO
/* Fill in the pc and argument information for up to NFRAMES of my */
/* callers. Ignore my frame and my callers frame. */
-void GC_save_callers (/* struct callinfo info[NFRAMES] */);
-
-void GC_print_callers (/* struct callinfo info[NFRAMES] */);
+struct callinfo;
+void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
+
+void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
#else
@@ -249,7 +282,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
#ifdef NEED_CALLINFO
struct callinfo {
- word ci_pc;
+ word ci_pc; /* Caller, not callee, pc */
# if NARGS > 0
word ci_arg[NARGS]; /* bit-wise complement to avoid retention */
# endif
@@ -278,6 +311,13 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# define MS_TIME_DIFF(a,b) ((double) (a.tv_sec - b.tv_sec) * 1000.0 \
+ (double) (a.tv_usec - b.tv_usec) / 1000.0)
#else /* !BSD_TIME */
+# if defined(MSWIN32) || defined(MSWINCE)
+# include <windows.h>
+# include <winbase.h>
+# define CLOCK_TYPE DWORD
+# define GET_TIME(x) x = GetTickCount()
+# define MS_TIME_DIFF(a,b) ((long)((a)-(b)))
+# else /* !MSWIN32, !MSWINCE, !BSD_TIME */
# include <time.h>
# if !defined(__STDC__) && defined(SPARC) && defined(SUNOS4)
clock_t clock(); /* Not in time.h, where it belongs */
@@ -303,6 +343,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# define GET_TIME(x) x = clock()
# define MS_TIME_DIFF(a,b) ((unsigned long) \
(1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC))
+# endif /* !MSWIN32 */
#endif /* !BSD_TIME */
/* We use bzero and bcopy internally. They may not be available. */
@@ -322,6 +363,9 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# include <string.h>
# define BCOPY_EXISTS
# endif
+# if defined(MACOSX)
+# define BCOPY_EXISTS
+# endif
# ifndef BCOPY_EXISTS
# include <string.h>
@@ -339,6 +383,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
/* GET_MEM is currently not assumed to retrieve 0 filled space, */
/* though we should perhaps take advantage of the case in which */
/* does. */
+struct hblk; /* See below. */
# ifdef PCR
char * real_malloc();
# define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
@@ -350,7 +395,8 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
+ GC_page_size) \
+ GC_page_size-1)
# else
-# if defined(AMIGA) || defined(NEXT) || defined(MACOSX) || defined(DOS4GW)
+# if defined(NEXT) || defined(MACOSX) || defined(DOS4GW) || \
+ (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC))
# define GET_MEM(bytes) HBLKPTR((size_t) \
calloc(1, (size_t)bytes + GC_page_size) \
+ GC_page_size-1)
@@ -371,198 +417,26 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
# endif
# else
- extern ptr_t GC_unix_get_mem();
-# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
+# ifdef MSWINCE
+ extern ptr_t GC_wince_get_mem();
+# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
+# else
+# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
+ extern void *GC_amiga_get_mem(size_t size);
+ define GET_MEM(bytes) HBLKPTR((size_t) \
+ GC_amiga_get_mem((size_t)bytes + GC_page_size) \
+ + GC_page_size-1)
+# else
+ extern ptr_t GC_unix_get_mem();
+# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
+# endif
+# endif
# endif
# endif
# endif
# endif
# endif
-/*
- * Mutual exclusion between allocator/collector routines.
- * Needed if there is more than one allocator thread.
- * FASTLOCK() is assumed to try to acquire the lock in a cheap and
- * dirty way that is acceptable for a few instructions, e.g. by
- * inhibiting preemption. This is assumed to have succeeded only
- * if a subsequent call to FASTLOCK_SUCCEEDED() returns TRUE.
- * FASTUNLOCK() is called whether or not FASTLOCK_SUCCEEDED().
- * If signals cannot be tolerated with the FASTLOCK held, then
- * FASTLOCK should disable signals. The code executed under
- * FASTLOCK is otherwise immune to interruption, provided it is
- * not restarted.
- * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK
- * and/or DISABLE_SIGNALS and ENABLE_SIGNALS and/or FASTLOCK.
- * (There is currently no equivalent for FASTLOCK.)
- */
-# ifdef THREADS
-# ifdef PCR_OBSOLETE /* Faster, but broken with multiple lwp's */
-# include "th/PCR_Th.h"
-# include "th/PCR_ThCrSec.h"
- extern struct PCR_Th_MLRep GC_allocate_ml;
-# define DCL_LOCK_STATE PCR_sigset_t GC_old_sig_mask
-# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
-# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
-# define FASTLOCK() PCR_ThCrSec_EnterSys()
- /* Here we cheat (a lot): */
-# define FASTLOCK_SUCCEEDED() (*(int *)(&GC_allocate_ml) == 0)
- /* TRUE if nobody currently holds the lock */
-# define FASTUNLOCK() PCR_ThCrSec_ExitSys()
-# endif
-# ifdef PCR
-# include <base/PCR_Base.h>
-# include <th/PCR_Th.h>
- extern PCR_Th_ML GC_allocate_ml;
-# define DCL_LOCK_STATE \
- PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask
-# define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
-# define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml)
-# define FASTLOCK() (GC_fastLockRes = PCR_Th_ML_Try(&GC_allocate_ml))
-# define FASTLOCK_SUCCEEDED() (GC_fastLockRes == PCR_ERes_okay)
-# define FASTUNLOCK() {\
- if( FASTLOCK_SUCCEEDED() ) PCR_Th_ML_Release(&GC_allocate_ml); }
-# endif
-# ifdef SRC_M3
- extern word RT0u__inCritical;
-# define LOCK() RT0u__inCritical++
-# define UNLOCK() RT0u__inCritical--
-# endif
-# ifdef SOLARIS_THREADS
-# include <thread.h>
-# include <signal.h>
- extern mutex_t GC_allocate_ml;
-# define LOCK() mutex_lock(&GC_allocate_ml);
-# define UNLOCK() mutex_unlock(&GC_allocate_ml);
-# endif
-# ifdef LINUX_THREADS
-# include <pthread.h>
-# ifdef __i386__
- inline static int GC_test_and_set(volatile unsigned int *addr) {
- int oldval;
- /* Note: the "xchg" instruction does not need a "lock" prefix */
- __asm__ __volatile__("xchgl %0, %1"
- : "=r"(oldval), "=m"(*(addr))
- : "0"(1), "m"(*(addr)));
- return oldval;
- }
-# else
- -- > Need implementation of GC_test_and_set()
-# endif
-# define GC_clear(addr) (*(addr) = 0)
-
- extern volatile unsigned int GC_allocate_lock;
- /* This is not a mutex because mutexes that obey the (optional) */
- /* POSIX scheduling rules are subject to convoys in high contention */
- /* applications. This is basically a spin lock. */
- extern pthread_t GC_lock_holder;
- extern void GC_lock(void);
- /* Allocation lock holder. Only set if acquired by client through */
- /* GC_call_with_alloc_lock. */
-# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
-# define NO_THREAD (pthread_t)(-1)
-# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
-# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
-# ifdef UNDEFINED
-# define LOCK() pthread_mutex_lock(&GC_allocate_ml)
-# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
-# else
-# define LOCK() \
- { if (GC_test_and_set(&GC_allocate_lock)) GC_lock(); }
-# define UNLOCK() \
- GC_clear(&GC_allocate_lock)
-# endif
- extern GC_bool GC_collecting;
-# define ENTER_GC() \
- { \
- GC_collecting = 1; \
- }
-# define EXIT_GC() GC_collecting = 0;
-# endif /* LINUX_THREADS */
-# if defined(IRIX_THREADS) || defined(IRIX_JDK_THREADS)
-# include <pthread.h>
-# include <mutex.h>
-
-# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) \
- || !defined(_COMPILER_VERSION) || _COMPILER_VERSION < 700
-# define GC_test_and_set(addr, v) test_and_set(addr,v)
-# else
-# define GC_test_and_set(addr, v) __test_and_set(addr,v)
-# endif
- extern unsigned long GC_allocate_lock;
- /* This is not a mutex because mutexes that obey the (optional) */
- /* POSIX scheduling rules are subject to convoys in high contention */
- /* applications. This is basically a spin lock. */
- extern pthread_t GC_lock_holder;
- extern void GC_lock(void);
- /* Allocation lock holder. Only set if acquired by client through */
- /* GC_call_with_alloc_lock. */
-# define SET_LOCK_HOLDER() GC_lock_holder = pthread_self()
-# define NO_THREAD (pthread_t)(-1)
-# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
-# define I_HOLD_LOCK() (pthread_equal(GC_lock_holder, pthread_self()))
-# ifdef UNDEFINED
-# define LOCK() pthread_mutex_lock(&GC_allocate_ml)
-# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
-# else
-# define LOCK() { if (GC_test_and_set(&GC_allocate_lock, 1)) GC_lock(); }
-# if __mips >= 3 && (defined (_ABIN32) || defined(_ABI64)) \
- && defined(_COMPILER_VERSION) && _COMPILER_VERSION >= 700
-# define UNLOCK() __lock_release(&GC_allocate_lock)
-# else
- /* The function call in the following should prevent the */
- /* compiler from moving assignments to below the UNLOCK. */
- /* This is probably not necessary for ucode or gcc 2.8. */
- /* It may be necessary for Ragnarok and future gcc */
- /* versions. */
-# define UNLOCK() { GC_noop1(&GC_allocate_lock); \
- *(volatile unsigned long *)(&GC_allocate_lock) = 0; }
-# endif
-# endif
- extern GC_bool GC_collecting;
-# define ENTER_GC() \
- { \
- GC_collecting = 1; \
- }
-# define EXIT_GC() GC_collecting = 0;
-# endif /* IRIX_THREADS || IRIX_JDK_THREADS */
-# ifdef WIN32_THREADS
-# include <windows.h>
- GC_API CRITICAL_SECTION GC_allocate_ml;
-# define LOCK() EnterCriticalSection(&GC_allocate_ml);
-# define UNLOCK() LeaveCriticalSection(&GC_allocate_ml);
-# endif
-# ifndef SET_LOCK_HOLDER
-# define SET_LOCK_HOLDER()
-# define UNSET_LOCK_HOLDER()
-# define I_HOLD_LOCK() FALSE
- /* Used on platforms were locks can be reacquired, */
- /* so it doesn't matter if we lie. */
-# endif
-# else
-# define LOCK()
-# define UNLOCK()
-# endif
-# ifndef SET_LOCK_HOLDER
-# define SET_LOCK_HOLDER()
-# define UNSET_LOCK_HOLDER()
-# define I_HOLD_LOCK() FALSE
- /* Used on platforms were locks can be reacquired, */
- /* so it doesn't matter if we lie. */
-# endif
-# ifndef ENTER_GC
-# define ENTER_GC()
-# define EXIT_GC()
-# endif
-
-# ifndef DCL_LOCK_STATE
-# define DCL_LOCK_STATE
-# endif
-# ifndef FASTLOCK
-# define FASTLOCK() LOCK()
-# define FASTLOCK_SUCCEEDED() TRUE
-# define FASTUNLOCK() UNLOCK()
-# endif
-
/* Delay any interrupts or signals that may abort this thread. Data */
/* structures are in a consistent state outside this pair of calls. */
/* ANSI C allows both to be empty (though the standard isn't very */
@@ -576,9 +450,9 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
PCR_Th_SetSigMask(&GC_old_sig_mask, NIL)
# else
# if defined(SRC_M3) || defined(AMIGA) || defined(SOLARIS_THREADS) \
- || defined(MSWIN32) || defined(MACOS) || defined(DJGPP) \
- || defined(NO_SIGNALS) || defined(IRIX_THREADS) \
- || defined(IRIX_JDK_THREADS) || defined(LINUX_THREADS)
+ || defined(MSWIN32) || defined(MSWINCE) || defined(MACOS) \
+ || defined(DJGPP) || defined(NO_SIGNALS) || defined(IRIX_THREADS) \
+ || defined(LINUX_THREADS)
/* Also useful for debugging. */
/* Should probably use thr_sigsetmask for SOLARIS_THREADS. */
# define DISABLE_SIGNALS()
@@ -607,7 +481,7 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# else
# if defined(SOLARIS_THREADS) || defined(WIN32_THREADS) \
|| defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(IRIX_JDK_THREADS)
+ || defined(HPUX_THREADS)
void GC_stop_world();
void GC_start_world();
# define STOP_WORLD() GC_stop_world()
@@ -641,6 +515,13 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */);
# define WARN(msg,arg) (*GC_current_warn_proc)(msg, (GC_word)(arg))
extern GC_warn_proc GC_current_warn_proc;
+/* Get environment entry */
+#if !defined(NO_GETENV)
+# define GETENV(name) getenv(name)
+#else
+# define GETENV(name) 0
+#endif
+
/*********************************/
/* */
/* Word-size-dependent defines */
@@ -670,7 +551,7 @@ extern GC_warn_proc GC_current_warn_proc;
#define WORDSZ ((word)CPP_WORDSZ)
#define SIGNB ((word)1 << (WORDSZ-1))
#define BYTES_PER_WORD ((word)(sizeof (word)))
-#define ONES ((word)(-1))
+#define ONES ((word)(signed_word)(-1))
#define divWORDSZ(n) ((n) >> LOGWL) /* divide n by size of word */
/*********************/
@@ -723,6 +604,8 @@ extern GC_warn_proc GC_current_warn_proc;
/* max size objects supported by freelist (larger objects may be */
/* allocated, but less efficiently) */
+#define CPP_MAXOBJBYTES (CPP_HBLKSIZE/2)
+#define MAXOBJBYTES ((word)CPP_MAXOBJBYTES)
#define CPP_MAXOBJSZ BYTES_TO_WORDS(CPP_HBLKSIZE/2)
#define MAXOBJSZ ((word)CPP_MAXOBJSZ)
@@ -743,25 +626,28 @@ extern GC_warn_proc GC_current_warn_proc;
# define HBLKDISPL(objptr) (((word) (objptr)) & (HBLKSIZE-1))
/* Round up byte allocation requests to integral number of words, etc. */
-# ifdef ADD_BYTE_AT_END
-# define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1))
-# ifdef ALIGN_DOUBLE
-# define ALIGNED_WORDS(n) (BYTES_TO_WORDS((n) + WORDS_TO_BYTES(2)) & ~1)
-# else
-# define ALIGNED_WORDS(n) ROUNDED_UP_WORDS(n)
-# endif
-# define SMALL_OBJ(bytes) ((bytes) < WORDS_TO_BYTES(MAXOBJSZ))
-# define ADD_SLOP(bytes) ((bytes)+1)
-# else
-# define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + (WORDS_TO_BYTES(1) - 1))
-# ifdef ALIGN_DOUBLE
+# define ROUNDED_UP_WORDS(n) \
+ BYTES_TO_WORDS((n) + (WORDS_TO_BYTES(1) - 1 + EXTRA_BYTES))
+# ifdef ALIGN_DOUBLE
# define ALIGNED_WORDS(n) \
- (BYTES_TO_WORDS((n) + WORDS_TO_BYTES(2) - 1) & ~1)
-# else
+ (BYTES_TO_WORDS((n) + WORDS_TO_BYTES(2) - 1 + EXTRA_BYTES) & ~1)
+# else
# define ALIGNED_WORDS(n) ROUNDED_UP_WORDS(n)
+# endif
+# define SMALL_OBJ(bytes) ((bytes) < (MAXOBJBYTES - EXTRA_BYTES))
+# define ADD_SLOP(bytes) ((bytes) + EXTRA_BYTES)
+# ifndef MIN_WORDS
+ /* MIN_WORDS is the size of the smallest allocated object. */
+ /* 1 and 2 are the only valid values. */
+ /* 2 must be used if: */
+ /* - GC_gcj_malloc can be used for objects of requested */
+ /* size smaller than 2 words, or */
+ /* - USE_MARK_BYTES is defined. */
+# if defined(USE_MARK_BYTES) || defined(GC_GCJ_SUPPORT)
+# define MIN_WORDS 2 /* Smallest allocated object. */
+# else
+# define MIN_WORDS 1
# endif
-# define SMALL_OBJ(bytes) ((bytes) <= WORDS_TO_BYTES(MAXOBJSZ))
-# define ADD_SLOP(bytes) (bytes)
# endif
@@ -772,11 +658,19 @@ extern GC_warn_proc GC_current_warn_proc;
*/
# ifdef LARGE_CONFIG
-# define LOG_PHT_ENTRIES 17
+# define LOG_PHT_ENTRIES 19 /* Collisions likely at 512K blocks, */
+ /* which is >= 2GB. Each table takes */
+ /* 64KB. */
# else
-# define LOG_PHT_ENTRIES 14 /* Collisions are likely if heap grows */
- /* to more than 16K hblks = 64MB. */
- /* Each hash table occupies 2K bytes. */
+# ifdef SMALL_CONFIG
+# define LOG_PHT_ENTRIES 14 /* Collisions are likely if heap grows */
+ /* to more than 16K hblks = 64MB. */
+ /* Each hash table occupies 2K bytes. */
+# else /* default "medium" configuration */
+# define LOG_PHT_ENTRIES 16 /* Collisions are likely if heap grows */
+ /* to more than 16K hblks >= 256MB. */
+ /* Each hash table occupies 8K bytes. */
+# endif
# endif
# define PHT_ENTRIES ((word)1 << LOG_PHT_ENTRIES)
# define PHT_SIZE (PHT_ENTRIES >> LOGWL)
@@ -790,6 +684,10 @@ typedef word page_hash_table[PHT_SIZE];
(bl)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
# define clear_pht_entry_from_index(bl, index) \
(bl)[divWORDSZ(index)] &= ~((word)1 << modWORDSZ(index))
+/* And a dumb but thread-safe version of set_pht_entry_from_index. */
+/* This sets (many) extra bits. */
+# define set_pht_entry_from_index_safe(bl, index) \
+ (bl)[divWORDSZ(index)] = ONES
@@ -802,20 +700,28 @@ typedef word page_hash_table[PHT_SIZE];
/* heap block header */
#define HBLKMASK (HBLKSIZE-1)
-#define BITS_PER_HBLK (HBLKSIZE * 8)
+#define BITS_PER_HBLK (CPP_HBLKSIZE * 8)
#define MARK_BITS_PER_HBLK (BITS_PER_HBLK/CPP_WORDSZ)
/* upper bound */
- /* We allocate 1 bit/word. Only the first word */
+ /* We allocate 1 bit/word, unless USE_MARK_BYTES */
+ /* is defined. Only the first word */
/* in each object is actually marked. */
-# ifdef ALIGN_DOUBLE
-# define MARK_BITS_SZ (((MARK_BITS_PER_HBLK + 2*CPP_WORDSZ - 1) \
- / (2*CPP_WORDSZ))*2)
+# ifdef USE_MARK_BYTES
+# define MARK_BITS_SZ (MARK_BITS_PER_HBLK/2)
+ /* Unlike the other case, this is in units of bytes. */
+ /* We actually allocate only every second mark bit, since we */
+ /* force all objects to be doubleword aligned. */
+ /* However, each mark bit is allocated as a byte. */
# else
-# define MARK_BITS_SZ ((MARK_BITS_PER_HBLK + CPP_WORDSZ - 1)/CPP_WORDSZ)
+# define MARK_BITS_SZ (MARK_BITS_PER_HBLK/CPP_WORDSZ)
# endif
- /* Upper bound on number of mark words per heap block */
+
+/* We maintain layout maps for heap blocks containing objects of a given */
+/* size. Each entry in this map describes a byte offset and has the */
+/* following type. */
+typedef unsigned char map_entry_type;
struct hblkhdr {
word hb_sz; /* If in use, size in words, of objects in the block. */
@@ -826,7 +732,8 @@ struct hblkhdr {
struct hblk * hb_prev; /* Backwards link for free list. */
word hb_descr; /* object descriptor for marking. See */
/* mark.h. */
- char* hb_map; /* A pointer to a pointer validity map of the block. */
+ map_entry_type * hb_map;
+ /* A pointer to a pointer validity map of the block. */
/* See GC_obj_map. */
/* Valid for all blocks with headers. */
/* Free blocks point to GC_invalid_map. */
@@ -848,51 +755,49 @@ struct hblkhdr {
/* Value of GC_gc_no when block was */
/* last allocated or swept. May wrap. */
/* For a free block, this is maintained */
- /* unly for USE_MUNMAP, and indicates */
+ /* only for USE_MUNMAP, and indicates */
/* when the header was allocated, or */
/* when the size of the block last */
/* changed. */
- word hb_marks[MARK_BITS_SZ];
+# ifdef USE_MARK_BYTES
+ union {
+ char _hb_marks[MARK_BITS_SZ];
+ /* The i'th byte is 1 if the object */
+ /* starting at word 2i is marked, 0 o.w. */
+ word dummy; /* Force word alignment of mark bytes. */
+ } _mark_byte_union;
+# define hb_marks _mark_byte_union._hb_marks
+# else
+ word hb_marks[MARK_BITS_SZ];
/* Bit i in the array refers to the */
/* object starting at the ith word (header */
/* INCLUDED) in the heap block. */
/* The lsb of word 0 is numbered 0. */
+ /* Unused bits are invalid, and are */
+ /* occasionally set, e.g for uncollectable */
+ /* objects. */
+# endif /* !USE_MARK_BYTES */
};
/* heap block body */
-# define DISCARD_WORDS 0
- /* Number of words to be dropped at the beginning of each block */
- /* Must be a multiple of WORDSZ. May reasonably be nonzero */
- /* on machines that don't guarantee longword alignment of */
- /* pointers, so that the number of false hits is minimized. */
- /* 0 and WORDSZ are probably the only reasonable values. */
-
-# define BODY_SZ ((HBLKSIZE-WORDS_TO_BYTES(DISCARD_WORDS))/sizeof(word))
+# define BODY_SZ (HBLKSIZE/sizeof(word))
struct hblk {
-# if (DISCARD_WORDS != 0)
+# if 0 /* DISCARDWORDS no longer supported */
word garbage[DISCARD_WORDS];
# endif
word hb_body[BODY_SZ];
};
-# define HDR_WORDS ((word)DISCARD_WORDS)
-# define HDR_BYTES ((word)WORDS_TO_BYTES(DISCARD_WORDS))
-
# define OBJ_SZ_TO_BLOCKS(sz) \
- divHBLKSZ(HDR_BYTES + WORDS_TO_BYTES(sz) + HBLKSIZE-1)
+ divHBLKSZ(WORDS_TO_BYTES(sz) + HBLKSIZE-1)
/* Size of block (in units of HBLKSIZE) needed to hold objects of */
/* given sz (in words). */
/* Object free list link */
# define obj_link(p) (*(ptr_t *)(p))
-/* The type of mark procedures. This really belongs in gc_mark.h. */
-/* But we put it here, so that we can avoid scanning the mark proc */
-/* table. */
-typedef struct ms_entry * (*mark_proc)(/* word * addr, mark_stack_ptr,
- mark_stack_limit, env */);
# define LOG_MAX_MARK_PROCS 6
# define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS)
@@ -906,12 +811,12 @@ typedef struct ms_entry * (*mark_proc)(/* word * addr, mark_stack_ptr,
# ifdef PCR
# define MAX_ROOT_SETS 1024
# else
-# ifdef MSWIN32
-# define MAX_ROOT_SETS 512
+# if defined(MSWIN32) || defined(MSWINCE)
+# define MAX_ROOT_SETS 1024
/* Under NT, we add only written pages, which can result */
/* in many small root sets. */
# else
-# define MAX_ROOT_SETS 64
+# define MAX_ROOT_SETS 256
# endif
# endif
# endif
@@ -934,14 +839,14 @@ struct exclusion {
struct roots {
ptr_t r_start;
ptr_t r_end;
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
struct roots * r_next;
# endif
GC_bool r_tmp;
/* Delete before registering new dynamic libraries */
};
-#ifndef MSWIN32
+#if !defined(MSWIN32) && !defined(MSWINCE)
/* Size of hash table index to roots. */
# define LOG_RT_SIZE 6
# define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */
@@ -969,16 +874,28 @@ struct roots {
struct _GC_arrays {
word _heapsize;
word _max_heapsize;
+ word _requested_heapsize; /* Heap size due to explicit expansion */
ptr_t _last_heap_addr;
ptr_t _prev_heap_addr;
word _large_free_bytes;
/* Total bytes contained in blocks on large object free */
/* list. */
+ word _large_allocd_bytes;
+ /* Total number of bytes in allocated large objects blocks. */
+ /* For the purposes of this counter and the next one only, a */
+ /* large object is one that occupies a block of at least */
+ /* 2*HBLKSIZE. */
+ word _max_large_allocd_bytes;
+ /* Maximum number of bytes that were ever allocated in */
+ /* large object blocks. This is used to help decide when it */
+ /* is safe to split up a large block. */
word _words_allocd_before_gc;
/* Number of words allocated before this */
/* collection cycle. */
- word _words_allocd;
+# ifndef SEPARATE_GLOBALS
+ word _words_allocd;
/* Number of words allocated during this collection cycle */
+# endif
word _words_wasted;
/* Number of words wasted due to internal fragmentation */
/* in large objects, or due to dropping blacklisted */
@@ -993,14 +910,21 @@ struct _GC_arrays {
word _mem_freed;
/* Number of explicitly deallocated words of memory */
/* since last collection. */
- mark_proc _mark_procs[MAX_MARK_PROCS];
+ ptr_t _scratch_end_ptr;
+ ptr_t _scratch_last_end_ptr;
+ /* Used by headers.c, and can easily appear to point to */
+ /* heap. */
+ GC_mark_proc _mark_procs[MAX_MARK_PROCS];
/* Table of user-defined mark procedures. There is */
/* a small number of these, which can be referenced */
/* by DS_PROC mark descriptors. See gc_mark.h. */
- ptr_t _objfreelist[MAXOBJSZ+1];
+
+# ifndef SEPARATE_GLOBALS
+ ptr_t _objfreelist[MAXOBJSZ+1];
/* free list for objects */
- ptr_t _aobjfreelist[MAXOBJSZ+1];
+ ptr_t _aobjfreelist[MAXOBJSZ+1];
/* free list for atomic objs */
+# endif
ptr_t _uobjfreelist[MAXOBJSZ+1];
/* uncollectable but traced objs */
@@ -1033,41 +957,28 @@ struct _GC_arrays {
ptr_t _sobjfreelist[MAXOBJSZ+1];
# endif
/* free list for immutable objects */
- ptr_t _obj_map[MAXOBJSZ+1];
+ map_entry_type * _obj_map[MAXOBJSZ+1];
/* If not NIL, then a pointer to a map of valid */
/* object addresses. _obj_map[sz][i] is j if the */
/* address block_start+i is a valid pointer */
- /* to an object at */
- /* block_start+i&~3 - WORDS_TO_BYTES(j). */
- /* (If ALL_INTERIOR_POINTERS is defined, then */
- /* instead ((short *)(hb_map[sz])[i] is j if */
- /* block_start+WORDS_TO_BYTES(i) is in the */
- /* interior of an object starting at */
- /* block_start+WORDS_TO_BYTES(i-j)). */
- /* It is OBJ_INVALID if */
- /* block_start+WORDS_TO_BYTES(i) is not */
- /* valid as a pointer to an object. */
- /* We assume all values of j <= OBJ_INVALID. */
- /* The zeroth entry corresponds to large objects.*/
-# ifdef ALL_INTERIOR_POINTERS
-# define map_entry_type short
-# define OBJ_INVALID 0x7fff
-# define MAP_ENTRY(map, bytes) \
- (((map_entry_type *)(map))[BYTES_TO_WORDS(bytes)])
-# define MAP_ENTRIES BYTES_TO_WORDS(HBLKSIZE)
-# define MAP_SIZE (MAP_ENTRIES * sizeof(map_entry_type))
-# define OFFSET_VALID(displ) TRUE
-# define CPP_MAX_OFFSET (HBLKSIZE - HDR_BYTES - 1)
-# define MAX_OFFSET ((word)CPP_MAX_OFFSET)
-# else
-# define map_entry_type char
-# define OBJ_INVALID 0x7f
-# define MAP_ENTRY(map, bytes) \
- (map)[bytes]
-# define MAP_ENTRIES HBLKSIZE
-# define MAP_SIZE MAP_ENTRIES
-# define CPP_MAX_OFFSET (WORDS_TO_BYTES(OBJ_INVALID) - 1)
-# define MAX_OFFSET ((word)CPP_MAX_OFFSET)
+ /* to an object at block_start + */
+ /* WORDS_TO_BYTES(BYTES_TO_WORDS(i) - j) */
+ /* I.e. j is a word displacement from the */
+ /* object beginning. */
+ /* The entry is OBJ_INVALID if the corresponding */
+ /* address is not a valid pointer. It is */
+ /* OFFSET_TOO_BIG if the value j would be too */
+ /* large to fit in the entry. (Note that the */
+ /* size of these entries matters, both for */
+ /* space consumption and for cache utilization. */
+# define OFFSET_TOO_BIG 0xfe
+# define OBJ_INVALID 0xff
+# define MAP_ENTRY(map, bytes) (map)[bytes]
+# define MAP_ENTRIES HBLKSIZE
+# define MAP_SIZE MAP_ENTRIES
+# define CPP_MAX_OFFSET (OFFSET_TOO_BIG - 1)
+# define MAX_OFFSET ((word)CPP_MAX_OFFSET)
+ /* The following are used only if GC_all_interior_ptrs != 0 */
# define VALID_OFFSET_SZ \
(CPP_MAX_OFFSET > WORDS_TO_BYTES(CPP_MAXOBJSZ)? \
CPP_MAX_OFFSET+1 \
@@ -1075,11 +986,11 @@ struct _GC_arrays {
char _valid_offsets[VALID_OFFSET_SZ];
/* GC_valid_offsets[i] == TRUE ==> i */
/* is registered as a displacement. */
-# define OFFSET_VALID(displ) GC_valid_offsets[displ]
+# define OFFSET_VALID(displ) \
+ (GC_all_interior_pointers || GC_valid_offsets[displ])
char _modws_valid_offsets[sizeof(word)];
/* GC_valid_offsets[i] ==> */
/* GC_modws_valid_offsets[i%sizeof(word)] */
-# endif
# ifdef STUBBORN_ALLOC
page_hash_table _changed_pages;
/* Stubborn object pages that were changes since last call to */
@@ -1106,17 +1017,25 @@ struct _GC_arrays {
# define MAX_HEAP_SECTS 768 /* Separately added heap sections. */
# endif
# else
-# define MAX_HEAP_SECTS 256
+# ifdef SMALL_CONFIG
+# define MAX_HEAP_SECTS 128 /* Roughly 1GB */
+# else
+# define MAX_HEAP_SECTS 384 /* Roughly 3GB */
+# endif
# endif
struct HeapSect {
ptr_t hs_start; word hs_bytes;
} _heap_sects[MAX_HEAP_SECTS];
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
ptr_t _heap_bases[MAX_HEAP_SECTS];
/* Start address of memory regions obtained from kernel. */
# endif
+# ifdef MSWINCE
+ word _heap_lengths[MAX_HEAP_SECTS];
+ /* Commited lengths of memory regions obtained from kernel. */
+# endif
struct roots _static_roots[MAX_ROOT_SETS];
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
struct roots * _root_index[RT_SIZE];
# endif
struct exclusion _excl_table[MAX_EXCLUSIONS];
@@ -1135,8 +1054,11 @@ struct _GC_arrays {
GC_API GC_FAR struct _GC_arrays GC_arrays;
-# define GC_objfreelist GC_arrays._objfreelist
-# define GC_aobjfreelist GC_arrays._aobjfreelist
+# ifndef SEPARATE_GLOBALS
+# define GC_objfreelist GC_arrays._objfreelist
+# define GC_aobjfreelist GC_arrays._aobjfreelist
+# define GC_words_allocd GC_arrays._words_allocd
+# endif
# define GC_uobjfreelist GC_arrays._uobjfreelist
# ifdef ATOMIC_UNCOLLECTABLE
# define GC_auobjfreelist GC_arrays._auobjfreelist
@@ -1151,24 +1073,31 @@ GC_API GC_FAR struct _GC_arrays GC_arrays;
# define GC_obj_map GC_arrays._obj_map
# define GC_last_heap_addr GC_arrays._last_heap_addr
# define GC_prev_heap_addr GC_arrays._prev_heap_addr
-# define GC_words_allocd GC_arrays._words_allocd
# define GC_words_wasted GC_arrays._words_wasted
# define GC_large_free_bytes GC_arrays._large_free_bytes
+# define GC_large_allocd_bytes GC_arrays._large_allocd_bytes
+# define GC_max_large_allocd_bytes GC_arrays._max_large_allocd_bytes
# define GC_words_finalized GC_arrays._words_finalized
# define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc
# define GC_mem_freed GC_arrays._mem_freed
+# define GC_scratch_end_ptr GC_arrays._scratch_end_ptr
+# define GC_scratch_last_end_ptr GC_arrays._scratch_last_end_ptr
# define GC_mark_procs GC_arrays._mark_procs
# define GC_heapsize GC_arrays._heapsize
# define GC_max_heapsize GC_arrays._max_heapsize
+# define GC_requested_heapsize GC_arrays._requested_heapsize
# define GC_words_allocd_before_gc GC_arrays._words_allocd_before_gc
# define GC_heap_sects GC_arrays._heap_sects
# define GC_last_stack GC_arrays._last_stack
# ifdef USE_MUNMAP
# define GC_unmapped_bytes GC_arrays._unmapped_bytes
# endif
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
# define GC_heap_bases GC_arrays._heap_bases
# endif
+# ifdef MSWINCE
+# define GC_heap_lengths GC_arrays._heap_lengths
+# endif
# define GC_static_roots GC_arrays._static_roots
# define GC_root_index GC_arrays._root_index
# define GC_excl_table GC_arrays._excl_table
@@ -1194,6 +1123,8 @@ GC_API GC_FAR struct _GC_arrays GC_arrays;
# define beginGC_arrays ((ptr_t)(&GC_arrays))
# define endGC_arrays (((ptr_t)(&GC_arrays)) + (sizeof GC_arrays))
+#define USED_HEAP_SIZE (GC_heapsize - GC_large_free_bytes)
+
/* Object kinds: */
# define MAXOBJKINDS 16
@@ -1213,10 +1144,27 @@ extern struct obj_kind {
GC_bool ok_init; /* Clear objects before putting them on the free list. */
} GC_obj_kinds[MAXOBJKINDS];
-# define endGC_obj_kinds (((ptr_t)(&GC_obj_kinds)) + (sizeof GC_obj_kinds))
+# define beginGC_obj_kinds ((ptr_t)(&GC_obj_kinds))
+# define endGC_obj_kinds (beginGC_obj_kinds + (sizeof GC_obj_kinds))
-# define end_gc_area ((ptr_t)endGC_arrays == (ptr_t)(&GC_obj_kinds) ? \
- endGC_obj_kinds : endGC_arrays)
+/* Variables that used to be in GC_arrays, but need to be accessed by */
+/* inline allocation code. If they were in GC_arrays, the inlined */
+/* allocation code would include GC_arrays offsets (as it did), which */
+/* introduce maintenance problems. */
+
+#ifdef SEPARATE_GLOBALS
+ word GC_words_allocd;
+ /* Number of words allocated during this collection cycle */
+ ptr_t GC_objfreelist[MAXOBJSZ+1];
+ /* free list for NORMAL objects */
+# define beginGC_objfreelist ((ptr_t)(&GC_objfreelist))
+# define endGC_objfreelist (beginGC_objfreelist + sizeof(GC_objfreelist))
+
+ ptr_t GC_aobjfreelist[MAXOBJSZ+1];
+ /* free list for atomic (PTRFREE) objs */
+# define beginGC_aobjfreelist ((ptr_t)(&GC_aobjfreelist))
+# define endGC_aobjfreelist (beginGC_aobjfreelist + sizeof(GC_aobjfreelist))
+#endif
/* Predefined kinds: */
# define PTRFREE 0
@@ -1240,8 +1188,10 @@ extern word GC_n_heap_sects; /* Number of separately added heap */
extern word GC_page_size;
-# ifdef MSWIN32
-extern word GC_n_heap_bases; /* See GC_heap_bases. */
+# if defined(MSWIN32) || defined(MSWINCE)
+ struct _SYSTEM_INFO;
+ extern struct _SYSTEM_INFO GC_sysinfo;
+ extern word GC_n_heap_bases; /* See GC_heap_bases. */
# endif
extern word GC_total_stack_black_listed;
@@ -1254,7 +1204,7 @@ extern word GC_black_list_spacing;
/* "stack-blacklisted", i.e. that are */
/* problematic in the interior of an object. */
-extern char * GC_invalid_map;
+extern map_entry_type * GC_invalid_map;
/* Pointer to the nowhere valid hblk map */
/* Blocks pointing to this map are free. */
@@ -1273,7 +1223,7 @@ extern GC_bool GC_objects_are_marked; /* There are marked objects in */
extern GC_bool GC_incremental;
/* Using incremental/generational collection. */
#else
-# define GC_incremental TRUE
+# define GC_incremental FALSE
/* Hopefully allow optimizer to remove some code. */
#endif
@@ -1286,10 +1236,6 @@ extern word GC_root_size; /* Total size of registered root sections */
extern GC_bool GC_debugging_started; /* GC_debug_malloc has been called. */
-extern ptr_t GC_least_plausible_heap_addr;
-extern ptr_t GC_greatest_plausible_heap_addr;
- /* Bounds on the heap. Guaranteed valid */
- /* Likely to include future heap expansion. */
/* Operations */
# ifndef abs
@@ -1302,6 +1248,33 @@ extern ptr_t GC_greatest_plausible_heap_addr;
/* with it. Only those corresponding to the beginning of an */
/* object are used. */
+/* Set mark bit correctly, even if mark bits may be concurrently */
+/* accessed. */
+#ifdef PARALLEL_MARK
+# define OR_WORD(addr, bits) \
+ { word old; \
+ do { \
+ old = *((volatile word *)addr); \
+ } while (!GC_compare_and_exchange((addr), old, old | (bits))); \
+ }
+# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \
+ { word old; \
+ word my_bits = (bits); \
+ do { \
+ old = *((volatile word *)addr); \
+ if (old & my_bits) goto exit_label; \
+ } while (!GC_compare_and_exchange((addr), old, old | my_bits)); \
+ }
+#else
+# define OR_WORD(addr, bits) *(addr) |= (bits)
+# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \
+ { \
+ word old = *(addr); \
+ word my_bits = (bits); \
+ if (old & my_bits) goto exit_label; \
+ *(addr) = (old | my_bits); \
+ }
+#endif
/* Mark bit operations */
@@ -1313,75 +1286,87 @@ extern ptr_t GC_greatest_plausible_heap_addr;
* relative to the beginning of the block, including unused words)
*/
+#ifdef USE_MARK_BYTES
+# define mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[(n) >> 1])
+# define set_mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[(n)>>1]) = 1
+# define clear_mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[(n)>>1]) = 0
+#else /* !USE_MARK_BYTES */
# define mark_bit_from_hdr(hhdr,n) (((hhdr)->hb_marks[divWORDSZ(n)] \
>> (modWORDSZ(n))) & (word)1)
-# define set_mark_bit_from_hdr(hhdr,n) (hhdr)->hb_marks[divWORDSZ(n)] \
- |= (word)1 << modWORDSZ(n)
-
+# define set_mark_bit_from_hdr(hhdr,n) \
+ OR_WORD((hhdr)->hb_marks+divWORDSZ(n), \
+ (word)1 << modWORDSZ(n))
# define clear_mark_bit_from_hdr(hhdr,n) (hhdr)->hb_marks[divWORDSZ(n)] \
&= ~((word)1 << modWORDSZ(n))
+#endif /* !USE_MARK_BYTES */
/* Important internal collector routines */
-ptr_t GC_approx_sp();
-
-GC_bool GC_should_collect();
-#ifdef PRESERVE_LAST
- GC_bool GC_in_last_heap_sect(/* ptr_t */);
- /* In last added heap section? If so, avoid breaking up. */
-#endif
-void GC_apply_to_all_blocks(/*fn, client_data*/);
- /* Invoke fn(hbp, client_data) for each */
- /* allocated heap block. */
-struct hblk * GC_next_used_block(/* struct hblk * h */);
- /* Return first in-use block >= h */
-struct hblk * GC_prev_block(/* struct hblk * h */);
- /* Return last block <= h. Returned block */
- /* is managed by GC, but may or may not be in */
+ptr_t GC_approx_sp GC_PROTO((void));
+
+GC_bool GC_should_collect GC_PROTO((void));
+
+void GC_apply_to_all_blocks GC_PROTO(( \
+ void (*fn) GC_PROTO((struct hblk *h, word client_data)), \
+ word client_data));
+ /* Invoke fn(hbp, client_data) for each */
+ /* allocated heap block. */
+struct hblk * GC_next_used_block GC_PROTO((struct hblk * h));
+ /* Return first in-use block >= h */
+struct hblk * GC_prev_block GC_PROTO((struct hblk * h));
+ /* Return last block <= h. Returned block */
+ /* is managed by GC, but may or may not be in */
/* use. */
-void GC_mark_init();
-void GC_clear_marks(); /* Clear mark bits for all heap objects. */
-void GC_invalidate_mark_state(); /* Tell the marker that marked */
- /* objects may point to unmarked */
- /* ones, and roots may point to */
- /* unmarked objects. */
- /* Reset mark stack. */
-void GC_mark_from_mark_stack(); /* Mark from everything on the mark stack. */
- /* Return after about one pages worth of */
- /* work. */
-GC_bool GC_mark_stack_empty();
-GC_bool GC_mark_some(/* cold_gc_frame */);
- /* Perform about one pages worth of marking */
- /* work of whatever kind is needed. Returns */
- /* quickly if no collection is in progress. */
- /* Return TRUE if mark phase finished. */
-void GC_initiate_gc(); /* initiate collection. */
- /* If the mark state is invalid, this */
- /* becomes full colleection. Otherwise */
- /* it's partial. */
-void GC_push_all(/*b,t*/); /* Push everything in a range */
- /* onto mark stack. */
-void GC_push_dirty(/*b,t*/); /* Push all possibly changed */
- /* subintervals of [b,t) onto */
- /* mark stack. */
+void GC_mark_init GC_PROTO((void));
+void GC_clear_marks GC_PROTO((void)); /* Clear mark bits for all heap objects. */
+void GC_invalidate_mark_state GC_PROTO((void));
+ /* Tell the marker that marked */
+ /* objects may point to unmarked */
+ /* ones, and roots may point to */
+ /* unmarked objects. */
+ /* Reset mark stack. */
+GC_bool GC_mark_stack_empty GC_PROTO((void));
+GC_bool GC_mark_some GC_PROTO((ptr_t cold_gc_frame));
+ /* Perform about one pages worth of marking */
+ /* work of whatever kind is needed. Returns */
+ /* quickly if no collection is in progress. */
+ /* Return TRUE if mark phase finished. */
+void GC_initiate_gc GC_PROTO((void));
+ /* initiate collection. */
+ /* If the mark state is invalid, this */
+ /* becomes full colleection. Otherwise */
+ /* it's partial. */
+void GC_push_all GC_PROTO((ptr_t bottom, ptr_t top));
+ /* Push everything in a range */
+ /* onto mark stack. */
+void GC_push_selected GC_PROTO(( \
+ ptr_t bottom, \
+ ptr_t top, \
+ int (*dirty_fn) GC_PROTO((struct hblk *h)), \
+ void (*push_fn) GC_PROTO((ptr_t bottom, ptr_t top)) ));
+ /* Push all pages h in [b,t) s.t. */
+ /* select_fn(h) != 0 onto mark stack. */
#ifndef SMALL_CONFIG
- void GC_push_conditional(/* ptr_t b, ptr_t t, GC_bool all*/);
+ void GC_push_conditional GC_PROTO((ptr_t b, ptr_t t, GC_bool all));
#else
# define GC_push_conditional(b, t, all) GC_push_all(b, t)
#endif
/* Do either of the above, depending */
/* on the third arg. */
-void GC_push_all_stack(/*b,t*/); /* As above, but consider */
+void GC_push_all_stack GC_PROTO((ptr_t b, ptr_t t));
+ /* As above, but consider */
/* interior pointers as valid */
-void GC_push_all_eager(/*b,t*/); /* Same as GC_push_all_stack, but */
+void GC_push_all_eager GC_PROTO((ptr_t b, ptr_t t));
+ /* Same as GC_push_all_stack, but */
/* ensures that stack is scanned */
/* immediately, not just scheduled */
/* for scanning. */
#ifndef THREADS
- void GC_push_all_stack_partially_eager(/* bottom, top, cold_gc_frame */);
+ void GC_push_all_stack_partially_eager GC_PROTO(( \
+ ptr_t bottom, ptr_t top, ptr_t cold_gc_frame ));
/* Similar to GC_push_all_eager, but only the */
/* part hotter than cold_gc_frame is scanned */
- /* immediately. Needed to endure that callee- */
+ /* immediately. Needed to ensure that callee- */
/* save registers are not missed. */
#else
/* In the threads case, we push part of the current thread stack */
@@ -1390,163 +1375,240 @@ void GC_push_all_eager(/*b,t*/); /* Same as GC_push_all_stack, but */
/* stacks are scheduled for scanning in *GC_push_other_roots, which */
/* is thread-package-specific. */
#endif
-void GC_push_current_stack(/* ptr_t cold_gc_frame */);
- /* Push enough of the current stack eagerly to */
- /* ensure that callee-save registers saved in */
- /* GC frames are scanned. */
- /* In the non-threads case, schedule entire */
- /* stack for scanning. */
-void GC_push_roots(/* GC_bool all, ptr_t cold_gc_frame */);
- /* Push all or dirty roots. */
-extern void (*GC_push_other_roots)();
- /* Push system or application specific roots */
- /* onto the mark stack. In some environments */
- /* (e.g. threads environments) this is */
- /* predfined to be non-zero. A client supplied */
- /* replacement should also call the original */
- /* function. */
-extern void (*GC_start_call_back)(/* void */);
- /* Called at start of full collections. */
- /* Not called if 0. Called with allocation */
- /* lock held. */
- /* 0 by default. */
-void GC_push_regs(); /* Push register contents onto mark stack. */
-void GC_remark(); /* Mark from all marked objects. Used */
- /* only if we had to drop something. */
-# if defined(MSWIN32)
- void __cdecl GC_push_one();
+void GC_push_current_stack GC_PROTO((ptr_t cold_gc_frame));
+ /* Push enough of the current stack eagerly to */
+ /* ensure that callee-save registers saved in */
+ /* GC frames are scanned. */
+ /* In the non-threads case, schedule entire */
+ /* stack for scanning. */
+void GC_push_roots GC_PROTO((GC_bool all, ptr_t cold_gc_frame));
+ /* Push all or dirty roots. */
+extern void (*GC_push_other_roots) GC_PROTO((void));
+ /* Push system or application specific roots */
+ /* onto the mark stack. In some environments */
+ /* (e.g. threads environments) this is */
+ /* predfined to be non-zero. A client supplied */
+ /* replacement should also call the original */
+ /* function. */
+extern void GC_push_gc_structures GC_PROTO((void));
+ /* Push GC internal roots. These are normally */
+ /* included in the static data segment, and */
+ /* Thus implicitly pushed. But we must do this */
+ /* explicitly if normal root processing is */
+ /* disabled. Calls the following: */
+ extern void GC_push_finalizer_structures GC_PROTO((void));
+ extern void GC_push_stubborn_structures GC_PROTO((void));
+# ifdef THREADS
+ extern void GC_push_thread_structures GC_PROTO((void));
+# endif
+extern void (*GC_start_call_back) GC_PROTO((void));
+ /* Called at start of full collections. */
+ /* Not called if 0. Called with allocation */
+ /* lock held. */
+ /* 0 by default. */
+# if defined(USE_GENERIC_PUSH_REGS)
+ void GC_generic_push_regs GC_PROTO((ptr_t cold_gc_frame));
+# else
+ void GC_push_regs GC_PROTO((void));
+# endif
+ /* Push register contents onto mark stack. */
+ /* If NURSERY is defined, the default push */
+ /* action can be overridden with GC_push_proc */
+
+# ifdef NURSERY
+ extern void (*GC_push_proc)(ptr_t);
+# endif
+# if defined(MSWIN32) || defined(MSWINCE)
+ void __cdecl GC_push_one GC_PROTO((word p));
# else
- void GC_push_one(/*p*/); /* If p points to an object, mark it */
+ void GC_push_one GC_PROTO((word p));
+ /* If p points to an object, mark it */
/* and push contents on the mark stack */
+ /* Pointer recognition test always */
+ /* accepts interior pointers, i.e. this */
+ /* is appropriate for pointers found on */
+ /* stack. */
# endif
-void GC_push_one_checked(/*p*/); /* Ditto, omits plausibility test */
-void GC_push_marked(/* struct hblk h, hdr * hhdr */);
+# if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS)
+ void GC_mark_and_push_stack GC_PROTO((word p, ptr_t source));
+ /* Ditto, omits plausibility test */
+# else
+ void GC_mark_and_push_stack GC_PROTO((word p));
+# endif
+void GC_push_marked GC_PROTO((struct hblk * h, hdr * hhdr));
/* Push contents of all marked objects in h onto */
/* mark stack. */
#ifdef SMALL_CONFIG
# define GC_push_next_marked_dirty(h) GC_push_next_marked(h)
#else
- struct hblk * GC_push_next_marked_dirty(/* h */);
+ struct hblk * GC_push_next_marked_dirty GC_PROTO((struct hblk * h));
/* Invoke GC_push_marked on next dirty block above h. */
/* Return a pointer just past the end of this block. */
#endif /* !SMALL_CONFIG */
-struct hblk * GC_push_next_marked(/* h */);
- /* Ditto, but also mark from clean pages. */
-struct hblk * GC_push_next_marked_uncollectable(/* h */);
- /* Ditto, but mark only from uncollectable pages. */
-GC_bool GC_stopped_mark(); /* Stop world and mark from all roots */
- /* and rescuers. */
-void GC_clear_hdr_marks(/* hhdr */); /* Clear the mark bits in a header */
-void GC_set_hdr_marks(/* hhdr */); /* Set the mark bits in a header */
-void GC_add_roots_inner();
-GC_bool GC_is_static_root(/* ptr_t p */);
- /* Is the address p in one of the registered static */
+struct hblk * GC_push_next_marked GC_PROTO((struct hblk * h));
+ /* Ditto, but also mark from clean pages. */
+struct hblk * GC_push_next_marked_uncollectable GC_PROTO((struct hblk * h));
+ /* Ditto, but mark only from uncollectable pages. */
+GC_bool GC_stopped_mark GC_PROTO((GC_stop_func stop_func));
+ /* Stop world and mark from all roots */
+ /* and rescuers. */
+void GC_clear_hdr_marks GC_PROTO((hdr * hhdr));
+ /* Clear the mark bits in a header */
+void GC_set_hdr_marks GC_PROTO((hdr * hhdr));
+ /* Set the mark bits in a header */
+void GC_set_fl_marks GC_PROTO((ptr_t p));
+ /* Set all mark bits associated with */
+ /* a free list. */
+void GC_add_roots_inner GC_PROTO((char * b, char * e, GC_bool tmp));
+GC_bool GC_is_static_root GC_PROTO((ptr_t p));
+ /* Is the address p in one of the registered static */
+ /* root sections? */
+# if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+GC_bool GC_is_tmp_root GC_PROTO((ptr_t p));
+ /* Is the address p in one of the temporary static */
/* root sections? */
-void GC_register_dynamic_libraries();
- /* Add dynamic library data sections to the root set. */
-
+# endif
+void GC_register_dynamic_libraries GC_PROTO((void));
+ /* Add dynamic library data sections to the root set. */
+
/* Machine dependent startup routines */
-ptr_t GC_get_stack_base();
-void GC_register_data_segments();
-
+ptr_t GC_get_stack_base GC_PROTO((void)); /* Cold end of stack */
+#ifdef IA64
+ ptr_t GC_get_register_stack_base GC_PROTO((void));
+ /* Cold end of register stack. */
+#endif
+void GC_register_data_segments GC_PROTO((void));
+
/* Black listing: */
-void GC_bl_init();
-# ifndef ALL_INTERIOR_POINTERS
- void GC_add_to_black_list_normal(/* bits, maybe source */);
+void GC_bl_init GC_PROTO((void));
+# ifdef PRINT_BLACK_LIST
+ void GC_add_to_black_list_normal GC_PROTO((word p, ptr_t source));
/* Register bits as a possible future false */
/* reference from the heap or static data */
-# ifdef PRINT_BLACK_LIST
# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_normal(bits, source)
-# else
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_normal(bits)
-# endif
+ if (GC_all_interior_pointers) { \
+ GC_add_to_black_list_stack(bits, (ptr_t)(source)); \
+ } else { \
+ GC_add_to_black_list_normal(bits, (ptr_t)(source)); \
+ }
# else
-# ifdef PRINT_BLACK_LIST
-# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_stack(bits, source)
-# else
+ void GC_add_to_black_list_normal GC_PROTO((word p));
# define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \
- GC_add_to_black_list_stack(bits)
-# endif
+ if (GC_all_interior_pointers) { \
+ GC_add_to_black_list_stack(bits); \
+ } else { \
+ GC_add_to_black_list_normal(bits); \
+ }
# endif
-void GC_add_to_black_list_stack(/* bits, maybe source */);
-struct hblk * GC_is_black_listed(/* h, len */);
- /* If there are likely to be false references */
- /* to a block starting at h of the indicated */
- /* length, then return the next plausible */
- /* starting location for h that might avoid */
- /* these false references. */
-void GC_promote_black_lists();
- /* Declare an end to a black listing phase. */
-void GC_unpromote_black_lists();
- /* Approximately undo the effect of the above. */
- /* This actually loses some information, but */
- /* only in a reasonably safe way. */
-word GC_number_stack_black_listed(/*struct hblk *start, struct hblk *endp1 */);
- /* Return the number of (stack) blacklisted */
- /* blocks in the range for statistical */
- /* purposes. */
-
-ptr_t GC_scratch_alloc(/*bytes*/);
- /* GC internal memory allocation for */
- /* small objects. Deallocation is not */
- /* possible. */
-
+# ifdef PRINT_BLACK_LIST
+ void GC_add_to_black_list_stack GC_PROTO((word p, ptr_t source));
+# else
+ void GC_add_to_black_list_stack GC_PROTO((word p));
+# endif
+struct hblk * GC_is_black_listed GC_PROTO((struct hblk * h, word len));
+ /* If there are likely to be false references */
+ /* to a block starting at h of the indicated */
+ /* length, then return the next plausible */
+ /* starting location for h that might avoid */
+ /* these false references. */
+void GC_promote_black_lists GC_PROTO((void));
+ /* Declare an end to a black listing phase. */
+void GC_unpromote_black_lists GC_PROTO((void));
+ /* Approximately undo the effect of the above. */
+ /* This actually loses some information, but */
+ /* only in a reasonably safe way. */
+word GC_number_stack_black_listed GC_PROTO(( \
+ struct hblk *start, struct hblk *endp1));
+ /* Return the number of (stack) blacklisted */
+ /* blocks in the range for statistical */
+ /* purposes. */
+
+ptr_t GC_scratch_alloc GC_PROTO((word bytes));
+ /* GC internal memory allocation for */
+ /* small objects. Deallocation is not */
+ /* possible. */
+
/* Heap block layout maps: */
-void GC_invalidate_map(/* hdr */);
- /* Remove the object map associated */
- /* with the block. This identifies */
- /* the block as invalid to the mark */
- /* routines. */
-GC_bool GC_add_map_entry(/*sz*/);
- /* Add a heap block map for objects of */
- /* size sz to obj_map. */
- /* Return FALSE on failure. */
-void GC_register_displacement_inner(/*offset*/);
- /* Version of GC_register_displacement */
- /* that assumes lock is already held */
- /* and signals are already disabled. */
-
+void GC_invalidate_map GC_PROTO((hdr * hhdr));
+ /* Remove the object map associated */
+ /* with the block. This identifies */
+ /* the block as invalid to the mark */
+ /* routines. */
+GC_bool GC_add_map_entry GC_PROTO((word sz));
+ /* Add a heap block map for objects of */
+ /* size sz to obj_map. */
+ /* Return FALSE on failure. */
+void GC_register_displacement_inner GC_PROTO((word offset));
+ /* Version of GC_register_displacement */
+ /* that assumes lock is already held */
+ /* and signals are already disabled. */
+
/* hblk allocation: */
-void GC_new_hblk(/*size_in_words, kind*/);
- /* Allocate a new heap block, and build */
- /* a free list in it. */
-struct hblk * GC_allochblk(/*size_in_words, kind*/);
- /* Allocate a heap block, clear it if */
- /* for composite objects, inform */
+void GC_new_hblk GC_PROTO((word size_in_words, int kind));
+ /* Allocate a new heap block, and build */
+ /* a free list in it. */
+
+ptr_t GC_build_fl GC_PROTO((struct hblk *h, word sz,
+ GC_bool clear, ptr_t list));
+ /* Build a free list for objects of */
+ /* size sz in block h. Append list to */
+ /* end of the free lists. Possibly */
+ /* clear objects on the list. Normally */
+ /* called by GC_new_hblk, but also */
+ /* called explicitly without GC lock. */
+
+struct hblk * GC_allochblk GC_PROTO(( \
+ word size_in_words, int kind, unsigned flags));
+ /* Allocate a heap block, inform */
/* the marker that block is valid */
/* for objects of indicated size. */
- /* sz < 0 ==> atomic. */
-void GC_freehblk(); /* Deallocate a heap block and mark it */
- /* as invalid. */
-
+
+ptr_t GC_alloc_large GC_PROTO((word lw, int k, unsigned flags));
+ /* Allocate a large block of size lw words. */
+ /* The block is not cleared. */
+ /* Flags is 0 or IGNORE_OFF_PAGE. */
+ /* Calls GC_allchblk to do the actual */
+ /* allocation, but also triggers GC and/or */
+ /* heap expansion as appropriate. */
+ /* Does not update GC_words_allocd, but does */
+ /* other accounting. */
+
+ptr_t GC_alloc_large_and_clear GC_PROTO((word lw, int k, unsigned flags));
+ /* As above, but clear block if appropriate */
+ /* for kind k. */
+
+void GC_freehblk GC_PROTO((struct hblk * p));
+ /* Deallocate a heap block and mark it */
+ /* as invalid. */
+
/* Misc GC: */
-void GC_init_inner();
-GC_bool GC_expand_hp_inner();
-void GC_start_reclaim(/*abort_if_found*/);
- /* Restore unmarked objects to free */
- /* lists, or (if abort_if_found is */
- /* TRUE) report them. */
- /* Sweeping of small object pages is */
- /* largely deferred. */
-void GC_continue_reclaim(/*size, kind*/);
- /* Sweep pages of the given size and */
- /* kind, as long as possible, and */
- /* as long as the corr. free list is */
- /* empty. */
-void GC_reclaim_or_delete_all();
- /* Arrange for all reclaim lists to be */
- /* empty. Judiciously choose between */
- /* sweeping and discarding each page. */
-GC_bool GC_reclaim_all(/* GC_stop_func f*/);
- /* Reclaim all blocks. Abort (in a */
- /* consistent state) if f returns TRUE. */
-GC_bool GC_block_empty(/* hhdr */); /* Block completely unmarked? */
-GC_bool GC_never_stop_func(); /* Returns FALSE. */
-GC_bool GC_try_to_collect_inner(/* GC_stop_func f */);
+void GC_init_inner GC_PROTO((void));
+GC_bool GC_expand_hp_inner GC_PROTO((word n));
+void GC_start_reclaim GC_PROTO((int abort_if_found));
+ /* Restore unmarked objects to free */
+ /* lists, or (if abort_if_found is */
+ /* TRUE) report them. */
+ /* Sweeping of small object pages is */
+ /* largely deferred. */
+void GC_continue_reclaim GC_PROTO((word sz, int kind));
+ /* Sweep pages of the given size and */
+ /* kind, as long as possible, and */
+ /* as long as the corr. free list is */
+ /* empty. */
+void GC_reclaim_or_delete_all GC_PROTO((void));
+ /* Arrange for all reclaim lists to be */
+ /* empty. Judiciously choose between */
+ /* sweeping and discarding each page. */
+GC_bool GC_reclaim_all GC_PROTO((GC_stop_func stop_func, GC_bool ignore_old));
+ /* Reclaim all blocks. Abort (in a */
+ /* consistent state) if f returns TRUE. */
+GC_bool GC_block_empty GC_PROTO((hdr * hhdr));
+ /* Block completely unmarked? */
+GC_bool GC_never_stop_func GC_PROTO((void));
+ /* Returns FALSE. */
+GC_bool GC_try_to_collect_inner GC_PROTO((GC_stop_func f));
+
/* Collect; caller must have acquired */
/* lock and disabled signals. */
/* Collection is aborted if f returns */
@@ -1554,87 +1616,133 @@ GC_bool GC_try_to_collect_inner(/* GC_stop_func f */);
/* successfully. */
# define GC_gcollect_inner() \
(void) GC_try_to_collect_inner(GC_never_stop_func)
-void GC_finish_collection(); /* Finish collection. Mark bits are */
- /* consistent and lock is still held. */
-GC_bool GC_collect_or_expand(/* needed_blocks */);
- /* Collect or expand heap in an attempt */
- /* make the indicated number of free */
- /* blocks available. Should be called */
- /* until the blocks are available or */
- /* until it fails by returning FALSE. */
-GC_API void GC_init(); /* Initialize collector. */
-void GC_collect_a_little_inner(/* int n */);
- /* Do n units worth of garbage */
- /* collection work, if appropriate. */
- /* A unit is an amount appropriate for */
- /* HBLKSIZE bytes of allocation. */
-ptr_t GC_generic_malloc(/* bytes, kind */);
- /* Allocate an object of the given */
- /* kind. By default, there are only */
- /* a few kinds: composite(pointerfree), */
+void GC_finish_collection GC_PROTO((void));
+ /* Finish collection. Mark bits are */
+ /* consistent and lock is still held. */
+GC_bool GC_collect_or_expand GC_PROTO(( \
+ word needed_blocks, GC_bool ignore_off_page));
+ /* Collect or expand heap in an attempt */
+ /* make the indicated number of free */
+ /* blocks available. Should be called */
+ /* until the blocks are available or */
+ /* until it fails by returning FALSE. */
+GC_API void GC_init GC_PROTO((void)); /* Initialize collector. */
+
+#if defined(MSWIN32) || defined(MSWINCE)
+ void GC_deinit GC_PROTO((void));
+ /* Free any resources allocated by */
+ /* GC_init */
+#endif
+
+void GC_collect_a_little_inner GC_PROTO((int n));
+ /* Do n units worth of garbage */
+ /* collection work, if appropriate. */
+ /* A unit is an amount appropriate for */
+ /* HBLKSIZE bytes of allocation. */
+ptr_t GC_generic_malloc GC_PROTO((word lb, int k));
+ /* Allocate an object of the given */
+ /* kind. By default, there are only */
+ /* a few kinds: composite(pointerfree), */
/* atomic, uncollectable, etc. */
/* We claim it's possible for clever */
/* client code that understands GC */
/* internals to add more, e.g. to */
/* communicate object layout info */
/* to the collector. */
-ptr_t GC_generic_malloc_ignore_off_page(/* bytes, kind */);
- /* As above, but pointers past the */
- /* first page of the resulting object */
- /* are ignored. */
-ptr_t GC_generic_malloc_inner(/* bytes, kind */);
- /* Ditto, but I already hold lock, etc. */
-ptr_t GC_generic_malloc_words_small GC_PROTO((size_t words, int kind));
- /* As above, but size in units of words */
- /* Bypasses MERGE_SIZES. Assumes */
- /* words <= MAXOBJSZ. */
-ptr_t GC_generic_malloc_inner_ignore_off_page(/* bytes, kind */);
- /* Allocate an object, where */
- /* the client guarantees that there */
- /* will always be a pointer to the */
- /* beginning of the object while the */
- /* object is live. */
-ptr_t GC_allocobj(/* sz_inn_words, kind */);
- /* Make the indicated */
- /* free list nonempty, and return its */
- /* head. */
-
-void GC_init_headers();
-GC_bool GC_install_header(/*h*/);
- /* Install a header for block h. */
- /* Return FALSE on failure. */
-GC_bool GC_install_counts(/*h, sz*/);
- /* Set up forwarding counts for block */
- /* h of size sz. */
- /* Return FALSE on failure. */
-void GC_remove_header(/*h*/);
- /* Remove the header for block h. */
-void GC_remove_counts(/*h, sz*/);
- /* Remove forwarding counts for h. */
-hdr * GC_find_header(/*p*/); /* Debugging only. */
-
-void GC_finalize(); /* Perform all indicated finalization actions */
- /* on unmarked objects. */
- /* Unreachable finalizable objects are enqueued */
- /* for processing by GC_invoke_finalizers. */
- /* Invoked with lock. */
-
-void GC_add_to_heap(/*p, bytes*/);
- /* Add a HBLKSIZE aligned chunk to the heap. */
-
-void GC_print_obj(/* ptr_t p */);
- /* P points to somewhere inside an object with */
- /* debugging info. Print a human readable */
- /* description of the object to stderr. */
-extern void (*GC_check_heap)();
- /* Check that all objects in the heap with */
- /* debugging info are intact. Print */
- /* descriptions of any that are not. */
-extern void (*GC_print_heap_obj)(/* ptr_t p */);
- /* If possible print s followed by a more */
- /* detailed description of the object */
- /* referred to by p. */
-
+ptr_t GC_generic_malloc_ignore_off_page GC_PROTO((size_t b, int k));
+ /* As above, but pointers past the */
+ /* first page of the resulting object */
+ /* are ignored. */
+ptr_t GC_generic_malloc_inner GC_PROTO((word lb, int k));
+ /* Ditto, but I already hold lock, etc. */
+ptr_t GC_generic_malloc_words_small GC_PROTO((size_t lw, int k));
+ /* As above, but size in units of words */
+ /* Bypasses MERGE_SIZES. Assumes */
+ /* words <= MAXOBJSZ. */
+ptr_t GC_generic_malloc_inner_ignore_off_page GC_PROTO((size_t lb, int k));
+ /* Allocate an object, where */
+ /* the client guarantees that there */
+ /* will always be a pointer to the */
+ /* beginning of the object while the */
+ /* object is live. */
+ptr_t GC_allocobj GC_PROTO((word sz, int kind));
+ /* Make the indicated */
+ /* free list nonempty, and return its */
+ /* head. */
+
+void GC_init_headers GC_PROTO((void));
+struct hblkhdr * GC_install_header GC_PROTO((struct hblk *h));
+ /* Install a header for block h. */
+ /* Return 0 on failure, or the header */
+ /* otherwise. */
+GC_bool GC_install_counts GC_PROTO((struct hblk * h, word sz));
+ /* Set up forwarding counts for block */
+ /* h of size sz. */
+ /* Return FALSE on failure. */
+void GC_remove_header GC_PROTO((struct hblk * h));
+ /* Remove the header for block h. */
+void GC_remove_counts GC_PROTO((struct hblk * h, word sz));
+ /* Remove forwarding counts for h. */
+hdr * GC_find_header GC_PROTO((ptr_t h)); /* Debugging only. */
+
+void GC_finalize GC_PROTO((void));
+ /* Perform all indicated finalization actions */
+ /* on unmarked objects. */
+ /* Unreachable finalizable objects are enqueued */
+ /* for processing by GC_invoke_finalizers. */
+ /* Invoked with lock. */
+
+void GC_notify_or_invoke_finalizers GC_PROTO((void));
+ /* If GC_finalize_on_demand is not set, invoke */
+ /* eligible finalizers. Otherwise: */
+ /* Call *GC_finalizer_notifier if there are */
+ /* finalizers to be run, and we haven't called */
+ /* this procedure yet this GC cycle. */
+
+void GC_add_to_heap GC_PROTO((struct hblk *p, word bytes));
+ /* Add a HBLKSIZE aligned chunk to the heap. */
+
+void GC_print_obj GC_PROTO((ptr_t p));
+ /* P points to somewhere inside an object with */
+ /* debugging info. Print a human readable */
+ /* description of the object to stderr. */
+extern void (*GC_check_heap) GC_PROTO((void));
+ /* Check that all objects in the heap with */
+ /* debugging info are intact. Print */
+ /* descriptions of any that are not. */
+extern void (*GC_print_heap_obj) GC_PROTO((ptr_t p));
+ /* If possible print s followed by a more */
+ /* detailed description of the object */
+ /* referred to by p. */
+
+extern GC_bool GC_print_stats; /* Produce at least some logging output */
+ /* Set from environment variable. */
+
+/* Macros used for collector internal allocation. */
+/* These assume the collector lock is held. */
+#ifdef DBG_HDRS_ALL
+ extern GC_PTR GC_debug_generic_malloc_inner(size_t lb, int k);
+ extern GC_PTR GC_debug_generic_malloc_inner_ignore_off_page(size_t lb,
+ int k);
+# define GC_INTERNAL_MALLOC GC_debug_generic_malloc_inner
+# define GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE \
+ GC_debug_generic_malloc_inner_ignore_off_page
+# ifdef THREADS
+# define GC_INTERNAL_FREE GC_debug_free_inner
+# else
+# define GC_INTERNAL_FREE GC_debug_free
+# endif
+#else
+# define GC_INTERNAL_MALLOC GC_generic_malloc_inner
+# define GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE \
+ GC_generic_malloc_inner_ignore_off_page
+# ifdef THREADS
+# define GC_INTERNAL_FREE GC_free_inner
+# else
+# define GC_INTERNAL_FREE GC_free
+# endif
+#endif
+
/* Memory unmapping: */
#ifdef USE_MUNMAP
void GC_unmap_old(void);
@@ -1646,35 +1754,38 @@ extern void (*GC_print_heap_obj)(/* ptr_t p */);
/* Virtual dirty bit implementation: */
/* Each implementation exports the following: */
-void GC_read_dirty(); /* Retrieve dirty bits. */
-GC_bool GC_page_was_dirty(/* struct hblk * h */);
- /* Read retrieved dirty bits. */
-GC_bool GC_page_was_ever_dirty(/* struct hblk * h */);
- /* Could the page contain valid heap pointers? */
-void GC_is_fresh(/* struct hblk * h, word number_of_blocks */);
- /* Assert the region currently contains no */
- /* valid pointers. */
-void GC_write_hint(/* struct hblk * h */);
- /* h is about to be written. */
-void GC_dirty_init();
-
+void GC_read_dirty GC_PROTO((void));
+ /* Retrieve dirty bits. */
+GC_bool GC_page_was_dirty GC_PROTO((struct hblk *h));
+ /* Read retrieved dirty bits. */
+GC_bool GC_page_was_ever_dirty GC_PROTO((struct hblk *h));
+ /* Could the page contain valid heap pointers? */
+void GC_is_fresh GC_PROTO((struct hblk *h, word n));
+ /* Assert the region currently contains no */
+ /* valid pointers. */
+void GC_write_hint GC_PROTO((struct hblk *h));
+ /* h is about to be written. */
+void GC_dirty_init GC_PROTO((void));
+
/* Slow/general mark bit manipulation: */
-GC_API GC_bool GC_is_marked();
-void GC_clear_mark_bit();
-void GC_set_mark_bit();
-
+GC_API GC_bool GC_is_marked GC_PROTO((ptr_t p));
+void GC_clear_mark_bit GC_PROTO((ptr_t p));
+void GC_set_mark_bit GC_PROTO((ptr_t p));
+
/* Stubborn objects: */
-void GC_read_changed(); /* Analogous to GC_read_dirty */
-GC_bool GC_page_was_changed(/* h */); /* Analogous to GC_page_was_dirty */
-void GC_clean_changing_list(); /* Collect obsolete changing list entries */
-void GC_stubborn_init();
-
+void GC_read_changed GC_PROTO((void)); /* Analogous to GC_read_dirty */
+GC_bool GC_page_was_changed GC_PROTO((struct hblk * h));
+ /* Analogous to GC_page_was_dirty */
+void GC_clean_changing_list GC_PROTO((void));
+ /* Collect obsolete changing list entries */
+void GC_stubborn_init GC_PROTO((void));
+
/* Debugging print routines: */
-void GC_print_block_list();
-void GC_print_hblkfreelist();
-void GC_print_heap_sects();
-void GC_print_static_roots();
-void GC_dump();
+void GC_print_block_list GC_PROTO((void));
+void GC_print_hblkfreelist GC_PROTO((void));
+void GC_print_heap_sects GC_PROTO((void));
+void GC_print_static_roots GC_PROTO((void));
+void GC_dump GC_PROTO((void));
#ifdef KEEP_BACK_PTRS
void GC_store_back_pointer(ptr_t source, ptr_t dest);
@@ -1688,15 +1799,19 @@ void GC_dump();
/* Make arguments appear live to compiler */
# ifdef __WATCOMC__
- void GC_noop(void*, ...);
+ void GC_noop(void*, ...);
# else
- GC_API void GC_noop();
+# ifdef __DMC__
+ GC_API void GC_noop(...);
+# else
+ GC_API void GC_noop();
+# endif
# endif
-void GC_noop1(/* word arg */);
+void GC_noop1 GC_PROTO((word));
/* Logging and diagnostic output: */
-GC_API void GC_printf GC_PROTO((char * format, long, long, long, long, long, long));
+GC_API void GC_printf GC_PROTO((GC_CONST char * format, long, long, long, long, long, long));
/* A version of printf that doesn't allocate, */
/* is restricted to long arguments, and */
/* (unfortunately) doesn't use varargs for */
@@ -1715,7 +1830,7 @@ GC_API void GC_printf GC_PROTO((char * format, long, long, long, long, long, lon
# define GC_printf6(f,a,b,c,d,e,g) GC_printf(f, (long)a, (long)b, (long)c, \
(long)d, (long)e, (long)g)
-void GC_err_printf(/* format, a, b, c, d, e, f */);
+GC_API void GC_err_printf GC_PROTO((GC_CONST char * format, long, long, long, long, long, long));
# define GC_err_printf0(f) GC_err_puts(f)
# define GC_err_printf1(f,a) GC_err_printf(f, (long)a, 0l, 0l, 0l, 0l, 0l)
# define GC_err_printf2(f,a,b) GC_err_printf(f, (long)a, (long)b, 0l, 0l, 0l, 0l)
@@ -1731,18 +1846,86 @@ void GC_err_printf(/* format, a, b, c, d, e, f */);
(long)e, (long)g)
/* Ditto, writes to stderr. */
-void GC_err_puts(/* char *s */);
+void GC_err_puts GC_PROTO((GC_CONST char *s));
/* Write s to stderr, don't buffer, don't add */
/* newlines, don't ... */
+#if defined(LINUX) && !defined(SMALL_CONFIG)
+ void GC_err_write GC_PROTO((GC_CONST char *buf, size_t len));
+ /* Write buf to stderr, don't buffer, don't add */
+ /* newlines, don't ... */
+#endif
-# ifdef GC_ASSERTIONS
+
+# ifdef GC_ASSERTIONS
# define GC_ASSERT(expr) if(!(expr)) {\
GC_err_printf2("Assertion failure: %s:%ld\n", \
__FILE__, (unsigned long)__LINE__); \
ABORT("assertion failure"); }
-# else
+# else
# define GC_ASSERT(expr)
+# endif
+
+# if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+ /* We need additional synchronization facilities from the thread */
+ /* support. We believe these are less performance critical */
+ /* than the main garbage collector lock; standard pthreads-based */
+ /* implementations should be sufficient. */
+
+ /* The mark lock and condition variable. If the GC lock is also */
+ /* acquired, the GC lock must be acquired first. The mark lock is */
+ /* used to both protect some variables used by the parallel */
+ /* marker, and to protect GC_fl_builder_count, below. */
+ /* GC_notify_all_marker() is called when */
+ /* the state of the parallel marker changes */
+ /* in some significant way (see gc_mark.h for details). The */
+ /* latter set of events includes incrementing GC_mark_no. */
+ /* GC_notify_all_builder() is called when GC_fl_builder_count */
+ /* reaches 0. */
+
+ extern void GC_acquire_mark_lock();
+ extern void GC_release_mark_lock();
+ extern void GC_notify_all_builder();
+ /* extern void GC_wait_builder(); */
+ extern void GC_wait_for_reclaim();
+
+ extern word GC_fl_builder_count; /* Protected by mark lock. */
+# endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
+# ifdef PARALLEL_MARK
+ extern void GC_notify_all_marker();
+ extern void GC_wait_marker();
+ extern word GC_mark_no; /* Protected by mark lock. */
+
+ extern void GC_help_marker(word my_mark_no);
+ /* Try to help out parallel marker for mark cycle */
+ /* my_mark_no. Returns if the mark cycle finishes or */
+ /* was already done, or there was nothing to do for */
+ /* some other reason. */
+# endif /* PARALLEL_MARK */
+
+# if defined(LINUX_THREADS) || defined(IRIX_THREADS) \
+ || defined(HPUX_THREADS) || defined(OSF1_THREADS)
+ /* We define the thread suspension signal here, so that we can refer */
+ /* to it in the dirty bit implementation, if necessary. Ideally we */
+ /* would allocate a (real-time ?) signal using the standard mechanism.*/
+ /* unfortunately, there is no standard mechanism. (There is one */
+ /* in Linux glibc, but it's not exported.) Thus we continue to use */
+ /* the same hard-coded signals we've always used. */
+# if !defined(SIG_SUSPEND)
+# if defined(LINUX_THREADS)
+# if defined(SPARC) && !defined(SIGPWR)
+ /* SPARC/Linux doesn't properly define SIGPWR in <signal.h>.
+ * It is aliased to SIGLOST in asm/signal.h, though. */
+# define SIG_SUSPEND SIGLOST
+# else
+ /* Linuxthreads uses SIGUSR1 and SIGUSR2. */
+# define SIG_SUSPEND SIGPWR
+# endif
+# else /* !LINUX_THREADS */
+# define SIG_SUSPEND _SIGRTMIN + 6
# endif
+# endif /* !SIG_SUSPEND */
+
+# endif
# endif /* GC_PRIVATE_H */
diff --git a/gc/include/private/gcconfig.h b/gc/include/private/gcconfig.h
@@ -2,6 +2,7 @@
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -13,9 +14,9 @@
* modified is included with the above copyright notice.
*/
-#ifndef CONFIG_H
+#ifndef GCCONFIG_H
-# define CONFIG_H
+# define GCCONFIG_H
/* Machine dependent parameters. Some tuning parameters can be found */
/* near the top of gc_private.h. */
@@ -27,6 +28,11 @@
# define LINUX
# endif
+/* And one for NetBSD: */
+# if defined(__NetBSD__)
+# define NETBSD
+# endif
+
/* Determine the machine type: */
# if defined(sun) && defined(mc68000)
# define M68K
@@ -50,7 +56,14 @@
# endif
# if defined(__NetBSD__) && defined(m68k)
# define M68K
-# define NETBSD
+# define mach_type_known
+# endif
+# if defined(__NetBSD__) && defined(__powerpc__)
+# define POWERPC
+# define mach_type_known
+# endif
+# if defined(__NetBSD__) && defined(__arm32__)
+# define ARM32
# define mach_type_known
# endif
# if defined(vax)
@@ -64,23 +77,29 @@
# endif
# if defined(mips) || defined(__mips)
# define MIPS
-# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
-# define ULTRIX
-# else
-# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
-# define IRIX5 /* or IRIX 6.X */
-# else
-# define RISCOS /* or IRIX 4.X */
-# endif
+# if !defined(LINUX)
+# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
+# define ULTRIX
+# else
+# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
+ || defined(__SYSTYPE_SVR4__)
+# define IRIX5 /* or IRIX 6.X */
+# else
+# define RISCOS /* or IRIX 4.X */
+# endif
+# endif
+# endif /* !LINUX */
+# if defined(__NetBSD__) && defined(__MIPSEL__)
+# undef ULTRIX
# endif
# define mach_type_known
# endif
-# if defined(sequent) && defined(i386)
+# if defined(sequent) && (defined(i386) || defined(__i386__))
# define I386
# define SEQUENT
# define mach_type_known
# endif
-# if defined(sun) && defined(i386)
+# if defined(sun) && (defined(i386) || defined(__i386__))
# define I386
# define SUNOS5
# define mach_type_known
@@ -106,7 +125,7 @@
# define mach_type_known
# endif
# if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
- && !defined(__OpenBSD__)
+ && !defined(__OpenBSD__) && !(__NetBSD__)
# define SPARC
# define DRSNX
# define mach_type_known
@@ -115,6 +134,10 @@
# define RS6000
# define mach_type_known
# endif
+# if defined(__NetBSD__) && defined(__sparc__)
+# define SPARC
+# define mach_type_known
+# endif
# if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
/* The above test may need refinement */
# define I386
@@ -130,16 +153,28 @@
# define SYSV
# define mach_type_known
# endif
-# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) \
+# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
|| defined(hppa) || defined(__hppa__)
# define HP_PA
+# ifndef LINUX
+# define HPUX
+# endif
# define mach_type_known
# endif
+# if defined(__BEOS__) && defined(_X86_)
+# define I386
+# define BEOS
+# define mach_type_known
+# endif
# if defined(LINUX) && (defined(i386) || defined(__i386__))
# define I386
# define mach_type_known
# endif
-# if defined(LINUX) && defined(powerpc)
+# if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
+# define IA64
+# define mach_type_known
+# endif
+# if defined(LINUX) && (defined(powerpc) || defined(__powerpc__))
# define POWERPC
# define mach_type_known
# endif
@@ -147,13 +182,21 @@
# define M68K
# define mach_type_known
# endif
-# if defined(LINUX) && defined(sparc)
+# if defined(LINUX) && (defined(sparc) || defined(__sparc__))
# define SPARC
# define mach_type_known
# endif
+# if defined(LINUX) && defined(__arm__)
+# define ARM32
+# define mach_type_known
+# endif
+# if defined(LINUX) && defined(__sh__)
+# define SH
+# define mach_type_known
+# endif
# if defined(__alpha) || defined(__alpha__)
# define ALPHA
-# if !defined(LINUX)
+# if !defined(LINUX) && !defined(NETBSD)
# define OSF1 /* a.k.a Digital Unix */
# endif
# define mach_type_known
@@ -175,37 +218,42 @@
# define MACOS
# define mach_type_known
# endif
-# if defined(macosx)
+# if defined(macosx) || \
+ defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
# define MACOSX
# define POWERPC
# define mach_type_known
# endif
+# if defined(__APPLE__) && defined(__MACH__) && defined(__i386__)
+# define MACOSX
+# define I386
+ --> Not really supported, but at least we recognize it.
+# endif
# if defined(NeXT) && defined(mc68000)
# define M68K
# define NEXT
# define mach_type_known
# endif
-# if defined(NeXT) && defined(i386)
+# if defined(NeXT) && (defined(i386) || defined(__i386__))
# define I386
# define NEXT
# define mach_type_known
# endif
-# if defined(__OpenBSD__) && defined(i386)
+# if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
# define I386
# define OPENBSD
# define mach_type_known
# endif
-# if defined(__FreeBSD__) && defined(i386)
+# if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
# define I386
# define FREEBSD
# define mach_type_known
# endif
-# if defined(__NetBSD__) && defined(i386)
+# if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
# define I386
-# define NETBSD
# define mach_type_known
# endif
-# if defined(bsdi) && defined(i386)
+# if defined(bsdi) && (defined(i386) || defined(__i386__))
# define I386
# define BSDI
# define mach_type_known
@@ -225,11 +273,26 @@
/* DGUX defined */
# define mach_type_known
# endif
-# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
-# define I386
-# define MSWIN32 /* or Win32s */
+# if defined(_WIN32_WCE)
+ /* SH3, SH4, MIPS already defined for corresponding architectures */
+# if defined(SH3) || defined(SH4)
+# define SH
+# endif
+# if defined(x86)
+# define I386
+# endif
+# if defined(ARM)
+# define ARM32
+# endif
+# define MSWINCE
# define mach_type_known
+# else
+# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
+ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+# define I386
+# define MSWIN32 /* or Win32s */
+# define mach_type_known
+# endif
# endif
# if defined(__DJGPP__)
# define I386
@@ -243,6 +306,11 @@
# define CYGWIN32
# define mach_type_known
# endif
+# if defined(__MINGW32__)
+# define I386
+# define MSWIN32
+# define mach_type_known
+# endif
# if defined(__BORLANDC__)
# define I386
# define MSWIN32
@@ -253,6 +321,15 @@
# define UTS4
# define mach_type_known
# endif
+# if defined(__pj__)
+# define PJ
+# define mach_type_known
+# endif
+# if defined(__embedded__) && defined(PPC)
+# define POWERPC
+# define NOSYS
+# define mach_type_known
+# endif
/* Ivan Demakov */
# if defined(__WATCOMC__) && defined(__386__)
# define I386
@@ -269,6 +346,18 @@
# endif
# define mach_type_known
# endif
+# if defined(__s390__) && defined(LINUX)
+# define S370
+# define mach_type_known
+# endif
+# if defined(__GNU__)
+# if defined(__i386__)
+/* The Debian Hurd running on generic PC */
+# define HURD
+# define I386
+# define mach_type_known
+# endif
+# endif
/* Feel free to add more clauses here */
@@ -297,9 +386,9 @@
/* RS6000 ==> IBM RS/6000 AIX3.X */
/* RT ==> IBM PC/RT */
/* HP_PA ==> HP9000/700 & /800 */
- /* HP/UX */
- /* SPARC ==> SPARC under SunOS */
- /* (SUNOS4, SUNOS5, */
+ /* HP/UX, LINUX */
+ /* SPARC ==> SPARC v7/v8/v9 */
+ /* (SUNOS4, SUNOS5, LINUX, */
/* DRSNX variants) */
/* ALPHA ==> DEC Alpha */
/* (OSF1 and LINUX variants) */
@@ -307,6 +396,12 @@
/* (CX_UX and DGUX) */
/* S370 ==> 370-like machine */
/* running Amdahl UTS4 */
+ /* or a 390 running LINUX */
+ /* ARM32 ==> Intel StrongARM */
+ /* IA64 ==> Intel IA64 */
+ /* (e.g. Itanium) */
+ /* SH ==> Hitachi SuperH */
+ /* (LINUX & MSWINCE) */
/*
@@ -355,6 +450,13 @@
* to the nearest plausible page boundary, and use that instead
* of STACKBOTTOM.
*
+ * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
+ * the value of environ is a pointer that can serve as STACKBOTTOM.
+ * I expect that HEURISTIC2 can be replaced by this approach, which
+ * interferes far less with debugging. However it has the disadvantage
+ * that it's confused by a putenv call before the collector is initialized.
+ * This could be dealt with by intercepting putenv ...
+ *
* If no expression for STACKBOTTOM can be found, and neither of the above
* heuristics are usable, the collector can still be used with all of the above
* undefined, provided one of the following is done:
@@ -392,8 +494,25 @@
*
* An architecture may define DYNAMIC_LOADING if dynamic_load.c
* defined GC_register_dynamic_libraries() for the architecture.
+ *
+ * An architecture may define PREFETCH(x) to preload the cache with *x.
+ * This defaults to a no-op.
+ *
+ * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
+ *
+ * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
+ * clear the two words at GC_malloc-aligned address x. By default,
+ * word stores of 0 are used instead.
*/
+/* If we are using a recent version of gcc, we can use __builtin_unwind_init()
+ * to push the relevant registers onto the stack. This generally makes
+ * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
+ */
+# if defined(__GNUC__) && ((__GNUC__ >= 3) || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
+# define HAVE_BUILTIN_UNWIND_INIT
+# endif
# define STACK_GRAN 0x1000000
# ifdef M68K
@@ -417,8 +536,12 @@
# define MPROTECT_VDB
# ifdef __ELF__
# define DYNAMIC_LOADING
- extern char **__environ;
-# define DATASTART ((ptr_t)(&__environ))
+# include <features.h>
+# if defined(__GLIBC__)&& __GLIBC__>=2
+# define LINUX_DATA_START
+# else /* !GLIBC2 */
+ extern char **__environ;
+# define DATASTART ((ptr_t)(&__environ))
/* hideous kludge: __environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
@@ -427,6 +550,7 @@
/* would include .rodata, which may */
/* contain large read-only data tables */
/* that we'd rather not scan. */
+# endif /* !GLIBC2 */
extern int _end;
# define DATAEND (&_end)
# else
@@ -513,19 +637,43 @@
/* This was 2, but that didn't sound right. */
# define OS_TYPE "LINUX"
# define HEURISTIC1
+# define DYNAMIC_LOADING
# undef STACK_GRAN
# define STACK_GRAN 0x10000000
/* Stack usually starts at 0x80000000 */
-# define DATASTART GC_data_start
+# define LINUX_DATA_START
extern int _end;
# define DATAEND (&_end)
# endif
# ifdef MACOSX
+ /* There are reasons to suspect this may not be reliable. */
# define ALIGNMENT 4
# define OS_TYPE "MACOSX"
# define DATASTART ((ptr_t) get_etext())
# define STACKBOTTOM ((ptr_t) 0xc0000000)
# define DATAEND /* not needed */
+# define MPROTECT_VDB
+# include <unistd.h>
+# define GETPAGESIZE() getpagesize()
+# endif
+# ifdef NETBSD
+# define ALIGNMENT 4
+# define OS_TYPE "NETBSD"
+# define HEURISTIC2
+ extern char etext;
+# define DATASTART GC_data_start
+# define DYNAMIC_LOADING
+# endif
+# ifdef NOSYS
+# define ALIGNMENT 4
+# define OS_TYPE "NOSYS"
+ extern void __end, __dso_handle;
+# define DATASTART (&__dso_handle) /* OK, that's ugly. */
+# define DATAEND (&__end)
+ /* Stack starts at 0xE0000000 for the simulator. */
+# undef STACK_GRAN
+# define STACK_GRAN 0x10000000
+# define HEURISTIC1
# endif
# endif
@@ -554,9 +702,12 @@
# ifdef SPARC
# define MACH_TYPE "SPARC"
-# define ALIGNMENT 4 /* Required by hardware */
+# if defined(__arch64__) || defined(__sparcv9)
+# define ALIGNMENT 8
+# else
+# define ALIGNMENT 4 /* Required by hardware */
+# endif
# define ALIGN_DOUBLE
- extern int etext;
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int _etext;
@@ -573,10 +724,18 @@
# define HEAP_START DATAEND
# endif
# define PROC_VDB
-/* HEURISTIC1 reportedly no longer works under 2.7. Thus we */
-/* switched to HEURISTIC2, eventhough it creates some debugging */
-/* issues. */
-# define HEURISTIC2
+/* HEURISTIC1 reportedly no longer works under 2.7. */
+/* HEURISTIC2 probably works, but this appears to be preferable. */
+/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
+/* installations that's undefined. We work around this with a */
+/* gross hack: */
+# include <sys/vmparam.h>
+# ifdef USERLIMIT
+ /* This should work everywhere, but doesn't. */
+# define STACKBOTTOM USRSTACK
+# else
+# define HEURISTIC2
+# endif
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
/* getpagesize() appeared to be missing from at least one */
@@ -615,21 +774,40 @@
# ifdef LINUX
# define OS_TYPE "LINUX"
# ifdef __ELF__
-# define DATASTART GC_data_start
-# define DYNAMIC_LOADING
+# define DYNAMIC_LOADING
# else
- Linux Sparc non elf ?
+ Linux Sparc/a.out not supported
# endif
extern int _end;
+ extern int _etext;
# define DATAEND (&_end)
# define SVR4
-# define STACKBOTTOM ((ptr_t) 0xf0000000)
+# ifdef __arch64__
+# define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
+# define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
+# define CPP_WORDSZ 64
+# else
+# define STACKBOTTOM ((ptr_t) 0xf0000000)
+# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
+# endif
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# define STACKBOTTOM ((ptr_t) 0xf8000000)
+ extern int etext;
# define DATASTART ((ptr_t)(&etext))
# endif
+# ifdef NETBSD
+# define OS_TYPE "NETBSD"
+# define HEURISTIC2
+# ifdef __ELF__
+# define DATASTART GC_data_start
+# define DYNAMIC_LOADING
+# else
+ extern char etext;
+# define DATASTART ((ptr_t)(&etext))
+# endif
+# endif
# endif
# ifdef I386
@@ -642,18 +820,34 @@
# define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
/* improvement on Pentiums. */
# endif
+# ifdef HAVE_BUILTIN_UNWIND_INIT
+# define USE_GENERIC_PUSH_REGS
+# endif
# ifdef SEQUENT
# define OS_TYPE "SEQUENT"
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t) 0x3ffff000)
# endif
+# ifdef BEOS
+# define OS_TYPE "BEOS"
+# include <OS.h>
+# define GETPAGESIZE() B_PAGE_SIZE
+ extern int etext;
+# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
+# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int etext, _start;
extern char * GC_SysVGetDataStart();
# define DATASTART GC_SysVGetDataStart(0x1000, &etext)
-# define STACKBOTTOM ((ptr_t)(&_start))
+/* # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7, */
+/* but reportedly breaks under 2.8. It appears that the stack */
+/* base is a property of the executable, so this should not break */
+/* old executables. */
+/* HEURISTIC2 probably works, but this appears to be preferable. */
+# include <sys/vmparam.h>
+# define STACKBOTTOM USRSTACK
/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
/*# define PROC_VDB*/
# define DYNAMIC_LOADING
@@ -684,13 +878,16 @@
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
-# define HEURISTIC1
-# undef STACK_GRAN
-# define STACK_GRAN 0x10000000
- /* STACKBOTTOM is usually 0xc0000000, but this changes with */
- /* different kernel configurations. In particular, systems */
- /* with 2GB physical memory will usually move the user */
- /* address space limit, and hence initial SP to 0x80000000. */
+# define LINUX_STACKBOTTOM
+# if 0
+# define HEURISTIC1
+# undef STACK_GRAN
+# define STACK_GRAN 0x10000000
+ /* STACKBOTTOM is usually 0xc0000000, but this changes with */
+ /* different kernel configurations. In particular, systems */
+ /* with 2GB physical memory will usually move the user */
+ /* address space limit, and hence initial SP to 0x80000000. */
+# endif
# if !defined(LINUX_THREADS) || !defined(REDIRECT_MALLOC)
# define MPROTECT_VDB
# else
@@ -706,8 +903,7 @@
# endif
# include <features.h>
# if defined(__GLIBC__) && __GLIBC__ >= 2
- extern int __data_start;
-# define DATASTART ((ptr_t)(&__data_start))
+# define LINUX_DATA_START
# else
extern char **__environ;
# define DATASTART ((ptr_t)(&__environ))
@@ -726,6 +922,26 @@
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# endif
+# ifdef USE_I686_PREFETCH
+# define PREFETCH(x) \
+ __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
+ /* Empirically prefetcht0 is much more effective at reducing */
+ /* cache miss stalls for the targetted load instructions. But it */
+ /* seems to interfere enough with other cache traffic that the net */
+ /* result is worse than prefetchnta. */
+# if 0
+ /* Using prefetches for write seems to have a slight negative */
+ /* impact on performance, at least for a PIII/500. */
+# define PREFETCH_FOR_WRITE(x) \
+ __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
+# endif
+# endif
+# ifdef USE_3DNOW_PREFETCH
+# define PREFETCH(x) \
+ __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
+# define PREFETCH_FOR_WRITE(x) \
+ __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
+# endif
# endif
# ifdef CYGWIN32
# define OS_TYPE "CYGWIN32"
@@ -755,6 +971,7 @@
/* os_dep.c. OS2 actually has the right */
/* system call! */
# define DATAEND /* not needed */
+# define USE_GENERIC_PUSH_REGS
# endif
# ifdef MSWIN32
# define OS_TYPE "MSWIN32"
@@ -765,6 +982,10 @@
# endif
# define DATAEND /* not needed */
# endif
+# ifdef MSWINCE
+# define OS_TYPE "MSWINCE"
+# define DATAEND /* not needed */
+# endif
# ifdef DJGPP
# define OS_TYPE "DJGPP"
# include "stubinfo.h"
@@ -783,6 +1004,7 @@
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# define MPROTECT_VDB
+# define FREEBSD_STACKBOTTOM
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
@@ -793,7 +1015,7 @@
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
-# if defined(OPENBSD) || defined(FREEBSD) || defined(NETBSD) \
+# if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
@@ -820,6 +1042,17 @@
# define DATASTART ((ptr_t) &__nullarea)
# define DATAEND ((ptr_t) &_end)
# endif
+# ifdef HURD
+# define OS_TYPE "HURD"
+# define STACK_GROWS_DOWN
+# define HEURISTIC2
+ extern int __data_start;
+# define DATASTART ( (ptr_t) (&__data_start))
+ extern int _end;
+# define DATAEND ( (ptr_t) (&_end))
+/* # define MPROTECT_VDB Not quite working yet? */
+# define DYNAMIC_LOADING
+# endif
# endif
# ifdef NS32K
@@ -836,35 +1069,48 @@
# ifdef MIPS
# define MACH_TYPE "MIPS"
-# ifndef IRIX5
-# define DATASTART (ptr_t)0x10000000
+# ifdef LINUX
+ /* This was developed for a linuxce style platform. Probably */
+ /* needs to be tweaked for workstation class machines. */
+# define OS_TYPE "LINUX"
+ extern int __data_start;
+# define DATASTART ((ptr_t)(&__data_start))
+# define ALIGNMENT 4
+# define USE_GENERIC_PUSH_REGS
+# define STACKBOTTOM ((ptr_t)0x7fff8000)
+ /* Older toolchains may need 0x80000000. */
+ /* In many cases, this should probably use LINUX_STACKBOTTOM */
+ /* instead. But some kernel versions seem to give the wrong */
+ /* value from /proc. */
+# endif /* Linux */
+# ifdef ULTRIX
+# define HEURISTIC2
+# define DATASTART (ptr_t)0x10000000
/* Could probably be slightly higher since */
/* startup code allocates lots of stuff. */
-# else
- extern int _fdata;
-# define DATASTART ((ptr_t)(&_fdata))
-# ifdef USE_MMAP
-# define HEAP_START (ptr_t)0x30000000
-# else
-# define HEAP_START DATASTART
-# endif
- /* Lowest plausible heap address. */
- /* In the MMAP case, we map there. */
- /* In either case it is used to identify */
- /* heap sections so they're not */
- /* considered as roots. */
-# endif /* IRIX5 */
-# define HEURISTIC2
-/* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
-# ifdef ULTRIX
# define OS_TYPE "ULTRIX"
# define ALIGNMENT 4
# endif
# ifdef RISCOS
+# define HEURISTIC2
+# define DATASTART (ptr_t)0x10000000
# define OS_TYPE "RISCOS"
# define ALIGNMENT 4 /* Required by hardware */
# endif
# ifdef IRIX5
+# define HEURISTIC2
+ extern int _fdata;
+# define DATASTART ((ptr_t)(&_fdata))
+# ifdef USE_MMAP
+# define HEAP_START (ptr_t)0x30000000
+# else
+# define HEAP_START DATASTART
+# endif
+ /* Lowest plausible heap address. */
+ /* In the MMAP case, we map there. */
+ /* In either case it is used to identify */
+ /* heap sections so they're not */
+ /* considered as roots. */
# define OS_TYPE "IRIX5"
# define MPROTECT_VDB
# ifdef _MIPS_SZPTR
@@ -879,6 +1125,28 @@
# endif
# define DYNAMIC_LOADING
# endif
+# ifdef MSWINCE
+# define OS_TYPE "MSWINCE"
+# define ALIGNMENT 4
+# define DATAEND /* not needed */
+# endif
+# if defined(NETBSD)
+ /* This also checked for __MIPSEL__ . Why? NETBSD recognition */
+ /* should be handled at the top of the file. */
+# define ALIGNMENT 4
+# define OS_TYPE "NETBSD"
+# define HEURISTIC2
+# define USE_GENERIC_PUSH_REGS
+# ifdef __ELF__
+ extern int etext;
+# define DATASTART GC_data_start
+# define NEED_FIND_LIMIT
+# define DYNAMIC_LOADING
+# else
+# define DATASTART ((ptr_t) 0x10000000)
+# define STACKBOTTOM ((ptr_t) 0x7ffff000)
+# endif /* _ELF_ */
+# endif
# endif
# ifdef RS6000
@@ -893,11 +1161,34 @@
# ifdef HP_PA
# define MACH_TYPE "HP_PA"
-# define ALIGNMENT 4
-# define ALIGN_DOUBLE
- extern int __data_start;
-# define DATASTART ((ptr_t)(&__data_start))
-# if 0
+# define OS_TYPE "HPUX"
+# ifdef __LP64__
+# define CPP_WORDSZ 64
+# define ALIGNMENT 8
+# else
+# define CPP_WORDSZ 32
+# define ALIGNMENT 4
+# define ALIGN_DOUBLE
+# endif
+# if !defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS) \
+ && !defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS)
+# ifndef LINUX /* For now. */
+# define MPROTECT_VDB
+# endif
+# else
+# define GENERIC_COMPARE_AND_SWAP
+ /* No compare-and-swap instruction. Use pthread mutexes */
+ /* when we absolutely have to. */
+# ifdef PARALLEL_MARK
+# define USE_MARK_BYTES
+ /* Minimize compare-and-swap usage. */
+# endif
+# endif
+# define STACK_GROWS_UP
+# ifdef HPUX
+ extern int __data_start;
+# define DATASTART ((ptr_t)(&__data_start))
+# if 0
/* The following appears to work for 7xx systems running HP/UX */
/* 9.xx Furthermore, it might result in much faster */
/* collections than HEURISTIC2, which may involve scanning */
@@ -906,28 +1197,66 @@
/* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
/* this.) */
# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
-# else
-# define HEURISTIC2
-# endif
-# define STACK_GROWS_UP
-# define DYNAMIC_LOADING
-# include <unistd.h>
-# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
- /* They misspelled the Posix macro? */
-# endif
+# else
+ /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
+ /* to this. Note that the GC must be initialized before the */
+ /* first putenv call. */
+ extern char ** environ;
+# define STACKBOTTOM ((ptr_t)environ)
+# endif
+# define DYNAMIC_LOADING
+# include <unistd.h>
+# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
+# ifndef __GNUC__
+# define PREFETCH(x) { \
+ register long addr = (long)(x); \
+ (void) _asm ("LDW", 0, 0, addr, 0); \
+ }
+# endif
+# endif /* HPUX */
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define LINUX_STACKBOTTOM
+# define DYNAMIC_LOADING
+# define LINUX_DATA_START
+ extern int _end;
+# define DATAEND (&_end)
+# endif /* LINUX */
+# endif /* HP_PA */
# ifdef ALPHA
# define MACH_TYPE "ALPHA"
# define ALIGNMENT 8
+# define USE_GENERIC_PUSH_REGS
+ /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
+ /* fp registers in some cases when the target is a 21264. The assembly */
+ /* code doesn't handle that yet, and version dependencies make that a */
+ /* bit tricky. Do the easy thing for now. */
+# ifdef NETBSD
+# define OS_TYPE "NETBSD"
+# define HEURISTIC2
+# define DATASTART GC_data_start
+# define ELFCLASS32 32
+# define ELFCLASS64 64
+# define ELF_CLASS ELFCLASS64
+# define CPP_WORDSZ 64
+# define DYNAMIC_LOADING
+# endif
# ifdef OSF1
# define OS_TYPE "OSF1"
# define DATASTART ((ptr_t) 0x140000000)
- extern _end;
+ extern int _end;
# define DATAEND ((ptr_t) &_end)
-# define HEURISTIC2
+ extern char ** environ;
+ /* round up from the value of environ to the nearest page boundary */
+ /* Probably breaks if putenv is called before collector */
+ /* initialization. */
+# define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
+/* # define HEURISTIC2 */
/* Normally HEURISTIC2 is too conervative, since */
/* the text segment immediately follows the stack. */
/* Hence we give an upper pound. */
+ /* This is currently unused, since we disabled HEURISTIC2 */
extern int __start;
# define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
# define CPP_WORDSZ 64
@@ -939,12 +1268,8 @@
# define CPP_WORDSZ 64
# define STACKBOTTOM ((ptr_t) 0x120000000)
# ifdef __ELF__
-# if 0
- /* __data_start apparently disappeared in some recent releases. */
- extern int __data_start;
-# define DATASTART &__data_start
-# endif
-# define DATASTART GC_data_start
+# define SEARCH_FOR_DATA_START
+# define DATASTART GC_data_start
# define DYNAMIC_LOADING
# else
# define DATASTART ((ptr_t) 0x140000000)
@@ -957,6 +1282,55 @@
# endif
# endif
+# ifdef IA64
+# define MACH_TYPE "IA64"
+# define ALIGN_DOUBLE
+ /* Requires 16 byte alignment for malloc */
+# define ALIGNMENT 8
+# define USE_GENERIC_PUSH_REGS
+ /* We need to get preserved registers in addition to register */
+ /* windows. That's easiest to do with setjmp. */
+# ifdef PARALLEL_MARK
+# define USE_MARK_BYTES
+ /* Compare-and-exchange is too expensive to use for */
+ /* setting mark bits. */
+# endif
+# ifdef HPUX
+ --> needs work
+# endif
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define CPP_WORDSZ 64
+ /* The following works on NUE and older kernels: */
+/* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
+ /* This does not work on NUE: */
+# define LINUX_STACKBOTTOM
+ /* We also need the base address of the register stack */
+ /* backing store. This is computed in */
+ /* GC_linux_register_stack_base based on the following */
+ /* constants: */
+# define BACKING_STORE_ALIGNMENT 0x100000
+# define BACKING_STORE_DISPLACEMENT 0x80000000
+ extern char * GC_register_stackbottom;
+# define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
+# define SEARCH_FOR_DATA_START
+# define DATASTART GC_data_start
+# define DYNAMIC_LOADING
+# define MPROTECT_VDB
+ /* Requires Linux 2.3.47 or later. */
+ extern int _end;
+# define DATAEND (&_end)
+# ifdef __GNUC__
+# define PREFETCH(x) \
+ __asm__ (" lfetch [%0]": : "r"((void *)(x)))
+# define PREFETCH_FOR_WRITE(x) \
+ __asm__ (" lfetch.excl [%0]": : "r"((void *)(x)))
+# define CLEAR_DOUBLE(x) \
+ __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
+# endif
+# endif
+# endif
+
# ifdef M88K
# define MACH_TYPE "M88K"
# define ALIGNMENT 4
@@ -976,17 +1350,127 @@
# ifdef S370
# define MACH_TYPE "S370"
-# define OS_TYPE "UTS4"
# define ALIGNMENT 4 /* Required by hardware */
- extern int etext;
+# define USE_GENERIC_PUSH_REGS
+# ifdef UTS4
+# define OS_TYPE "UTS4"
+ extern int etext;
extern int _etext;
extern int _end;
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
# define HEURISTIC2
+# endif
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define HEURISTIC1
+# define DYNAMIC_LOADING
+ extern int __data_start;
+# define DATASTART ((ptr_t)(&__data_start))
+# endif
+# endif
+
+# if defined(PJ)
+# define ALIGNMENT 4
+ extern int _etext;
+# define DATASTART ((ptr_t)(&_etext))
+# define HEURISTIC1
+# endif
+
+# ifdef ARM32
+# define CPP_WORDSZ 32
+# define MACH_TYPE "ARM32"
+# define ALIGNMENT 4
+# ifdef NETBSD
+# define OS_TYPE "NETBSD"
+# define HEURISTIC2
+ extern char etext;
+# define DATASTART ((ptr_t)(&etext))
+# define USE_GENERIC_PUSH_REGS
+# endif
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define HEURISTIC1
+# undef STACK_GRAN
+# define STACK_GRAN 0x10000000
+# define USE_GENERIC_PUSH_REGS
+# ifdef __ELF__
+# define DYNAMIC_LOADING
+# include <features.h>
+# if defined(__GLIBC__) && __GLIBC__ >= 2
+# define LINUX_DATA_START
+# else
+ extern char **__environ;
+# define DATASTART ((ptr_t)(&__environ))
+ /* hideous kludge: __environ is the first */
+ /* word in crt0.o, and delimits the start */
+ /* of the data segment, no matter which */
+ /* ld options were passed through. */
+ /* We could use _etext instead, but that */
+ /* would include .rodata, which may */
+ /* contain large read-only data tables */
+ /* that we'd rather not scan. */
+# endif
+ extern int _end;
+# define DATAEND (&_end)
+# else
+ extern int etext;
+# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
+# endif
+# endif
+# ifdef MSWINCE
+# define OS_TYPE "MSWINCE"
+# define DATAEND /* not needed */
+# endif
+#endif
+
+# ifdef SH
+# define MACH_TYPE "SH"
+# define ALIGNMENT 4
+# ifdef MSWINCE
+# define OS_TYPE "MSWINCE"
+# define DATAEND /* not needed */
+# endif
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define STACKBOTTOM ((ptr_t) 0x7c000000)
+# define USE_GENERIC_PUSH_REGS
+# define DYNAMIC_LOADING
+# define LINUX_DATA_START
+ extern int _end;
+# define DATAEND (&_end)
+# endif
# endif
+
+# ifdef SH4
+# define MACH_TYPE "SH4"
+# define OS_TYPE "MSWINCE"
+# define ALIGNMENT 4
+# define DATAEND /* not needed */
+# endif
+
+#ifdef LINUX_DATA_START
+ /* Some Linux distributions arrange to define __data_start. Some */
+ /* define data_start as a weak symbol. The latter is technically */
+ /* broken, since the user program may define data_start, in which */
+ /* case we lose. Nonetheless, we try both, prefering __data_start. */
+ /* We assume gcc. */
+# pragma weak __data_start
+ extern int __data_start;
+# pragma weak data_start
+ extern int data_start;
+# define DATASTART ((ptr_t)(&__data_start != 0? &__data_start : &data_start))
+#endif
+#if defined(LINUX) && defined(REDIRECT_MALLOC)
+ /* Rld appears to allocate some memory with its own allocator, and */
+ /* some through malloc, which might be redirected. To make this */
+ /* work with collectable memory, we have to scan memory allocated */
+ /* by rld's internal malloc. */
+# define USE_PROC_FOR_LIBRARIES
+#endif
+
# ifndef STACK_GROWS_UP
# define STACK_GROWS_DOWN
# endif
@@ -1029,6 +1513,16 @@
# define SUNOS5SIGS
# endif
+# if defined(HPUX)
+# define SUNOS5SIGS
+# endif
+
+# if defined(SVR4) || defined(LINUX) || defined(IRIX) || defined(HPUX) \
+ || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
+ || defined(BSD) || defined(AIX) || defined(MACOSX) || defined(OSF1)
+# define UNIX_LIKE /* Basic Unix-like system calls work. */
+# endif
+
# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
-> bad word size
# endif
@@ -1059,41 +1553,107 @@
# undef MPROTECT_VDB /* Can't deal with address space holes. */
# endif
+# ifdef PARALLEL_MARK
+# undef MPROTECT_VDB /* For now. */
+# endif
+
# if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
# define DEFAULT_VDB
# endif
+# ifndef PREFETCH
+# define PREFETCH(x)
+# define NO_PREFETCH
+# endif
+
+# ifndef PREFETCH_FOR_WRITE
+# define PREFETCH_FOR_WRITE(x)
+# define NO_PREFETCH_FOR_WRITE
+# endif
+
+# ifndef CACHE_LINE_SIZE
+# define CACHE_LINE_SIZE 32 /* Wild guess */
+# endif
+
+# ifndef CLEAR_DOUBLE
+# define CLEAR_DOUBLE(x) \
+ ((word*)x)[0] = 0; \
+ ((word*)x)[1] = 0;
+# endif /* CLEAR_DOUBLE */
+
+/* Internally to the collector we test only the XXX_THREADS macros */
+/* not the GC_XXX_THREADS versions. Here we make sure the latter */
+/* are treated as equivalent. */
+#if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_THREADS)
+# define _SOLARIS_THREADS
+#endif
+#if defined(GC_SOLARIS_THREADS) && !defined(_SOLARIS_PTHREADS)
+# define _SOLARIS_PTHREADS
+#endif
+#if defined(GC_IRIX_THREADS) && !defined(IRIX_THREADS)
+# define IRIX_THREADS
+#endif
+#if defined(GC_LINUX_THREADS) && !defined(LINUX_THREADS)
+# define LINUX_THREADS
+#endif
+#if defined(GC_WIN32_THREADS) && !defined(WIN32_THREADS)
+# define WIN32_THREADS
+#endif
+#if defined(GC_HPUX_THREADS) && !defined(HPUX_THREADS)
+# define HPUX_THREADS
+#endif
+#if defined(GC_OSF1_THREADS) && !defined(OSF1_THREADS)
+# define OSF1_THREADS
+#endif
+
+/* Internally we use SOLARIS_THREADS to test for either old or pthreads. */
# if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS)
# define SOLARIS_THREADS
# endif
# if defined(IRIX_THREADS) && !defined(IRIX5)
--> inconsistent configuration
# endif
-# if defined(IRIX_JDK_THREADS) && !defined(IRIX5)
---> inconsistent configuration
-# endif
# if defined(LINUX_THREADS) && !defined(LINUX)
--> inconsistent configuration
# endif
# if defined(SOLARIS_THREADS) && !defined(SUNOS5)
--> inconsistent configuration
# endif
+# if defined(HPUX_THREADS) && !defined(HPUX)
+--> inconsistent configuration
+# endif
+# if defined(WIN32_THREADS) && !defined(MSWIN32)
+ /* Ideally CYGWIN32 should work, in addition to MSWIN32. I suspect the necessary code */
+ /* is mostly there, but nobody has actually made sure the right combination of pieces is */
+ /* compiled in, etc. */
+--> inconsistent configuration
+# endif
# if defined(PCR) || defined(SRC_M3) || \
defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
- defined(IRIX_JDK_THREADS)
+ defined(HPUX_THREADS) || defined(OSF1_THREADS)
# define THREADS
# endif
-# if defined(HP_PA) || defined(M88K) || defined(POWERPC) \
- || (defined(I386) && defined(OS2)) || defined(UTS4) || defined(LINT)
- /* Use setjmp based hack to mark from callee-save registers. */
+# if defined(HP_PA) || defined(M88K) || defined(POWERPC) && !defined(MACOSX) \
+ || defined(LINT) || defined(MSWINCE) \
+ || (defined(I386) && defined(__LCC__))
+ /* Use setjmp based hack to mark from callee-save registers. */
+ /* The define should move to the individual platform */
+ /* descriptions. */
# define USE_GENERIC_PUSH_REGS
# endif
-# if defined(SPARC) && !defined(LINUX)
+# if defined(I386) && defined(LINUX)
+ /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
+ /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
+# ifdef SAVE_CALL_COUNT
+# define SAVE_CALL_CHAIN
+# endif
+# endif
+# if defined(SPARC)
# define SAVE_CALL_CHAIN
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */
# endif
-# endif
+# endif /* GCCONFIG_H */
diff --git a/gc/solaris_threads.h b/gc/include/private/solaris_threads.h
diff --git a/gc/include/private/specific.h b/gc/include/private/specific.h
@@ -0,0 +1,83 @@
+/*
+ * This is a reimplementation of a subset of the pthread_getspecific/setspecific
+ * interface. This appears to outperform the standard linuxthreads one
+ * by a significant margin.
+ * The major restriction is that each thread may only make a single
+ * pthread_setspecific call on a single key. (The current data structure
+ * doesn't really require that. The restriction should be easily removable.)
+ * We don't currently support the destruction functions, though that
+ * could be done.
+ * We also currently assume that only one pthread_setspecific call
+ * can be executed at a time, though that assumption would be easy to remove
+ * by adding a lock.
+ */
+
+#include <errno.h>
+
+/* Called during key creation or setspecific. */
+/* For the GC we already hold lock. */
+/* Currently allocated objects leak on thread exit. */
+/* That's hard to fix, but OK if we allocate garbage */
+/* collected memory. */
+#define MALLOC_CLEAR(n) GC_INTERNAL_MALLOC(n, NORMAL)
+#define PREFIXED(name) GC_##name
+
+#define TS_CACHE_SIZE 1024
+#define CACHE_HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1))
+#define TS_HASH_SIZE 1024
+#define HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_HASH_SIZE - 1))
+
+typedef struct thread_specific_entry {
+ unsigned long qtid; /* quick thread id, only for cache */
+ void * value;
+ pthread_t thread;
+ struct thread_specific_entry *next;
+} tse;
+
+
+/* We represent each thread-specific datum as two tables. The first is */
+/* a cache, index by a "quick thread identifier". The "quick" thread */
+/* identifier is an easy to compute value, which is guaranteed to */
+/* determine the thread, though a thread may correspond to more than */
+/* one value. We typically use the address of a page in the stack. */
+/* The second is a hash table, indexed by pthread_self(). It is used */
+/* only as a backup. */
+
+/* Return the "quick thread id". Default version. Assumes page size, */
+/* or at least thread stack separation, is at least 4K. */
+static __inline__ long quick_thread_id() {
+ int dummy;
+ return (long)(&dummy) >> 12;
+}
+
+#define INVALID_QTID ((unsigned long)(-1))
+
+typedef struct thread_specific_data {
+ tse * volatile cache[TS_CACHE_SIZE];
+ /* A faster index to the hash table */
+ tse * hash[TS_HASH_SIZE];
+ pthread_mutex_t lock;
+} tsd;
+
+typedef tsd * PREFIXED(key_t);
+
+extern int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *));
+
+extern int PREFIXED(setspecific) (tsd * key, void * value);
+
+extern void PREFIXED(remove_specific) (tsd * key);
+
+/* An internal version of getspecific that assumes a cache miss. */
+void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid,
+ tse * volatile * cache_entry);
+
+static __inline__ void * PREFIXED(getspecific) (tsd * key) {
+ long qtid = quick_thread_id();
+ unsigned hash_val = CACHE_HASH(qtid);
+ tse * volatile * entry_ptr = key -> cache + hash_val;
+ tse * entry = *entry_ptr; /* Must be loaded only once. */
+ if (entry -> qtid == qtid) return entry -> value;
+ return PREFIXED(slow_getspecific) (key, qtid, entry_ptr);
+}
+
+
diff --git a/gc/install-sh b/gc/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/gc/irix_threads.c b/gc/irix_threads.c
@@ -1,6 +1,7 @@
/*
- * Copyright (c) 1994 by Xerox Corporation. All rights reserved.
- * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -16,14 +17,17 @@
* not guaranteed by the Pthread standard. It may or may not be portable
* to other implementations.
*
+ * This now also includes an initial attempt at thread support for
+ * HP/UX 11.
+ *
* Note that there is a lot of code duplication between linux_threads.c
- * and irix_threads.c; any changes made here may need to be reflected
+ * and hpux_irix_threads.c; any changes made here may need to be reflected
* there too.
*/
-# if defined(IRIX_THREADS)
+# if defined(GC_IRIX_THREADS) || defined(IRIX_THREADS)
-# include "gc_priv.h"
+# include "private/gc_priv.h"
# include <pthread.h>
# include <semaphore.h>
# include <time.h>
@@ -35,6 +39,7 @@
#undef pthread_create
#undef pthread_sigmask
#undef pthread_join
+#undef pthread_detach
void GC_thr_init();
@@ -95,8 +100,8 @@ GC_thread GC_lookup_thread(pthread_t id);
* The only way to suspend threads given the pthread interface is to send
* signals. Unfortunately, this means we have to reserve
* a signal, and intercept client calls to change the signal mask.
+ * We use SIG_SUSPEND, defined in gc_priv.h.
*/
-# define SIG_SUSPEND (SIGRTMIN + 6)
pthread_mutex_t GC_suspend_lock = PTHREAD_MUTEX_INITIALIZER;
/* Number of threads stopped so far */
@@ -169,8 +174,12 @@ ptr_t GC_stack_alloc(size_t * stack_size)
result = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_sz);
result = (ptr_t)(((word)result + GC_page_sz) & ~(GC_page_sz - 1));
/* Protect hottest page to detect overflow. */
- /* mprotect(result, GC_page_sz, PROT_NONE); */
- result += GC_page_sz;
+# ifdef STACK_GROWS_UP
+ /* mprotect(result + search_sz, GC_page_sz, PROT_NONE); */
+# else
+ /* mprotect(result, GC_page_sz, PROT_NONE); */
+ result += GC_page_sz;
+# endif
}
*stack_size = search_sz;
return(result);
@@ -196,6 +205,11 @@ void GC_stack_free(ptr_t stack, size_t size)
# define THREAD_TABLE_SZ 128 /* Must be power of 2 */
volatile GC_thread GC_threads[THREAD_TABLE_SZ];
+void GC_push_thread_structures GC_PROTO((void))
+{
+ GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads));
+}
+
/* Add a thread to GC_threads. We assume it wasn't already there. */
/* Caller holds allocation lock. */
GC_thread GC_new_thread(pthread_t id)
@@ -211,7 +225,7 @@ GC_thread GC_new_thread(pthread_t id)
/* Dont acquire allocation lock, since we may already hold it. */
} else {
result = (struct GC_Thread_Rep *)
- GC_generic_malloc_inner(sizeof(struct GC_Thread_Rep), NORMAL);
+ GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL);
}
if (result == 0) return(0);
result -> id = id;
@@ -375,13 +389,14 @@ int GC_is_thread_stack(ptr_t addr)
}
# endif
-/* We hold allocation lock. We assume the world is stopped. */
+/* We hold allocation lock. Should do exactly the right thing if the */
+/* world is stopped. Should not fail if it isn't. */
void GC_push_all_stacks()
{
register int i;
register GC_thread p;
register ptr_t sp = GC_approx_sp();
- register ptr_t lo, hi;
+ register ptr_t hot, cold;
pthread_t me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
@@ -390,17 +405,25 @@ void GC_push_all_stacks()
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> flags & FINISHED) continue;
if (pthread_equal(p -> id, me)) {
- lo = GC_approx_sp();
+ hot = GC_approx_sp();
} else {
- lo = p -> stack_ptr;
+ hot = p -> stack_ptr;
}
if (p -> stack_size != 0) {
- hi = p -> stack + p -> stack_size;
+# ifdef STACK_GROWS_UP
+ cold = p -> stack;
+# else
+ cold = p -> stack + p -> stack_size;
+# endif
} else {
/* The original stack. */
- hi = GC_stackbottom;
+ cold = GC_stackbottom;
}
- GC_push_all_stack(lo, hi);
+# ifdef STACK_GROWS_UP
+ GC_push_all_stack(cold, hot);
+# else
+ GC_push_all_stack(hot, cold);
+# endif
}
}
}
@@ -482,10 +505,33 @@ int GC_pthread_join(pthread_t thread, void **retval)
/* Some versions of the Irix pthreads library can erroneously */
/* return EINTR when the call succeeds. */
if (EINTR == result) result = 0;
+ if (result == 0) {
+ LOCK();
+ /* Here the pthread thread id may have been recycled. */
+ GC_delete_gc_thread(thread, thread_gc_id);
+ UNLOCK();
+ }
+ return result;
+}
+
+int GC_pthread_detach(pthread_t thread)
+{
+ int result;
+ GC_thread thread_gc_id;
+
LOCK();
- /* Here the pthread thread id may have been recycled. */
- GC_delete_gc_thread(thread, thread_gc_id);
+ thread_gc_id = GC_lookup_thread(thread);
UNLOCK();
+ result = REAL_FUNC(pthread_detach)(thread);
+ if (result == 0) {
+ LOCK();
+ thread_gc_id -> flags |= DETACHED;
+ /* Here the pthread thread id may have been recycled. */
+ if (thread_gc_id -> flags & FINISHED) {
+ GC_delete_gc_thread(thread, thread_gc_id);
+ }
+ UNLOCK();
+ }
return result;
}
@@ -531,6 +577,8 @@ void * GC_start_routine(void * arg)
return(result);
}
+# define copy_attr(pa_ptr, source) *(pa_ptr) = *(source)
+
int
GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
@@ -548,7 +596,9 @@ GC_pthread_create(pthread_t *new_thread,
/* library, which isn't visible to the collector. */
if (0 == si) return(ENOMEM);
- sem_init(&(si -> registered), 0, 0);
+ if (0 != sem_init(&(si -> registered), 0, 0)) {
+ ABORT("sem_init failed");
+ }
si -> start_routine = start_routine;
si -> arg = arg;
LOCK();
@@ -557,7 +607,7 @@ GC_pthread_create(pthread_t *new_thread,
stack = 0;
(void) pthread_attr_init(&new_attr);
} else {
- new_attr = *attr;
+ copy_attr(&new_attr, attr);
pthread_attr_getstackaddr(&new_attr, &stack);
}
pthread_attr_getstacksize(&new_attr, &stacksize);
@@ -586,24 +636,31 @@ GC_pthread_create(pthread_t *new_thread,
/* This also ensures that we hold onto si until the child is done */
/* with it. Thus it doesn't matter whether it is otherwise */
/* visible to the collector. */
- if (0 != sem_wait(&(si -> registered))) ABORT("sem_wait failed");
+ while (0 != sem_wait(&(si -> registered))) {
+ if (errno != EINTR) {
+ GC_printf1("Sem_wait: errno = %ld\n", (unsigned long) errno);
+ ABORT("sem_wait failed");
+ }
+ }
sem_destroy(&(si -> registered));
- /* pthread_attr_destroy(&new_attr); */
+ pthread_attr_destroy(&new_attr); /* Probably unnecessary under Irix */
return(result);
}
-GC_bool GC_collecting = 0; /* A hint that we're in the collector and */
+VOLATILE GC_bool GC_collecting = 0;
+ /* A hint that we're in the collector and */
/* holding the allocation lock for an */
/* extended period. */
/* Reasonably fast spin locks. Basically the same implementation */
-/* as STL alloc.h. This isn't really the right way to do this. */
-/* but until the POSIX scheduling mess gets straightened out ... */
-
-unsigned long GC_allocate_lock = 0;
+/* as STL alloc.h. */
#define SLEEP_THRESHOLD 3
+unsigned long GC_allocate_lock = 0;
+# define GC_TRY_LOCK() !GC_test_and_set(&GC_allocate_lock,1)
+# define GC_LOCK_TAKEN GC_allocate_lock
+
void GC_lock()
{
# define low_spin_max 30 /* spin cycles if we suspect uniprocessor */
@@ -616,7 +673,7 @@ void GC_lock()
# define PAUSE junk *= junk; junk *= junk; junk *= junk; junk *= junk
int i;
- if (!GC_test_and_set(&GC_allocate_lock, 1)) {
+ if (GC_TRY_LOCK()) {
return;
}
junk = 0;
@@ -624,11 +681,11 @@ void GC_lock()
my_last_spins = last_spins;
for (i = 0; i < my_spin_max; i++) {
if (GC_collecting) goto yield;
- if (i < my_last_spins/2 || GC_allocate_lock) {
+ if (i < my_last_spins/2 || GC_LOCK_TAKEN) {
PAUSE;
continue;
}
- if (!GC_test_and_set(&GC_allocate_lock, 1)) {
+ if (GC_TRY_LOCK()) {
/*
* got it!
* Spinning worked. Thus we're probably not being scheduled
@@ -644,7 +701,7 @@ void GC_lock()
spin_max = low_spin_max;
yield:
for (i = 0;; ++i) {
- if (!GC_test_and_set(&GC_allocate_lock, 1)) {
+ if (GC_TRY_LOCK()) {
return;
}
if (i < SLEEP_THRESHOLD) {
@@ -662,8 +719,6 @@ yield:
}
}
-
-
# else
#ifndef LINT
diff --git a/gc/libtool.m4 b/gc/libtool.m4
@@ -0,0 +1,435 @@
+## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
+## Copyright (C) 1996-1999 Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 40 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
+DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+dnl
+
+case "$target" in
+NONE) lt_target="$host" ;;
+*) lt_target="$target" ;;
+esac
+
+# Check for any special flags to pass to ltconfig.
+#
+# the following will cause an existing older ltconfig to fail, so
+# we ignore this at the expense of the cache file... Checking this
+# will just take longer ... bummer!
+#libtool_flags="--cache-file=$cache_file"
+#
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$lt_target" in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case "`/usr/bin/file conftest.o`" in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+changequote(,)dnl
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ ac_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ break
+ else
+ ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$lt_target" in
+*-*-beos* | *-*-cygwin*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library, adds --enable-ltdl-convenience to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case "$enable_ltdl_convenience" in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library, and adds --enable-ltdl-install to
+# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
+# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
+# to be `${top_builddir}/libltdl'. Make sure you start DIR with
+# '${top_builddir}/' (note the single quotes!) if your package is not
+# flat, and, if you're not using automake, define top_builddir as
+# appropriate in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
+ INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ INCLTDL=
+ fi
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
diff --git a/gc/linux_threads.c b/gc/linux_threads.c
@@ -2,6 +2,7 @@
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
+ * Copyright (c) 2000-2001 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -17,35 +18,96 @@
* thread package for Linux which is included in libc6.
*
* This code relies on implementation details of LinuxThreads,
- * (i.e. properties not guaranteed by the Pthread standard):
- *
- * - the function GC_linux_thread_top_of_stack(void)
- * relies on the way LinuxThreads lays out thread stacks
- * in the address space.
+ * (i.e. properties not guaranteed by the Pthread standard),
+ * though this version now does less of that than the other Pthreads
+ * support code.
*
* Note that there is a lot of code duplication between linux_threads.c
- * and irix_threads.c; any changes made here may need to be reflected
- * there too.
+ * and thread support for some of the other Posix platforms; any changes
+ * made here may need to be reflected there too.
+ */
+/*
+ * Linux_threads.c now also includes some code to support HPUX and
+ * OSF1 (Compaq Tru64 Unix, really). The OSF1 support is not yet
+ * functional. The OSF1 code is based on Eric Benson's
+ * patch, though that was originally against hpux_irix_threads. The code
+ * here is completely untested. With 0.0000001% probability, it might
+ * actually work.
+ *
+ * Eric also suggested an alternate basis for a lock implementation in
+ * his code:
+ * + #elif defined(OSF1)
+ * + unsigned long GC_allocate_lock = 0;
+ * + msemaphore GC_allocate_semaphore;
+ * + # define GC_TRY_LOCK() \
+ * + ((msem_lock(&GC_allocate_semaphore, MSEM_IF_NOWAIT) == 0) \
+ * + ? (GC_allocate_lock = 1) \
+ * + : 0)
+ * + # define GC_LOCK_TAKEN GC_allocate_lock
*/
/* #define DEBUG_THREADS 1 */
/* ANSI C requires that a compilation unit contains something */
-# include "gc_priv.h"
-# if defined(LINUX_THREADS)
+# if defined(GC_LINUX_THREADS) || defined(LINUX_THREADS) \
+ || defined(GC_HPUX_THREADS) || defined(HPUX_THREADS) \
+ || defined(GC_OSF1_THREADS) || defined(OSF1_THREADS) \
+
+# include "private/gc_priv.h"
+# if defined(HPUX_THREADS) && !defined(USE_PTHREAD_SPECIFIC) \
+ && !defined(USE_HPUX_TLS)
+# define USE_HPUX_TLS
+# endif
+
+# ifdef THREAD_LOCAL_ALLOC
+# if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_HPUX_TLS)
+# include "private/specific.h"
+# endif
+# if defined(USE_PTHREAD_SPECIFIC)
+# define GC_getspecific pthread_getspecific
+# define GC_setspecific pthread_setspecific
+# define GC_key_create pthread_key_create
+ typedef pthread_key_t GC_key_t;
+# endif
+# if defined(USE_HPUX_TLS)
+# define GC_getspecific(x) (x)
+# define GC_setspecific(key, v) ((key) = (v), 0)
+# define GC_key_create(key, d) 0
+ typedef void * GC_key_t;
+# endif
+# endif
+# include <stdlib.h>
# include <pthread.h>
+# include <sched.h>
# include <time.h>
# include <errno.h>
# include <unistd.h>
# include <sys/mman.h>
# include <sys/time.h>
# include <semaphore.h>
+# include <signal.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+
+#ifndef __GNUC__
+# define __inline__
+#endif
+
+#ifdef GC_USE_LD_WRAP
+# define WRAP_FUNC(f) __wrap_##f
+# define REAL_FUNC(f) __real_##f
+#else
+# define WRAP_FUNC(f) GC_##f
+# define REAL_FUNC(f) f
+# undef pthread_create
+# undef pthread_sigmask
+# undef pthread_join
+# undef pthread_detach
+#endif
-#undef pthread_create
-#undef pthread_sigmask
-#undef pthread_join
void GC_thr_init();
@@ -65,14 +127,13 @@ void GC_print_sig_mask()
}
#endif
+
/* We use the allocation lock to protect thread-related data structures. */
/* The set of all known threads. We intercept thread creation and */
-/* joins. We never actually create detached threads. We allocate all */
-/* new thread stacks ourselves. These allow us to maintain this */
-/* data structure. */
-/* Protected by GC_thr_lock. */
-/* Some of this should be declared volatile, but that's incosnsistent */
+/* joins. */
+/* Protected by allocation/GC lock. */
+/* Some of this should be declared volatile, but that's inconsistent */
/* with some library routine declarations. */
typedef struct GC_Thread_Rep {
struct GC_Thread_Rep * next; /* More recently allocated threads */
@@ -81,42 +142,324 @@ typedef struct GC_Thread_Rep {
/* guaranteed to be dead, but we may */
/* not yet have registered the join.) */
pthread_t id;
- word flags;
+ short flags;
# define FINISHED 1 /* Thread has exited. */
# define DETACHED 2 /* Thread is intended to be detached. */
# define MAIN_THREAD 4 /* True for the original thread only. */
-
- ptr_t stack_end;
- ptr_t stack_ptr; /* Valid only when stopped. */
+ short thread_blocked; /* Protected by GC lock. */
+ /* Treated as a boolean value. If set, */
+ /* thread will acquire GC lock before */
+ /* doing any pointer manipulations, and */
+ /* has set its sp value. Thus it does */
+ /* not need to be sent a signal to stop */
+ /* it. */
+ ptr_t stack_end; /* Cold end of the stack. */
+ ptr_t stack_ptr; /* Valid only when stopped. */
+# ifdef IA64
+ ptr_t backing_store_end;
+ ptr_t backing_store_ptr;
+# endif
int signal;
void * status; /* The value returned from the thread. */
/* Used only to avoid premature */
/* reclamation of any data it might */
/* reference. */
+# ifdef THREAD_LOCAL_ALLOC
+# if CPP_WORDSZ == 64 && defined(ALIGN_DOUBLE)
+# define GRANULARITY 16
+# define NFREELISTS 49
+# else
+# define GRANULARITY 8
+# define NFREELISTS 65
+# endif
+ /* The ith free list corresponds to size i*GRANULARITY */
+# define INDEX_FROM_BYTES(n) ((ADD_SLOP(n) + GRANULARITY - 1)/GRANULARITY)
+# define BYTES_FROM_INDEX(i) ((i) * GRANULARITY - EXTRA_BYTES)
+# define SMALL_ENOUGH(bytes) (ADD_SLOP(bytes) <= \
+ (NFREELISTS-1)*GRANULARITY)
+ ptr_t ptrfree_freelists[NFREELISTS];
+ ptr_t normal_freelists[NFREELISTS];
+# ifdef GC_GCJ_SUPPORT
+ ptr_t gcj_freelists[NFREELISTS];
+# endif
+ /* Free lists contain either a pointer or a small count */
+ /* reflecting the number of granules allocated at that */
+ /* size. */
+ /* 0 ==> thread-local allocation in use, free list */
+ /* empty. */
+ /* > 0, <= DIRECT_GRANULES ==> Using global allocation, */
+ /* too few objects of this size have been */
+ /* allocated by this thread. */
+ /* >= HBLKSIZE => pointer to nonempty free list. */
+ /* > DIRECT_GRANULES, < HBLKSIZE ==> transition to */
+ /* local alloc, equivalent to 0. */
+# define DIRECT_GRANULES (HBLKSIZE/GRANULARITY)
+ /* Don't use local free lists for up to this much */
+ /* allocation. */
+# endif
} * GC_thread;
GC_thread GC_lookup_thread(pthread_t id);
+static GC_bool parallel_initialized = FALSE;
+
+# if defined(__GNUC__)
+ void GC_init_parallel() __attribute__ ((constructor));
+# else
+ void GC_init_parallel();
+# endif
+
+# if defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
+
+/* We don't really support thread-local allocation with DBG_HDRS_ALL */
+
+#ifdef USE_HPUX_TLS
+ __thread
+#endif
+GC_key_t GC_thread_key;
+
+static GC_bool keys_initialized;
+
+/* Recover the contents of the freelist array fl into the global one gfl.*/
+/* Note that the indexing scheme differs, in that gfl has finer size */
+/* resolution, even if not all entries are used. */
+/* We hold the allocator lock. */
+static void return_freelists(ptr_t *fl, ptr_t *gfl)
+{
+ int i;
+ ptr_t q, *qptr;
+ size_t nwords;
+
+ for (i = 1; i < NFREELISTS; ++i) {
+ nwords = i * (GRANULARITY/sizeof(word));
+ qptr = fl + i;
+ q = *qptr;
+ if ((word)q < HBLKSIZE) continue;
+ if (gfl[nwords] == 0) {
+ gfl[nwords] = q;
+ } else {
+ /* Concatenate: */
+ for (; (word)q >= HBLKSIZE; qptr = &(obj_link(q)), q = *qptr);
+ GC_ASSERT(0 == q);
+ *qptr = gfl[nwords];
+ gfl[nwords] = fl[i];
+ }
+ /* Clear fl[i], since the thread structure may hang around. */
+ /* Do it in a way that is likely to trap if we access it. */
+ fl[i] = (ptr_t)HBLKSIZE;
+ }
+}
+
+/* We statically allocate a single "size 0" object. It is linked to */
+/* itself, and is thus repeatedly reused for all size 0 allocation */
+/* requests. (Size 0 gcj allocation requests are incorrect, and */
+/* we arrange for those to fault asap.) */
+static ptr_t size_zero_object = (ptr_t)(&size_zero_object);
+
+/* Each thread structure must be initialized. */
+/* This call must be made from the new thread. */
+/* Caller holds allocation lock. */
+void GC_init_thread_local(GC_thread p)
+{
+ int i;
+
+ if (!keys_initialized) {
+ if (0 != GC_key_create(&GC_thread_key, 0)) {
+ ABORT("Failed to create key for local allocator");
+ }
+ keys_initialized = TRUE;
+ }
+ if (0 != GC_setspecific(GC_thread_key, p)) {
+ ABORT("Failed to set thread specific allocation pointers");
+ }
+ for (i = 1; i < NFREELISTS; ++i) {
+ p -> ptrfree_freelists[i] = (ptr_t)1;
+ p -> normal_freelists[i] = (ptr_t)1;
+# ifdef GC_GCJ_SUPPORT
+ p -> gcj_freelists[i] = (ptr_t)1;
+# endif
+ }
+ /* Set up the size 0 free lists. */
+ p -> ptrfree_freelists[0] = (ptr_t)(&size_zero_object);
+ p -> normal_freelists[0] = (ptr_t)(&size_zero_object);
+# ifdef GC_GCJ_SUPPORT
+ p -> gcj_freelists[0] = (ptr_t)(-1);
+# endif
+}
+
+#ifdef GC_GCJ_SUPPORT
+ extern ptr_t * GC_gcjobjfreelist;
+#endif
+
+/* We hold the allocator lock. */
+void GC_destroy_thread_local(GC_thread p)
+{
+ /* We currently only do this from the thread itself. */
+ GC_ASSERT(GC_getspecific(GC_thread_key) == (void *)p);
+ return_freelists(p -> ptrfree_freelists, GC_aobjfreelist);
+ return_freelists(p -> normal_freelists, GC_objfreelist);
+# ifdef GC_GCJ_SUPPORT
+ return_freelists(p -> gcj_freelists, GC_gcjobjfreelist);
+# endif
+}
+
+extern GC_PTR GC_generic_malloc_many();
+
+GC_PTR GC_local_malloc(size_t bytes)
+{
+ if (EXPECT(!SMALL_ENOUGH(bytes),0)) {
+ return(GC_malloc(bytes));
+ } else {
+ int index = INDEX_FROM_BYTES(bytes);
+ ptr_t * my_fl;
+ ptr_t my_entry;
+ GC_key_t k = GC_thread_key;
+ void * tsd;
+
+# if defined(REDIRECT_MALLOC) && !defined(USE_PTHREAD_SPECIFIC) \
+ || !defined(__GNUC__)
+ if (EXPECT(0 == k, 0)) {
+ /* This can happen if we get called when the world is */
+ /* being initialized. Whether we can actually complete */
+ /* the initialization then is unclear. */
+ GC_init_parallel();
+ k = GC_thread_key;
+ }
+# endif
+ tsd = GC_getspecific(GC_thread_key);
+# ifdef GC_ASSERTIONS
+ LOCK();
+ GC_ASSERT(tsd == (void *)GC_lookup_thread(pthread_self()));
+ UNLOCK();
+# endif
+ my_fl = ((GC_thread)tsd) -> normal_freelists + index;
+ my_entry = *my_fl;
+ if (EXPECT((word)my_entry >= HBLKSIZE, 1)) {
+ ptr_t next = obj_link(my_entry);
+ GC_PTR result = (GC_PTR)my_entry;
+ *my_fl = next;
+ obj_link(my_entry) = 0;
+ PREFETCH_FOR_WRITE(next);
+ return result;
+ } else if ((word)my_entry - 1 < DIRECT_GRANULES) {
+ *my_fl = my_entry + index + 1;
+ return GC_malloc(bytes);
+ } else {
+ GC_generic_malloc_many(BYTES_FROM_INDEX(index), NORMAL, my_fl);
+ if (*my_fl == 0) return GC_oom_fn(bytes);
+ return GC_local_malloc(bytes);
+ }
+ }
+}
+
+GC_PTR GC_local_malloc_atomic(size_t bytes)
+{
+ if (EXPECT(!SMALL_ENOUGH(bytes), 0)) {
+ return(GC_malloc_atomic(bytes));
+ } else {
+ int index = INDEX_FROM_BYTES(bytes);
+ ptr_t * my_fl = ((GC_thread)GC_getspecific(GC_thread_key))
+ -> ptrfree_freelists + index;
+ ptr_t my_entry = *my_fl;
+ if (EXPECT((word)my_entry >= HBLKSIZE, 1)) {
+ GC_PTR result = (GC_PTR)my_entry;
+ *my_fl = obj_link(my_entry);
+ return result;
+ } else if ((word)my_entry - 1 < DIRECT_GRANULES) {
+ *my_fl = my_entry + index + 1;
+ return GC_malloc_atomic(bytes);
+ } else {
+ GC_generic_malloc_many(BYTES_FROM_INDEX(index), PTRFREE, my_fl);
+ /* *my_fl is updated while the collector is excluded; */
+ /* the free list is always visible to the collector as */
+ /* such. */
+ if (*my_fl == 0) return GC_oom_fn(bytes);
+ return GC_local_malloc_atomic(bytes);
+ }
+ }
+}
+
+#ifdef GC_GCJ_SUPPORT
+
+#include "include/gc_gcj.h"
+
+#ifdef GC_ASSERTIONS
+ extern GC_bool GC_gcj_malloc_initialized;
+#endif
+
+extern int GC_gcj_kind;
+
+GC_PTR GC_local_gcj_malloc(size_t bytes,
+ void * ptr_to_struct_containing_descr)
+{
+ GC_ASSERT(GC_gcj_malloc_initialized);
+ if (EXPECT(!SMALL_ENOUGH(bytes), 0)) {
+ return GC_gcj_malloc(bytes, ptr_to_struct_containing_descr);
+ } else {
+ int index = INDEX_FROM_BYTES(bytes);
+ ptr_t * my_fl = ((GC_thread)GC_getspecific(GC_thread_key))
+ -> gcj_freelists + index;
+ ptr_t my_entry = *my_fl;
+ if (EXPECT((word)my_entry >= HBLKSIZE, 1)) {
+ GC_PTR result = (GC_PTR)my_entry;
+ GC_ASSERT(!GC_incremental);
+ /* We assert that any concurrent marker will stop us. */
+ /* Thus it is impossible for a mark procedure to see the */
+ /* allocation of the next object, but to see this object */
+ /* still containing a free list pointer. Otherwise the */
+ /* marker might find a random "mark descriptor". */
+ *(volatile ptr_t *)my_fl = obj_link(my_entry);
+ /* We must update the freelist before we store the pointer. */
+ /* Otherwise a GC at this point would see a corrupted */
+ /* free list. */
+ /* A memory barrier is probably never needed, since the */
+ /* action of stopping this thread will cause prior writes */
+ /* to complete. */
+ *(void * volatile *)result = ptr_to_struct_containing_descr;
+ return result;
+ } else if ((word)my_entry - 1 < DIRECT_GRANULES) {
+ *my_fl = my_entry + index + 1;
+ return GC_gcj_malloc(bytes, ptr_to_struct_containing_descr);
+ } else {
+ GC_generic_malloc_many(BYTES_FROM_INDEX(index), GC_gcj_kind, my_fl);
+ if (*my_fl == 0) return GC_oom_fn(bytes);
+ return GC_local_gcj_malloc(bytes, ptr_to_struct_containing_descr);
+ }
+ }
+}
+
+#endif /* GC_GCJ_SUPPORT */
+
+# else /* !THREAD_LOCAL_ALLOC && !DBG_HDRS_ALL */
+
+# define GC_destroy_thread_local(t)
+
+# endif /* !THREAD_LOCAL_ALLOC */
+
/*
- * The only way to suspend threads given the pthread interface is to send
- * signals. We can't use SIGSTOP directly, because we need to get the
- * thread to save its stack pointer in the GC thread table before
- * suspending. So we have to reserve a signal of our own for this.
- * This means we have to intercept client calls to change the signal mask.
- * The linuxthreads package already uses SIGUSR1 and SIGUSR2,
- * so we need to reuse something else. I chose SIGPWR.
- * (Perhaps SIGUNUSED would be a better choice.)
+ * We use signals to stop threads during GC.
+ *
+ * Suspended threads wait in signal handler for SIG_THR_RESTART.
+ * That's more portable than semaphores or condition variables.
+ * (We do use sem_post from a signal handler, but that should be portable.)
+ *
+ * The thread suspension signal SIG_SUSPEND is now defined in gc_priv.h.
+ * Note that we can't just stop a thread; we need it to save its stack
+ * pointer(s) and acknowledge.
*/
-#define SIG_SUSPEND SIGPWR
-#define SIG_RESTART SIGXCPU
+#ifndef SIG_THR_RESTART
+# if defined(HPUX_THREADS) || defined(GC_OSF1_THREADS)
+# define SIG_THR_RESTART _SIGRTMIN + 5
+# else
+# define SIG_THR_RESTART SIGXCPU
+# endif
+#endif
sem_t GC_suspend_ack_sem;
+#if !defined(HPUX_THREADS) && !defined(GC_OSF1_THREADS)
/*
-GC_linux_thread_top_of_stack() relies on implementation details of
-LinuxThreads, namely that thread stacks are allocated on 2M boundaries
-and grow to no more than 2M.
To make sure that we're using LinuxThreads and not some other thread
package, we generate a dummy reference to `pthread_kill_other_threads_np'
(was `__pthread_initial_thread_bos' but that disappeared),
@@ -124,20 +467,90 @@ which is a symbol defined in LinuxThreads, but (hopefully) not in other
thread packages.
*/
void (*dummy_var_to_force_linux_threads)() = pthread_kill_other_threads_np;
+#endif /* !HPUX_THREADS */
+
+#if defined(SPARC) || defined(IA64)
+ extern word GC_save_regs_in_stack();
+#endif
+
+long GC_nprocs = 1; /* Number of processors. We may not have */
+ /* access to all of them, but this is as good */
+ /* a guess as any ... */
+
+#ifdef PARALLEL_MARK
-#define LINUX_THREADS_STACK_SIZE (2 * 1024 * 1024)
+# ifndef MAX_MARKERS
+# define MAX_MARKERS 16
+# endif
-static inline ptr_t GC_linux_thread_top_of_stack(void)
+static ptr_t marker_sp[MAX_MARKERS] = {0};
+
+void * GC_mark_thread(void * id)
{
- char *sp = GC_approx_sp();
- ptr_t tos = (ptr_t) (((unsigned long)sp | (LINUX_THREADS_STACK_SIZE - 1)) + 1);
-#if DEBUG_THREADS
- GC_printf1("SP = %lx\n", (unsigned long)sp);
- GC_printf1("TOS = %lx\n", (unsigned long)tos);
-#endif
- return tos;
+ word my_mark_no = 0;
+
+ marker_sp[(word)id] = GC_approx_sp();
+ for (;; ++my_mark_no) {
+ /* GC_mark_no is passed only to allow GC_help_marker to terminate */
+ /* promptly. This is important if it were called from the signal */
+ /* handler or from the GC lock acquisition code. Under Linux, it's */
+ /* not safe to call it from a signal handler, since it uses mutexes */
+ /* and condition variables. Since it is called only here, the */
+ /* argument is unnecessary. */
+ if (my_mark_no < GC_mark_no || my_mark_no > GC_mark_no + 2) {
+ /* resynchronize if we get far off, e.g. because GC_mark_no */
+ /* wrapped. */
+ my_mark_no = GC_mark_no;
+ }
+# ifdef DEBUG_THREADS
+ GC_printf1("Starting mark helper for mark number %ld\n", my_mark_no);
+# endif
+ GC_help_marker(my_mark_no);
+ }
+}
+
+extern long GC_markers; /* Number of mark threads we would */
+ /* like to have. Includes the */
+ /* initiating thread. */
+
+pthread_t GC_mark_threads[MAX_MARKERS];
+
+#define PTHREAD_CREATE REAL_FUNC(pthread_create)
+
+static void start_mark_threads()
+{
+ unsigned i;
+ pthread_attr_t attr;
+
+ if (GC_markers > MAX_MARKERS) {
+ WARN("Limiting number of mark threads\n", 0);
+ GC_markers = MAX_MARKERS;
+ }
+ if (0 != pthread_attr_init(&attr)) ABORT("pthread_attr_init failed");
+
+ if (0 != pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))
+ ABORT("pthread_attr_setdetachstate failed");
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf1("Starting %ld marker threads\n", GC_markers - 1);
+ }
+# endif
+ for (i = 0; i < GC_markers - 1; ++i) {
+ if (0 != PTHREAD_CREATE(GC_mark_threads + i, &attr,
+ GC_mark_thread, (void *)(word)i)) {
+ WARN("Marker thread creation failed, errno = %ld.\n", errno);
+ }
+ }
}
+#else /* !PARALLEL_MARK */
+
+static __inline__ void start_mark_threads()
+{
+}
+
+#endif /* !PARALLEL_MARK */
+
void GC_suspend_handler(int sig)
{
int dummy;
@@ -147,6 +560,12 @@ void GC_suspend_handler(int sig)
sigset_t old_sigs;
int i;
sigset_t mask;
+# ifdef PARALLEL_MARK
+ word my_mark_no = GC_mark_no;
+ /* Marker can't proceed until we acknowledge. Thus this is */
+ /* guaranteed to be the mark_no correspending to our */
+ /* suspension, i.e. the marker can't have incremented it yet. */
+# endif
if (sig != SIG_SUSPEND) ABORT("Bad signal in suspend_handler");
@@ -159,8 +578,14 @@ void GC_suspend_handler(int sig)
/* of a thread which holds the allocation lock in order */
/* to stop the world. Thus concurrent modification of the */
/* data structure is impossible. */
- me -> stack_ptr = (ptr_t)(&dummy);
- me -> stack_end = GC_linux_thread_top_of_stack();
+# ifdef SPARC
+ me -> stack_ptr = (ptr_t)GC_save_regs_in_stack();
+# else
+ me -> stack_ptr = (ptr_t)(&dummy);
+# endif
+# ifdef IA64
+ me -> backing_store_ptr = (ptr_t)GC_save_regs_in_stack();
+# endif
/* Tell the thread that wants to stop the world that this */
/* thread has been stopped. Note that sem_post() is */
@@ -168,15 +593,21 @@ void GC_suspend_handler(int sig)
sem_post(&GC_suspend_ack_sem);
/* Wait until that thread tells us to restart by sending */
- /* this thread a SIG_RESTART signal. */
- /* SIG_RESTART should be masked at this point. Thus there */
+ /* this thread a SIG_THR_RESTART signal. */
+ /* SIG_THR_RESTART should be masked at this point. Thus there */
/* is no race. */
if (sigfillset(&mask) != 0) ABORT("sigfillset() failed");
- if (sigdelset(&mask, SIG_RESTART) != 0) ABORT("sigdelset() failed");
+ if (sigdelset(&mask, SIG_THR_RESTART) != 0) ABORT("sigdelset() failed");
+# ifdef NO_SIGNALS
+ if (sigdelset(&mask, SIGINT) != 0) ABORT("sigdelset() failed");
+ if (sigdelset(&mask, SIGQUIT) != 0) ABORT("sigdelset() failed");
+ if (sigdelset(&mask, SIGTERM) != 0) ABORT("sigdelset() failed");
+ if (sigdelset(&mask, SIGABRT) != 0) ABORT("sigdelset() failed");
+# endif
do {
me->signal = 0;
sigsuspend(&mask); /* Wait for signal */
- } while (me->signal != SIG_RESTART);
+ } while (me->signal != SIG_THR_RESTART);
#if DEBUG_THREADS
GC_printf1("Continuing 0x%x\n", my_thread);
@@ -187,15 +618,15 @@ void GC_restart_handler(int sig)
{
GC_thread me;
- if (sig != SIG_RESTART) ABORT("Bad signal in suspend_handler");
+ if (sig != SIG_THR_RESTART) ABORT("Bad signal in suspend_handler");
- /* Let the GC_suspend_handler() know that we got a SIG_RESTART. */
+ /* Let the GC_suspend_handler() know that we got a SIG_THR_RESTART. */
/* The lookup here is safe, since I'm doing this on behalf */
/* of a thread which holds the allocation lock in order */
/* to stop the world. Thus concurrent modification of the */
/* data structure is impossible. */
me = GC_lookup_thread(pthread_self());
- me->signal = SIG_RESTART;
+ me->signal = SIG_THR_RESTART;
/*
** Note: even if we didn't do anything useful here,
@@ -210,11 +641,57 @@ void GC_restart_handler(int sig)
#endif
}
+/* Defining INSTALL_LOOPING_SEGV_HANDLER causes SIGSEGV and SIGBUS to */
+/* result in an infinite loop in a signal handler. This can be very */
+/* useful for debugging, since (as of RH7) gdb still seems to have */
+/* serious problems with threads. */
+#ifdef INSTALL_LOOPING_SEGV_HANDLER
+void GC_looping_handler(int sig)
+{
+ GC_printf3("Signal %ld in thread %lx, pid %ld\n",
+ sig, pthread_self(), getpid());
+ for (;;);
+}
+#endif
+
GC_bool GC_thr_initialized = FALSE;
# define THREAD_TABLE_SZ 128 /* Must be power of 2 */
volatile GC_thread GC_threads[THREAD_TABLE_SZ];
+void GC_push_thread_structures GC_PROTO((void))
+{
+ GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads));
+}
+
+#ifdef THREAD_LOCAL_ALLOC
+/* We must explicitly mark ptrfree and gcj free lists, since the free */
+/* list links wouldn't otherwise be found. We also set them in the */
+/* normal free lists, since that involves touching less memory than if */
+/* we scanned them normally. */
+void GC_mark_thread_local_free_lists(void)
+{
+ int i, j;
+ GC_thread p;
+ ptr_t q;
+
+ for (i = 0; i < THREAD_TABLE_SZ; ++i) {
+ for (p = GC_threads[i]; 0 != p; p = p -> next) {
+ for (j = 1; j < NFREELISTS; ++j) {
+ q = p -> ptrfree_freelists[j];
+ if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
+ q = p -> normal_freelists[j];
+ if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
+# ifdef GC_GCJ_SUPPORT
+ q = p -> gcj_freelists[j];
+ if ((word)q > HBLKSIZE) GC_set_fl_marks(q);
+# endif /* GC_GCJ_SUPPORT */
+ }
+ }
+ }
+}
+#endif /* THREAD_LOCAL_ALLOC */
+
/* Add a thread to GC_threads. We assume it wasn't already there. */
/* Caller holds allocation lock. */
GC_thread GC_new_thread(pthread_t id)
@@ -227,16 +704,15 @@ GC_thread GC_new_thread(pthread_t id)
if (!first_thread_used) {
result = &first_thread;
first_thread_used = TRUE;
- /* Dont acquire allocation lock, since we may already hold it. */
} else {
result = (struct GC_Thread_Rep *)
- GC_generic_malloc_inner(sizeof(struct GC_Thread_Rep), NORMAL);
+ GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL);
}
if (result == 0) return(0);
result -> id = id;
result -> next = GC_threads[hv];
GC_threads[hv] = result;
- /* result -> flags = 0; */
+ GC_ASSERT(result -> flags == 0 && result -> thread_blocked == 0);
return(result);
}
@@ -258,6 +734,7 @@ void GC_delete_thread(pthread_t id)
} else {
prev -> next = p -> next;
}
+ GC_INTERNAL_FREE(p);
}
/* If a thread has been joined, but we have not yet */
@@ -279,6 +756,7 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
} else {
prev -> next = p -> next;
}
+ GC_INTERNAL_FREE(p);
}
/* Return a GC_thread corresponding to a given thread_t. */
@@ -296,6 +774,11 @@ GC_thread GC_lookup_thread(pthread_t id)
return(p);
}
+/* There seems to be a very rare thread stopping problem. To help us */
+/* debug that, we save the ids of the stopping thread. */
+pthread_t GC_stopping_thread;
+int GC_stopping_pid;
+
/* Caller holds allocation lock. */
void GC_stop_world()
{
@@ -305,10 +788,22 @@ void GC_stop_world()
register int n_live_threads = 0;
register int result;
+ GC_stopping_thread = my_thread; /* debugging only. */
+ GC_stopping_pid = getpid(); /* debugging only. */
+ /* Make sure all free list construction has stopped before we start. */
+ /* No new construction can start, since free list construction is */
+ /* required to acquire and release the GC lock before it starts, */
+ /* and we have the lock. */
+# ifdef PARALLEL_MARK
+ GC_acquire_mark_lock();
+ GC_ASSERT(GC_fl_builder_count == 0);
+ /* We should have previously waited for it to become zero. */
+# endif /* PARALLEL_MARK */
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> id != my_thread) {
if (p -> flags & FINISHED) continue;
+ if (p -> thread_blocked) /* Will wait */ continue;
n_live_threads++;
#if DEBUG_THREADS
GC_printf1("Sending suspend signal to 0x%x\n", p -> id);
@@ -328,14 +823,20 @@ void GC_stop_world()
}
}
for (i = 0; i < n_live_threads; i++) {
- sem_wait(&GC_suspend_ack_sem);
+ if (0 != sem_wait(&GC_suspend_ack_sem))
+ ABORT("sem_wait in handler failed");
}
+# ifdef PARALLEL_MARK
+ GC_release_mark_lock();
+# endif
#if DEBUG_THREADS
- GC_printf1("World stopped 0x%x\n", pthread_self());
+ GC_printf1("World stopped 0x%x\n", pthread_self());
#endif
+ GC_stopping_thread = 0; /* debugging only */
}
-/* Caller holds allocation lock. */
+/* Caller holds allocation lock, and has held it continuously since */
+/* the world stopped. */
void GC_start_world()
{
pthread_t my_thread = pthread_self();
@@ -352,11 +853,12 @@ void GC_start_world()
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> id != my_thread) {
if (p -> flags & FINISHED) continue;
+ if (p -> thread_blocked) continue;
n_live_threads++;
#if DEBUG_THREADS
GC_printf1("Sending restart signal to 0x%x\n", p -> id);
#endif
- result = pthread_kill(p -> id, SIG_RESTART);
+ result = pthread_kill(p -> id, SIG_THR_RESTART);
switch(result) {
case ESRCH:
/* Not really there anymore. Possible? */
@@ -375,13 +877,21 @@ void GC_start_world()
#endif
}
-/* We hold allocation lock. We assume the world is stopped. */
+# ifdef IA64
+# define IF_IA64(x) x
+# else
+# define IF_IA64(x)
+# endif
+/* We hold allocation lock. Should do exactly the right thing if the */
+/* world is stopped. Should not fail if it isn't. */
void GC_push_all_stacks()
{
- register int i;
- register GC_thread p;
- register ptr_t sp = GC_approx_sp();
- register ptr_t lo, hi;
+ int i;
+ GC_thread p;
+ ptr_t sp = GC_approx_sp();
+ ptr_t lo, hi;
+ /* On IA64, we also need to scan the register backing store. */
+ IF_IA64(ptr_t bs_lo; ptr_t bs_hi;)
pthread_t me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
@@ -392,34 +902,115 @@ void GC_push_all_stacks()
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> flags & FINISHED) continue;
if (pthread_equal(p -> id, me)) {
- lo = GC_approx_sp();
+# ifdef SPARC
+ lo = (ptr_t)GC_save_regs_in_stack();
+# else
+ lo = GC_approx_sp();
+# endif
+ IF_IA64(bs_hi = (ptr_t)GC_save_regs_in_stack();)
} else {
lo = p -> stack_ptr;
+ IF_IA64(bs_hi = p -> backing_store_ptr;)
}
if ((p -> flags & MAIN_THREAD) == 0) {
- if (pthread_equal(p -> id, me)) {
- hi = GC_linux_thread_top_of_stack();
- } else {
- hi = p -> stack_end;
- }
+ hi = p -> stack_end;
+ IF_IA64(bs_lo = p -> backing_store_end);
} else {
/* The original stack. */
hi = GC_stackbottom;
+ IF_IA64(bs_lo = BACKING_STORE_BASE;)
}
#if DEBUG_THREADS
GC_printf3("Stack for thread 0x%lx = [%lx,%lx)\n",
(unsigned long) p -> id,
(unsigned long) lo, (unsigned long) hi);
#endif
- GC_push_all_stack(lo, hi);
+ if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
+# ifdef STACK_GROWS_UP
+ /* We got them backwards! */
+ GC_push_all_stack(hi, lo);
+# else
+ GC_push_all_stack(lo, hi);
+# endif
+# ifdef IA64
+ if (pthread_equal(p -> id, me)) {
+ GC_push_all_eager(bs_lo, bs_hi);
+ } else {
+ GC_push_all_stack(bs_lo, bs_hi);
+ }
+# endif
}
}
}
+#ifdef USE_PROC_FOR_LIBRARIES
+int GC_segment_is_thread_stack(ptr_t lo, ptr_t hi)
+{
+ int i;
+ GC_thread p;
+
+# ifdef PARALLEL_MARK
+ for (i = 0; i < GC_markers; ++i) {
+ if (marker_sp[i] > lo & marker_sp[i] < hi) return 1;
+ }
+# endif
+ for (i = 0; i < THREAD_TABLE_SZ; i++) {
+ for (p = GC_threads[i]; p != 0; p = p -> next) {
+ if (0 != p -> stack_end) {
+# ifdef STACK_GROWS_UP
+ if (p -> stack_end >= lo && p -> stack_end < hi) return 1;
+# else /* STACK_GROWS_DOWN */
+ if (p -> stack_end > lo && p -> stack_end <= hi) return 1;
+# endif
+ }
+ }
+ }
+ return 0;
+}
+#endif /* USE_PROC_FOR_LIBRARIES */
+
+#ifdef LINUX_THREADS
+/* Return the number of processors, or i<= 0 if it can't be determined. */
+int GC_get_nprocs()
+{
+ /* Should be "return sysconf(_SC_NPROCESSORS_ONLN);" but that */
+ /* appears to be buggy in many cases. */
+ /* We look for lines "cpu<n>" in /proc/stat. */
+# define STAT_BUF_SIZE 4096
+# if defined(GC_USE_LD_WRAP)
+# define STAT_READ __real_read
+# else
+# define STAT_READ read
+# endif
+ char stat_buf[STAT_BUF_SIZE];
+ int f;
+ char c;
+ word result = 1;
+ /* Some old kernels only have a single "cpu nnnn ..." */
+ /* entry in /proc/stat. We identify those as */
+ /* uniprocessors. */
+ size_t i, len = 0;
+
+ f = open("/proc/stat", O_RDONLY);
+ if (f < 0 || (len = STAT_READ(f, stat_buf, STAT_BUF_SIZE)) < 100) {
+ WARN("Couldn't read /proc/stat\n", 0);
+ return -1;
+ }
+ for (i = 0; i < len - 100; ++i) {
+ if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'
+ && stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') {
+ int cpu_no = atoi(stat_buf + i + 4);
+ if (cpu_no >= result) result = cpu_no + 1;
+ }
+ }
+ return result;
+}
+#endif /* LINUX_THREADS */
/* We hold the allocation lock. */
void GC_thr_init()
{
+ int dummy;
GC_thread t;
struct sigaction act;
@@ -433,24 +1024,112 @@ void GC_thr_init()
if (sigfillset(&act.sa_mask) != 0) {
ABORT("sigfillset() failed");
}
- /* SIG_RESTART is unmasked by the handler when necessary. */
+# ifdef NO_SIGNALS
+ if (sigdelset(&act.sa_mask, SIGINT) != 0
+ || sigdelset(&act.sa_mask, SIGQUIT != 0)
+ || sigdelset(&act.sa_mask, SIGABRT != 0)
+ || sigdelset(&act.sa_mask, SIGTERM != 0)) {
+ ABORT("sigdelset() failed");
+ }
+# endif
+
+ /* SIG_THR_RESTART is unmasked by the handler when necessary. */
act.sa_handler = GC_suspend_handler;
if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
ABORT("Cannot set SIG_SUSPEND handler");
}
act.sa_handler = GC_restart_handler;
- if (sigaction(SIG_RESTART, &act, NULL) != 0) {
- ABORT("Cannot set SIG_SUSPEND handler");
+ if (sigaction(SIG_THR_RESTART, &act, NULL) != 0) {
+ ABORT("Cannot set SIG_THR_RESTART handler");
}
+# ifdef INSTALL_LOOPING_SEGV_HANDLER
+ act.sa_handler = GC_looping_handler;
+ if (sigaction(SIGSEGV, &act, NULL) != 0
+ || sigaction(SIGBUS, &act, NULL) != 0) {
+ ABORT("Cannot set SIGSEGV or SIGBUS looping handler");
+ }
+# endif /* INSTALL_LOOPING_SEGV_HANDLER */
/* Add the initial thread, so we can stop it. */
t = GC_new_thread(pthread_self());
- t -> stack_ptr = 0;
+ t -> stack_ptr = (ptr_t)(&dummy);
t -> flags = DETACHED | MAIN_THREAD;
+
+ /* Set GC_nprocs. */
+ {
+ char * nprocs_string = GETENV("GC_NPROCS");
+ GC_nprocs = -1;
+ if (nprocs_string != NULL) GC_nprocs = atoi(nprocs_string);
+ }
+ if (GC_nprocs <= 0) {
+# if defined(HPUX_THREADS)
+ GC_nprocs = pthread_num_processors_np();
+# endif
+# if defined(OSF1_THREADS)
+ GC_nprocs = 1;
+# endif
+# ifdef LINUX_THREADS
+ GC_nprocs = GC_get_nprocs();
+# endif
+ }
+ if (GC_nprocs <= 0) {
+ WARN("GC_get_nprocs() returned %ld\n", GC_nprocs);
+ GC_nprocs = 2;
+# ifdef PARALLEL_MARK
+ GC_markers = 1;
+# endif
+ } else {
+# ifdef PARALLEL_MARK
+ GC_markers = GC_nprocs;
+# endif
+ }
+# ifdef PARALLEL_MARK
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf2("Number of processors = %ld, "
+ "number of marker threads = %ld\n", GC_nprocs, GC_markers);
+ }
+# endif
+ if (GC_markers == 1) {
+ GC_parallel = FALSE;
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf0("Single marker thread, turning off parallel marking\n");
+ }
+# endif
+ } else {
+ GC_parallel = TRUE;
+ }
+# endif
+}
+
+
+/* Perform all initializations, including those that */
+/* may require allocation. */
+/* Called as constructor without allocation lock. */
+/* Must be called before a second thread is created. */
+/* Called without allocation lock. */
+void GC_init_parallel()
+{
+ if (parallel_initialized) return;
+ parallel_initialized = TRUE;
+ /* GC_init() calls us back, so set flag first. */
+ if (!GC_is_initialized) GC_init();
+ /* If we are using a parallel marker, start the helper threads. */
+# ifdef PARALLEL_MARK
+ if (GC_parallel) start_mark_threads();
+# endif
+ /* Initialize thread local free lists if used. */
+# if defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
+ LOCK();
+ GC_init_thread_local(GC_lookup_thread(pthread_self()));
+ UNLOCK();
+# endif
}
-int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
+
+int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set, sigset_t *oset)
{
sigset_t fudged_set;
@@ -459,7 +1138,57 @@ int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
sigdelset(&fudged_set, SIG_SUSPEND);
set = &fudged_set;
}
- return(pthread_sigmask(how, set, oset));
+ return(REAL_FUNC(pthread_sigmask)(how, set, oset));
+}
+
+/* Wrappers for functions that are likely to block for an appreciable */
+/* length of time. Must be called in pairs, if at all. */
+/* Nothing much beyond the system call itself should be executed */
+/* between these. */
+
+void GC_start_blocking(void) {
+# define SP_SLOP 128
+ GC_thread me;
+ LOCK();
+ me = GC_lookup_thread(pthread_self());
+ GC_ASSERT(!(me -> thread_blocked));
+# ifdef SPARC
+ me -> stack_ptr = (ptr_t)GC_save_regs_in_stack();
+# else
+ me -> stack_ptr = (ptr_t)GC_approx_sp();
+# endif
+# ifdef IA64
+ me -> backing_store_ptr = (ptr_t)GC_save_regs_in_stack() + SP_SLOP;
+# endif
+ /* Add some slop to the stack pointer, since the wrapped call may */
+ /* end up pushing more callee-save registers. */
+# ifdef STACK_GROWS_UP
+ me -> stack_ptr += SP_SLOP;
+# else
+ me -> stack_ptr -= SP_SLOP;
+# endif
+ me -> thread_blocked = TRUE;
+ UNLOCK();
+}
+
+GC_end_blocking(void) {
+ GC_thread me;
+ LOCK(); /* This will block if the world is stopped. */
+ me = GC_lookup_thread(pthread_self());
+ GC_ASSERT(me -> thread_blocked);
+ me -> thread_blocked = FALSE;
+ UNLOCK();
+}
+
+/* A wrapper for the standard C sleep function */
+int WRAP_FUNC(sleep) (unsigned int seconds)
+{
+ int result;
+
+ GC_start_blocking();
+ result = REAL_FUNC(sleep)(seconds);
+ GC_end_blocking();
+ return result;
}
struct start_info {
@@ -470,23 +1199,46 @@ struct start_info {
/* parent hasn't yet noticed. */
};
-
+/* Called at thread exit. */
+/* Never called for main thread. That's OK, since it */
+/* results in at most a tiny one-time leak. And */
+/* linuxthreads doesn't reclaim the main threads */
+/* resources or id anyway. */
void GC_thread_exit_proc(void *arg)
{
GC_thread me;
- struct start_info * si = arg;
LOCK();
me = GC_lookup_thread(pthread_self());
+ GC_destroy_thread_local(me);
if (me -> flags & DETACHED) {
GC_delete_thread(pthread_self());
} else {
me -> flags |= FINISHED;
}
+# if defined(THREAD_LOCAL_ALLOC) && !defined(USE_PTHREAD_SPECIFIC) \
+ && !defined(USE_HPUX_TLS) && !defined(DBG_HDRS_ALL)
+ GC_remove_specific(GC_thread_key);
+# endif
+ if (GC_incremental && GC_collection_in_progress()) {
+ int old_gc_no = GC_gc_no;
+
+ /* Make sure that no part of our stack is still on the mark stack, */
+ /* since it's about to be unmapped. */
+ while (GC_incremental && GC_collection_in_progress()
+ && old_gc_no == GC_gc_no) {
+ ENTER_GC();
+ GC_collect_a_little_inner(1);
+ EXIT_GC();
+ UNLOCK();
+ sched_yield();
+ LOCK();
+ }
+ }
UNLOCK();
}
-int GC_pthread_join(pthread_t thread, void **retval)
+int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
{
int result;
GC_thread thread_gc_id;
@@ -496,16 +1248,41 @@ int GC_pthread_join(pthread_t thread, void **retval)
/* This is guaranteed to be the intended one, since the thread id */
/* cant have been recycled by pthreads. */
UNLOCK();
- result = pthread_join(thread, retval);
+ result = REAL_FUNC(pthread_join)(thread, retval);
+ if (result == 0) {
+ LOCK();
+ /* Here the pthread thread id may have been recycled. */
+ GC_delete_gc_thread(thread, thread_gc_id);
+ UNLOCK();
+ }
+ return result;
+}
+
+int
+WRAP_FUNC(pthread_detach)(pthread_t thread)
+{
+ int result;
+ GC_thread thread_gc_id;
+
LOCK();
- /* Here the pthread thread id may have been recycled. */
- GC_delete_gc_thread(thread, thread_gc_id);
+ thread_gc_id = GC_lookup_thread(thread);
UNLOCK();
+ result = REAL_FUNC(pthread_detach)(thread);
+ if (result == 0) {
+ LOCK();
+ thread_gc_id -> flags |= DETACHED;
+ /* Here the pthread thread id may have been recycled. */
+ if (thread_gc_id -> flags & FINISHED) {
+ GC_delete_gc_thread(thread, thread_gc_id);
+ }
+ UNLOCK();
+ }
return result;
}
void * GC_start_routine(void * arg)
{
+ int dummy;
struct start_info * si = arg;
void * result;
GC_thread me;
@@ -514,22 +1291,51 @@ void * GC_start_routine(void * arg)
void *start_arg;
my_pthread = pthread_self();
+# ifdef DEBUG_THREADS
+ GC_printf1("Starting thread 0x%lx\n", my_pthread);
+ GC_printf1("pid = %ld\n", (long) getpid());
+ GC_printf1("sp = 0x%lx\n", (long) &arg);
+# endif
LOCK();
me = GC_new_thread(my_pthread);
me -> flags = si -> flags;
me -> stack_ptr = 0;
- me -> stack_end = 0;
+ /* me -> stack_end = GC_linux_stack_base(); -- currently (11/99) */
+ /* doesn't work because the stack base in /proc/self/stat is the */
+ /* one for the main thread. There is a strong argument that that's */
+ /* a kernel bug, but a pervasive one. */
+# ifdef STACK_GROWS_DOWN
+ me -> stack_end = (ptr_t)(((word)(&dummy) + (GC_page_size - 1))
+ & ~(GC_page_size - 1));
+ me -> stack_ptr = me -> stack_end - 0x10;
+ /* Needs to be plausible, since an asynchronous stack mark */
+ /* should not crash. */
+# else
+ me -> stack_end = (ptr_t)((word)(&dummy) & ~(GC_page_size - 1));
+ me -> stack_ptr = me -> stack_end + 0x10;
+# endif
+ /* This is dubious, since we may be more than a page into the stack, */
+ /* and hence skip some of it, though it's not clear that matters. */
+# ifdef IA64
+ me -> backing_store_end = (ptr_t)
+ (GC_save_regs_in_stack() & ~(GC_page_size - 1));
+ /* This is also < 100% convincing. We should also read this */
+ /* from /proc, but the hook to do so isn't there yet. */
+# endif /* IA64 */
UNLOCK();
start = si -> start_routine;
- start_arg = si -> arg;
- sem_post(&(si -> registered));
- pthread_cleanup_push(GC_thread_exit_proc, si);
# ifdef DEBUG_THREADS
- GC_printf1("Starting thread 0x%lx\n", pthread_self());
- GC_printf1("pid = %ld\n", (long) getpid());
- GC_printf1("sp = 0x%lx\n", (long) &arg);
GC_printf1("start_routine = 0x%lx\n", start);
# endif
+ start_arg = si -> arg;
+ sem_post(&(si -> registered)); /* Last action on si. */
+ /* OK to deallocate. */
+ pthread_cleanup_push(GC_thread_exit_proc, 0);
+# if defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
+ LOCK();
+ GC_init_thread_local(me);
+ UNLOCK();
+# endif
result = (*start)(start_arg);
#if DEBUG_THREADS
GC_printf1("Finishing thread 0x%x\n", pthread_self());
@@ -544,22 +1350,23 @@ void * GC_start_routine(void * arg)
}
int
-GC_pthread_create(pthread_t *new_thread,
+WRAP_FUNC(pthread_create)(pthread_t *new_thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg)
{
int result;
GC_thread t;
pthread_t my_new_thread;
- void * stack;
- size_t stacksize;
- pthread_attr_t new_attr;
int detachstate;
word my_flags = 0;
- struct start_info * si = GC_malloc(sizeof(struct start_info));
+ struct start_info * si;
/* This is otherwise saved only in an area mmapped by the thread */
/* library, which isn't visible to the collector. */
-
+
+ LOCK();
+ si = (struct start_info *)GC_INTERNAL_MALLOC(sizeof(struct start_info), NORMAL);
+ UNLOCK();
+ if (!parallel_initialized) GC_init_parallel();
if (0 == si) return(ENOMEM);
sem_init(&(si -> registered), 0, 0);
si -> start_routine = start_routine;
@@ -567,32 +1374,132 @@ GC_pthread_create(pthread_t *new_thread,
LOCK();
if (!GC_thr_initialized) GC_thr_init();
if (NULL == attr) {
- stack = 0;
- (void) pthread_attr_init(&new_attr);
+ detachstate = PTHREAD_CREATE_JOINABLE;
} else {
- new_attr = *attr;
+ pthread_attr_getdetachstate(attr, &detachstate);
}
- pthread_attr_getdetachstate(&new_attr, &detachstate);
if (PTHREAD_CREATE_DETACHED == detachstate) my_flags |= DETACHED;
si -> flags = my_flags;
UNLOCK();
- result = pthread_create(new_thread, &new_attr, GC_start_routine, si);
+# ifdef DEBUG_THREADS
+ GC_printf1("About to start new thread from thread 0x%X\n",
+ pthread_self());
+# endif
+ result = REAL_FUNC(pthread_create)(new_thread, attr, GC_start_routine, si);
+# ifdef DEBUG_THREADS
+ GC_printf1("Started thread 0x%X\n", *new_thread);
+# endif
/* Wait until child has been added to the thread table. */
/* This also ensures that we hold onto si until the child is done */
/* with it. Thus it doesn't matter whether it is otherwise */
/* visible to the collector. */
- if (0 != sem_wait(&(si -> registered))) ABORT("sem_wait failed");
+ while (0 != sem_wait(&(si -> registered))) {
+ if (EINTR != errno) ABORT("sem_wait failed");
+ }
sem_destroy(&(si -> registered));
- /* pthread_attr_destroy(&new_attr); */
- /* pthread_attr_destroy(&new_attr); */
+ LOCK();
+ GC_INTERNAL_FREE(si);
+ UNLOCK();
return(result);
}
-GC_bool GC_collecting = 0;
+#ifdef GENERIC_COMPARE_AND_SWAP
+ pthread_mutex_t GC_compare_and_swap_lock = PTHREAD_MUTEX_INITIALIZER;
+
+ GC_bool GC_compare_and_exchange(volatile GC_word *addr,
+ GC_word old, GC_word new_val)
+ {
+ GC_bool result;
+ pthread_mutex_lock(&GC_compare_and_swap_lock);
+ if (*addr == old) {
+ *addr = new_val;
+ result = TRUE;
+ } else {
+ result = FALSE;
+ }
+ pthread_mutex_unlock(&GC_compare_and_swap_lock);
+ return result;
+ }
+
+ GC_word GC_atomic_add(volatile GC_word *addr, GC_word how_much)
+ {
+ GC_word old;
+ pthread_mutex_lock(&GC_compare_and_swap_lock);
+ old = *addr;
+ *addr = old + how_much;
+ pthread_mutex_unlock(&GC_compare_and_swap_lock);
+ return old;
+ }
+
+#endif /* GENERIC_COMPARE_AND_SWAP */
+/* Spend a few cycles in a way that can't introduce contention with */
+/* othre threads. */
+void GC_pause()
+{
+ int i;
+ volatile word dummy = 0;
+
+ for (i = 0; i < 10; ++i) {
+# ifdef __GNUC__
+ __asm__ __volatile__ (" " : : : "memory");
+# else
+ /* Something that's unlikely to be optimized away. */
+ GC_noop(++dummy);
+# endif
+ }
+}
+
+#define SPIN_MAX 1024 /* Maximum number of calls to GC_pause before */
+ /* give up. */
+
+VOLATILE GC_bool GC_collecting = 0;
/* A hint that we're in the collector and */
/* holding the allocation lock for an */
/* extended period. */
+#if !defined(USE_SPIN_LOCK) || defined(PARALLEL_MARK)
+/* If we don't want to use the below spinlock implementation, either */
+/* because we don't have a GC_test_and_set implementation, or because */
+/* we don't want to risk sleeping, we can still try spinning on */
+/* pthread_mutex_trylock for a while. This appears to be very */
+/* beneficial in many cases. */
+/* I suspect that under high contention this is nearly always better */
+/* than the spin lock. But it's a bit slower on a uniprocessor. */
+/* Hence we still default to the spin lock. */
+/* This is also used to acquire the mark lock for the parallel */
+/* marker. */
+
+/* Here we use a strict exponential backoff scheme. I don't know */
+/* whether that's better or worse than the above. We eventually */
+/* yield by calling pthread_mutex_lock(); it never makes sense to */
+/* explicitly sleep. */
+
+void GC_generic_lock(pthread_mutex_t * lock)
+{
+ unsigned pause_length = 1;
+ unsigned i;
+
+ if (0 == pthread_mutex_trylock(lock)) return;
+ for (; pause_length <= SPIN_MAX; pause_length <<= 1) {
+ for (i = 0; i < pause_length; ++i) {
+ GC_pause();
+ }
+ switch(pthread_mutex_trylock(lock)) {
+ case 0:
+ return;
+ case EBUSY:
+ break;
+ default:
+ ABORT("Unexpected error from pthread_mutex_trylock");
+ }
+ }
+ pthread_mutex_lock(lock);
+}
+
+#endif /* !USE_SPIN_LOCK || PARALLEL_MARK */
+
+#if defined(USE_SPIN_LOCK)
+
/* Reasonably fast spin locks. Basically the same implementation */
/* as STL alloc.h. This isn't really the right way to do this. */
/* but until the POSIX scheduling mess gets straightened out ... */
@@ -603,25 +1510,22 @@ volatile unsigned int GC_allocate_lock = 0;
void GC_lock()
{
# define low_spin_max 30 /* spin cycles if we suspect uniprocessor */
-# define high_spin_max 1000 /* spin cycles for multiprocessor */
+# define high_spin_max SPIN_MAX /* spin cycles for multiprocessor */
static unsigned spin_max = low_spin_max;
unsigned my_spin_max;
static unsigned last_spins = 0;
unsigned my_last_spins;
- volatile unsigned junk;
-# define PAUSE junk *= junk; junk *= junk; junk *= junk; junk *= junk
int i;
if (!GC_test_and_set(&GC_allocate_lock)) {
return;
}
- junk = 0;
my_spin_max = spin_max;
my_last_spins = last_spins;
for (i = 0; i < my_spin_max; i++) {
- if (GC_collecting) goto yield;
+ if (GC_collecting || GC_nprocs == 1) goto yield;
if (i < my_last_spins/2 || GC_allocate_lock) {
- PAUSE;
+ GC_pause();
continue;
}
if (!GC_test_and_set(&GC_allocate_lock)) {
@@ -651,8 +1555,8 @@ yield:
} else {
struct timespec ts;
- if (i > 26) i = 26;
- /* Don't wait for more than about 60msecs, even */
+ if (i > 24) i = 24;
+ /* Don't wait for more than about 15msecs, even */
/* under extreme contention. */
ts.tv_sec = 0;
ts.tv_nsec = 1 << i;
@@ -661,5 +1565,131 @@ yield:
}
}
+#else /* !USE_SPINLOCK */
+
+void GC_lock()
+{
+ if (1 == GC_nprocs || GC_collecting) {
+ pthread_mutex_lock(&GC_allocate_ml);
+ } else {
+ GC_generic_lock(&GC_allocate_ml);
+ }
+}
+
+#endif /* !USE_SPINLOCK */
+
+#if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+
+#ifdef GC_ASSERTIONS
+ pthread_t GC_mark_lock_holder = NO_THREAD;
+#endif
+
+#ifdef IA64
+ /* Ugly workaround for a linux threads bug in the final versions */
+ /* of glibc2.1. Pthread_mutex_trylock sets the mutex owner */
+ /* field even when it fails to acquire the mutex. This causes */
+ /* pthread_cond_wait to die. Remove for glibc2.2. */
+ /* According to the man page, we should use */
+ /* PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, but that isn't actually */
+ /* defined. */
+ static pthread_mutex_t mark_mutex =
+ {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, {0, 0}};
+#else
+ static pthread_mutex_t mark_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER;
+
+void GC_acquire_mark_lock()
+{
+/*
+ if (pthread_mutex_lock(&mark_mutex) != 0) {
+ ABORT("pthread_mutex_lock failed");
+ }
+*/
+ GC_generic_lock(&mark_mutex);
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = pthread_self();
+# endif
+}
+
+void GC_release_mark_lock()
+{
+ GC_ASSERT(GC_mark_lock_holder == pthread_self());
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = NO_THREAD;
+# endif
+ if (pthread_mutex_unlock(&mark_mutex) != 0) {
+ ABORT("pthread_mutex_unlock failed");
+ }
+}
+
+/* Collector must wait for a freelist builders for 2 reasons: */
+/* 1) Mark bits may still be getting examined without lock. */
+/* 2) Partial free lists referenced only by locals may not be scanned */
+/* correctly, e.g. if they contain "pointer-free" objects, since the */
+/* free-list link may be ignored. */
+void GC_wait_builder()
+{
+ GC_ASSERT(GC_mark_lock_holder == pthread_self());
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = NO_THREAD;
+# endif
+ if (pthread_cond_wait(&builder_cv, &mark_mutex) != 0) {
+ ABORT("pthread_cond_wait failed");
+ }
+ GC_ASSERT(GC_mark_lock_holder == NO_THREAD);
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = pthread_self();
+# endif
+}
+
+void GC_wait_for_reclaim()
+{
+ GC_acquire_mark_lock();
+ while (GC_fl_builder_count > 0) {
+ GC_wait_builder();
+ }
+ GC_release_mark_lock();
+}
+
+void GC_notify_all_builder()
+{
+ GC_ASSERT(GC_mark_lock_holder == pthread_self());
+ if (pthread_cond_broadcast(&builder_cv) != 0) {
+ ABORT("pthread_cond_broadcast failed");
+ }
+}
+
+#endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
+
+#ifdef PARALLEL_MARK
+
+static pthread_cond_t mark_cv = PTHREAD_COND_INITIALIZER;
+
+void GC_wait_marker()
+{
+ GC_ASSERT(GC_mark_lock_holder == pthread_self());
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = NO_THREAD;
+# endif
+ if (pthread_cond_wait(&mark_cv, &mark_mutex) != 0) {
+ ABORT("pthread_cond_wait failed");
+ }
+ GC_ASSERT(GC_mark_lock_holder == NO_THREAD);
+# ifdef GC_ASSERTIONS
+ GC_mark_lock_holder = pthread_self();
+# endif
+}
+
+void GC_notify_all_marker()
+{
+ if (pthread_cond_broadcast(&mark_cv) != 0) {
+ ABORT("pthread_cond_broadcast failed");
+ }
+}
+
+#endif /* PARALLEL_MARK */
+
# endif /* LINUX_THREADS */
diff --git a/gc/ltconfig b/gc/ltconfig
@@ -0,0 +1,3078 @@
+#! /bin/sh
+
+# ltconfig - Create a system-specific libtool.
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A lot of this script is taken from autoconf-2.10.
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+echo=echo
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec "$SHELL" "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) PATH_SEPARATOR=';' ;;
+ *) PATH_SEPARATOR=':' ;;
+ esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
+ test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running ltconfig again with it.
+ ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf "%s\n"'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
+ test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# The name of this program.
+progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
+
+# Constants:
+PROGRAM=ltconfig
+PACKAGE=libtool
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+rm="rm -f"
+
+help="Try \`$progname --help' for more information."
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+enable_shared=yes
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+enable_static=yes
+enable_fast_install=yes
+enable_dlopen=unknown
+enable_win32_dll=no
+ltmain=
+silent=
+srcdir=
+ac_config_guess=
+ac_config_sub=
+host=
+nonopt=
+ofile="$default_ofile"
+verify_host=yes
+with_gcc=no
+with_gnu_ld=no
+need_locks=yes
+ac_ext=c
+objext=o
+libext=a
+exeext=
+cache_file=
+
+old_AR="$AR"
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+old_CPPFLAGS="$CPPFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LD="$LD"
+old_LN_S="$LN_S"
+old_LIBS="$LIBS"
+old_NM="$NM"
+old_RANLIB="$RANLIB"
+old_DLLTOOL="$DLLTOOL"
+old_OBJDUMP="$OBJDUMP"
+old_AS="$AS"
+
+# Parse the command line options.
+args=
+prev=
+for option
+do
+ case "$option" in
+ -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ eval "$prev=\$option"
+ prev=
+ continue
+ fi
+
+ case "$option" in
+ --help) cat <<EOM
+Usage: $progname [OPTION]... [HOST [LTMAIN]]
+
+Generate a system-specific libtool script.
+
+ --debug enable verbose shell tracing
+ --disable-shared do not build shared libraries
+ --disable-static do not build static libraries
+ --disable-fast-install do not optimize for fast installation
+ --enable-dlopen enable dlopen support
+ --enable-win32-dll enable building dlls on win32 hosts
+ --help display this help and exit
+ --no-verify do not verify that HOST is a valid host type
+-o, --output=FILE specify the output file [default=$default_ofile]
+ --quiet same as \`--silent'
+ --silent do not print informational messages
+ --srcdir=DIR find \`config.guess' in DIR
+ --version output version information and exit
+ --with-gcc assume that the GNU C compiler will be used
+ --with-gnu-ld assume that the C compiler uses the GNU linker
+ --disable-lock disable file locking
+ --cache-file=FILE configure cache file
+
+LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
+that provides basic libtool functionality.
+
+HOST is the canonical host system name [default=guessed].
+EOM
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --disable-shared) enable_shared=no ;;
+
+ --disable-static) enable_static=no ;;
+
+ --disable-fast-install) enable_fast_install=no ;;
+
+ --enable-dlopen) enable_dlopen=yes ;;
+
+ --enable-win32-dll) enable_win32_dll=yes ;;
+
+ --quiet | --silent) silent=yes ;;
+
+ --srcdir) prev=srcdir ;;
+ --srcdir=*) srcdir="$optarg" ;;
+
+ --no-verify) verify_host=no ;;
+
+ --output | -o) prev=ofile ;;
+ --output=*) ofile="$optarg" ;;
+
+ --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
+
+ --with-gcc) with_gcc=yes ;;
+ --with-gnu-ld) with_gnu_ld=yes ;;
+
+ --disable-lock) need_locks=no ;;
+
+ --cache-file=*) cache_file="$optarg" ;;
+
+ -*)
+ echo "$progname: unrecognized option \`$option'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ if test -z "$ltmain"; then
+ ltmain="$option"
+ elif test -z "$host"; then
+# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
+# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
+# echo "$progname: warning \`$option' is not a valid host type" 1>&2
+# fi
+ host="$option"
+ else
+ echo "$progname: too many arguments" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+done
+
+if test -z "$ltmain"; then
+ echo "$progname: you must specify a LTMAIN file" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+if test ! -f "$ltmain"; then
+ echo "$progname: \`$ltmain' does not exist" 1>&2
+ echo "$help" 1>&2
+ exit 1
+fi
+
+# Quote any args containing shell metacharacters.
+ltconfig_args=
+for arg
+do
+ case "$arg" in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ltconfig_args="$ltconfig_args '$arg'" ;;
+ *) ltconfig_args="$ltconfig_args $arg" ;;
+ esac
+done
+
+# A relevant subset of AC_INIT.
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 compiler messages saved in config.log
+# 6 checking for... messages and results
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>>./config.log
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
+if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
+
+if test -n "$cache_file" && test -r "$cache_file"; then
+ echo "loading cache $cache_file within ltconfig"
+ . $cache_file
+fi
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+if test -z "$srcdir"; then
+ # Assume the source directory is the same one as the path to LTMAIN.
+ srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
+ test "$srcdir" = "$ltmain" && srcdir=.
+fi
+
+trap "$rm conftest*; exit 1" 1 2 15
+if test "$verify_host" = yes; then
+ # Check for config.guess and config.sub.
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/config.guess; then
+ ac_aux_dir=$ac_dir
+ break
+ fi
+ done
+ if test -z "$ac_aux_dir"; then
+ echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+ ac_config_guess=$ac_aux_dir/config.guess
+ ac_config_sub=$ac_aux_dir/config.sub
+
+ # Make sure we can run config.sub.
+ if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else
+ echo "$progname: cannot run $ac_config_sub" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi
+
+ echo $ac_n "checking host system type""... $ac_c" 1>&6
+
+ host_alias=$host
+ case "$host_alias" in
+ "")
+ if host_alias=`$SHELL $ac_config_guess`; then :
+ else
+ echo "$progname: cannot guess host type; you must specify one" 1>&2
+ echo "$help" 1>&2
+ exit 1
+ fi ;;
+ esac
+ host=`$SHELL $ac_config_sub $host_alias`
+ echo "$ac_t$host" 1>&6
+
+ # Make sure the host verified.
+ test -z "$host" && exit 1
+
+elif test -z "$host"; then
+ echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
+ echo "$help" 1>&2
+ exit 1
+else
+ host_alias=$host
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case "$host_os" in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+case "$host_os" in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+# Set a sane default for `AR'.
+test -z "$AR" && AR=ar
+
+# Set a sane default for `OBJDUMP'.
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+# If RANLIB is not set, then run the test.
+if test "${RANLIB+set}" != "set"; then
+ result=no
+
+ echo $ac_n "checking for ranlib... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
+ RANLIB="ranlib"
+ result="ranlib"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ echo "$ac_t$result" 1>&6
+fi
+
+if test -n "$RANLIB"; then
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+fi
+
+# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$AS" && AS=as
+
+# Check to see if we are using GCC.
+if test "$with_gcc" != yes || test -z "$CC"; then
+ # If CC is not set, then try to find GCC or a usable CC.
+ if test -z "$CC"; then
+ echo $ac_n "checking for gcc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
+ CC="gcc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+ fi
+
+ # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
+ if test -z "$CC"; then
+ echo $ac_n "checking for cc... $ac_c" 1>&6
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ cc_rejected=no
+ for dir in $PATH; do
+ test -z "$dir" && dir=.
+ if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
+ if test "$dir/cc" = "/usr/ucb/cc"; then
+ cc_rejected=yes
+ continue
+ fi
+ CC="cc"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test $cc_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same name, so the bogon will be chosen
+ # first if we set CC to just the name; use the full file name.
+ shift
+ set dummy "$dir/cc" "$@"
+ shift
+ CC="$@"
+ fi
+ fi
+
+ if test -n "$CC"; then
+ echo "$ac_t$CC" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$CC"; then
+ echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
+ exit 1
+ fi
+ fi
+
+ # Now see if the compiler is really GCC.
+ with_gcc=no
+ echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
+ echo "$progname:581: checking whether we are using GNU C" >&5
+
+ $rm conftest.c
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ with_gcc=yes
+ fi
+ $rm conftest.c
+ echo "$ac_t$with_gcc" 1>&6
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo $ac_n "checking for object suffix... $ac_c" 1>&6
+$rm conftest*
+echo 'int i = 1;' > conftest.c
+echo "$progname:603: checking for object suffix" >& 5
+if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c) ;;
+ *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+fi
+$rm conftest*
+echo "$ac_t$objext" 1>&6
+
+echo $ac_n "checking for executable suffix... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_exeext="no"
+ $rm conftest*
+ echo 'main () { return 0; }' > conftest.c
+ echo "$progname:629: checking for executable suffix" >& 5
+ if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ for ac_file in conftest.*; do
+ case $ac_file in
+ *.c | *.err | *.$objext ) ;;
+ *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
+ esac
+ done
+ else
+ cat conftest.err 1>&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest*
+fi
+if test "X$ac_cv_exeext" = Xno; then
+ exeext=""
+else
+ exeext="$ac_cv_exeext"
+fi
+echo "$ac_t$ac_cv_exeext" 1>&6
+
+echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
+pic_flag=
+special_shlib_compile_flags=
+wl=
+link_static_flag=
+no_builtin_flag=
+
+if test "$with_gcc" = yes; then
+ wl='-Wl,'
+ link_static_flag='-static'
+
+ case "$host_os" in
+ beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # we not sure about C++ programs.
+ link_static_flag="$link_static_flag ${wl}-lC"
+ ;;
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ pic_flag='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ pic_flag=-Kconform_pic
+ fi
+ ;;
+ *)
+ pic_flag='-fPIC'
+ ;;
+ esac
+else
+ # PORTME Check for PIC flags for the system compiler.
+ case "$host_os" in
+ aix3* | aix4*)
+ # All AIX code is PIC.
+ link_static_flag='-bnso -bI:/lib/syscalls.exp'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better link_static_flag that works with the bundled CC?
+ wl='-Wl,'
+ link_static_flag="${wl}-a ${wl}archive"
+ pic_flag='+Z'
+ ;;
+
+ irix5* | irix6*)
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | os2*)
+ # We can build DLLs from non-PIC.
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ wl='-Wl,'
+ link_static_flag='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ pic_flag='-Kpic'
+ link_static_flag='-dn'
+ special_shlib_compile_flags='-belf'
+ ;;
+
+ solaris*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ sunos4*)
+ pic_flag='-PIC'
+ link_static_flag='-Bstatic'
+ wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ pic_flag='-KPIC'
+ link_static_flag='-Bstatic'
+ wl='-Wl,'
+ ;;
+
+ uts4*)
+ pic_flag='-pic'
+ link_static_flag='-Bstatic'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ pic_flag='-Kconform_pic'
+ link_static_flag='-Bstatic'
+ fi
+ ;;
+ *)
+ can_build_shared=no
+ ;;
+ esac
+fi
+
+if test -n "$pic_flag"; then
+ echo "$ac_t$pic_flag" 1>&6
+
+ # Check to make sure the pic_flag actually works.
+ echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $pic_flag -DPIC"
+ echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
+ if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+ # Append any warnings to the config.log.
+ cat conftest.err 1>&5
+
+ case "$host_os" in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then they
+ # create non-PIC objects. So, if there were any warnings, we assume that
+ # PIC is not supported.
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ can_build_shared=no
+ pic_flag=
+ else
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ fi
+ ;;
+ *)
+ echo "$ac_t"yes 1>&6
+ pic_flag=" $pic_flag"
+ ;;
+ esac
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ can_build_shared=no
+ pic_flag=
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ echo "$ac_t"none 1>&6
+fi
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.o"
+echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
+if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_c_o=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&5
+ compiler_c_o=no
+ echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
+if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_o_lo=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_o_lo=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_o_lo=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$ac_t$hard_links" 1>&6
+ $rm conftest*
+ if test "$hard_links" = no; then
+ echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$with_gcc" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
+ $rm conftest*
+ echo "int some_variable = 0;" > conftest.c
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
+ echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+ if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ echo "$ac_t"no 1>&6
+ compiler_rtti_exceptions=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_rtti_exceptions=yes
+ fi
+ else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_rtti_exceptions=no
+ echo "$ac_t"no 1>&6
+ fi
+ CFLAGS="$save_CFLAGS"
+ $rm conftest*
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$special_shlib_compile_flags"; then
+ echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
+ else
+ echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
+ can_build_shared=no
+ fi
+fi
+
+echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
+$rm conftest*
+echo 'main(){return(0);}' > conftest.c
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $link_static_flag"
+echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
+if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ echo "$ac_t$link_static_flag" 1>&6
+else
+ echo "$ac_t"none 1>&6
+ link_static_flag=
+fi
+LDFLAGS="$save_LDFLAGS"
+$rm conftest*
+
+if test -z "$LN_S"; then
+ # Check to see if we can use ln -s, or we need hard links.
+ echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
+ $rm conftest.dat
+ if ln -s X conftest.dat 2>/dev/null; then
+ $rm conftest.dat
+ LN_S="ln -s"
+ else
+ LN_S=ln
+ fi
+ if test "$LN_S" = "ln -s"; then
+ echo "$ac_t"yes 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+fi
+
+# Make sure LD is an absolute path.
+if test -z "$LD"; then
+ ac_prog=ld
+ if test "$with_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
+ echo "$progname:991: checking for ld used by GCC" >&5
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we are not using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+ elif test "$with_gnu_ld" = yes; then
+ echo $ac_n "checking for GNU ld... $ac_c" 1>&6
+ echo "$progname:1015: checking for GNU ld" >&5
+ else
+ echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
+ echo "$progname:1018: checking for non-GNU ld" >&5
+ fi
+
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ fi
+
+ if test -n "$LD"; then
+ echo "$ac_t$LD" 1>&6
+ else
+ echo "$ac_t"no 1>&6
+ fi
+
+ if test -z "$LD"; then
+ echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
+ exit 1
+ fi
+fi
+
+# Check to see if it really is or is not GNU ld.
+echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
+# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+echo "$ac_t$with_gnu_ld" 1>&6
+
+# See if the linker supports building shared libraries.
+echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+
+case "$host_os" in
+cygwin* | mingw*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$with_gcc" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case "$host_os" in
+ aix3* | aix4*)
+ # On AIX, the GNU linker is very broken
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols'
+
+ archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
+ _lt_hint=1;
+ for symbol in `cat $export_symbols`; do
+ echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done~
+ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
+ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
+ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
+
+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
+ # can we support soname and/or expsyms with a.out? -oliva
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case "$host_os" in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4*)
+ hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+ hardcode_libdir_separator=':'
+ if test "$with_gcc" = yes; then
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ shared_flag='-shared'
+ else
+ shared_flag='${wl}-bM:SRE'
+ hardcode_direct=yes
+ fi
+ allow_undefined_flag=' ${wl}-berok'
+ archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+ archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+ case "$host_os" in aix4.[01]|aix4.[01].*)
+ # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+ always_export_symbols=yes ;;
+ esac
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs'
+ fix_srcfile_path='`cygpath -w $srcfile`'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case "$host_os" in
+ hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6*)
+ if test "$with_gcc" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
+ fi
+ hardcode_libdir_flag_spec='${wl}-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # As osf3* with the addition of the -msym flag
+ if test "$with_gcc" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case "$host_os" in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ unixware7*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+echo "$ac_t$ld_shlibs" 1>&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+if test -z "$NM"; then
+ echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
+ case "$NM" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
+ for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -B"
+ break
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ NM="$ac_dir/nm -p"
+ break
+ else
+ NM=${NM="$ac_dir/nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$NM" && NM=nm
+ ;;
+ esac
+ echo "$ac_t$NM" 1>&6
+fi
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+ ;;
+irix*)
+ symcode='[BCDEGRST]'
+ ;;
+solaris*)
+ symcode='[BDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+ global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ $rm conftest*
+ cat > conftest.c <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ echo "$progname:1635: checking if global_symbol_pipe works" >&5
+ if { (eval echo $progname:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { echo "$progname:1639: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.c
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
+
+ cat <<EOF >> conftest.c
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
+ cat <<\EOF >> conftest.c
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$objext conftstm.$objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if { (eval echo $progname:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ pipe_works=yes
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ LIBS="$save_LIBS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.c >&5
+ fi
+ $rm conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ global_symbol_pipe=
+ fi
+done
+if test "$pipe_works" = yes; then
+ echo "${ac_t}ok" 1>&6
+else
+ echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+fi
+
+# Check hardcoding attributes.
+echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$ac_t$hardcode_action" 1>&6
+
+
+reload_flag=
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
+# PORTME Some linkers may need a different reload flag.
+reload_flag='-r'
+echo "$ac_t$reload_flag" 1>&6
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+# PORTME Fill in your ld.so characteristics
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+file_magic_cmd=
+file_magic_test_file=
+deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
+case "$host_os" in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4*)
+ version_type=linux
+ # AIX has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ # We preserve .a as extension for shared libraries though AIX4.2
+ # and later linker supports .so
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
+ shlibpath_var=LIBPATH
+ deplibs_check_method=pass_all
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ deplibs_check_method=pass_all
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ if test "$with_gcc" = yes; then
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+ else
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+ fi
+ dynamic_linker='Win32 ld.exe'
+ deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ file_magic_cmd='${OBJDUMP} -f'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case "$version_type" in
+ freebsd-elf*)
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ deplibs_check_method=unknown
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_os" in
+ freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *) # from 3.2 on
+ shlibpath_overrides_runpath=no
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6*)
+ version_type=irix
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so.$major'
+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+ case "$host_os" in
+ irix5*)
+ libsuff= shlibsuff=
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case "$LD" in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ deplibs_check_method='pass_all'
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+
+ if test -f /lib/ld.so.1; then
+ dynamic_linker='GNU ld.so'
+ else
+ # Only the GNU ld.so supports shared libraries on MkLinux.
+ case "$host_cpu" in
+ powerpc*) dynamic_linker=no ;;
+ *) dynamic_linker='Linux ld.so' ;;
+ esac
+ fi
+ ;;
+
+netbsd*)
+ version_type=sunos
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+openbsd*)
+ version_type=sunos
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ need_version=no
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ soname_spec='${libname}${release}.so'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ # this will be overridden with pass_all, but let us keep it just in case
+ deplibs_check_method='file_magic COFF format alpha shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/shlib/libc.so
+ deplibs_check_method='pass_all'
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=/lib/libc.so
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case "$host_vendor" in
+ ncr)
+ deplibs_check_method='pass_all'
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$ac_t$dynamic_linker" 1>&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
+
+# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
+# configure.in, otherwise build static only libraries.
+case "$host_os" in
+cygwin* | mingw* | os2*)
+ if test x$can_build_shared = xyes; then
+ test x$enable_win32_dll = xno && can_build_shared=no
+ echo "checking if package supports dlls... $can_build_shared" 1>&6
+ fi
+;;
+esac
+
+if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
+ case "$deplibs_check_method" in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+fi
+
+echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ test "$enable_shared" = yes && enable_static=no
+ ;;
+esac
+
+echo "$ac_t$enable_shared" 1>&6
+
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+
+echo "checking whether to build static libraries... $enable_static" 1>&6
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+ lt_cv_dlopen=no lt_cv_dlopen_libs=
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "$progname:2212: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2220 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "$progname:2252: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2257 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dlopen"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
+echo "$progname:2299: checking for dld_link in -ldld" >&5
+ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2307 "ltconfig"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link();
+
+int main() {
+dld_link()
+; return 0; }
+EOF
+if { (eval echo $progname:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load""... $ac_c" 1>&6
+echo "$progname:2339: checking for shl_load" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2344 "ltconfig"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+shl_load();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo $progname:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_shl_load=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load"
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
+echo "$progname:2387: checking for shl_load in -ldld" >&5
+ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldld $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2395 "ltconfig"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load();
+
+int main() {
+shl_load()
+; return 0; }
+EOF
+if { (eval echo $progname:2409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+fi
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ fi
+
+ case "$lt_cv_dlopen" in
+ dlopen)
+for ac_hdr in dlfcn.h; do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "$progname:2452: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2457 "ltconfig"
+#include <$ac_hdr>
+int fnord = 0;
+EOF
+ac_try="$ac_compile >/dev/null 2>conftest.out"
+{ (eval echo $progname:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ if test "x$ac_cv_header_dlfcn_h" = xyes; then
+ CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+ fi
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2490: checking whether a program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self=cross
+ else
+ cat > conftest.c <<EOF
+#line 2498 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self" 1>&6
+
+ if test "$lt_cv_dlopen_self" = yes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
+echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lt_cv_dlopen_self_static=cross
+ else
+ cat > conftest.c <<EOF
+#line 2571 "ltconfig"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LTDL_GLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LTDL_GLOBAL DL_GLOBAL
+# else
+# define LTDL_GLOBAL 0
+# endif
+#endif
+
+/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LTDL_LAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LTDL_LAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LTDL_LAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LTDL_LAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LTDL_LAZY_OR_NOW DL_NOW
+# else
+# define LTDL_LAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+fnord() { int i=42;}
+main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
+ if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
+ if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
+
+EOF
+if { (eval echo $progname:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ lt_cv_dlopen_self_static=yes
+else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lt_cv_dlopen_self_static=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
+fi
+ ;;
+ esac
+
+ case "$lt_cv_dlopen_self" in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case "$lt_cv_dlopen_self_static" in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+# Copy echo and quote the copy, instead of the original, because it is
+# used later.
+ltecho="$echo"
+if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ltecho="$CONFIG_SHELL \$0 --fallback-echo"
+fi
+LTSHELL="$SHELL"
+
+LTCONFIG_VERSION="$VERSION"
+
+# Only quote variables if we're using ltmain.sh.
+case "$ltmain" in
+*.sh)
+ # Now quote all the things that may contain metacharacters.
+ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
+ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
+ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case "$var" in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case "$ltecho" in
+ *'\$0 --fallback-echo"')
+ ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+ trap "$rm \"$ofile\"; exit 1" 1 2 15
+ echo "creating $ofile"
+ $rm "$ofile"
+ cat <<EOF > "$ofile"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="sed -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+### BEGIN LIBTOOL CONFIG
+EOF
+ cfgfile="$ofile"
+ ;;
+
+*)
+ # Double-quote the variables that need it (for aesthetics).
+ for var in old_CC old_CFLAGS old_CPPFLAGS \
+ old_LD old_LDFLAGS old_LIBS \
+ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+ eval "$var=\\\"\$var\\\""
+ done
+
+ # Just create a config file.
+ cfgfile="$ofile.cfg"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ echo "creating $cfgfile"
+ $rm "$cfgfile"
+ cat <<EOF > "$cfgfile"
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+EOF
+ ;;
+esac
+
+cat <<EOF >> "$cfgfile"
+# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
+# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+# $0$ltconfig_args
+#
+# Compiler and other test output produced by $progname, useful for
+# debugging $progname, is in ./config.log if it exists.
+
+# The version of $progname that generated this script.
+LTCONFIG_VERSION=$LTCONFIG_VERSION
+
+# Shell to use when invoking shell scripts.
+SHELL=$LTSHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$ltecho
+
+# The archiver.
+AR=$AR
+
+# The default C compiler.
+CC=$CC
+
+# The linker used to build libraries.
+LD=$LD
+
+# Whether we need hard or soft links.
+LN_S=$LN_S
+
+# A BSD-compatible nm program.
+NM=$NM
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$reload_flag
+reload_cmds=$reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$wl
+
+# Object file suffix (normally "o").
+objext="$objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$pic_flag
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$RANLIB
+old_archive_cmds=$old_archive_cmds
+old_postinstall_cmds=$old_postinstall_cmds
+old_postuninstall_cmds=$old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$old_archive_from_new_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$archive_cmds
+archive_expsym_cmds=$archive_expsym_cmds
+postinstall_cmds=$postinstall_cmds
+postuninstall_cmds=$postuninstall_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$global_symbol_to_cdecl
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$include_expsyms
+
+EOF
+
+case "$ltmain" in
+*.sh)
+ echo '### END LIBTOOL CONFIG' >> "$ofile"
+ echo >> "$ofile"
+ case "$host_os" in
+ aix3*)
+ cat <<\EOF >> "$ofile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # Append the ltmain.sh script.
+ sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+
+ chmod +x "$ofile"
+ ;;
+
+*)
+ # Compile the libtool program.
+ echo "FIXME: would compile $ltmain"
+ ;;
+esac
+
+test -n "$cache_file" || exit 0
+
+# AC_CACHE_SAVE
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/gc/ltmain.sh b/gc/ltmain.sh
@@ -0,0 +1,4012 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun ltconfig.
+#
+# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | sed 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.3.4
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+SP2NL='tr \040 \012'
+NL2SP='tr \015\012 \040\040'
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+if test "$LTCONFIG_VERSION" != "$VERSION"; then
+ echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case "$arg" in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ execute_dlfiles)
+ eval "$prev=\"\$$prev \$arg\""
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case "$arg" in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case "$nonopt" in
+ *cc | *++ | gcc* | *-gcc*)
+ mode=link
+ for arg
+ do
+ case "$arg" in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case "$mode" in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ # Accept any command-line options.
+ case "$arg" in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+ esac
+
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly in scan
+ # sets, so we specify it separately.
+ case "$lastarg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case "$libobj" in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case "$libobj" in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if test -z "$pic_flag" && test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link)
+ modename="$modename: link"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# */
+#
+# #include <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (!dll)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ linkopts=
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ lib_search_path=
+ fi
+ # now prepend the system-specific ones
+ eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ link_against_libtool_libs=
+ ltlibs=
+ module=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case "$arg" in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case "$prev" in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case "$prev" in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case "$arg" in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case "$arg" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi
+
+ prevarg="$arg"
+
+ case "$arg" in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: not more than one -exported-symbols argument allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case " $deplibs " in
+ *" $arg "*) ;;
+ *) deplibs="$deplibs $arg";;
+ esac
+ case " $lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir";;
+ esac
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ case ":$dllsearchpath:" in
+ ::) dllsearchpath="$dllsearchdir";;
+ *":$dllsearchdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+ esac
+ ;;
+ esac
+ ;;
+
+ -l*)
+ if test "$arg" = "-lc"; then
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # These systems don't actually have c library (as such)
+ continue
+ ;;
+ esac
+ elif test "$arg" = "-lm"; then
+ case "$host" in
+ *-*-cygwin* | *-*-beos*)
+ # These systems don't actually have math library (as such)
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # If we have no pic_flag, then this is the same as -all-static.
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.o | *.obj | *.a | *.lib)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A library object.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ fi
+ libobjs="$libobjs $arg"
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ dlname=
+ libdir=
+ library_names=
+ old_library=
+
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ # If there is no directory component, then add one.
+ case "$arg" in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Find the relevant object directory and library name.
+ name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
+
+ if test "X$installed" = Xyes; then
+ dir="$libdir"
+ else
+ dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$arg"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ fi
+
+ if test -n "$dependency_libs"; then
+ # Extract -R and -L from dependency_libs
+ temp_deplibs=
+ for deplib in $dependency_libs; do
+ case "$deplib" in
+ -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ case " $rpath $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ -L*) case "$compile_command $temp_deplibs " in
+ *" $deplib "*) ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ case " $lib_search_path " in
+ *" $temp_dir "*) ;;
+ *) lib_search_path="$lib_search_path $temp_dir";;
+ esac
+ ;;
+ *) temp_deplibs="$temp_deplibs $deplib";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ if test -z "$libdir"; then
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$deplibs$dependency_libs"
+ compile_command="$compile_command $dir/$old_library$dependency_libs"
+ finalize_command="$finalize_command $dir/$old_library$dependency_libs"
+ continue
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking statically,
+ # we need to preload.
+ prev=dlprefiles
+ else
+ # We should not create a dependency on this library, but we
+ # may need any libraries it requires.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ prev=
+ continue
+ fi
+ fi
+
+ # The library was specified with -dlpreopen.
+ if test "$prev" = dlprefiles; then
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ dlprefiles="$dlprefiles $dir/$old_library"
+ else
+ dlprefiles="$dlprefiles $dir/$linklib"
+ fi
+ prev=
+ fi
+
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ link_against_libtool_libs="$link_against_libtool_libs $arg"
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # We need an absolute path.
+ case "$dir" in
+ [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+
+ # This is the magic to use -rpath.
+ # Skip directories that are in the system default run-time
+ # search path, unless they have been requested with -R.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+
+ lib_linked=yes
+ case "$hardcode_action" in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ compile_command="$compile_command $dir/$linklib"
+ deplibs="$deplibs $dir/$linklib"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2*)
+ dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+ if test -n "$dllsearchpath"; then
+ dllsearchpath="$dllsearchpath:$dllsearchdir"
+ else
+ dllsearchpath="$dllsearchdir"
+ fi
+ ;;
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case "$host" in
+ *-*-sunos*)
+ compile_shlibpath="$compile_shlibpath$dir:"
+ ;;
+ esac
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$dir -l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ case ":$compile_shlibpath:" in
+ *":$dir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$dir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ relink)
+ if test "$hardcode_direct" = yes; then
+ compile_command="$compile_command $absdir/$linklib"
+ deplibs="$deplibs $absdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$compile_command " in
+ *" -L$absdir "*) ;;
+ *) compile_command="$compile_command -L$absdir";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -L$absdir -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$compile_shlibpath:" in
+ *":$absdir:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$absdir:";;
+ esac
+ compile_command="$compile_command -l$name"
+ deplibs="$deplibs -l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+
+ *)
+ lib_linked=no
+ ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ finalize_command="$finalize_command $libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ case "$finalize_command " in
+ *" -L$libdir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case ":$finalize_shlibpath:" in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$libdir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ else
+ # Transform directly to old archives if we don't build new libraries.
+ if test -n "$pic_flag" && test -z "$old_library"; then
+ $echo "$modename: cannot find static library for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_command="$compile_command $dir/$linklib"
+ finalize_command="$finalize_command $dir/$linklib"
+ else
+ case "$compile_command " in
+ *" -L$dir "*) ;;
+ *) compile_command="$compile_command -L$dir";;
+ esac
+ compile_command="$compile_command -l$name"
+ case "$finalize_command " in
+ *" -L$dir "*) ;;
+ *) finalize_command="$finalize_command -L$dir";;
+ esac
+ finalize_command="$finalize_command -l$name"
+ fi
+ fi
+
+ # Add in any libraries that this one depends upon.
+ compile_command="$compile_command$dependency_libs"
+ finalize_command="$finalize_command$dependency_libs"
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ case "$output" in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *.a | *.lib)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ ;;
+
+ *.la)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case "$outputname" in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ if test -n "$objs"; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
+ exit 1
+ fi
+
+ # How the heck are we supposed to write a wrapper for a shared library?
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+ exit 1
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+ dependency_libs="$deplibs"
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case "$current" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$revision" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case "$age" in
+ 0 | [1-9] | [1-9][0-9]*) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case "$version_type" in
+ none) ;;
+
+ irix)
+ major=`expr $current - $age + 1`
+ versuffix="$major.$revision"
+ verstring="sgi$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="sgi$major.$iface:$verstring"
+ done
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ windows)
+ # Like Linux, but with '-' rather than '.', since we only
+ # want one extension on Windows 95.
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ dependency_libs="$deplibs"
+ case "$host" in
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *)
+ # Add libc to deplibs on all other systems.
+ deplibs="$deplibs -lc"
+ ;;
+ esac
+ fi
+
+ # Create the output directory, or remove our outputs if we need to.
+ if test -d $output_objdir; then
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ else
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ if test "$build_libtool_libs" = yes; then
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case "$deplibs_check_method" in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage the situation:
+ # Compile a seperate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+ case "$potliblink" in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | sed 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: This library needs some functionality provided by $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linkopts="$linkopts $flag"
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ *.lo | *.o | *.obj)
+ if test -n "$link_against_libtool_libs"; then
+ $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
+ exit 1
+ fi
+
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case "$output" in
+ *.lo)
+ if test -n "$objs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag"; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ # Anything else should be a program.
+ *)
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$compile_rpath " in
+ *" $libdir "*) ;;
+ *) compile_rpath="$compile_rpath $libdir" ;;
+ esac
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+
+ # Create the binary in the object directory, then wrap it.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case "$dlsyms" in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | sed -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
+ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
+ < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr_t) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case "$host" in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case "$dir" in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case "$0" in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ link_against_libtool_libs='$link_against_libtool_libs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if (cd \"\$thisdir\" && eval \$relink_command); then :
+ else
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ *-*-cygwin* | *-*-mingw | *-*-os2*)
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case "$xlib" in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case "$output" in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ if test -n "$xrpath"; then
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ done
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ fi
+ $rm $output
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$dlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'\
+"
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case "$arg" in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case "$arg" in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case "$file" in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case "$file" in
+ *.a | *.lib)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$realname $destdir/$realname"
+ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case "$destfile" in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.o | *.obj)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ link_against_libtool_libs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$link_against_libtool_libs"; then
+ $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $link_against_libtool_libs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case "$lib" in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec $SHELL $0 --finish$current_libdirs
+ exit 1
+ fi
+
+ exit 0
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case "$file" in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case "$file" in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case "$file" in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now actually exec the command.
+ eval "exec \$cmd$args"
+
+ $echo "$modename: cannot exec \$cmd$args"
+ exit 1
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool uninstall mode
+ uninstall)
+ modename="$modename: uninstall"
+ rm="$nonopt"
+ files=
+
+ for arg
+ do
+ case "$arg" in
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ rmfiles="$file"
+
+ case "$name" in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $dir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ done
+ IFS="$save_ifs"
+ fi
+
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+
+ *)
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles
+ ;;
+ esac
+ done
+ exit 0
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+fi # test -z "$show_help"
+
+# We need to display help for each of the modes.
+case "$mode" in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/gc/mach_dep.c b/gc/mach_dep.c
@@ -12,7 +12,7 @@
* modified is included with the above copyright notice.
*/
/* Boehm, November 17, 1995 12:13 pm PST */
-# include "gc_priv.h"
+# include "private/gc_priv.h"
# include <stdio.h>
# include <setjmp.h>
# if defined(OS2) || defined(CX_UX)
@@ -21,7 +21,7 @@
# endif
# ifdef AMIGA
# ifndef __GNUC__
-# include <dos/dos.h>
+# include <dos.h>
# else
# include <machine/reg.h>
# endif
@@ -62,6 +62,12 @@ asm static void PushMacRegisters()
#endif /* __MWERKS__ */
+# if defined(SPARC) || defined(IA64)
+ /* Value returned from register flushing routine; either sp (SPARC) */
+ /* or ar.bsp (IA64) */
+ word GC_save_regs_ret_val;
+# endif
+
/* Routine to mark from registers that are preserved by the C compiler. */
/* This must be ported to every new architecture. There is a generic */
/* version at the end, that is likely, but not guaranteed to work */
@@ -74,21 +80,24 @@ void GC_push_regs()
# ifdef RT
register long TMP_SP; /* must be bound to r11 */
# endif
+
# if defined(MIPS) && defined(LINUX)
+ /* I'm not sure whether this has actually been tested. */
# define call_push(x) asm("move $4," x ";"); asm("jal GC_push_one")
- call_push("$2");
- call_push("$3");
- call_push("$16");
- call_push("$17");
- call_push("$18");
- call_push("$19");
- call_push("$20");
- call_push("$21");
- call_push("$22");
- call_push("$23");
- call_push("$30");
+ call_push("$2");
+ call_push("$3");
+ call_push("$16");
+ call_push("$17");
+ call_push("$18");
+ call_push("$19");
+ call_push("$20");
+ call_push("$21");
+ call_push("$22");
+ call_push("$23");
+ call_push("$30");
# undef call_push
-# endif // MIPS && LINUX
+# endif /* MIPS && LINUX */
+
# ifdef VAX
/* VAX - generic code below does not work under 4.2 */
/* r1 through r5 are caller save, and therefore */
@@ -169,7 +178,10 @@ void GC_push_regs()
# else /* !__GNUC__ */
GC_push_one(getreg(REG_A2));
GC_push_one(getreg(REG_A3));
- GC_push_one(getreg(REG_A4));
+# ifndef __SASC
+ /* Can probably be changed to #if 0 -Kjetil M. (a4=globals)*/
+ GC_push_one(getreg(REG_A4));
+# endif
GC_push_one(getreg(REG_A5));
GC_push_one(getreg(REG_A6));
/* Skip stack pointer */
@@ -208,11 +220,15 @@ void GC_push_regs()
# endif /* __MWERKS__ */
# endif /* MACOS */
-# if defined(I386) &&!defined(OS2) &&!defined(SVR4) &&!defined(MSWIN32) \
+# if defined(I386) &&!defined(OS2) &&!defined(SVR4) \
+ && (defined(__MINGW32__) || !defined(MSWIN32)) \
&& !defined(SCO) && !defined(SCO_ELF) \
- && !(defined(LINUX) && defined(__ELF__)) \
- && !(defined(__FreeBSD__) && defined(__ELF__)) \
- && !defined(DOS4GW)
+ && !(defined(LINUX) && defined(__ELF__)) \
+ && !(defined(FREEBSD) && defined(__ELF__)) \
+ && !(defined(NETBSD) && defined(__ELF__)) \
+ && !(defined(OPENBSD) && defined(__ELF__)) \
+ && !(defined(BEOS) && defined(__ELF__)) \
+ && !defined(DOS4GW) && !defined(HURD)
/* I386 code, generic code does not appear to work */
/* It does appear to work under OS2, and asms dont */
/* This is used for some 38g UNIX variants and for CYGWIN32 */
@@ -226,20 +242,39 @@ void GC_push_regs()
# endif
# if ( defined(I386) && defined(LINUX) && defined(__ELF__) ) \
- || ( defined(I386) && defined(__FreeBSD__) && defined(__ELF__) )
+ || ( defined(I386) && defined(FREEBSD) && defined(__ELF__) ) \
+ || ( defined(I386) && defined(NETBSD) && defined(__ELF__) ) \
+ || ( defined(I386) && defined(OPENBSD) && defined(__ELF__) ) \
+ || ( defined(I386) && defined(HURD) && defined(__ELF__) )
/* This is modified for Linux with ELF (Note: _ELF_ only) */
/* This section handles FreeBSD with ELF. */
- asm("pushl %eax"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %ecx"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %edx"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %ebp"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %esi"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %edi"); asm("call GC_push_one"); asm("addl $4,%esp");
- asm("pushl %ebx"); asm("call GC_push_one"); asm("addl $4,%esp");
+ /* Eax is caller-save and dead here. Other caller-save */
+ /* registers could also be skipped. We assume there are no */
+ /* pointers in MMX registers, etc. */
+ /* We combine instructions in a single asm to prevent gcc from */
+ /* inserting code in the middle. */
+ asm("pushl %ecx; call GC_push_one; addl $4,%esp");
+ asm("pushl %edx; call GC_push_one; addl $4,%esp");
+ asm("pushl %ebp; call GC_push_one; addl $4,%esp");
+ asm("pushl %esi; call GC_push_one; addl $4,%esp");
+ asm("pushl %edi; call GC_push_one; addl $4,%esp");
+ asm("pushl %ebx; call GC_push_one; addl $4,%esp");
# endif
-# if defined(I386) && defined(MSWIN32) && !defined(USE_GENERIC)
+# if ( defined(I386) && defined(BEOS) && defined(__ELF__) )
+ /* As far as I can understand from */
+ /* http://www.beunited.org/articles/jbq/nasm.shtml, */
+ /* only ebp, esi, edi and ebx are not scratch. How MMX */
+ /* etc. registers should be treated, I have no idea. */
+ asm("pushl %ebp; call GC_push_one; addl $4,%esp");
+ asm("pushl %esi; call GC_push_one; addl $4,%esp");
+ asm("pushl %edi; call GC_push_one; addl $4,%esp");
+ asm("pushl %ebx; call GC_push_one; addl $4,%esp");
+# endif
+
+# if defined(I386) && defined(MSWIN32) && !defined(__MINGW32__) \
+ && !defined(USE_GENERIC)
/* I386 code, Microsoft variant */
__asm push eax
__asm call GC_push_one
@@ -283,12 +318,11 @@ void GC_push_regs()
asm ("movd r7, tos"); asm ("bsr ?_GC_push_one"); asm ("adjspb $-4");
# endif
-# ifdef SPARC
+# if defined(SPARC)
{
word GC_save_regs_in_stack();
- /* generic code will not work */
- (void)GC_save_regs_in_stack();
+ GC_save_regs_ret_val = GC_save_regs_in_stack();
}
# endif
@@ -348,14 +382,22 @@ void GC_push_regs()
# endif /* !__GNUC__ */
# endif /* M68K/SYSV */
+# if defined(PJ)
+ {
+ register int * sp asm ("optop");
+ extern int *__libc_stack_end;
+
+ GC_push_all_stack (sp, __libc_stack_end);
+ }
+# endif
/* other machines... */
-# if !(defined M68K) && !(defined VAX) && !(defined RT)
-# if !(defined SPARC) && !(defined I386) && !(defined NS32K)
-# if !defined(POWERPC) && !defined(UTS4)
-# if (!defined(MIPS) && !defined(LINUX))
+# if !defined(M68K) && !defined(VAX) && !defined(RT)
+# if !defined(SPARC) && !defined(I386) && !defined(NS32K)
+# if !defined(POWERPC) && !defined(UTS4)
+# if !defined(PJ) && !(defined(MIPS) && defined(LINUX))
--> bad news <--
-# endif
+# endif
# endif
# endif
# endif
@@ -366,25 +408,51 @@ void GC_push_regs()
void GC_generic_push_regs(cold_gc_frame)
ptr_t cold_gc_frame;
{
- /* Generic code */
- /* The idea is due to Parag Patel at HP. */
- /* We're not sure whether he would like */
- /* to be he acknowledged for it or not. */
{
- static jmp_buf regs;
- register word * i = (word *) regs;
- register ptr_t lim = (ptr_t)(regs) + (sizeof regs);
-
- /* Setjmp on Sun 3s doesn't clear all of the buffer. */
- /* That tends to preserve garbage. Clear it. */
+# ifdef HAVE_BUILTIN_UNWIND_INIT
+ /* This was suggested by Richard Henderson as the way to */
+ /* force callee-save registers and register windows onto */
+ /* the stack. */
+ __builtin_unwind_init();
+# else /* !HAVE_BUILTIN_UNWIND_INIT */
+ /* Generic code */
+ /* The idea is due to Parag Patel at HP. */
+ /* We're not sure whether he would like */
+ /* to be he acknowledged for it or not. */
+ jmp_buf regs;
+ register word * i = (word *) regs;
+ register ptr_t lim = (ptr_t)(regs) + (sizeof regs);
+
+ /* Setjmp doesn't always clear all of the buffer. */
+ /* That tends to preserve garbage. Clear it. */
for (; (char *)i < lim; i++) {
*i = 0;
}
-# if defined(POWERPC) || defined(MSWIN32) || defined(UTS4)
- (void) setjmp(regs);
-# else
- (void) _setjmp(regs);
-# endif
+# if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
+ || defined(UTS4) || defined(LINUX)
+ (void) setjmp(regs);
+# else
+ (void) _setjmp(regs);
+# endif
+# endif /* !HAVE_BUILTIN_UNWIND_INIT */
+# if (defined(SPARC) && !defined(HAVE_BUILTIN_UNWIND_INIT)) \
+ || defined(IA64)
+ /* On a register window machine, we need to save register */
+ /* contents on the stack for this to work. The setjmp */
+ /* is probably not needed on SPARC, since pointers are */
+ /* only stored in windowed or scratch registers. It is */
+ /* needed on IA64, since some non-windowed registers are */
+ /* preserved. */
+ {
+ word GC_save_regs_in_stack();
+
+ GC_save_regs_ret_val = GC_save_regs_in_stack();
+ /* On IA64 gcc, could use __builtin_ia64_flushrs() and */
+ /* __builtin_ia64_flushrs(). The latter will be done */
+ /* implicitly by __builtin_unwind_init() for gcc3.0.1 */
+ /* and later. */
+ }
+# endif
GC_push_current_stack(cold_gc_frame);
}
}
@@ -402,10 +470,16 @@ ptr_t cold_gc_frame;
asm(" .globl _GC_save_regs_in_stack");
asm("_GC_save_regs_in_stack:");
# endif
- asm(" ta 0x3 ! ST_FLUSH_WINDOWS");
- asm(" mov %sp,%o0");
- asm(" retl");
- asm(" nop");
+# if defined(__arch64__) || defined(__sparcv9)
+ asm(" save %sp,-128,%sp");
+ asm(" flushw");
+ asm(" ret");
+ asm(" restore %sp,2047+128,%o0");
+# else
+ asm(" ta 0x3 ! ST_FLUSH_WINDOWS");
+ asm(" retl");
+ asm(" mov %sp,%o0");
+# endif
# ifdef SVR4
asm(" .GC_save_regs_in_stack_end:");
asm(" .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack");
@@ -415,12 +489,42 @@ ptr_t cold_gc_frame;
# endif
# endif
+/* On IA64, we also need to flush register windows. But they end */
+/* up on the other side of the stack segment. */
+/* Returns the backing store pointer for the register stack. */
+# ifdef IA64
+# ifdef __GNUC__
+ asm(" .text");
+ asm(" .psr abi64");
+ asm(" .psr lsb");
+ asm(" .lsb");
+ asm("");
+ asm(" .text");
+ asm(" .align 16");
+ asm(" .global GC_save_regs_in_stack");
+ asm(" .proc GC_save_regs_in_stack");
+ asm("GC_save_regs_in_stack:");
+ asm(" .body");
+ asm(" flushrs");
+ asm(" ;;");
+ asm(" mov r8=ar.bsp");
+ asm(" br.ret.sptk.few rp");
+ asm(" .endp GC_save_regs_in_stack");
+# else
+ void GC_save_regs_in_stack() {
+ asm(" flushrs");
+ asm(" ;;");
+ asm(" mov r8=ar.bsp");
+ asm(" br.ret.sptk.few rp");
+ }
+# endif
+# endif
/* GC_clear_stack_inner(arg, limit) clears stack area up to limit and */
/* returns arg. Stack clearing is crucial on SPARC, so we supply */
/* an assembly version that's more careful. Assumes limit is hotter */
/* than sp, and limit is 8 byte aligned. */
-#if defined(ASM_CLEAR_CODE) && !defined(THREADS)
+#if defined(ASM_CLEAR_CODE)
#ifndef SPARC
--> fix it
#endif
@@ -432,6 +536,21 @@ ptr_t cold_gc_frame;
asm("GC_clear_stack_inner:");
asm(".type GC_save_regs_in_stack,#function");
# endif
+#if defined(__arch64__) || defined(__sparcv9)
+ asm("mov %sp,%o2"); /* Save sp */
+ asm("add %sp,2047-8,%o3"); /* p = sp+bias-8 */
+ asm("add %o1,-2047-192,%sp"); /* Move sp out of the way, */
+ /* so that traps still work. */
+ /* Includes some extra words */
+ /* so we can be sloppy below. */
+ asm("loop:");
+ asm("stx %g0,[%o3]"); /* *(long *)p = 0 */
+ asm("cmp %o3,%o1");
+ asm("bgu,pt %xcc, loop"); /* if (p > limit) goto loop */
+ asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
+ asm("retl");
+ asm("mov %o2,%sp"); /* Restore sp., delay slot */
+#else
asm("mov %sp,%o2"); /* Save sp */
asm("add %sp,-8,%o3"); /* p = sp-8 */
asm("clr %g1"); /* [g0,g1] = 0 */
@@ -446,6 +565,7 @@ ptr_t cold_gc_frame;
asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
asm("retl");
asm("mov %o2,%sp"); /* Restore sp., delay slot */
+#endif /* old SPARC */
/* First argument = %o0 = return value */
# ifdef SVR4
asm(" .GC_clear_stack_inner_end:");
diff --git a/gc/malloc.c b/gc/malloc.c
@@ -1,6 +1,7 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -14,7 +15,7 @@
/* Boehm, February 7, 1996 4:32 pm PST */
#include <stdio.h>
-#include "gc_priv.h"
+#include "private/gc_priv.h"
extern ptr_t GC_clear_stack(); /* in misc.c, behaves like identity */
void GC_extend_size_map(); /* in misc.c. */
@@ -32,7 +33,66 @@ register struct obj_kind * kind;
return(TRUE);
}
-/* allocate lb bytes for an object of kind. */
+/* Allocate a large block of size lw words. */
+/* The block is not cleared. */
+/* Flags is 0 or IGNORE_OFF_PAGE. */
+ptr_t GC_alloc_large(lw, k, flags)
+word lw;
+int k;
+unsigned flags;
+{
+ struct hblk * h;
+ word n_blocks = OBJ_SZ_TO_BLOCKS(lw);
+ ptr_t result;
+
+ if (!GC_is_initialized) GC_init_inner();
+ /* Do our share of marking work */
+ if(GC_incremental && !GC_dont_gc)
+ GC_collect_a_little_inner((int)n_blocks);
+ h = GC_allochblk(lw, k, flags);
+# ifdef USE_MUNMAP
+ if (0 == h) {
+ GC_merge_unmapped();
+ h = GC_allochblk(lw, k, flags);
+ }
+# endif
+ while (0 == h && GC_collect_or_expand(n_blocks, (flags != 0))) {
+ h = GC_allochblk(lw, k, flags);
+ }
+ if (h == 0) {
+ result = 0;
+ } else {
+ int total_bytes = BYTES_TO_WORDS(n_blocks * HBLKSIZE);
+ if (n_blocks > 1) {
+ GC_large_allocd_bytes += n_blocks * HBLKSIZE;
+ if (GC_large_allocd_bytes > GC_max_large_allocd_bytes)
+ GC_max_large_allocd_bytes = GC_large_allocd_bytes;
+ }
+ result = (ptr_t) (h -> hb_body);
+ GC_words_wasted += total_bytes - lw;
+ }
+ return result;
+}
+
+
+/* Allocate a large block of size lb bytes. Clear if appropriate. */
+ptr_t GC_alloc_large_and_clear(lw, k, flags)
+word lw;
+int k;
+unsigned flags;
+{
+ ptr_t result = GC_alloc_large(lw, k, flags);
+ word n_blocks = OBJ_SZ_TO_BLOCKS(lw);
+
+ if (0 == result) return 0;
+ if (GC_debugging_started || GC_obj_kinds[k].ok_init) {
+ /* Clear the whole block, in case of GC_realloc call. */
+ BZERO(result, n_blocks * HBLKSIZE);
+ }
+ return result;
+}
+
+/* allocate lb bytes for an object of kind k. */
/* Should not be used to directly to allocate */
/* objects such as STUBBORN objects that */
/* require special handling on allocation. */
@@ -52,7 +112,7 @@ register ptr_t *opp;
lw = GC_size_map[lb];
# else
lw = ALIGNED_WORDS(lb);
- if (lw == 0) lw = 1;
+ if (lw == 0) lw = MIN_WORDS;
# endif
opp = &(kind -> ok_freelist[lw]);
if( (op = *opp) == 0 ) {
@@ -81,39 +141,38 @@ register ptr_t *opp;
/* but that's benign. */
/* Volatile declarations may need to be added */
/* to prevent the compiler from breaking things.*/
+ /* If we only execute the second of the */
+ /* following assignments, we lose the free */
+ /* list, but that should still be OK, at least */
+ /* for garbage collected memory. */
*opp = obj_link(op);
obj_link(op) = 0;
} else {
- register struct hblk * h;
- register word n_blocks = divHBLKSZ(ADD_SLOP(lb)
- + HDR_BYTES + HBLKSIZE-1);
-
- if (!GC_is_initialized) GC_init_inner();
- /* Do our share of marking work */
- if(GC_incremental && !GC_dont_gc)
- GC_collect_a_little_inner((int)n_blocks);
lw = ROUNDED_UP_WORDS(lb);
- h = GC_allochblk(lw, k, 0);
-# ifdef USE_MUNMAP
- if (0 == h) {
- GC_merge_unmapped();
- h = GC_allochblk(lw, k, 0);
- }
-# endif
- while (0 == h && GC_collect_or_expand(n_blocks, FALSE)) {
- h = GC_allochblk(lw, k, 0);
- }
- if (h == 0) {
- op = 0;
- } else {
- op = (ptr_t) (h -> hb_body);
- GC_words_wasted += BYTES_TO_WORDS(n_blocks * HBLKSIZE) - lw;
- }
+ op = (ptr_t)GC_alloc_large_and_clear(lw, k, 0);
}
GC_words_allocd += lw;
out:
- return((ptr_t)op);
+ return op;
+}
+
+/* Allocate a composite object of size n bytes. The caller guarantees */
+/* that pointers past the first page are not relevant. Caller holds */
+/* allocation lock. */
+ptr_t GC_generic_malloc_inner_ignore_off_page(lb, k)
+register size_t lb;
+register int k;
+{
+ register word lw;
+ ptr_t op;
+
+ if (lb <= HBLKSIZE)
+ return(GC_generic_malloc_inner((word)lb, k));
+ lw = ROUNDED_UP_WORDS(lb);
+ op = (ptr_t)GC_alloc_large_and_clear(lw, k, IGNORE_OFF_PAGE);
+ GC_words_allocd += lw;
+ return op;
}
ptr_t GC_generic_malloc(lb, k)
@@ -124,11 +183,43 @@ register int k;
DCL_LOCK_STATE;
GC_INVOKE_FINALIZERS();
- DISABLE_SIGNALS();
- LOCK();
- result = GC_generic_malloc_inner(lb, k);
- UNLOCK();
- ENABLE_SIGNALS();
+ if (SMALL_OBJ(lb)) {
+ DISABLE_SIGNALS();
+ LOCK();
+ result = GC_generic_malloc_inner((word)lb, k);
+ UNLOCK();
+ ENABLE_SIGNALS();
+ } else {
+ word lw;
+ word n_blocks;
+ GC_bool init;
+ lw = ROUNDED_UP_WORDS(lb);
+ n_blocks = OBJ_SZ_TO_BLOCKS(lw);
+ init = GC_obj_kinds[k].ok_init;
+ DISABLE_SIGNALS();
+ LOCK();
+ result = (ptr_t)GC_alloc_large(lw, k, 0);
+ if (0 != result) {
+ if (GC_debugging_started) {
+ BZERO(result, n_blocks * HBLKSIZE);
+ } else {
+# ifdef THREADS
+ /* Clear any memory that might be used for GC descriptors */
+ /* before we release the lock. */
+ ((word *)result)[0] = 0;
+ ((word *)result)[1] = 0;
+ ((word *)result)[lw-1] = 0;
+ ((word *)result)[lw-2] = 0;
+# endif
+ }
+ }
+ GC_words_allocd += lw;
+ UNLOCK();
+ ENABLE_SIGNALS();
+ if (init & !GC_debugging_started && 0 != result) {
+ BZERO(result, n_blocks * HBLKSIZE);
+ }
+ }
if (0 == result) {
return((*GC_oom_fn)(lb));
} else {
@@ -155,7 +246,7 @@ register ptr_t * opp;
register word lw;
DCL_LOCK_STATE;
- if( SMALL_OBJ(lb) ) {
+ if( EXPECT(SMALL_OBJ(lb), 1) ) {
# ifdef MERGE_SIZES
lw = GC_size_map[lb];
# else
@@ -163,7 +254,7 @@ DCL_LOCK_STATE;
# endif
opp = &(GC_aobjfreelist[lw]);
FASTLOCK();
- if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {
+ if( EXPECT(!FASTLOCK_SUCCEEDED() || (op = *opp) == 0, 0) ) {
FASTUNLOCK();
return(GENERAL_MALLOC((word)lb, PTRFREE));
}
@@ -190,7 +281,7 @@ register ptr_t *opp;
register word lw;
DCL_LOCK_STATE;
- if( SMALL_OBJ(lb) ) {
+ if( EXPECT(SMALL_OBJ(lb), 1) ) {
# ifdef MERGE_SIZES
lw = GC_size_map[lb];
# else
@@ -198,7 +289,7 @@ DCL_LOCK_STATE;
# endif
opp = &(GC_objfreelist[lw]);
FASTLOCK();
- if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) {
+ if( EXPECT(!FASTLOCK_SUCCEEDED() || (op = *opp) == 0, 0) ) {
FASTUNLOCK();
return(GENERAL_MALLOC((word)lb, NORMAL));
}
@@ -234,7 +325,7 @@ DCL_LOCK_STATE;
*/
if (!GC_is_initialized) return sbrk(lb);
# endif /* I386 && SOLARIS_THREADS */
- return(REDIRECT_MALLOC(lb));
+ return((GC_PTR)REDIRECT_MALLOC(lb));
}
# ifdef __STDC__
@@ -244,125 +335,7 @@ DCL_LOCK_STATE;
size_t n, lb;
# endif
{
- return(REDIRECT_MALLOC(n*lb));
- }
-# endif /* REDIRECT_MALLOC */
-
-GC_PTR GC_generic_or_special_malloc(lb,knd)
-word lb;
-int knd;
-{
- switch(knd) {
-# ifdef STUBBORN_ALLOC
- case STUBBORN:
- return(GC_malloc_stubborn((size_t)lb));
-# endif
- case PTRFREE:
- return(GC_malloc_atomic((size_t)lb));
- case NORMAL:
- return(GC_malloc((size_t)lb));
- case UNCOLLECTABLE:
- return(GC_malloc_uncollectable((size_t)lb));
-# ifdef ATOMIC_UNCOLLECTABLE
- case AUNCOLLECTABLE:
- return(GC_malloc_atomic_uncollectable((size_t)lb));
-# endif /* ATOMIC_UNCOLLECTABLE */
- default:
- return(GC_generic_malloc(lb,knd));
- }
-}
-
-
-/* Change the size of the block pointed to by p to contain at least */
-/* lb bytes. The object may be (and quite likely will be) moved. */
-/* The kind (e.g. atomic) is the same as that of the old. */
-/* Shrinking of large blocks is not implemented well. */
-# ifdef __STDC__
- GC_PTR GC_realloc(GC_PTR p, size_t lb)
-# else
- GC_PTR GC_realloc(p,lb)
- GC_PTR p;
- size_t lb;
-# endif
-{
-register struct hblk * h;
-register hdr * hhdr;
-register word sz; /* Current size in bytes */
-register word orig_sz; /* Original sz in bytes */
-int obj_kind;
-
- if (p == 0) return(GC_malloc(lb)); /* Required by ANSI */
- h = HBLKPTR(p);
- hhdr = HDR(h);
- sz = hhdr -> hb_sz;
- obj_kind = hhdr -> hb_obj_kind;
- sz = WORDS_TO_BYTES(sz);
- orig_sz = sz;
-
- if (sz > WORDS_TO_BYTES(MAXOBJSZ)) {
- /* Round it up to the next whole heap block */
- register word descr;
-
- sz = (sz+HDR_BYTES+HBLKSIZE-1)
- & (~HBLKMASK);
- sz -= HDR_BYTES;
- hhdr -> hb_sz = BYTES_TO_WORDS(sz);
- descr = GC_obj_kinds[obj_kind].ok_descriptor;
- if (GC_obj_kinds[obj_kind].ok_relocate_descr) descr += sz;
- hhdr -> hb_descr = descr;
- if (IS_UNCOLLECTABLE(obj_kind)) GC_non_gc_bytes += (sz - orig_sz);
- /* Extra area is already cleared by allochblk. */
- }
- if (ADD_SLOP(lb) <= sz) {
- if (lb >= (sz >> 1)) {
-# ifdef STUBBORN_ALLOC
- if (obj_kind == STUBBORN) GC_change_stubborn(p);
-# endif
- if (orig_sz > lb) {
- /* Clear unneeded part of object to avoid bogus pointer */
- /* tracing. */
- /* Safe for stubborn objects. */
- BZERO(((ptr_t)p) + lb, orig_sz - lb);
- }
- return(p);
- } else {
- /* shrink */
- GC_PTR result =
- GC_generic_or_special_malloc((word)lb, obj_kind);
-
- if (result == 0) return(0);
- /* Could also return original object. But this */
- /* gives the client warning of imminent disaster. */
- BCOPY(p, result, lb);
-# ifndef IGNORE_FREE
- GC_free(p);
-# endif
- return(result);
- }
- } else {
- /* grow */
- GC_PTR result =
- GC_generic_or_special_malloc((word)lb, obj_kind);
-
- if (result == 0) return(0);
- BCOPY(p, result, sz);
-# ifndef IGNORE_FREE
- GC_free(p);
-# endif
- return(result);
- }
-}
-
-# ifdef REDIRECT_MALLOC
-# ifdef __STDC__
- GC_PTR realloc(GC_PTR p, size_t lb)
-# else
- GC_PTR realloc(p,lb)
- GC_PTR p;
- size_t lb;
-# endif
- {
- return(GC_realloc(p, lb));
+ return((GC_PTR)REDIRECT_MALLOC(n*lb));
}
# endif /* REDIRECT_MALLOC */
@@ -387,15 +360,18 @@ int obj_kind;
h = HBLKPTR(p);
hhdr = HDR(h);
# if defined(REDIRECT_MALLOC) && \
- (defined(SOLARIS_THREADS) || defined(LINUX_THREADS))
- /* We have to redirect malloc calls during initialization. */
+ (defined(SOLARIS_THREADS) || defined(LINUX_THREADS) \
+ || defined(__MINGW32__)) /* Should this be MSWIN32 in general? */
+ /* For Solaris, we have to redirect malloc calls during */
+ /* initialization. For the others, this seems to happen */
+ /* implicitly. */
/* Don't try to deallocate that memory. */
if (0 == hhdr) return;
# endif
knd = hhdr -> hb_obj_kind;
sz = hhdr -> hb_sz;
ok = &GC_obj_kinds[knd];
- if (sz <= MAXOBJSZ) {
+ if (EXPECT((sz <= MAXOBJSZ), 1)) {
# ifdef THREADS
DISABLE_SIGNALS();
LOCK();
@@ -428,6 +404,42 @@ int obj_kind;
}
}
+/* Explicitly deallocate an object p when we already hold lock. */
+/* Only used for internally allocated objects, so we can take some */
+/* shortcuts. */
+#ifdef THREADS
+void GC_free_inner(GC_PTR p)
+{
+ register struct hblk *h;
+ register hdr *hhdr;
+ register signed_word sz;
+ register ptr_t * flh;
+ register int knd;
+ register struct obj_kind * ok;
+ DCL_LOCK_STATE;
+
+ h = HBLKPTR(p);
+ hhdr = HDR(h);
+ knd = hhdr -> hb_obj_kind;
+ sz = hhdr -> hb_sz;
+ ok = &GC_obj_kinds[knd];
+ if (sz <= MAXOBJSZ) {
+ GC_mem_freed += sz;
+ if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= WORDS_TO_BYTES(sz);
+ if (ok -> ok_init) {
+ BZERO((word *)p + 1, WORDS_TO_BYTES(sz-1));
+ }
+ flh = &(ok -> ok_freelist[sz]);
+ obj_link(p) = *flh;
+ *flh = (ptr_t)p;
+ } else {
+ GC_mem_freed += sz;
+ if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= WORDS_TO_BYTES(sz);
+ GC_freehblk(h);
+ }
+}
+#endif /* THREADS */
+
# ifdef REDIRECT_MALLOC
# ifdef __STDC__
void free(GC_PTR p)
diff --git a/gc/mallocx.c b/gc/mallocx.c
@@ -2,6 +2,7 @@
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -21,7 +22,7 @@
*/
#include <stdio.h>
-#include "gc_priv.h"
+#include "private/gc_priv.h"
extern ptr_t GC_clear_stack(); /* in misc.c, behaves like identity */
void GC_extend_size_map(); /* in misc.c. */
@@ -30,69 +31,179 @@ GC_bool GC_alloc_reclaim_list(); /* in malloc.c */
/* Some externally visible but unadvertised variables to allow access to */
/* free lists from inlined allocators without including gc_priv.h */
/* or introducing dependencies on internal data structure layouts. */
-ptr_t * CONST GC_objfreelist_ptr = GC_objfreelist;
-ptr_t * CONST GC_aobjfreelist_ptr = GC_aobjfreelist;
-ptr_t * CONST GC_uobjfreelist_ptr = GC_uobjfreelist;
+ptr_t * GC_CONST GC_objfreelist_ptr = GC_objfreelist;
+ptr_t * GC_CONST GC_aobjfreelist_ptr = GC_aobjfreelist;
+ptr_t * GC_CONST GC_uobjfreelist_ptr = GC_uobjfreelist;
# ifdef ATOMIC_UNCOLLECTABLE
- ptr_t * CONST GC_auobjfreelist_ptr = GC_auobjfreelist;
+ ptr_t * GC_CONST GC_auobjfreelist_ptr = GC_auobjfreelist;
# endif
-/* Allocate a composite object of size n bytes. The caller guarantees */
-/* that pointers past the first page are not relevant. Caller holds */
-/* allocation lock. */
-ptr_t GC_generic_malloc_inner_ignore_off_page(lb, k)
-register size_t lb;
-register int k;
+
+GC_PTR GC_generic_or_special_malloc(lb,knd)
+word lb;
+int knd;
{
- register struct hblk * h;
- register word n_blocks;
- register word lw;
- register ptr_t op;
-
- if (lb <= HBLKSIZE)
- return(GC_generic_malloc_inner((word)lb, k));
- n_blocks = divHBLKSZ(ADD_SLOP(lb) + HDR_BYTES + HBLKSIZE-1);
- if (!GC_is_initialized) GC_init_inner();
- /* Do our share of marking work */
- if(GC_incremental && !GC_dont_gc)
- GC_collect_a_little_inner((int)n_blocks);
- lw = ROUNDED_UP_WORDS(lb);
- h = GC_allochblk(lw, k, IGNORE_OFF_PAGE);
-# ifdef USE_MUNMAP
- if (0 == h) {
- GC_merge_unmapped();
- h = GC_allochblk(lw, k, IGNORE_OFF_PAGE);
- }
-# endif
- while (0 == h && GC_collect_or_expand(n_blocks, TRUE)) {
- h = GC_allochblk(lw, k, IGNORE_OFF_PAGE);
+ switch(knd) {
+# ifdef STUBBORN_ALLOC
+ case STUBBORN:
+ return(GC_malloc_stubborn((size_t)lb));
+# endif
+ case PTRFREE:
+ return(GC_malloc_atomic((size_t)lb));
+ case NORMAL:
+ return(GC_malloc((size_t)lb));
+ case UNCOLLECTABLE:
+ return(GC_malloc_uncollectable((size_t)lb));
+# ifdef ATOMIC_UNCOLLECTABLE
+ case AUNCOLLECTABLE:
+ return(GC_malloc_atomic_uncollectable((size_t)lb));
+# endif /* ATOMIC_UNCOLLECTABLE */
+ default:
+ return(GC_generic_malloc(lb,knd));
}
- if (h == 0) {
- op = 0;
+}
+
+
+/* Change the size of the block pointed to by p to contain at least */
+/* lb bytes. The object may be (and quite likely will be) moved. */
+/* The kind (e.g. atomic) is the same as that of the old. */
+/* Shrinking of large blocks is not implemented well. */
+# ifdef __STDC__
+ GC_PTR GC_realloc(GC_PTR p, size_t lb)
+# else
+ GC_PTR GC_realloc(p,lb)
+ GC_PTR p;
+ size_t lb;
+# endif
+{
+register struct hblk * h;
+register hdr * hhdr;
+register word sz; /* Current size in bytes */
+register word orig_sz; /* Original sz in bytes */
+int obj_kind;
+
+ if (p == 0) return(GC_malloc(lb)); /* Required by ANSI */
+ h = HBLKPTR(p);
+ hhdr = HDR(h);
+ sz = hhdr -> hb_sz;
+ obj_kind = hhdr -> hb_obj_kind;
+ sz = WORDS_TO_BYTES(sz);
+ orig_sz = sz;
+
+ if (sz > MAXOBJBYTES) {
+ /* Round it up to the next whole heap block */
+ register word descr;
+
+ sz = (sz+HBLKSIZE-1) & (~HBLKMASK);
+ hhdr -> hb_sz = BYTES_TO_WORDS(sz);
+ descr = GC_obj_kinds[obj_kind].ok_descriptor;
+ if (GC_obj_kinds[obj_kind].ok_relocate_descr) descr += sz;
+ hhdr -> hb_descr = descr;
+ if (IS_UNCOLLECTABLE(obj_kind)) GC_non_gc_bytes += (sz - orig_sz);
+ /* Extra area is already cleared by GC_alloc_large_and_clear. */
+ }
+ if (ADD_SLOP(lb) <= sz) {
+ if (lb >= (sz >> 1)) {
+# ifdef STUBBORN_ALLOC
+ if (obj_kind == STUBBORN) GC_change_stubborn(p);
+# endif
+ if (orig_sz > lb) {
+ /* Clear unneeded part of object to avoid bogus pointer */
+ /* tracing. */
+ /* Safe for stubborn objects. */
+ BZERO(((ptr_t)p) + lb, orig_sz - lb);
+ }
+ return(p);
+ } else {
+ /* shrink */
+ GC_PTR result =
+ GC_generic_or_special_malloc((word)lb, obj_kind);
+
+ if (result == 0) return(0);
+ /* Could also return original object. But this */
+ /* gives the client warning of imminent disaster. */
+ BCOPY(p, result, lb);
+# ifndef IGNORE_FREE
+ GC_free(p);
+# endif
+ return(result);
+ }
} else {
- op = (ptr_t) (h -> hb_body);
- GC_words_wasted += BYTES_TO_WORDS(n_blocks * HBLKSIZE) - lw;
+ /* grow */
+ GC_PTR result =
+ GC_generic_or_special_malloc((word)lb, obj_kind);
+
+ if (result == 0) return(0);
+ BCOPY(p, result, sz);
+# ifndef IGNORE_FREE
+ GC_free(p);
+# endif
+ return(result);
}
- GC_words_allocd += lw;
- return((ptr_t)op);
}
+# if defined(REDIRECT_MALLOC) || defined(REDIRECT_REALLOC)
+# ifdef __STDC__
+ GC_PTR realloc(GC_PTR p, size_t lb)
+# else
+ GC_PTR realloc(p,lb)
+ GC_PTR p;
+ size_t lb;
+# endif
+ {
+# ifdef REDIRECT_REALLOC
+ return(REDIRECT_REALLOC(p, lb));
+# else
+ return(GC_realloc(p, lb));
+# endif
+ }
+# endif /* REDIRECT_MALLOC */
+
+
+/* The same thing, except caller does not hold allocation lock. */
+/* We avoid holding allocation lock while we clear memory. */
ptr_t GC_generic_malloc_ignore_off_page(lb, k)
register size_t lb;
register int k;
{
register ptr_t result;
+ word lw;
+ word n_blocks;
+ GC_bool init;
DCL_LOCK_STATE;
+ if (SMALL_OBJ(lb))
+ return(GC_generic_malloc((word)lb, k));
+ lw = ROUNDED_UP_WORDS(lb);
+ n_blocks = OBJ_SZ_TO_BLOCKS(lw);
+ init = GC_obj_kinds[k].ok_init;
GC_INVOKE_FINALIZERS();
DISABLE_SIGNALS();
LOCK();
- result = GC_generic_malloc_inner_ignore_off_page(lb,k);
+ result = (ptr_t)GC_alloc_large(lw, k, IGNORE_OFF_PAGE);
+ if (0 != result) {
+ if (GC_debugging_started) {
+ BZERO(result, n_blocks * HBLKSIZE);
+ } else {
+# ifdef THREADS
+ /* Clear any memory that might be used for GC descriptors */
+ /* before we release the lock. */
+ ((word *)result)[0] = 0;
+ ((word *)result)[1] = 0;
+ ((word *)result)[lw-1] = 0;
+ ((word *)result)[lw-2] = 0;
+# endif
+ }
+ }
+ GC_words_allocd += lw;
UNLOCK();
ENABLE_SIGNALS();
if (0 == result) {
return((*GC_oom_fn)(lb));
} else {
+ if (init & !GC_debugging_started) {
+ BZERO(result, n_blocks * HBLKSIZE);
+ }
return(result);
}
}
@@ -134,22 +245,14 @@ void GC_incr_mem_freed(size_t n)
/* Analogous to the above, but assumes a small object size, and */
/* bypasses MERGE_SIZES mechanism. Used by gc_inline.h. */
-#ifdef __STDC__
- ptr_t GC_generic_malloc_words_small(size_t lw, int k)
-#else
- ptr_t GC_generic_malloc_words_small(lw, k)
- register word lw;
- register int k;
-#endif
+ptr_t GC_generic_malloc_words_small_inner(lw, k)
+register word lw;
+register int k;
{
register ptr_t op;
register ptr_t *opp;
register struct obj_kind * kind = GC_obj_kinds + k;
-DCL_LOCK_STATE;
- GC_INVOKE_FINALIZERS();
- DISABLE_SIGNALS();
- LOCK();
opp = &(kind -> ok_freelist[lw]);
if( (op = *opp) == 0 ) {
if (!GC_is_initialized) {
@@ -167,12 +270,50 @@ DCL_LOCK_STATE;
*opp = obj_link(op);
obj_link(op) = 0;
GC_words_allocd += lw;
+ return((ptr_t)op);
+}
+
+/* Analogous to the above, but assumes a small object size, and */
+/* bypasses MERGE_SIZES mechanism. Used by gc_inline.h. */
+#ifdef __STDC__
+ ptr_t GC_generic_malloc_words_small(size_t lw, int k)
+#else
+ ptr_t GC_generic_malloc_words_small(lw, k)
+ register word lw;
+ register int k;
+#endif
+{
+register ptr_t op;
+DCL_LOCK_STATE;
+
+ GC_INVOKE_FINALIZERS();
+ DISABLE_SIGNALS();
+ LOCK();
+ op = GC_generic_malloc_words_small_inner(lw, k);
UNLOCK();
ENABLE_SIGNALS();
return((ptr_t)op);
}
#if defined(THREADS) && !defined(SRC_M3)
+
+extern signed_word GC_mem_found; /* Protected by GC lock. */
+
+#ifdef PARALLEL_MARK
+volatile signed_word GC_words_allocd_tmp = 0;
+ /* Number of words of memory allocated since */
+ /* we released the GC lock. Instead of */
+ /* reacquiring the GC lock just to add this in, */
+ /* we add it in the next time we reacquire */
+ /* the lock. (Atomically adding it doesn't */
+ /* work, since we would have to atomically */
+ /* update it in GC_malloc, which is too */
+ /* expensive. */
+#endif /* PARALLEL_MARK */
+
+/* See reclaim.c: */
+extern ptr_t GC_reclaim_generic();
+
/* Return a list of 1 or more objects of the indicated size, linked */
/* through the first word in the object. This has the advantage that */
/* it acquires the allocation lock only once, and may greatly reduce */
@@ -182,63 +323,191 @@ DCL_LOCK_STATE;
/* GC_malloc_many or friends to replenish it. (We do not round up */
/* object sizes, since a call indicates the intention to consume many */
/* objects of exactly this size.) */
+/* We return the free-list by assigning it to *result, since it is */
+/* not safe to return, e.g. a linked list of pointer-free objects, */
+/* since the collector would not retain the entire list if it were */
+/* invoked just as we were returning. */
/* Note that the client should usually clear the link field. */
-ptr_t GC_generic_malloc_many(lb, k)
+void GC_generic_malloc_many(lb, k, result)
register word lb;
register int k;
+ptr_t *result;
{
ptr_t op;
-register ptr_t p;
+ptr_t p;
ptr_t *opp;
word lw;
-register word my_words_allocd;
+word my_words_allocd = 0;
+struct obj_kind * ok = &(GC_obj_kinds[k]);
DCL_LOCK_STATE;
+# if defined(GATHERSTATS) || defined(PARALLEL_MARK)
+# define COUNT_ARG , &my_words_allocd
+# else
+# define COUNT_ARG
+# define NEED_TO_COUNT
+# endif
if (!SMALL_OBJ(lb)) {
op = GC_generic_malloc(lb, k);
if(0 != op) obj_link(op) = 0;
- return(op);
+ *result = op;
+ return;
}
lw = ALIGNED_WORDS(lb);
GC_INVOKE_FINALIZERS();
DISABLE_SIGNALS();
LOCK();
- opp = &(GC_obj_kinds[k].ok_freelist[lw]);
- if( (op = *opp) == 0 ) {
- if (!GC_is_initialized) {
- GC_init_inner();
- }
- op = GC_clear_stack(GC_allocobj(lw, k));
- if (op == 0) {
- UNLOCK();
- ENABLE_SIGNALS();
- op = (*GC_oom_fn)(lb);
- if(0 != op) obj_link(op) = 0;
- return(op);
- }
+ if (!GC_is_initialized) GC_init_inner();
+ /* Do our share of marking work */
+ if (GC_incremental && !GC_dont_gc) {
+ ENTER_GC();
+ GC_collect_a_little_inner(1);
+ EXIT_GC();
+ }
+ /* First see if we can reclaim a page of objects waiting to be */
+ /* reclaimed. */
+ {
+ struct hblk ** rlh = ok -> ok_reclaim_list;
+ struct hblk * hbp;
+ hdr * hhdr;
+
+ rlh += lw;
+ while ((hbp = *rlh) != 0) {
+ hhdr = HDR(hbp);
+ *rlh = hhdr -> hb_next;
+# ifdef PARALLEL_MARK
+ {
+ signed_word my_words_allocd_tmp = GC_words_allocd_tmp;
+
+ GC_ASSERT(my_words_allocd_tmp >= 0);
+ /* We only decrement it while holding the GC lock. */
+ /* Thus we can't accidentally adjust it down in more */
+ /* than one thread simultaneously. */
+ if (my_words_allocd_tmp != 0) {
+ (void)GC_atomic_add(
+ (volatile GC_word *)(&GC_words_allocd_tmp),
+ (GC_word)(-my_words_allocd_tmp));
+ GC_words_allocd += my_words_allocd_tmp;
+ }
+ }
+ GC_acquire_mark_lock();
+ ++ GC_fl_builder_count;
+ UNLOCK();
+ ENABLE_SIGNALS();
+ GC_release_mark_lock();
+# endif
+ op = GC_reclaim_generic(hbp, hhdr, lw,
+ ok -> ok_init, 0 COUNT_ARG);
+ if (op != 0) {
+# ifdef NEED_TO_COUNT
+ /* We are neither gathering statistics, nor marking in */
+ /* parallel. Thus GC_reclaim_generic doesn't count */
+ /* for us. */
+ for (p = op; p != 0; p = obj_link(p)) {
+ my_words_allocd += lw;
+ }
+# endif
+# if defined(GATHERSTATS)
+ /* We also reclaimed memory, so we need to adjust */
+ /* that count. */
+ /* This should be atomic, so the results may be */
+ /* inaccurate. */
+ GC_mem_found += my_words_allocd;
+# endif
+# ifdef PARALLEL_MARK
+ *result = op;
+ (void)GC_atomic_add(
+ (volatile GC_word *)(&GC_words_allocd_tmp),
+ (GC_word)(my_words_allocd));
+ GC_acquire_mark_lock();
+ -- GC_fl_builder_count;
+ if (GC_fl_builder_count == 0) GC_notify_all_builder();
+ GC_release_mark_lock();
+ (void) GC_clear_stack(0);
+ return;
+# else
+ GC_words_allocd += my_words_allocd;
+ goto out;
+# endif
+ }
+# ifdef PARALLEL_MARK
+ GC_acquire_mark_lock();
+ -- GC_fl_builder_count;
+ if (GC_fl_builder_count == 0) GC_notify_all_builder();
+ GC_release_mark_lock();
+ DISABLE_SIGNALS();
+ LOCK();
+ /* GC lock is needed for reclaim list access. We */
+ /* must decrement fl_builder_count before reaquiring GC */
+ /* lock. Hopefully this path is rare. */
+# endif
+ }
}
- *opp = 0;
- my_words_allocd = 0;
- for (p = op; p != 0; p = obj_link(p)) {
- my_words_allocd += lw;
- if (my_words_allocd >= BODY_SZ) {
+ /* Next try to use prefix of global free list if there is one. */
+ /* We don't refill it, but we need to use it up before allocating */
+ /* a new block ourselves. */
+ opp = &(GC_obj_kinds[k].ok_freelist[lw]);
+ if ( (op = *opp) != 0 ) {
+ *opp = 0;
+ my_words_allocd = 0;
+ for (p = op; p != 0; p = obj_link(p)) {
+ my_words_allocd += lw;
+ if (my_words_allocd >= BODY_SZ) {
*opp = obj_link(p);
obj_link(p) = 0;
break;
+ }
}
+ GC_words_allocd += my_words_allocd;
+ goto out;
+ }
+ /* Next try to allocate a new block worth of objects of this size. */
+ {
+ struct hblk *h = GC_allochblk(lw, k, 0);
+ if (h != 0) {
+ if (IS_UNCOLLECTABLE(k)) GC_set_hdr_marks(HDR(h));
+ GC_words_allocd += BYTES_TO_WORDS(HBLKSIZE)
+ - BYTES_TO_WORDS(HBLKSIZE) % lw;
+# ifdef PARALLEL_MARK
+ GC_acquire_mark_lock();
+ ++ GC_fl_builder_count;
+ UNLOCK();
+ ENABLE_SIGNALS();
+ GC_release_mark_lock();
+# endif
+
+ op = GC_build_fl(h, lw, ok -> ok_init, 0);
+# ifdef PARALLEL_MARK
+ *result = op;
+ GC_acquire_mark_lock();
+ -- GC_fl_builder_count;
+ if (GC_fl_builder_count == 0) GC_notify_all_builder();
+ GC_release_mark_lock();
+ (void) GC_clear_stack(0);
+ return;
+# else
+ goto out;
+# endif
+ }
}
- GC_words_allocd += my_words_allocd;
-out:
+ /* As a last attempt, try allocating a single object. Note that */
+ /* this may trigger a collection or expand the heap. */
+ op = GC_generic_malloc_inner(lb, k);
+ if (0 != op) obj_link(op) = 0;
+
+ out:
+ *result = op;
UNLOCK();
ENABLE_SIGNALS();
- return(op);
-
+ (void) GC_clear_stack(0);
}
-void * GC_malloc_many(size_t lb)
+GC_PTR GC_malloc_many(size_t lb)
{
- return(GC_generic_malloc_many(lb, NORMAL));
+ ptr_t result;
+ GC_generic_malloc_many(lb, NORMAL, &result);
+ return result;
}
/* Note that the "atomic" version of this would be unsafe, since the */
@@ -260,11 +529,9 @@ DCL_LOCK_STATE;
if( SMALL_OBJ(lb) ) {
# ifdef MERGE_SIZES
-# ifdef ADD_BYTE_AT_END
- if (lb != 0) lb--;
+ if (EXTRA_BYTES != 0 && lb != 0) lb--;
/* We don't need the extra byte, since this won't be */
/* collected anyway. */
-# endif
lw = GC_size_map[lb];
# else
lw = ALIGNED_WORDS(lb);
@@ -326,11 +593,9 @@ DCL_LOCK_STATE;
if( SMALL_OBJ(lb) ) {
# ifdef MERGE_SIZES
-# ifdef ADD_BYTE_AT_END
- if (lb != 0) lb--;
+ if (EXTRA_BYTES != 0 && lb != 0) lb--;
/* We don't need the extra byte, since this won't be */
/* collected anyway. */
-# endif
lw = GC_size_map[lb];
# else
lw = ALIGNED_WORDS(lb);
diff --git a/gc/mark.c b/gc/mark.c
@@ -2,6 +2,7 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -16,8 +17,7 @@
# include <stdio.h>
-# include "gc_priv.h"
-# include "gc_mark.h"
+# include "private/gc_pmark.h"
/* We put this here to minimize the risk of inlining. */
/*VARARGS*/
@@ -38,7 +38,7 @@ word x;
/* mark_proc GC_mark_procs[MAX_MARK_PROCS] = {0} -- declared in gc_priv.h */
-word GC_n_mark_procs = 0;
+word GC_n_mark_procs = GC_RESERVED_MARK_PROCS;
/* Initialize GC_obj_kinds properly and standard free lists properly. */
/* This must be done statically since they may be accessed before */
@@ -46,25 +46,21 @@ word GC_n_mark_procs = 0;
/* It's done here, since we need to deal with mark descriptors. */
struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
/* PTRFREE */ { &GC_aobjfreelist[0], 0 /* filled in dynamically */,
- 0 | DS_LENGTH, FALSE, FALSE },
+ 0 | GC_DS_LENGTH, FALSE, FALSE },
/* NORMAL */ { &GC_objfreelist[0], 0,
-# if defined(ADD_BYTE_AT_END) && ALIGNMENT > DS_TAGS
- (word)(-ALIGNMENT) | DS_LENGTH,
-# else
- 0 | DS_LENGTH,
-# endif
+ 0 | GC_DS_LENGTH, /* Adjusted in GC_init_inner for EXTRA_BYTES */
TRUE /* add length to descr */, TRUE },
/* UNCOLLECTABLE */
{ &GC_uobjfreelist[0], 0,
- 0 | DS_LENGTH, TRUE /* add length to descr */, TRUE },
+ 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE },
# ifdef ATOMIC_UNCOLLECTABLE
/* AUNCOLLECTABLE */
{ &GC_auobjfreelist[0], 0,
- 0 | DS_LENGTH, FALSE /* add length to descr */, FALSE },
+ 0 | GC_DS_LENGTH, FALSE /* add length to descr */, FALSE },
# endif
# ifdef STUBBORN_ALLOC
/*STUBBORN*/ { &GC_sobjfreelist[0], 0,
- 0 | DS_LENGTH, TRUE /* add length to descr */, TRUE },
+ 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE },
# endif
};
@@ -87,6 +83,10 @@ struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
# define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE)
/* INITIAL_MARK_STACK_SIZE * sizeof(mse) should be a */
/* multiple of HBLKSIZE. */
+ /* The incremental collector actually likes a larger */
+ /* size, since it want to push all marked dirty objs */
+ /* before marking anything new. Currently we let it */
+ /* grow dynamically. */
# endif
/*
@@ -100,9 +100,15 @@ word GC_n_rescuing_pages; /* Number of dirty pages we marked from */
mse * GC_mark_stack;
+mse * GC_mark_stack_limit;
+
word GC_mark_stack_size = 0;
-mse * GC_mark_stack_top;
+#ifdef PARALLEL_MARK
+ mse * VOLATILE GC_mark_stack_top;
+#else
+ mse * GC_mark_stack_top;
+#endif
static struct hblk * scan_ptr;
@@ -125,7 +131,11 @@ GC_bool GC_collection_in_progress()
void GC_clear_hdr_marks(hhdr)
register hdr * hhdr;
{
- BZERO(hhdr -> hb_marks, MARK_BITS_SZ*sizeof(word));
+# ifdef USE_MARK_BYTES
+ BZERO(hhdr -> hb_marks, MARK_BITS_SZ);
+# else
+ BZERO(hhdr -> hb_marks, MARK_BITS_SZ*sizeof(word));
+# endif
}
/* Set all mark bits in the header. Used for uncollectable blocks. */
@@ -135,7 +145,11 @@ register hdr * hhdr;
register int i;
for (i = 0; i < MARK_BITS_SZ; ++i) {
+# ifdef USE_MARK_BYTES
+ hhdr -> hb_marks[i] = 1;
+# else
hhdr -> hb_marks[i] = ONES;
+# endif
}
}
@@ -143,9 +157,13 @@ register hdr * hhdr;
* Clear all mark bits associated with block h.
*/
/*ARGSUSED*/
-static void clear_marks_for_block(h, dummy)
-struct hblk *h;
-word dummy;
+# if defined(__STDC__) || defined(__cplusplus)
+ static void clear_marks_for_block(struct hblk *h, word dummy)
+# else
+ static void clear_marks_for_block(h, dummy)
+ struct hblk *h;
+ word dummy;
+# endif
{
register hdr * hhdr = HDR(h);
@@ -223,9 +241,7 @@ void GC_initiate_gc()
if (GC_dirty_maintained) GC_check_dirty();
}
# endif
-# ifdef GATHERSTATS
- GC_n_rescuing_pages = 0;
-# endif
+ GC_n_rescuing_pages = 0;
if (GC_mark_state == MS_NONE) {
GC_mark_state = MS_PUSH_RESCUERS;
} else if (GC_mark_state != MS_INVALID) {
@@ -248,21 +264,38 @@ static void alloc_mark_stack();
GC_bool GC_mark_some(cold_gc_frame)
ptr_t cold_gc_frame;
{
+#ifdef MSWIN32
+ /* Windows 98 appears to asynchronously create and remove writable */
+ /* memory mappings, for reasons we haven't yet understood. Since */
+ /* we look for writable regions to determine the root set, we may */
+ /* try to mark from an address range that disappeared since we */
+ /* started the collection. Thus we have to recover from faults here. */
+ /* This code does not appear to be necessary for Windows 95/NT/2000. */
+ /* Note that this code should never generate an incremental GC write */
+ /* fault. */
+ __try {
+#endif
switch(GC_mark_state) {
case MS_NONE:
return(FALSE);
case MS_PUSH_RESCUERS:
if (GC_mark_stack_top
- >= GC_mark_stack + INITIAL_MARK_STACK_SIZE/4) {
- GC_mark_from_mark_stack();
+ >= GC_mark_stack_limit - INITIAL_MARK_STACK_SIZE/2) {
+ /* Go ahead and mark, even though that might cause us to */
+ /* see more marked dirty objects later on. Avoid this */
+ /* in the future. */
+ GC_mark_stack_too_small = TRUE;
+ MARK_FROM_MARK_STACK();
return(FALSE);
} else {
scan_ptr = GC_push_next_marked_dirty(scan_ptr);
if (scan_ptr == 0) {
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Marked from %lu dirty pages\n",
(unsigned long)GC_n_rescuing_pages);
+ }
# endif
GC_push_roots(FALSE, cold_gc_frame);
GC_objects_are_marked = TRUE;
@@ -275,8 +308,13 @@ ptr_t cold_gc_frame;
case MS_PUSH_UNCOLLECTABLE:
if (GC_mark_stack_top
- >= GC_mark_stack + INITIAL_MARK_STACK_SIZE/4) {
- GC_mark_from_mark_stack();
+ >= GC_mark_stack + GC_mark_stack_size/4) {
+# ifdef PARALLEL_MARK
+ /* Avoid this, since we don't parallelize the marker */
+ /* here. */
+ if (GC_parallel) GC_mark_stack_too_small = TRUE;
+# endif
+ MARK_FROM_MARK_STACK();
return(FALSE);
} else {
scan_ptr = GC_push_next_marked_uncollectable(scan_ptr);
@@ -291,8 +329,32 @@ ptr_t cold_gc_frame;
return(FALSE);
case MS_ROOTS_PUSHED:
+# ifdef PARALLEL_MARK
+ /* In the incremental GC case, this currently doesn't */
+ /* quite do the right thing, since it runs to */
+ /* completion. On the other hand, starting a */
+ /* parallel marker is expensive, so perhaps it is */
+ /* the right thing? */
+ /* Eventually, incremental marking should run */
+ /* asynchronously in multiple threads, without grabbing */
+ /* the allocation lock. */
+ if (GC_parallel) {
+ GC_do_parallel_mark();
+ GC_ASSERT(GC_mark_stack_top < GC_first_nonempty);
+ GC_mark_stack_top = GC_mark_stack - 1;
+ if (GC_mark_stack_too_small) {
+ alloc_mark_stack(2*GC_mark_stack_size);
+ }
+ if (GC_mark_state == MS_ROOTS_PUSHED) {
+ GC_mark_state = MS_NONE;
+ return(TRUE);
+ } else {
+ return(FALSE);
+ }
+ }
+# endif
if (GC_mark_stack_top >= GC_mark_stack) {
- GC_mark_from_mark_stack();
+ MARK_FROM_MARK_STACK();
return(FALSE);
} else {
GC_mark_state = MS_NONE;
@@ -309,7 +371,7 @@ ptr_t cold_gc_frame;
return(FALSE);
}
if (GC_mark_stack_top >= GC_mark_stack) {
- GC_mark_from_mark_stack();
+ MARK_FROM_MARK_STACK();
return(FALSE);
}
if (scan_ptr == 0 && GC_mark_state == MS_INVALID) {
@@ -333,6 +395,22 @@ ptr_t cold_gc_frame;
ABORT("GC_mark_some: bad state");
return(FALSE);
}
+#ifdef MSWIN32
+ } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ?
+ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf0("Caught ACCESS_VIOLATION in marker. "
+ "Memory mapping disappeared.\n");
+ }
+# endif /* CONDPRINT */
+ /* We have bad roots on the stack. Discard mark stack. */
+ /* Rescan from marked objects. Redetermine roots. */
+ GC_invalidate_mark_state();
+ scan_ptr = 0;
+ return FALSE;
+ }
+#endif /* MSWIN32 */
}
@@ -349,27 +427,28 @@ GC_bool GC_mark_stack_empty()
#endif
/* Given a pointer to someplace other than a small object page or the */
-/* first page of a large object, return a pointer either to the */
-/* start of the large object or NIL. */
-/* In the latter case black list the address current. */
-/* Returns NIL without black listing if current points to a block */
-/* with IGNORE_OFF_PAGE set. */
+/* first page of a large object, either: */
+/* - return a pointer to somewhere in the first page of the large */
+/* object, if current points to a large object. */
+/* In this case *hhdr is replaced with a pointer to the header */
+/* for the large object. */
+/* - just return current if it does not point to a large object. */
/*ARGSUSED*/
# ifdef PRINT_BLACK_LIST
- word GC_find_start(current, hhdr, source)
- word source;
+ ptr_t GC_find_start(current, hhdr, new_hdr_p, source)
+ ptr_t source;
# else
- word GC_find_start(current, hhdr)
+ ptr_t GC_find_start(current, hhdr, new_hdr_p)
# define source 0
# endif
-register word current;
-register hdr * hhdr;
+register ptr_t current;
+register hdr *hhdr, **new_hdr_p;
{
-# ifdef ALL_INTERIOR_POINTERS
+ if (GC_all_interior_pointers) {
if (hhdr != 0) {
- register word orig = current;
+ register ptr_t orig = current;
- current = (word)HBLKPTR(current) + HDR_BYTES;
+ current = (ptr_t)HBLKPTR(current);
do {
current = current - HBLKSIZE*(word)hhdr;
hhdr = HDR(current);
@@ -379,18 +458,16 @@ register hdr * hhdr;
if ((word *)orig - (word *)current
>= (ptrdiff_t)(hhdr->hb_sz)) {
/* Pointer past the end of the block */
- GC_ADD_TO_BLACK_LIST_NORMAL(orig, source);
- return(0);
+ return(orig);
}
+ *new_hdr_p = hhdr;
return(current);
} else {
- GC_ADD_TO_BLACK_LIST_NORMAL(current, source);
- return(0);
+ return(current);
}
-# else
- GC_ADD_TO_BLACK_LIST_NORMAL(current, source);
- return(0);
-# endif
+ } else {
+ return(current);
+ }
# undef source
}
@@ -405,14 +482,15 @@ mse * msp;
{
GC_mark_state = MS_INVALID;
GC_mark_stack_too_small = TRUE;
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Mark stack overflow; current size = %lu entries\n",
GC_mark_stack_size);
-# endif
- return(msp-INITIAL_MARK_STACK_SIZE/8);
+ }
+# endif
+ return(msp - GC_MARK_STACK_DISCARDS);
}
-
/*
* Mark objects pointed to by the regions described by
* mark stack entries between GC_mark_stack and GC_mark_stack_top,
@@ -420,12 +498,18 @@ mse * msp;
* is never 0. A mark stack entry never has size 0.
* We try to traverse on the order of a hblk of memory before we return.
* Caller is responsible for calling this until the mark stack is empty.
+ * Note that this is the most performance critical routine in the
+ * collector. Hence it contains all sorts of ugly hacks to speed
+ * things up. In particular, we avoid procedure calls on the common
+ * path, we take advantage of peculiarities of the mark descriptor
+ * encoding, we optionally maintain a cache for the block address to
+ * header mapping, we prefetch when an object is "grayed", etc.
*/
-void GC_mark_from_mark_stack()
+mse * GC_mark_from(mark_stack_top, mark_stack, mark_stack_limit)
+mse * mark_stack_top;
+mse * mark_stack;
+mse * mark_stack_limit;
{
- mse * GC_mark_stack_reg = GC_mark_stack;
- mse * GC_mark_stack_top_reg = GC_mark_stack_top;
- mse * mark_stack_limit = &(GC_mark_stack[GC_mark_stack_size]);
int credit = HBLKSIZE; /* Remaining credit for marking work */
register word * current_p; /* Pointer to current candidate ptr. */
register word current; /* Candidate pointer. */
@@ -434,94 +518,509 @@ void GC_mark_from_mark_stack()
register word descr;
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
register ptr_t least_ha = GC_least_plausible_heap_addr;
+ DECLARE_HDR_CACHE;
+
# define SPLIT_RANGE_WORDS 128 /* Must be power of 2. */
GC_objects_are_marked = TRUE;
+ INIT_HDR_CACHE;
# ifdef OS2 /* Use untweaked version to circumvent compiler problem */
- while (GC_mark_stack_top_reg >= GC_mark_stack_reg && credit >= 0) {
+ while (mark_stack_top >= mark_stack && credit >= 0) {
# else
- while ((((ptr_t)GC_mark_stack_top_reg - (ptr_t)GC_mark_stack_reg) | credit)
+ while ((((ptr_t)mark_stack_top - (ptr_t)mark_stack) | credit)
>= 0) {
# endif
- current_p = GC_mark_stack_top_reg -> mse_start;
+ current_p = mark_stack_top -> mse_start;
+ descr = mark_stack_top -> mse_descr;
retry:
- descr = GC_mark_stack_top_reg -> mse_descr;
- if (descr & ((~(WORDS_TO_BYTES(SPLIT_RANGE_WORDS) - 1)) | DS_TAGS)) {
- word tag = descr & DS_TAGS;
+ /* current_p and descr describe the current object. */
+ /* *mark_stack_top is vacant. */
+ /* The following is 0 only for small objects described by a simple */
+ /* length descriptor. For many applications this is the common */
+ /* case, so we try to detect it quickly. */
+ if (descr & ((~(WORDS_TO_BYTES(SPLIT_RANGE_WORDS) - 1)) | GC_DS_TAGS)) {
+ word tag = descr & GC_DS_TAGS;
switch(tag) {
- case DS_LENGTH:
+ case GC_DS_LENGTH:
/* Large length. */
/* Process part of the range to avoid pushing too much on the */
/* stack. */
- GC_mark_stack_top_reg -> mse_start =
+# ifdef PARALLEL_MARK
+# define SHARE_BYTES 2048
+ if (descr > SHARE_BYTES && GC_parallel
+ && mark_stack_top < mark_stack_limit - 1) {
+ int new_size = (descr/2) & ~(sizeof(word)-1);
+ GC_ASSERT(descr < GC_greatest_plausible_heap_addr
+ - GC_least_plausible_heap_addr);
+ mark_stack_top -> mse_start = current_p;
+ mark_stack_top -> mse_descr = new_size + sizeof(word);
+ /* makes sure we handle */
+ /* misaligned pointers. */
+ mark_stack_top++;
+ current_p = (word *) ((char *)current_p + new_size);
+ descr -= new_size;
+ goto retry;
+ }
+# endif /* PARALLEL_MARK */
+ mark_stack_top -> mse_start =
limit = current_p + SPLIT_RANGE_WORDS-1;
- GC_mark_stack_top_reg -> mse_descr -=
- WORDS_TO_BYTES(SPLIT_RANGE_WORDS-1);
+ mark_stack_top -> mse_descr =
+ descr - WORDS_TO_BYTES(SPLIT_RANGE_WORDS-1);
/* Make sure that pointers overlapping the two ranges are */
/* considered. */
limit = (word *)((char *)limit + sizeof(word) - ALIGNMENT);
break;
- case DS_BITMAP:
- GC_mark_stack_top_reg--;
- descr &= ~DS_TAGS;
+ case GC_DS_BITMAP:
+ mark_stack_top--;
+ descr &= ~GC_DS_TAGS;
credit -= WORDS_TO_BYTES(WORDSZ/2); /* guess */
while (descr != 0) {
if ((signed_word)descr < 0) {
current = *current_p;
if ((ptr_t)current >= least_ha && (ptr_t)current < greatest_ha) {
- PUSH_CONTENTS(current, GC_mark_stack_top_reg, mark_stack_limit,
- current_p, exit1);
+ PREFETCH(current);
+ HC_PUSH_CONTENTS((ptr_t)current, mark_stack_top,
+ mark_stack_limit, current_p, exit1);
}
}
descr <<= 1;
++ current_p;
}
continue;
- case DS_PROC:
- GC_mark_stack_top_reg--;
- credit -= PROC_BYTES;
- GC_mark_stack_top_reg =
+ case GC_DS_PROC:
+ mark_stack_top--;
+ credit -= GC_PROC_BYTES;
+ mark_stack_top =
(*PROC(descr))
- (current_p, GC_mark_stack_top_reg,
+ (current_p, mark_stack_top,
mark_stack_limit, ENV(descr));
continue;
- case DS_PER_OBJECT:
- GC_mark_stack_top_reg -> mse_descr =
- *(word *)((ptr_t)current_p + descr - tag);
+ case GC_DS_PER_OBJECT:
+ if ((signed_word)descr >= 0) {
+ /* Descriptor is in the object. */
+ descr = *(word *)((ptr_t)current_p + descr - GC_DS_PER_OBJECT);
+ } else {
+ /* Descriptor is in type descriptor pointed to by first */
+ /* word in object. */
+ ptr_t type_descr = *(ptr_t *)current_p;
+ /* type_descr is either a valid pointer to the descriptor */
+ /* structure, or this object was on a free list. If it */
+ /* it was anything but the last object on the free list, */
+ /* we will misinterpret the next object on the free list as */
+ /* the type descriptor, and get a 0 GC descriptor, which */
+ /* is ideal. Unfortunately, we need to check for the last */
+ /* object case explicitly. */
+ if (0 == type_descr) {
+ /* Rarely executed. */
+ mark_stack_top--;
+ continue;
+ }
+ descr = *(word *)(type_descr
+ - (descr - (GC_DS_PER_OBJECT
+ - GC_INDIR_PER_OBJ_BIAS)));
+ }
+ if (0 == descr) {
+ /* Can happen either because we generated a 0 descriptor */
+ /* or we saw a pointer to a free object. */
+ mark_stack_top--;
+ continue;
+ }
goto retry;
}
- } else {
- GC_mark_stack_top_reg--;
+ } else /* Small object with length descriptor */ {
+ mark_stack_top--;
limit = (word *)(((ptr_t)current_p) + (word)descr);
}
/* The simple case in which we're scanning a range. */
+ GC_ASSERT(!((word)current_p & (ALIGNMENT-1)));
credit -= (ptr_t)limit - (ptr_t)current_p;
limit -= 1;
- while (current_p <= limit) {
- current = *current_p;
- if ((ptr_t)current >= least_ha && (ptr_t)current < greatest_ha) {
- PUSH_CONTENTS(current, GC_mark_stack_top_reg,
- mark_stack_limit, current_p, exit2);
+ {
+# define PREF_DIST 4
+
+# ifndef SMALL_CONFIG
+ word deferred;
+
+ /* Try to prefetch the next pointer to be examined asap. */
+ /* Empirically, this also seems to help slightly without */
+ /* prefetches, at least on linux/X86. Presumably this loop */
+ /* ends up with less register pressure, and gcc thus ends up */
+ /* generating slightly better code. Overall gcc code quality */
+ /* for this loop is still not great. */
+ for(;;) {
+ PREFETCH((ptr_t)limit - PREF_DIST*CACHE_LINE_SIZE);
+ GC_ASSERT(limit >= current_p);
+ deferred = *limit;
+ limit = (word *)((char *)limit - ALIGNMENT);
+ if ((ptr_t)deferred >= least_ha && (ptr_t)deferred < greatest_ha) {
+ PREFETCH(deferred);
+ break;
+ }
+ if (current_p > limit) goto next_object;
+ /* Unroll once, so we don't do too many of the prefetches */
+ /* based on limit. */
+ deferred = *limit;
+ limit = (word *)((char *)limit - ALIGNMENT);
+ if ((ptr_t)deferred >= least_ha && (ptr_t)deferred < greatest_ha) {
+ PREFETCH(deferred);
+ break;
+ }
+ if (current_p > limit) goto next_object;
+ }
+# endif
+
+ while (current_p <= limit) {
+ /* Empirically, unrolling this loop doesn't help a lot. */
+ /* Since HC_PUSH_CONTENTS expands to a lot of code, */
+ /* we don't. */
+ current = *current_p;
+ PREFETCH((ptr_t)current_p + PREF_DIST*CACHE_LINE_SIZE);
+ if ((ptr_t)current >= least_ha && (ptr_t)current < greatest_ha) {
+ /* Prefetch the contents of the object we just pushed. It's */
+ /* likely we will need them soon. */
+ PREFETCH(current);
+ HC_PUSH_CONTENTS((ptr_t)current, mark_stack_top,
+ mark_stack_limit, current_p, exit2);
+ }
+ current_p = (word *)((char *)current_p + ALIGNMENT);
}
- current_p = (word *)((char *)current_p + ALIGNMENT);
+
+# ifndef SMALL_CONFIG
+ /* We still need to mark the entry we previously prefetched. */
+ /* We alrady know that it passes the preliminary pointer */
+ /* validity test. */
+ HC_PUSH_CONTENTS((ptr_t)deferred, mark_stack_top,
+ mark_stack_limit, current_p, exit4);
+ next_object:;
+# endif
}
}
- GC_mark_stack_top = GC_mark_stack_top_reg;
+ return mark_stack_top;
+}
+
+#ifdef PARALLEL_MARK
+
+/* We assume we have an ANSI C Compiler. */
+GC_bool GC_help_wanted = FALSE;
+unsigned GC_helper_count = 0;
+unsigned GC_active_count = 0;
+mse * VOLATILE GC_first_nonempty;
+word GC_mark_no = 0;
+
+#define LOCAL_MARK_STACK_SIZE HBLKSIZE
+ /* Under normal circumstances, this is big enough to guarantee */
+ /* We don't overflow half of it in a single call to */
+ /* GC_mark_from. */
+
+
+/* Steal mark stack entries starting at mse low into mark stack local */
+/* until we either steal mse high, or we have max entries. */
+/* Return a pointer to the top of the local mark stack. */
+/* *next is replaced by a pointer to the next unscanned mark stack */
+/* entry. */
+mse * GC_steal_mark_stack(mse * low, mse * high, mse * local,
+ unsigned max, mse **next)
+{
+ mse *p;
+ mse *top = local - 1;
+ unsigned i = 0;
+
+ GC_ASSERT(high >= low-1 && high - low + 1 <= GC_mark_stack_size);
+ for (p = low; p <= high && i <= max; ++p) {
+ word descr = *(volatile word *) &(p -> mse_descr);
+ if (descr != 0) {
+ *(volatile word *) &(p -> mse_descr) = 0;
+ ++top;
+ top -> mse_descr = descr;
+ top -> mse_start = p -> mse_start;
+ GC_ASSERT( top -> mse_descr & GC_DS_TAGS != GC_DS_LENGTH ||
+ top -> mse_descr < GC_greatest_plausible_heap_addr
+ - GC_least_plausible_heap_addr);
+ /* There is no synchronization here. We assume that at */
+ /* least one thread will see the original descriptor. */
+ /* Otherwise we need a barrier. */
+ /* More than one thread may get this entry, but that's only */
+ /* a minor performance problem. */
+ /* If this is a big object, count it as */
+ /* size/256 + 1 objects. */
+ ++i;
+ if ((descr & GC_DS_TAGS) == GC_DS_LENGTH) i += (descr >> 8);
+ }
+ }
+ *next = p;
+ return top;
+}
+
+/* Copy back a local mark stack. */
+/* low and high are inclusive bounds. */
+void GC_return_mark_stack(mse * low, mse * high)
+{
+ mse * my_top;
+ mse * my_start;
+ size_t stack_size;
+
+ if (high < low) return;
+ stack_size = high - low + 1;
+ GC_acquire_mark_lock();
+ my_top = GC_mark_stack_top;
+ my_start = my_top + 1;
+ if (my_start - GC_mark_stack + stack_size > GC_mark_stack_size) {
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GC_printf0("No room to copy back mark stack.");
+ }
+# endif
+ GC_mark_state = MS_INVALID;
+ GC_mark_stack_too_small = TRUE;
+ /* We drop the local mark stack. We'll fix things later. */
+ } else {
+ BCOPY(low, my_start, stack_size * sizeof(mse));
+ GC_ASSERT(GC_mark_stack_top = my_top);
+# if !defined(IA64) && !defined(HP_PA)
+ GC_memory_write_barrier();
+# endif
+ /* On IA64, the volatile write acts as a release barrier. */
+ GC_mark_stack_top = my_top + stack_size;
+ }
+ GC_release_mark_lock();
+ GC_notify_all_marker();
+}
+
+/* Mark from the local mark stack. */
+/* On return, the local mark stack is empty. */
+/* But this may be achieved by copying the */
+/* local mark stack back into the global one. */
+void GC_do_local_mark(mse *local_mark_stack, mse *local_top)
+{
+ unsigned n;
+# define N_LOCAL_ITERS 1
+
+# ifdef GC_ASSERTIONS
+ /* Make sure we don't hold mark lock. */
+ GC_acquire_mark_lock();
+ GC_release_mark_lock();
+# endif
+ for (;;) {
+ for (n = 0; n < N_LOCAL_ITERS; ++n) {
+ local_top = GC_mark_from(local_top, local_mark_stack,
+ local_mark_stack + LOCAL_MARK_STACK_SIZE);
+ if (local_top < local_mark_stack) return;
+ if (local_top - local_mark_stack >= LOCAL_MARK_STACK_SIZE/2) {
+ GC_return_mark_stack(local_mark_stack, local_top);
+ return;
+ }
+ }
+ if (GC_mark_stack_top < GC_first_nonempty &&
+ GC_active_count < GC_helper_count
+ && local_top > local_mark_stack + 1) {
+ /* Try to share the load, since the main stack is empty, */
+ /* and helper threads are waiting for a refill. */
+ /* The entries near the bottom of the stack are likely */
+ /* to require more work. Thus we return those, eventhough */
+ /* it's harder. */
+ mse * p;
+ mse * new_bottom = local_mark_stack
+ + (local_top - local_mark_stack)/2;
+ GC_ASSERT(new_bottom > local_mark_stack
+ && new_bottom < local_top);
+ GC_return_mark_stack(local_mark_stack, new_bottom - 1);
+ memmove(local_mark_stack, new_bottom,
+ (local_top - new_bottom + 1) * sizeof(mse));
+ local_top -= (new_bottom - local_mark_stack);
+ }
+ }
}
+#define ENTRIES_TO_GET 5
+
+long GC_markers = 2; /* Normally changed by thread-library- */
+ /* -specific code. */
+
+/* Mark using the local mark stack until the global mark stack is empty */
+/* and ther are no active workers. Update GC_first_nonempty to reflect */
+/* progress. */
+/* Caller does not hold mark lock. */
+/* Caller has already incremented GC_helper_count. We decrement it, */
+/* and maintain GC_active_count. */
+void GC_mark_local(mse *local_mark_stack, int id)
+{
+ mse * my_first_nonempty;
+
+ GC_acquire_mark_lock();
+ GC_active_count++;
+ my_first_nonempty = GC_first_nonempty;
+ GC_ASSERT(GC_first_nonempty >= GC_mark_stack &&
+ GC_first_nonempty <= GC_mark_stack_top + 1);
+# ifdef PRINTSTATS
+ GC_printf1("Starting mark helper %lu\n", (unsigned long)id);
+# endif
+ GC_release_mark_lock();
+ for (;;) {
+ size_t n_on_stack;
+ size_t n_to_get;
+ mse *next;
+ mse * my_top;
+ mse * local_top;
+ mse * global_first_nonempty = GC_first_nonempty;
+
+ GC_ASSERT(my_first_nonempty >= GC_mark_stack &&
+ my_first_nonempty <= GC_mark_stack_top + 1);
+ GC_ASSERT(global_first_nonempty >= GC_mark_stack &&
+ global_first_nonempty <= GC_mark_stack_top + 1);
+ if (my_first_nonempty < global_first_nonempty) {
+ my_first_nonempty = global_first_nonempty;
+ } else if (global_first_nonempty < my_first_nonempty) {
+ GC_compare_and_exchange((word *)(&GC_first_nonempty),
+ (word) global_first_nonempty,
+ (word) my_first_nonempty);
+ /* If this fails, we just go ahead, without updating */
+ /* GC_first_nonempty. */
+ }
+ /* Perhaps we should also update GC_first_nonempty, if it */
+ /* is less. But that would require using atomic updates. */
+ my_top = GC_mark_stack_top;
+ n_on_stack = my_top - my_first_nonempty + 1;
+ if (0 == n_on_stack) {
+ GC_acquire_mark_lock();
+ my_top = GC_mark_stack_top;
+ n_on_stack = my_top - my_first_nonempty + 1;
+ if (0 == n_on_stack) {
+ GC_active_count--;
+ GC_ASSERT(GC_active_count <= GC_helper_count);
+ /* Other markers may redeposit objects */
+ /* on the stack. */
+ if (0 == GC_active_count) GC_notify_all_marker();
+ while (GC_active_count > 0
+ && GC_first_nonempty > GC_mark_stack_top) {
+ /* We will be notified if either GC_active_count */
+ /* reaches zero, or if more objects are pushed on */
+ /* the global mark stack. */
+ GC_wait_marker();
+ }
+ if (GC_active_count == 0 &&
+ GC_first_nonempty > GC_mark_stack_top) {
+ GC_bool need_to_notify = FALSE;
+ /* The above conditions can't be falsified while we */
+ /* hold the mark lock, since neither */
+ /* GC_active_count nor GC_mark_stack_top can */
+ /* change. GC_first_nonempty can only be */
+ /* incremented asynchronously. Thus we know that */
+ /* both conditions actually held simultaneously. */
+ GC_helper_count--;
+ if (0 == GC_helper_count) need_to_notify = TRUE;
+# ifdef PRINTSTATS
+ GC_printf1(
+ "Finished mark helper %lu\n", (unsigned long)id);
+# endif
+ GC_release_mark_lock();
+ if (need_to_notify) GC_notify_all_marker();
+ return;
+ }
+ /* else there's something on the stack again, or */
+ /* another help may push something. */
+ GC_active_count++;
+ GC_ASSERT(GC_active_count > 0);
+ GC_release_mark_lock();
+ continue;
+ } else {
+ GC_release_mark_lock();
+ }
+ }
+ n_to_get = ENTRIES_TO_GET;
+ if (n_on_stack < 2 * ENTRIES_TO_GET) n_to_get = 1;
+ local_top = GC_steal_mark_stack(my_first_nonempty, my_top,
+ local_mark_stack, n_to_get,
+ &my_first_nonempty);
+ GC_ASSERT(my_first_nonempty >= GC_mark_stack &&
+ my_first_nonempty <= GC_mark_stack_top + 1);
+ GC_do_local_mark(local_mark_stack, local_top);
+ }
+}
+
+/* Perform Parallel mark. */
+/* We hold the GC lock, not the mark lock. */
+/* Currently runs until the mark stack is */
+/* empty. */
+void GC_do_parallel_mark()
+{
+ mse local_mark_stack[LOCAL_MARK_STACK_SIZE];
+ mse * local_top;
+ mse * my_top;
+
+ GC_acquire_mark_lock();
+ GC_ASSERT(I_HOLD_LOCK());
+ GC_ASSERT(!GC_help_wanted);
+ GC_ASSERT(GC_active_count == 0);
+# ifdef PRINTSTATS
+ GC_printf1("Starting marking for mark phase number %lu\n",
+ (unsigned long)GC_mark_no);
+# endif
+ GC_first_nonempty = GC_mark_stack;
+ GC_active_count = 0;
+ GC_helper_count = 1;
+ GC_help_wanted = TRUE;
+ GC_release_mark_lock();
+ GC_notify_all_marker();
+ /* Wake up potential helpers. */
+ GC_mark_local(local_mark_stack, 0);
+ GC_acquire_mark_lock();
+ GC_help_wanted = FALSE;
+ /* Done; clean up. */
+ while (GC_helper_count > 0) GC_wait_marker();
+ /* GC_helper_count cannot be incremented while GC_help_wanted == FALSE */
+# ifdef PRINTSTATS
+ GC_printf1(
+ "Finished marking for mark phase number %lu\n",
+ (unsigned long)GC_mark_no);
+# endif
+ GC_mark_no++;
+ GC_release_mark_lock();
+ GC_notify_all_marker();
+}
+
+
+/* Try to help out the marker, if it's running. */
+/* We do not hold the GC lock, but the requestor does. */
+void GC_help_marker(word my_mark_no)
+{
+ mse local_mark_stack[LOCAL_MARK_STACK_SIZE];
+ unsigned my_id;
+ mse * my_first_nonempty;
+
+ if (!GC_parallel) return;
+ GC_acquire_mark_lock();
+ while (GC_mark_no < my_mark_no
+ || !GC_help_wanted && GC_mark_no == my_mark_no) {
+ GC_wait_marker();
+ }
+ my_id = GC_helper_count;
+ if (GC_mark_no != my_mark_no || my_id >= GC_markers) {
+ /* Second test is useful only if original threads can also */
+ /* act as helpers. Under Linux they can't. */
+ GC_release_mark_lock();
+ return;
+ }
+ GC_helper_count = my_id + 1;
+ GC_release_mark_lock();
+ GC_mark_local(local_mark_stack, my_id);
+ /* GC_mark_local decrements GC_helper_count. */
+}
+
+#endif /* PARALLEL_MARK */
+
/* Allocate or reallocate space for mark stack of size s words */
/* May silently fail. */
static void alloc_mark_stack(n)
word n;
{
- mse * new_stack = (mse *)GC_scratch_alloc(n * sizeof(struct ms_entry));
+ mse * new_stack = (mse *)GC_scratch_alloc(n * sizeof(struct GC_ms_entry));
GC_mark_stack_too_small = FALSE;
if (GC_mark_stack_size != 0) {
if (new_stack != 0) {
word displ = (word)GC_mark_stack & (GC_page_size - 1);
- signed_word size = GC_mark_stack_size * sizeof(struct ms_entry);
+ signed_word size = GC_mark_stack_size * sizeof(struct GC_ms_entry);
/* Recycle old space */
if (0 != displ) displ = GC_page_size - displ;
@@ -532,14 +1031,19 @@ word n;
}
GC_mark_stack = new_stack;
GC_mark_stack_size = n;
-# ifdef PRINTSTATS
+ GC_mark_stack_limit = new_stack + n;
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Grew mark stack to %lu frames\n",
(unsigned long) GC_mark_stack_size);
+ }
# endif
} else {
-# ifdef PRINTSTATS
+# ifdef CONDPRINT
+ if (GC_print_stats) {
GC_printf1("Failed to grow mark stack to %lu frames\n",
(unsigned long) n);
+ }
# endif
}
} else {
@@ -549,6 +1053,7 @@ word n;
}
GC_mark_stack = new_stack;
GC_mark_stack_size = n;
+ GC_mark_stack_limit = new_stack + n;
}
GC_mark_stack_top = GC_mark_stack-1;
}
@@ -575,32 +1080,33 @@ ptr_t top;
top = (ptr_t)(((word) top) & ~(ALIGNMENT-1));
if (top == 0 || bottom == top) return;
GC_mark_stack_top++;
- if (GC_mark_stack_top >= GC_mark_stack + GC_mark_stack_size) {
+ if (GC_mark_stack_top >= GC_mark_stack_limit) {
ABORT("unexpected mark stack overflow");
}
length = top - bottom;
-# if DS_TAGS > ALIGNMENT - 1
- length += DS_TAGS;
- length &= ~DS_TAGS;
+# if GC_DS_TAGS > ALIGNMENT - 1
+ length += GC_DS_TAGS;
+ length &= ~GC_DS_TAGS;
# endif
GC_mark_stack_top -> mse_start = (word *)bottom;
GC_mark_stack_top -> mse_descr = length;
}
/*
- * Analogous to the above, but push only those pages that may have been
- * dirtied. A block h is assumed dirty if dirty_fn(h) != 0.
+ * Analogous to the above, but push only those pages h with dirty_fn(h) != 0.
* We use push_fn to actually push the block.
+ * Used both to selectively push dirty pages, or to push a block
+ * in piecemeal fashion, to allow for more marking concurrency.
* Will not overflow mark stack if push_fn pushes a small fixed number
* of entries. (This is invoked only if push_fn pushes a single entry,
* or if it marks each object before pushing it, thus ensuring progress
* in the event of a stack overflow.)
*/
-void GC_push_dirty(bottom, top, dirty_fn, push_fn)
+void GC_push_selected(bottom, top, dirty_fn, push_fn)
ptr_t bottom;
ptr_t top;
-int (*dirty_fn)(/* struct hblk * h */);
-void (*push_fn)(/* ptr_t bottom, ptr_t top */);
+int (*dirty_fn) GC_PROTO((struct hblk * h));
+void (*push_fn) GC_PROTO((ptr_t bottom, ptr_t top));
{
register struct hblk * h;
@@ -636,12 +1142,23 @@ void (*push_fn)(/* ptr_t bottom, ptr_t top */);
(*push_fn)((ptr_t)h, top);
}
}
- if (GC_mark_stack_top >= GC_mark_stack + GC_mark_stack_size) {
+ if (GC_mark_stack_top >= GC_mark_stack_limit) {
ABORT("unexpected mark stack overflow");
}
}
# ifndef SMALL_CONFIG
+
+#ifdef PARALLEL_MARK
+ /* Break up root sections into page size chunks to better spread */
+ /* out work. */
+ GC_bool GC_true_func(struct hblk *h) { return TRUE; }
+# define GC_PUSH_ALL(b,t) GC_push_selected(b,t,GC_true_func,GC_push_all);
+#else
+# define GC_PUSH_ALL(b,t) GC_push_all(b,t);
+#endif
+
+
void GC_push_conditional(bottom, top, all)
ptr_t bottom;
ptr_t top;
@@ -651,7 +1168,7 @@ int all;
if (GC_dirty_maintained) {
# ifdef PROC_VDB
/* Pages that were never dirtied cannot contain pointers */
- GC_push_dirty(bottom, top, GC_page_was_ever_dirty, GC_push_all);
+ GC_push_selected(bottom, top, GC_page_was_ever_dirty, GC_push_all);
# else
GC_push_all(bottom, top);
# endif
@@ -659,19 +1176,31 @@ int all;
GC_push_all(bottom, top);
}
} else {
- GC_push_dirty(bottom, top, GC_page_was_dirty, GC_push_all);
+ GC_push_selected(bottom, top, GC_page_was_dirty, GC_push_all);
}
}
#endif
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
void __cdecl GC_push_one(p)
# else
void GC_push_one(p)
# endif
word p;
{
- GC_PUSH_ONE_STACK(p, 0);
+ GC_PUSH_ONE_STACK(p, MARKED_FROM_REGISTER);
+}
+
+struct GC_ms_entry *GC_mark_and_push(obj, mark_stack_ptr, mark_stack_limit, src)
+GC_PTR obj;
+struct GC_ms_entry * mark_stack_ptr;
+struct GC_ms_entry * mark_stack_limit;
+GC_PTR *src;
+{
+ PREFETCH(obj);
+ PUSH_CONTENTS(obj, mark_stack_ptr /* modified */, mark_stack_limit, src,
+ was_marked /* internally generated exit label */);
+ return mark_stack_ptr;
}
# ifdef __STDC__
@@ -680,16 +1209,21 @@ word p;
# define BASE(p) (word)GC_base((char *)(p))
# endif
-/* As above, but argument passed preliminary test. */
+/* Mark and push (i.e. gray) a single object p onto the main */
+/* mark stack. Consider p to be valid if it is an interior */
+/* pointer. */
+/* The object p has passed a preliminary pointer validity */
+/* test, but we do not definitely know whether it is valid. */
+/* Mark bits are NOT atomically updated. Thus this must be the */
+/* only thread setting them. */
# if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS)
- void GC_push_one_checked(p, interior_ptrs, source)
+ void GC_mark_and_push_stack(p, source)
ptr_t source;
# else
- void GC_push_one_checked(p, interior_ptrs)
+ void GC_mark_and_push_stack(p)
# define source 0
# endif
register word p;
-register GC_bool interior_ptrs;
{
register word r;
register hdr * hhdr;
@@ -697,31 +1231,25 @@ register GC_bool interior_ptrs;
GET_HDR(p, hhdr);
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
- if (hhdr != 0 && interior_ptrs) {
+ if (hhdr != 0) {
r = BASE(p);
hhdr = HDR(r);
displ = BYTES_TO_WORDS(HBLKDISPL(r));
- } else {
- hhdr = 0;
}
} else {
register map_entry_type map_entry;
displ = HBLKDISPL(p);
map_entry = MAP_ENTRY((hhdr -> hb_map), displ);
- if (map_entry == OBJ_INVALID) {
-# ifndef ALL_INTERIOR_POINTERS
- if (interior_ptrs) {
+ if (map_entry >= MAX_OFFSET) {
+ if (map_entry == OFFSET_TOO_BIG || !GC_all_interior_pointers) {
r = BASE(p);
displ = BYTES_TO_WORDS(HBLKDISPL(r));
if (r == 0) hhdr = 0;
- } else {
+ } else {
+ /* Offset invalid, but map reflects interior pointers */
hhdr = 0;
- }
-# else
- /* map already reflects interior pointers */
- hhdr = 0;
-# endif
+ }
} else {
displ = BYTES_TO_WORDS(displ);
displ -= map_entry;
@@ -731,22 +1259,18 @@ register GC_bool interior_ptrs;
/* If hhdr != 0 then r == GC_base(p), only we did it faster. */
/* displ is the word index within the block. */
if (hhdr == 0) {
- if (interior_ptrs) {
-# ifdef PRINT_BLACK_LIST
- GC_add_to_black_list_stack(p, source);
-# else
- GC_add_to_black_list_stack(p);
-# endif
- } else {
- GC_ADD_TO_BLACK_LIST_NORMAL(p, source);
-# undef source /* In case we had to define it. */
- }
+# ifdef PRINT_BLACK_LIST
+ GC_add_to_black_list_stack(p, source);
+# else
+ GC_add_to_black_list_stack(p);
+# endif
+# undef source /* In case we had to define it. */
} else {
if (!mark_bit_from_hdr(hhdr, displ)) {
set_mark_bit_from_hdr(hhdr, displ);
GC_STORE_BACK_PTR(source, (ptr_t)r);
PUSH_OBJ((word *)r, hhdr, GC_mark_stack_top,
- &(GC_mark_stack[GC_mark_stack_size]));
+ GC_mark_stack_limit);
}
}
}
@@ -840,7 +1364,7 @@ ptr_t bottom;
ptr_t top;
ptr_t cold_gc_frame;
{
-# ifdef ALL_INTERIOR_POINTERS
+ if (GC_all_interior_pointers) {
# define EAGER_BYTES 1024
/* Push the hot end of the stack eagerly, so that register values */
/* saved inside GC frames are marked before they disappear. */
@@ -856,9 +1380,9 @@ ptr_t cold_gc_frame;
GC_push_all_eager(cold_gc_frame, top);
GC_push_all(bottom, cold_gc_frame + sizeof(ptr_t));
# endif /* STACK_GROWS_UP */
-# else
+ } else {
GC_push_all_eager(bottom, top);
-# endif
+ }
# ifdef TRACE_BUF
GC_add_trace_entry("GC_push_all_stack", bottom, top);
# endif
@@ -869,21 +1393,21 @@ void GC_push_all_stack(bottom, top)
ptr_t bottom;
ptr_t top;
{
-# ifdef ALL_INTERIOR_POINTERS
+ if (GC_all_interior_pointers) {
GC_push_all(bottom, top);
-# else
+ } else {
GC_push_all_eager(bottom, top);
-# endif
+ }
}
-#ifndef SMALL_CONFIG
+#if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
/* Push all objects reachable from marked objects in the given block */
/* of size 1 objects. */
void GC_push_marked1(h, hhdr)
struct hblk *h;
register hdr * hhdr;
{
- word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p;
word *plim;
register int i;
@@ -891,6 +1415,10 @@ register hdr * hhdr;
register word mark_word;
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
register ptr_t least_ha = GC_least_plausible_heap_addr;
+ register mse * mark_stack_top = GC_mark_stack_top;
+ register mse * mark_stack_limit = GC_mark_stack_limit;
+# define GC_mark_stack_top mark_stack_top
+# define GC_mark_stack_limit mark_stack_limit
# define GC_greatest_plausible_heap_addr greatest_ha
# define GC_least_plausible_heap_addr least_ha
@@ -913,6 +1441,9 @@ register hdr * hhdr;
}
# undef GC_greatest_plausible_heap_addr
# undef GC_least_plausible_heap_addr
+# undef GC_mark_stack_top
+# undef GC_mark_stack_limit
+ GC_mark_stack_top = mark_stack_top;
}
@@ -924,7 +1455,7 @@ void GC_push_marked2(h, hhdr)
struct hblk *h;
register hdr * hhdr;
{
- word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p;
word *plim;
register int i;
@@ -932,6 +1463,10 @@ register hdr * hhdr;
register word mark_word;
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
register ptr_t least_ha = GC_least_plausible_heap_addr;
+ register mse * mark_stack_top = GC_mark_stack_top;
+ register mse * mark_stack_limit = GC_mark_stack_limit;
+# define GC_mark_stack_top mark_stack_top
+# define GC_mark_stack_limit mark_stack_limit
# define GC_greatest_plausible_heap_addr greatest_ha
# define GC_least_plausible_heap_addr least_ha
@@ -956,6 +1491,9 @@ register hdr * hhdr;
}
# undef GC_greatest_plausible_heap_addr
# undef GC_least_plausible_heap_addr
+# undef GC_mark_stack_top
+# undef GC_mark_stack_limit
+ GC_mark_stack_top = mark_stack_top;
}
/* Push all objects reachable from marked objects in the given block */
@@ -966,7 +1504,7 @@ void GC_push_marked4(h, hhdr)
struct hblk *h;
register hdr * hhdr;
{
- word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p;
word *plim;
register int i;
@@ -974,6 +1512,10 @@ register hdr * hhdr;
register word mark_word;
register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
register ptr_t least_ha = GC_least_plausible_heap_addr;
+ register mse * mark_stack_top = GC_mark_stack_top;
+ register mse * mark_stack_limit = GC_mark_stack_limit;
+# define GC_mark_stack_top mark_stack_top
+# define GC_mark_stack_limit mark_stack_limit
# define GC_greatest_plausible_heap_addr greatest_ha
# define GC_least_plausible_heap_addr least_ha
@@ -1002,6 +1544,9 @@ register hdr * hhdr;
}
# undef GC_greatest_plausible_heap_addr
# undef GC_least_plausible_heap_addr
+# undef GC_mark_stack_top
+# undef GC_mark_stack_limit
+ GC_mark_stack_top = mark_stack_top;
}
#endif /* UNALIGNED */
@@ -1014,37 +1559,32 @@ struct hblk *h;
register hdr * hhdr;
{
register int sz = hhdr -> hb_sz;
+ register int descr = hhdr -> hb_descr;
register word * p;
register int word_no;
register word * lim;
register mse * GC_mark_stack_top_reg;
- register mse * mark_stack_limit = &(GC_mark_stack[GC_mark_stack_size]);
+ register mse * mark_stack_limit = GC_mark_stack_limit;
/* Some quick shortcuts: */
- {
- struct obj_kind *ok = &(GC_obj_kinds[hhdr -> hb_obj_kind]);
- if ((0 | DS_LENGTH) == ok -> ok_descriptor
- && FALSE == ok -> ok_relocate_descr)
- return;
- }
+ if ((0 | GC_DS_LENGTH) == descr) return;
if (GC_block_empty(hhdr)/* nothing marked */) return;
-# ifdef GATHERSTATS
- GC_n_rescuing_pages++;
-# endif
+ GC_n_rescuing_pages++;
GC_objects_are_marked = TRUE;
if (sz > MAXOBJSZ) {
- lim = (word *)(h + 1);
+ lim = (word *)h;
} else {
lim = (word *)(h + 1) - sz;
}
switch(sz) {
-# if !defined(SMALL_CONFIG)
+# if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
case 1:
GC_push_marked1(h, hhdr);
break;
# endif
-# if !defined(SMALL_CONFIG) && !defined(UNALIGNED)
+# if !defined(SMALL_CONFIG) && !defined(UNALIGNED) && \
+ !defined(USE_MARK_BYTES)
case 2:
GC_push_marked2(h, hhdr);
break;
@@ -1054,12 +1594,7 @@ register hdr * hhdr;
# endif
default:
GC_mark_stack_top_reg = GC_mark_stack_top;
- for (p = (word *)h + HDR_WORDS, word_no = HDR_WORDS; p <= lim;
- p += sz, word_no += sz) {
- /* This ignores user specified mark procs. This currently */
- /* doesn't matter, since marking from the whole object */
- /* is always sufficient, and we will eventually use the user */
- /* mark proc to avoid any bogus pointers. */
+ for (p = (word *)h, word_no = 0; p <= lim; p += sz, word_no += sz) {
if (mark_bit_from_hdr(hhdr, word_no)) {
/* Mark from fields inside the object */
PUSH_OBJ((word *)p, hhdr, GC_mark_stack_top_reg, mark_stack_limit);
@@ -1086,7 +1621,6 @@ register hdr * hhdr;
return(GC_page_was_dirty(h));
} else {
register ptr_t p = (ptr_t)h;
- sz += HDR_WORDS;
sz = WORDS_TO_BYTES(sz);
while (p < (ptr_t)h + sz) {
if (GC_page_was_dirty((struct hblk *)p)) return(TRUE);
@@ -1115,7 +1649,7 @@ struct hblk *h;
struct hblk * GC_push_next_marked_dirty(h)
struct hblk *h;
{
- register hdr * hhdr = HDR(h);
+ register hdr * hhdr;
if (!GC_dirty_maintained) { ABORT("dirty bits not set up"); }
for (;;) {
diff --git a/gc/mark_rts.c b/gc/mark_rts.c
@@ -11,9 +11,8 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, October 9, 1995 1:06 pm PDT */
# include <stdio.h>
-# include "gc_priv.h"
+# include "private/gc_priv.h"
/* Data structure for list of root sets. */
/* We keep a hash table, so that we can filter out duplicate additions. */
@@ -23,7 +22,7 @@
struct roots {
ptr_t r_start;
ptr_t r_end;
- # ifndef MSWIN32
+ # if !defined(MSWIN32) && !defined(MSWINCE)
struct roots * r_next;
# endif
GC_bool r_tmp;
@@ -33,6 +32,8 @@ struct roots {
struct roots GC_static_roots[MAX_ROOT_SETS];
*/
+int GC_no_dls = 0; /* Register dynamic library data segments. */
+
static int n_root_sets = 0;
/* GC_static_roots[0..n_root_sets) contains the valid root sets. */
@@ -69,11 +70,12 @@ void GC_print_static_roots()
GC_bool GC_is_static_root(p)
ptr_t p;
{
- static int last_root_set = 0;
+ static int last_root_set = MAX_ROOT_SETS;
register int i;
- if (p >= GC_static_roots[last_root_set].r_start
+ if (last_root_set < n_root_sets
+ && p >= GC_static_roots[last_root_set].r_start
&& p < GC_static_roots[last_root_set].r_end) return(TRUE);
for (i = 0; i < n_root_sets; i++) {
if (p >= GC_static_roots[i].r_start
@@ -85,7 +87,7 @@ ptr_t p;
return(FALSE);
}
-#ifndef MSWIN32
+#if !defined(MSWIN32) && !defined(MSWINCE)
/*
# define LOG_RT_SIZE 6
# define RT_SIZE (1 << LOG_RT_SIZE) -- Power of 2, may be != MAX_ROOT_SETS
@@ -137,7 +139,7 @@ struct roots *p;
GC_root_index[h] = p;
}
-# else /* MSWIN32 */
+# else /* MSWIN32 || MSWINCE */
# define add_roots_to_index(p)
@@ -173,7 +175,7 @@ GC_bool tmp;
{
struct roots * old;
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
/* Spend the time to ensure that there are no overlapping */
/* or adjacent intervals. */
/* This could be done faster with e.g. a */
@@ -242,7 +244,7 @@ GC_bool tmp;
GC_static_roots[n_root_sets].r_start = (ptr_t)b;
GC_static_roots[n_root_sets].r_end = (ptr_t)e;
GC_static_roots[n_root_sets].r_tmp = tmp;
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
GC_static_roots[n_root_sets].r_next = 0;
# endif
add_roots_to_index(GC_static_roots + n_root_sets);
@@ -250,15 +252,18 @@ GC_bool tmp;
n_root_sets++;
}
+static roots_were_cleared = FALSE;
+
void GC_clear_roots GC_PROTO((void))
{
DCL_LOCK_STATE;
DISABLE_SIGNALS();
LOCK();
+ roots_were_cleared = TRUE;
n_root_sets = 0;
GC_root_size = 0;
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
{
register int i;
@@ -286,7 +291,7 @@ void GC_remove_tmp_roots()
i++;
}
}
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
{
register int i;
@@ -298,11 +303,41 @@ void GC_remove_tmp_roots()
}
+#if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION)
+/* Workaround for the OS mapping and unmapping behind our back: */
+/* Is the address p in one of the temporary static root sections? */
+GC_bool GC_is_tmp_root(p)
+ptr_t p;
+{
+ static int last_root_set = MAX_ROOT_SETS;
+ register int i;
+
+ if (last_root_set < n_root_sets
+ && p >= GC_static_roots[last_root_set].r_start
+ && p < GC_static_roots[last_root_set].r_end)
+ return GC_static_roots[last_root_set].r_tmp;
+ for (i = 0; i < n_root_sets; i++) {
+ if (p >= GC_static_roots[i].r_start
+ && p < GC_static_roots[i].r_end) {
+ last_root_set = i;
+ return GC_static_roots[i].r_tmp;
+ }
+ }
+ return(FALSE);
+}
+#endif /* MSWIN32 || _WIN32_WCE_EMULATION */
+
ptr_t GC_approx_sp()
{
word dummy;
-
+
+# ifdef _MSC_VER
+# pragma warning(disable:4172)
+# endif
return((ptr_t)(&dummy));
+# ifdef _MSC_VER
+# pragma warning(default:4172)
+# endif
}
/*
@@ -412,6 +447,8 @@ ptr_t cold_gc_frame;
if (0 == cold_gc_frame) return;
# ifdef STACK_GROWS_DOWN
GC_push_all_eager(GC_approx_sp(), cold_gc_frame);
+ /* For IA64, the register stack backing store is handled */
+ /* in the thread-specific code. */
# else
GC_push_all_eager( cold_gc_frame, GC_approx_sp() );
# endif
@@ -419,6 +456,32 @@ ptr_t cold_gc_frame;
# ifdef STACK_GROWS_DOWN
GC_push_all_stack_partially_eager( GC_approx_sp(), GC_stackbottom,
cold_gc_frame );
+# ifdef IA64
+ /* We also need to push the register stack backing store. */
+ /* This should really be done in the same way as the */
+ /* regular stack. For now we fudge it a bit. */
+ /* Note that the backing store grows up, so we can't use */
+ /* GC_push_all_stack_partially_eager. */
+ {
+ extern word GC_save_regs_ret_val;
+ /* Previously set to backing store pointer. */
+ ptr_t bsp = (ptr_t) GC_save_regs_ret_val;
+ ptr_t cold_gc_bs_pointer;
+ if (GC_all_interior_pointers) {
+ cold_gc_bs_pointer = bsp - 2048;
+ if (cold_gc_bs_pointer < BACKING_STORE_BASE) {
+ cold_gc_bs_pointer = BACKING_STORE_BASE;
+ } else {
+ GC_push_all_stack(BACKING_STORE_BASE, cold_gc_bs_pointer);
+ }
+ } else {
+ cold_gc_bs_pointer = BACKING_STORE_BASE;
+ }
+ GC_push_all_eager(cold_gc_bs_pointer, bsp);
+ /* All values should be sufficiently aligned that we */
+ /* dont have to worry about the boundary. */
+ }
+# endif
# else
GC_push_all_stack_partially_eager( GC_stackbottom, GC_approx_sp(),
cold_gc_frame );
@@ -427,6 +490,23 @@ ptr_t cold_gc_frame;
}
/*
+ * Push GC internal roots. Only called if there is some reason to believe
+ * these would not otherwise get registered.
+ */
+void GC_push_gc_structures GC_PROTO((void))
+{
+ GC_push_finalizer_structures();
+ GC_push_stubborn_structures();
+# if defined(THREADS)
+ GC_push_thread_structures();
+# endif
+}
+
+#ifdef THREAD_LOCAL_ALLOC
+ void GC_mark_thread_local_free_lists();
+#endif
+
+/*
* Call the mark routines (GC_tl_push for a single pointer, GC_push_conditional
* on groups of pointers) on every top level accessible pointer.
* If all is FALSE, arrange to push only possibly altered values.
@@ -456,11 +536,14 @@ ptr_t cold_gc_frame;
* not robust against mark stack overflow.
*/
/* Reregister dynamic libraries, in case one got added. */
-# if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(PCR)) \
- && !defined(SRC_M3)
+# if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \
+ || defined(PCR)) && !defined(SRC_M3)
GC_remove_tmp_roots();
- GC_register_dynamic_libraries();
+ if (!GC_no_dls) GC_register_dynamic_libraries();
+# else
+ GC_no_dls = TRUE;
# endif
+
/* Mark everything in static data areas */
for (i = 0; i < n_root_sets; i++) {
GC_push_conditional_with_exclusions(
@@ -468,6 +551,18 @@ ptr_t cold_gc_frame;
GC_static_roots[i].r_end, all);
}
+ /* Mark from GC internal roots if those might otherwise have */
+ /* been excluded. */
+ if (GC_no_dls || roots_were_cleared) {
+ GC_push_gc_structures();
+ }
+
+ /* Mark thread local free lists, even if their mark */
+ /* descriptor excludes the link field. */
+# ifdef THREAD_LOCAL_ALLOC
+ GC_mark_thread_local_free_lists();
+# endif
+
/*
* Now traverse stacks.
*/
@@ -477,6 +572,9 @@ ptr_t cold_gc_frame;
/* In the USE_GENERIC_PUSH_REGS case, this is done inside */
/* GC_push_regs, so that we catch callee-save registers saved */
/* inside the GC_push_regs frame. */
+ /* In the case of linux threads on Ia64, the hot section of */
+ /* the main stack is marked here, but the register stack */
+ /* backing store is handled in the threads-specific code. */
# endif
if (GC_push_other_roots != 0) (*GC_push_other_roots)();
/* In the threads case, this also pushes thread stacks. */
diff --git a/gc/mips_sgi_mach_dep.s b/gc/mips_sgi_mach_dep.s
@@ -3,6 +3,7 @@
# define call_push(x) move $4,x; jal GC_push_one
+ .option pic2
.text
/* Mark from machine registers that are saved by C compiler */
# define FRAMESZ 32
diff --git a/gc/misc.c b/gc/misc.c
@@ -15,16 +15,21 @@
#include <stdio.h>
+#ifndef _WIN32_WCE
#include <signal.h>
+#endif
#define I_HIDE_POINTERS /* To make GC_call_with_alloc_lock visible */
-#include "gc_priv.h"
+#include "private/gc_pmark.h"
#ifdef SOLARIS_THREADS
# include <sys/syscall.h>
#endif
-#ifdef MSWIN32
+#if defined(MSWIN32) || defined(MSWINCE)
+# define WIN32_LEAN_AND_MEAN
+# define NOSERVICE
# include <windows.h>
+# include <tchar.h>
#endif
# ifdef THREADS
@@ -40,16 +45,25 @@
mutex_t GC_allocate_ml; /* Implicitly initialized. */
# else
# ifdef WIN32_THREADS
- GC_API CRITICAL_SECTION GC_allocate_ml;
+# if !defined(GC_NOT_DLL) && (defined(_DLL) || defined(GC_DLL))
+ __declspec(dllexport) CRITICAL_SECTION GC_allocate_ml;
+# else
+ CRITICAL_SECTION GC_allocate_ml;
+# endif
# else
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(IRIX_JDK_THREADS)
-# ifdef UNDEFINED
- pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
-# endif
+# if defined(IRIX_THREADS) \
+ || (defined(LINUX_THREADS) && defined(USE_SPIN_LOCK))
pthread_t GC_lock_holder = NO_THREAD;
# else
- --> declare allocator lock here
+# if defined(HPUX_THREADS) \
+ || defined(LINUX_THREADS) && !defined(USE_SPIN_LOCK)
+ pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
+ pthread_t GC_lock_holder = NO_THREAD;
+ /* Used only for assertions, and to prevent */
+ /* recursive reentry in the system call wrapper. */
+# else
+ --> declare allocator lock here
+# endif
# endif
# endif
# endif
@@ -57,28 +71,46 @@
# endif
# endif
+#ifdef ECOS
+#undef STACKBASE
+#endif
+
GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */;
GC_bool GC_debugging_started = FALSE;
/* defined here so we don't have to load debug_malloc.o */
-void (*GC_check_heap)() = (void (*)())0;
+void (*GC_check_heap) GC_PROTO((void)) = (void (*) GC_PROTO((void)))0;
-void (*GC_start_call_back)() = (void (*)())0;
+void (*GC_start_call_back) GC_PROTO((void)) = (void (*) GC_PROTO((void)))0;
ptr_t GC_stackbottom = 0;
+#ifdef IA64
+ ptr_t GC_register_stackbottom = 0;
+#endif
+
GC_bool GC_dont_gc = 0;
+GC_bool GC_dont_precollect = 0;
+
GC_bool GC_quiet = 0;
+GC_bool GC_print_stats = 0;
+
#ifdef FIND_LEAK
int GC_find_leak = 1;
#else
int GC_find_leak = 0;
#endif
+#ifdef ALL_INTERIOR_POINTERS
+ int GC_all_interior_pointers = 1;
+#else
+ int GC_all_interior_pointers = 0;
+#endif
+
/*ARGSUSED*/
GC_PTR GC_default_oom_fn GC_PROTO((size_t bytes_requested))
{
@@ -101,23 +133,33 @@ extern signed_word GC_mem_found;
{
register unsigned i;
- /* Map size 0 to 1. This avoids problems at lower levels. */
- GC_size_map[0] = 1;
- /* One word objects don't have to be 2 word aligned. */
- for (i = 1; i < sizeof(word); i++) {
- GC_size_map[i] = 1;
+ /* Map size 0 to something bigger. */
+ /* This avoids problems at lower levels. */
+ /* One word objects don't have to be 2 word aligned, */
+ /* unless we're using mark bytes. */
+ for (i = 0; i < sizeof(word); i++) {
+ GC_size_map[i] = MIN_WORDS;
}
- GC_size_map[sizeof(word)] = ROUNDED_UP_WORDS(sizeof(word));
+# if MIN_WORDS > 1
+ GC_size_map[sizeof(word)] = MIN_WORDS;
+# else
+ GC_size_map[sizeof(word)] = ROUNDED_UP_WORDS(sizeof(word));
+# endif
for (i = sizeof(word) + 1; i <= 8 * sizeof(word); i++) {
-# ifdef ALIGN_DOUBLE
- GC_size_map[i] = (ROUNDED_UP_WORDS(i) + 1) & (~1);
-# else
- GC_size_map[i] = ROUNDED_UP_WORDS(i);
-# endif
+ GC_size_map[i] = ALIGNED_WORDS(i);
}
for (i = 8*sizeof(word) + 1; i <= 16 * sizeof(word); i++) {
GC_size_map[i] = (ROUNDED_UP_WORDS(i) + 1) & (~1);
}
+# ifdef GC_GCJ_SUPPORT
+ /* Make all sizes up to 32 words predictable, so that a */
+ /* compiler can statically perform the same computation, */
+ /* or at least a computation that results in similar size */
+ /* classes. */
+ for (i = 16*sizeof(word) + 1; i <= 32 * sizeof(word); i++) {
+ GC_size_map[i] = (ROUNDED_UP_WORDS(i) + 3) & (~3);
+ }
+# endif
/* We leave the rest of the array to be filled in on demand. */
}
@@ -167,10 +209,10 @@ extern signed_word GC_mem_found;
# endif
}
byte_sz = WORDS_TO_BYTES(word_sz);
-# ifdef ADD_BYTE_AT_END
+ if (GC_all_interior_pointers) {
/* We need one extra byte; don't fill in GC_size_map[byte_sz] */
byte_sz--;
-# endif
+ }
for (j = low_limit; j <= byte_sz; j++) GC_size_map[j] = word_sz;
}
@@ -187,39 +229,24 @@ extern signed_word GC_mem_found;
*/
word GC_stack_last_cleared = 0; /* GC_no when we last did this */
# ifdef THREADS
-# define CLEAR_SIZE 2048
-# else
-# define CLEAR_SIZE 213
+# define BIG_CLEAR_SIZE 2048 /* Clear this much now and then. */
+# define SMALL_CLEAR_SIZE 256 /* Clear this much every time. */
# endif
+# define CLEAR_SIZE 213 /* Granularity for GC_clear_stack_inner */
# define DEGRADE_RATE 50
word GC_min_sp; /* Coolest stack pointer value from which we've */
/* already cleared the stack. */
-# ifdef STACK_GROWS_DOWN
-# define COOLER_THAN >
-# define HOTTER_THAN <
-# define MAKE_COOLER(x,y) if ((word)(x)+(y) > (word)(x)) {(x) += (y);} \
- else {(x) = (word)ONES;}
-# define MAKE_HOTTER(x,y) (x) -= (y)
-# else
-# define COOLER_THAN <
-# define HOTTER_THAN >
-# define MAKE_COOLER(x,y) if ((word)(x)-(y) < (word)(x)) {(x) -= (y);} else {(x) = 0;}
-# define MAKE_HOTTER(x,y) (x) += (y)
-# endif
-
word GC_high_water;
/* "hottest" stack pointer value we have seen */
/* recently. Degrades over time. */
word GC_words_allocd_at_reset;
-#if defined(ASM_CLEAR_CODE) && !defined(THREADS)
+#if defined(ASM_CLEAR_CODE)
extern ptr_t GC_clear_stack_inner();
-#endif
-
-#if !defined(ASM_CLEAR_CODE) && !defined(THREADS)
+#else
/* Clear the stack up to about limit. Return arg. */
/*ARGSUSED*/
ptr_t GC_clear_stack_inner(arg, limit)
@@ -247,10 +274,13 @@ ptr_t arg;
{
register word sp = (word)GC_approx_sp(); /* Hotter than actual sp */
# ifdef THREADS
- word dummy[CLEAR_SIZE];
-# else
- register word limit;
+ word dummy[SMALL_CLEAR_SIZE];
+ static unsigned random_no = 0;
+ /* Should be more random than it is ... */
+ /* Used to occasionally clear a bigger */
+ /* chunk. */
# endif
+ register word limit;
# define SLOP 400
/* Extra bytes we clear every time. This clears our own */
@@ -268,7 +298,16 @@ ptr_t arg;
/* thus more junk remains accessible, thus the heap gets */
/* larger ... */
# ifdef THREADS
- BZERO(dummy, CLEAR_SIZE*sizeof(word));
+ if (++random_no % 13 == 0) {
+ limit = sp;
+ MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word));
+ limit &= ~0xf; /* Make it sufficiently aligned for assembly */
+ /* implementations of GC_clear_stack_inner. */
+ return GC_clear_stack_inner(arg, limit);
+ } else {
+ BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word));
+ return arg;
+ }
# else
if (GC_gc_no > GC_stack_last_cleared) {
/* Start things over, so we clear the entire stack again */
@@ -298,8 +337,8 @@ ptr_t arg;
if (GC_min_sp HOTTER_THAN GC_high_water) GC_min_sp = GC_high_water;
GC_words_allocd_at_reset = GC_words_allocd;
}
+ return(arg);
# endif
- return(arg);
}
@@ -328,37 +367,27 @@ ptr_t arg;
/* to the beginning. */
while (IS_FORWARDING_ADDR_OR_NIL(candidate_hdr)) {
h = FORWARDED_ADDR(h,candidate_hdr);
- r = (word)h + HDR_BYTES;
+ r = (word)h;
candidate_hdr = HDR(h);
}
if (candidate_hdr -> hb_map == GC_invalid_map) return(0);
/* Make sure r points to the beginning of the object */
r &= ~(WORDS_TO_BYTES(1) - 1);
{
- register int offset = (char *)r - (char *)(HBLKPTR(r));
+ register int offset = HBLKDISPL(r);
register signed_word sz = candidate_hdr -> hb_sz;
-
-# ifdef ALL_INTERIOR_POINTERS
- register map_entry_type map_entry;
+ register signed_word map_entry;
- map_entry = MAP_ENTRY((candidate_hdr -> hb_map), offset);
- if (map_entry == OBJ_INVALID) {
- return(0);
- }
- r -= WORDS_TO_BYTES(map_entry);
- limit = r + WORDS_TO_BYTES(sz);
-# else
- register int correction;
-
- offset = BYTES_TO_WORDS(offset - HDR_BYTES);
- correction = offset % sz;
- r -= (WORDS_TO_BYTES(correction));
- limit = r + WORDS_TO_BYTES(sz);
- if (limit > (word)(h + 1)
- && sz <= BYTES_TO_WORDS(HBLKSIZE) - HDR_WORDS) {
+ map_entry = MAP_ENTRY((candidate_hdr -> hb_map), offset);
+ if (map_entry > CPP_MAX_OFFSET) {
+ map_entry = (signed_word)(BYTES_TO_WORDS(offset)) % sz;
+ }
+ r -= WORDS_TO_BYTES(map_entry);
+ limit = r + WORDS_TO_BYTES(sz);
+ if (limit > (word)(h + 1)
+ && sz <= BYTES_TO_WORDS(HBLKSIZE)) {
return(0);
- }
-# endif
+ }
if ((word)p >= limit) return(0);
}
return((GC_PTR)r);
@@ -379,11 +408,7 @@ ptr_t arg;
register hdr * hhdr = HDR(p);
sz = WORDS_TO_BYTES(hhdr -> hb_sz);
- if (sz < 0) {
- return(-sz);
- } else {
- return(sz);
- }
+ return(sz);
}
size_t GC_get_heap_size GC_PROTO(())
@@ -391,11 +416,21 @@ size_t GC_get_heap_size GC_PROTO(())
return ((size_t) GC_heapsize);
}
+size_t GC_get_free_bytes GC_PROTO(())
+{
+ return ((size_t) GC_large_free_bytes);
+}
+
size_t GC_get_bytes_since_gc GC_PROTO(())
{
return ((size_t) WORDS_TO_BYTES(GC_words_allocd));
}
+size_t GC_get_total_bytes GC_PROTO(())
+{
+ return ((size_t) WORDS_TO_BYTES(GC_words_allocd+GC_words_allocd_before_gc));
+}
+
GC_bool GC_is_initialized = FALSE;
void GC_init()
@@ -408,59 +443,111 @@ void GC_init()
UNLOCK();
ENABLE_SIGNALS();
+# if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+ /* Make sure marker threads and started and thread local */
+ /* allocation is initialized, in case we didn't get */
+ /* called from GC_init_parallel(); */
+ {
+ extern void GC_init_parallel(void);
+ GC_init_parallel();
+ }
+# endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
}
+#if defined(MSWIN32) || defined(MSWINCE)
+ CRITICAL_SECTION GC_write_cs;
+#endif
+
#ifdef MSWIN32
- extern void GC_init_win32();
+ extern void GC_init_win32 GC_PROTO((void));
#endif
extern void GC_setpagesize();
+#ifdef UNIX_LIKE
+
+extern void GC_set_and_save_fault_handler GC_PROTO((void (*handler)(int)));
+
+static void looping_handler(sig)
+int sig;
+{
+ GC_err_printf1("Caught signal %d: looping in handler\n", sig);
+ for(;;);
+}
+#endif
+
void GC_init_inner()
{
-# ifndef THREADS
+# if !defined(THREADS) && defined(GC_ASSERTIONS)
word dummy;
# endif
+ word initial_heap_sz = (word)MINHINCR;
if (GC_is_initialized) return;
- GC_setpagesize();
- GC_exclude_static_roots(beginGC_arrays, end_gc_area);
# ifdef PRINTSTATS
- if ((ptr_t)endGC_arrays != (ptr_t)(&GC_obj_kinds)) {
- GC_printf0("Reordering linker, didn't exclude obj_kinds\n");
- }
+ GC_print_stats = 1;
+# endif
+ if (0 != GETENV("GC_PRINT_STATS")) {
+ GC_print_stats = 1;
+ }
+ if (0 != GETENV("GC_FIND_LEAK")) {
+ GC_find_leak = 1;
+ }
+ if (0 != GETENV("GC_ALL_INTERIOR_POINTERS")) {
+ GC_all_interior_pointers = 1;
+ }
+ if (0 != GETENV("GC_DONT_GC")) {
+ GC_dont_gc = 1;
+ }
+# ifdef UNIX_LIKE
+ if (0 != GETENV("GC_LOOP_ON_ABORT")) {
+ GC_set_and_save_fault_handler(looping_handler);
+ }
+# endif
+ /* Adjust normal object descriptor for extra allocation. */
+ if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) {
+ GC_obj_kinds[NORMAL].ok_descriptor = ((word)(-ALIGNMENT) | GC_DS_LENGTH);
+ }
+# if defined(MSWIN32) || defined(MSWINCE)
+ InitializeCriticalSection(&GC_write_cs);
+# endif
+ GC_setpagesize();
+ GC_exclude_static_roots(beginGC_arrays, endGC_arrays);
+ GC_exclude_static_roots(beginGC_obj_kinds, endGC_obj_kinds);
+# ifdef SEPARATE_GLOBALS
+ GC_exclude_static_roots(beginGC_objfreelist, endGC_objfreelist);
+ GC_exclude_static_roots(beginGC_aobjfreelist, endGC_aobjfreelist);
# endif
# ifdef MSWIN32
GC_init_win32();
# endif
-# if defined(LINUX) && (defined(POWERPC) || defined(ALPHA) || \
- defined(SPARC) || defined(MIPS))
+# if defined(SEARCH_FOR_DATA_START)
GC_init_linux_data_start();
# endif
-# ifdef SOLARIS_THREADS
- GC_thr_init();
- /* We need dirty bits in order to find live stack sections. */
- GC_dirty_init();
+# if defined(NETBSD) && defined(__ELF__)
+ GC_init_netbsd_elf();
# endif
# if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(IRIX_JDK_THREADS)
+ || defined(HPUX_THREADS) || defined(SOLARIS_THREADS)
GC_thr_init();
# endif
+# ifdef SOLARIS_THREADS
+ /* We need dirty bits in order to find live stack sections. */
+ GC_dirty_init();
+# endif
# if !defined(THREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) \
- || defined(IRIX_THREADS) || defined(LINUX_THREADS)
+ || defined(IRIX_THREADS) || defined(LINUX_THREADS) \
+ || defined(HPUX_THREADS)
if (GC_stackbottom == 0) {
GC_stackbottom = GC_get_stack_base();
+# if defined(LINUX) && defined(IA64)
+ GC_register_stackbottom = GC_get_register_stack_base();
+# endif
}
# endif
- if (sizeof (ptr_t) != sizeof(word)) {
- ABORT("sizeof (ptr_t) != sizeof(word)\n");
- }
- if (sizeof (signed_word) != sizeof(word)) {
- ABORT("sizeof (signed_word) != sizeof(word)\n");
- }
- if (sizeof (struct hblk) != HBLKSIZE) {
- ABORT("sizeof (struct hblk) != HBLKSIZE\n");
- }
+ GC_ASSERT(sizeof (ptr_t) == sizeof(word));
+ GC_ASSERT(sizeof (signed_word) == sizeof(word));
+ GC_ASSERT(sizeof (struct hblk) == HBLKSIZE);
# ifndef THREADS
# if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)
ABORT(
@@ -471,40 +558,16 @@ void GC_init_inner()
"One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd\n");
# endif
# ifdef STACK_GROWS_DOWN
- if ((word)(&dummy) > (word)GC_stackbottom) {
- GC_err_printf0(
- "STACK_GROWS_DOWN is defd, but stack appears to grow up\n");
-# ifndef UTS4 /* Compiler bug workaround */
- GC_err_printf2("sp = 0x%lx, GC_stackbottom = 0x%lx\n",
- (unsigned long) (&dummy),
- (unsigned long) GC_stackbottom);
-# endif
- ABORT("stack direction 3\n");
- }
+ GC_ASSERT((word)(&dummy) <= (word)GC_stackbottom);
# else
- if ((word)(&dummy) < (word)GC_stackbottom) {
- GC_err_printf0(
- "STACK_GROWS_UP is defd, but stack appears to grow down\n");
- GC_err_printf2("sp = 0x%lx, GC_stackbottom = 0x%lx\n",
- (unsigned long) (&dummy),
- (unsigned long) GC_stackbottom);
- ABORT("stack direction 4");
- }
+ GC_ASSERT((word)(&dummy) >= (word)GC_stackbottom);
# endif
# endif
# if !defined(_AUX_SOURCE) || defined(__GNUC__)
- if ((word)(-1) < (word)0) {
- GC_err_printf0("The type word should be an unsigned integer type\n");
- GC_err_printf0("It appears to be signed\n");
- ABORT("word");
- }
+ GC_ASSERT((word)(-1) > (word)0);
+ /* word should be unsigned */
# endif
- if ((signed_word)(-1) >= (signed_word)0) {
- GC_err_printf0(
- "The type signed_word should be a signed integer type\n");
- GC_err_printf0("It appears to be unsigned\n");
- ABORT("signed_word");
- }
+ GC_ASSERT((signed_word)(-1) < (signed_word)0);
/* Add initial guess of root sets. Do this first, since sbrk(0) */
/* might be used. */
@@ -512,7 +575,18 @@ void GC_init_inner()
GC_init_headers();
GC_bl_init();
GC_mark_init();
- if (!GC_expand_hp_inner((word)MINHINCR)) {
+ {
+ char * sz_str = GETENV("GC_INITIAL_HEAP_SIZE");
+ if (sz_str != NULL) {
+ initial_heap_sz = atoi(sz_str);
+ if (initial_heap_sz <= MINHINCR * HBLKSIZE) {
+ WARN("Bad initial heap size %s - ignoring it.\n",
+ sz_str);
+ }
+ initial_heap_sz = divHBLKSZ(initial_heap_sz);
+ }
+ }
+ if (!GC_expand_hp_inner(initial_heap_sz)) {
GC_err_printf0("Can't start up: not enough memory\n");
EXIT();
}
@@ -537,11 +611,11 @@ void GC_init_inner()
GC_pcr_install();
# endif
/* Get black list set up */
- GC_gcollect_inner();
+ if (!GC_dont_precollect) GC_gcollect_inner();
+ GC_is_initialized = TRUE;
# ifdef STUBBORN_ALLOC
GC_stubborn_init();
# endif
- GC_is_initialized = TRUE;
/* Convince lint that some things are used */
# ifdef LINT
{
@@ -606,25 +680,41 @@ out:
}
-#ifdef MSWIN32
-# define LOG_FILE "gc.log"
+#if defined(MSWIN32) || defined(MSWINCE)
+# define LOG_FILE _T("gc.log")
- HANDLE GC_stdout = 0, GC_stderr;
- int GC_tmp;
- DWORD GC_junk;
+ HANDLE GC_stdout = 0;
- void GC_set_files()
+ void GC_deinit()
{
- if (!GC_stdout) {
- GC_stdout = CreateFile(LOG_FILE, GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH,
- NULL);
- if (INVALID_HANDLE_VALUE == GC_stdout) ABORT("Open of log file failed");
- }
- if (GC_stderr == 0) {
- GC_stderr = GC_stdout;
- }
+ if (GC_is_initialized) {
+ DeleteCriticalSection(&GC_write_cs);
+ }
+ }
+
+ int GC_write(buf, len)
+ GC_CONST char * buf;
+ size_t len;
+ {
+ BOOL tmp;
+ DWORD written;
+ if (len == 0)
+ return 0;
+ EnterCriticalSection(&GC_write_cs);
+ if (GC_stdout == INVALID_HANDLE_VALUE) {
+ return -1;
+ } else if (GC_stdout == 0) {
+ GC_stdout = CreateFile(LOG_FILE, GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH,
+ NULL);
+ if (GC_stdout == INVALID_HANDLE_VALUE) ABORT("Open of log file failed");
+ }
+ tmp = WriteFile(GC_stdout, buf, len, &written, NULL);
+ if (!tmp)
+ DebugBreak();
+ LeaveCriticalSection(&GC_write_cs);
+ return tmp ? (int)written : -1;
}
#endif
@@ -645,7 +735,7 @@ int GC_tmp; /* Should really be local ... */
}
#endif
-#if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32)
+#if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32) && !defined(MSWINCE)
int GC_stdout = 1;
int GC_stderr = 2;
# if !defined(AMIGA)
@@ -653,10 +743,10 @@ int GC_tmp; /* Should really be local ... */
# endif
#endif
-#if !defined(MSWIN32) && !defined(OS2) && !defined(MACOS)
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(OS2) && !defined(MACOS)
int GC_write(fd, buf, len)
int fd;
-char *buf;
+GC_CONST char *buf;
size_t len;
{
register int bytes_written = 0;
@@ -676,11 +766,17 @@ size_t len;
}
#endif /* UN*X */
-#ifdef MSWIN32
-# define WRITE(f, buf, len) (GC_set_files(), \
- GC_tmp = WriteFile((f), (buf), \
- (len), &GC_junk, NULL),\
- (GC_tmp? 1 : -1))
+#if defined(ECOS)
+int GC_write(fd, buf, len)
+{
+ _Jv_diag_write (buf, len);
+ return len;
+}
+#endif
+
+
+#if defined(MSWIN32) || defined(MSWINCE)
+# define WRITE(f, buf, len) GC_write(buf, len)
#else
# if defined(OS2) || defined(MACOS)
# define WRITE(f, buf, len) (GC_set_files(), \
@@ -698,7 +794,7 @@ size_t len;
/* same size as long, and that the format conversions expect something */
/* of that size. */
void GC_printf(format, a, b, c, d, e, f)
-char * format;
+GC_CONST char * format;
long a, b, c, d, e, f;
{
char buf[1025];
@@ -711,7 +807,7 @@ long a, b, c, d, e, f;
}
void GC_err_printf(format, a, b, c, d, e, f)
-char * format;
+GC_CONST char * format;
long a, b, c, d, e, f;
{
char buf[1025];
@@ -723,11 +819,20 @@ long a, b, c, d, e, f;
}
void GC_err_puts(s)
-char *s;
+GC_CONST char *s;
{
if (WRITE(GC_stderr, s, strlen(s)) < 0) ABORT("write to stderr failed");
}
+#if defined(LINUX) && !defined(SMALL_CONFIG)
+void GC_err_write(buf, len)
+GC_CONST char *buf;
+size_t len;
+{
+ if (WRITE(GC_stderr, buf, len) < 0) ABORT("write to stderr failed");
+}
+#endif
+
# if defined(__STDC__) || defined(__cplusplus)
void GC_default_warn_proc(char *msg, GC_word arg)
# else
@@ -760,10 +865,26 @@ GC_warn_proc GC_current_warn_proc = GC_default_warn_proc;
#ifndef PCR
void GC_abort(msg)
-char * msg;
+GC_CONST char * msg;
{
- GC_err_printf1("%s\n", msg);
- (void) abort();
+# if defined(MSWIN32)
+ (void) MessageBoxA(NULL, msg, "Fatal error in gc", MB_ICONERROR|MB_OK);
+ DebugBreak();
+# else
+ GC_err_printf1("%s\n", msg);
+# endif
+ if (GETENV("GC_LOOP_ON_ABORT") != NULL) {
+ /* In many cases it's easier to debug a running process. */
+ /* It's arguably nicer to sleep, but that makes it harder */
+ /* to look at the thread if the debugger doesn't know much */
+ /* about threads. */
+ for(;;) {}
+ }
+# ifdef MSWIN32
+ DebugBreak();
+# else
+ (void) abort();
+# endif
}
#endif
@@ -800,7 +921,8 @@ struct callinfo info[NFRAMES];
#endif /* SAVE_CALL_CHAIN */
-# ifdef SRC_M3
+/* Needed by SRC_M3, gcj, and should perhaps be the official interface */
+/* to GC_dont_gc. */
void GC_enable()
{
GC_dont_gc--;
@@ -810,7 +932,6 @@ void GC_disable()
{
GC_dont_gc++;
}
-# endif
#if !defined(NO_DEBUGGING)
@@ -826,4 +947,4 @@ void GC_dump()
GC_print_block_list();
}
-# endif /* NO_DEBUGGING */
+#endif /* NO_DEBUGGING */
diff --git a/gc/mkinstalldirs b/gc/mkinstalldirs
@@ -0,0 +1,36 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d in ${1+"$@"} ; do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+ mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
+ fi
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/gc/new_hblk.c b/gc/new_hblk.c
@@ -1,6 +1,7 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -19,7 +20,7 @@
# include <stdio.h>
-# include "gc_priv.h"
+# include "private/gc_priv.h"
#ifndef SMALL_CONFIG
/*
@@ -30,7 +31,7 @@ ptr_t GC_build_fl1(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1);
p[0] = (word)ofl;
@@ -52,7 +53,7 @@ ptr_t GC_build_fl_clear2(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1);
p[0] = (word)ofl;
@@ -74,7 +75,7 @@ ptr_t GC_build_fl_clear3(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1) - 2;
p[0] = (word)ofl;
@@ -94,7 +95,7 @@ ptr_t GC_build_fl_clear4(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1);
p[0] = (word)ofl;
@@ -103,10 +104,10 @@ ptr_t ofl;
p[3] = 0;
p += 4;
for (; p < lim; p += 4) {
+ PREFETCH_FOR_WRITE(p+64);
p[0] = (word)(p-4);
p[1] = 0;
- p[2] = 0;
- p[3] = 0;
+ CLEAR_DOUBLE(p+2);
};
return((ptr_t)(p-4));
}
@@ -116,7 +117,7 @@ ptr_t GC_build_fl2(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1);
p[0] = (word)ofl;
@@ -134,13 +135,14 @@ ptr_t GC_build_fl4(h, ofl)
struct hblk *h;
ptr_t ofl;
{
- register word * p = (word *)h;
+ register word * p = h -> hb_body;
register word * lim = (word *)(h + 1);
p[0] = (word)ofl;
p[4] = (word)p;
p += 8;
for (; p < lim; p += 8) {
+ PREFETCH_FOR_WRITE(p+64);
p[0] = (word)(p-4);
p[4] = (word)p;
};
@@ -149,67 +151,51 @@ ptr_t ofl;
#endif /* !SMALL_CONFIG */
-/*
- * Allocate a new heapblock for small objects of size n.
- * Add all of the heapblock's objects to the free list for objects
- * of that size.
- * Set all mark bits if objects are uncollectable.
- * Will fail to do anything if we are out of memory.
- */
-void GC_new_hblk(sz, kind)
-register word sz;
-int kind;
-{
- register word *p,
- *prev;
- word *last_object; /* points to last object in new hblk */
- register struct hblk *h; /* the new heap block */
- register GC_bool clear = GC_obj_kinds[kind].ok_init;
-# ifdef PRINTSTATS
- if ((sizeof (struct hblk)) > HBLKSIZE) {
- ABORT("HBLK SZ inconsistency");
- }
-# endif
-
- /* Allocate a new heap block */
- h = GC_allochblk(sz, kind, 0);
- if (h == 0) return;
-
- /* Mark all objects if appropriate. */
- if (IS_UNCOLLECTABLE(kind)) GC_set_hdr_marks(HDR(h));
+/* Build a free list for objects of size sz inside heap block h. */
+/* Clear objects inside h if clear is set. Add list to the end of */
+/* the free list we build. Return the new free list. */
+/* This could be called without the main GC lock, if we ensure that */
+/* there is no concurrent collection which might reclaim objects that */
+/* we have not yet allocated. */
+ptr_t GC_build_fl(h, sz, clear, list)
+struct hblk *h;
+word sz;
+GC_bool clear;
+ptr_t list;
+{
+ word *p, *prev;
+ word *last_object; /* points to last object in new hblk */
+ /* Do a few prefetches here, just because its cheap. */
+ /* If we were more serious about it, these should go inside */
+ /* the loops. But write prefetches usually don't seem to */
+ /* matter much. */
+ PREFETCH_FOR_WRITE((char *)h);
+ PREFETCH_FOR_WRITE((char *)h + 128);
+ PREFETCH_FOR_WRITE((char *)h + 256);
+ PREFETCH_FOR_WRITE((char *)h + 378);
/* Handle small objects sizes more efficiently. For larger objects */
/* the difference is less significant. */
# ifndef SMALL_CONFIG
switch (sz) {
- case 1: GC_obj_kinds[kind].ok_freelist[1] =
- GC_build_fl1(h, GC_obj_kinds[kind].ok_freelist[1]);
- return;
+ case 1: return GC_build_fl1(h, list);
case 2: if (clear) {
- GC_obj_kinds[kind].ok_freelist[2] =
- GC_build_fl_clear2(h, GC_obj_kinds[kind].ok_freelist[2]);
+ return GC_build_fl_clear2(h, list);
} else {
- GC_obj_kinds[kind].ok_freelist[2] =
- GC_build_fl2(h, GC_obj_kinds[kind].ok_freelist[2]);
+ return GC_build_fl2(h, list);
}
- return;
case 3: if (clear) {
- GC_obj_kinds[kind].ok_freelist[3] =
- GC_build_fl_clear3(h, GC_obj_kinds[kind].ok_freelist[3]);
- return;
+ return GC_build_fl_clear3(h, list);
} else {
/* It's messy to do better than the default here. */
break;
}
case 4: if (clear) {
- GC_obj_kinds[kind].ok_freelist[4] =
- GC_build_fl_clear4(h, GC_obj_kinds[kind].ok_freelist[4]);
+ return GC_build_fl_clear4(h, list);
} else {
- GC_obj_kinds[kind].ok_freelist[4] =
- GC_build_fl4(h, GC_obj_kinds[kind].ok_freelist[4]);
+ return GC_build_fl4(h, list);
}
- return;
default:
break;
}
@@ -238,7 +224,39 @@ int kind;
* put p (which is now head of list of objects in *h) as first
* pointer in the appropriate free list for this size.
*/
- obj_link(h -> hb_body) = GC_obj_kinds[kind].ok_freelist[sz];
- GC_obj_kinds[kind].ok_freelist[sz] = ((ptr_t)p);
+ obj_link(h -> hb_body) = list;
+ return ((ptr_t)p);
+}
+
+/*
+ * Allocate a new heapblock for small objects of size n.
+ * Add all of the heapblock's objects to the free list for objects
+ * of that size.
+ * Set all mark bits if objects are uncollectable.
+ * Will fail to do anything if we are out of memory.
+ */
+void GC_new_hblk(sz, kind)
+register word sz;
+int kind;
+{
+ register struct hblk *h; /* the new heap block */
+ register GC_bool clear = GC_obj_kinds[kind].ok_init;
+
+# ifdef PRINTSTATS
+ if ((sizeof (struct hblk)) > HBLKSIZE) {
+ ABORT("HBLK SZ inconsistency");
+ }
+# endif
+
+ /* Allocate a new heap block */
+ h = GC_allochblk(sz, kind, 0);
+ if (h == 0) return;
+
+ /* Mark all objects if appropriate. */
+ if (IS_UNCOLLECTABLE(kind)) GC_set_hdr_marks(HDR(h));
+
+ /* Build the free list */
+ GC_obj_kinds[kind].ok_freelist[sz] =
+ GC_build_fl(h, sz, clear, GC_obj_kinds[kind].ok_freelist[sz]);
}
diff --git a/gc/nursery.c b/gc/nursery.c
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 1999 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-
-??? This implementation is incomplete. If you are trying to
-??? compile this you are doing something wrong.
-
-#include "nursery.h"
-
-struct copy_obj {
- ptr_t forward; /* Forwarding link for copied objects. */
- GC_copy_descriptor descr; /* Object descriptor */
- word data[1];
-}
-
-ptr_t GC_nursery_start; /* Start of nursery area. */
- /* Must be NURSERY_BLOCK_SIZE */
- /* aligned. */
-ptr_t GC_nursery_end; /* End of nursery area. */
-unsigned char * GC_nursery_map;
- /* GC_nursery_map[i] != 0 if an object */
- /* starts on the ith 64-bit "word" of */
- /* nursery. This simple structure has */
- /* the advantage that */
- /* allocation is cheap. Lookup is */
- /* cheap for pointers to the head of */
- /* an object, which should be the */
- /* usual case. */
-# define NURSERY_MAP_NOT_START 0 /* Not start of object. */
-# define NURSERY_MAP_START 1 /* Start of object. */
-# define NURSERY_MAP_PINNED 2 /* Start of pinned obj. */
-
-# ifdef ALIGN_DOUBLE
-# define NURSERY_WORD_SIZE (2 * sizeof(word))
-# else
-# define NURSERY_WORD_SIZE sizeof(word)
-# endif
-
-# define NURSERY_BLOCK_SIZE (HBLKSIZE/2)
- /* HBLKSIZE must be a multiple of NURSERY_BLOCK_SIZE */
-# define NURSERY_SIZE (1024 * NURSERY_BLOCK_SIZE)
-
-size_t GC_nursery_size = NURSERY_SIZE;
- /* Must be multiple of NURSERY_BLOCK_SIZE */
-
-size_t GC_nursery_blocks; /* Number of blocks in the nursery. */
-
-unsigned GC_next_nursery_block; /* index of next block we will attempt */
- /* allocate from during this cycle. */
- /* If it is pinned, we won't actually */
- /* use it. */
-
-unsigned short *GC_pinned; /* Number of pinned objects in ith */
- /* nursery block. */
- /* GC_pinned[i] != 0 if the ith nursery */
- /* block is pinned, and thus not used */
- /* for allocation. */
-
-GC_copy_alloc_state global_alloc_state = (ptr_t)(-1); /* will overflow. */
-
-/* Should be called with allocator lock held. */
-GC_nursery_init() {
- GC_nursery_start = GET_MEM(GC_nursery_size);
- GC_nursery_end = GC_nursery_start + GC_nursery_size;
- GC_next_nursery_block = 0;
- if (GC_nursery_start < GC_least_plausible_heap_addr) {
- GC_least_plausible_heap_addr = GC_nursery_start;
- }
- if (GC_nursery_end > GC_greatest_plausible_heap_addr) {
- GC_greatest_plausible_heap_addr = GC_nursery_end;
- }
- if (GC_nursery_start & (NURSERY_BLOCK_SIZE-1)) {
- GC_err_printf1("Nursery area is misaligned!!");
- /* This should be impossible, since GET_MEM returns HBLKSIZE */
- /* aligned chunks, and that should be a multiple of */
- /* NURSERY_BLOCK_SIZE */
- ABORT("misaligned nursery");
- }
- GC_nursery_map = GET_MEM(GC_nursery_size/NURSERY_WORD_SIZE);
- /* Map is cleared a block at a time when we allocate from the block. */
- /* BZERO(GC_nursery_map, GC_nursery_size/NURSERY_WORD_SIZE); */
- GC_nursery_blocks = GC_nursery_size/NURSERY_BLOCK_SIZE;
- GC_pinned = GC_scratch_alloc(GC_nursery_blocks * sizeof(unsigned short));
- BZERO(GC_pinned, GC_nursery_blocks);
-}
-
-/* Pin all nursery objects referenced from mark stack. */
-void GC_pin_mark_stack_objects(void) {
- for each possible pointer current in a mark stack object
- if (current >= GC_nursery_start && current < GC_nursery_end) {
- unsigned offset = current - GC_nursery_start;
- unsigned word_offset = BYTES_TO_WORDS(offset);
- unsigned blockno = (current - GC_nursery_start)/NURSERY_BLOCK_SIZE;
- while (GC_nursery_map[word_offset] == NURSERY_MAP_NOT_START) {
- --word_offset;
- }
- if (GC_nursery_map[word_offset] != NURSERY_MAP_PINNED) {
- GC_nursery_map[word_offset] = NURSERY_MAP_PINNED;
- ++GC_pinned[blockno];
- ??Push object at GC_nursery_start + WORDS_TO_BYTES(word_offset)
- ??onto stack.
- }
- }
- }
-}
-
-/* Caller holds allocation lock. */
-void GC_collect_nursery(void) {
- int i;
- ptr_t scan_ptr = 0;
- ?? old_mark_stack_top;
- STOP_WORLD;
- for (i = 0; i < GC_nursery_blocks; ++i) GC_pinned[i] = 0;
- GC_push_all_roots();
- old_mark_stack_top = GC_mark_stack_top();
- GC_pin_mark_stack_objects();
- START_WORLD;
-}
-
-/* Initialize an allocation state so that it can be used for */
-/* allocation. This implicitly reserves a small section of the */
-/* nursery for use with his allocator. */
-void GC_init_copy_alloc_state(GC_copy_alloc_state *)
- unsigned next_block;
- ptr_t block_addr;
- LOCK();
- next_block = GC_next_nursery_block;
- while(is_pinned[next_block] && next_block < GC_nursery_blocks) {
- ++next_block;
- }
- if (next_block < GC_nursery_blocks) {
- block_addr = GC_nursery_start + NURSERY_BLOCK_SIZE * next_block;
- GC_next_nursery_block = next_block + 1;
- BZERO(GC_nursery_map + next_block *
- (NURSERY_BLOCK_SIZE/NURSERY_WORD_SIZE),
- NURSERY_BLOCK_SIZE/NURSERY_WORD_SIZE);
- *GC_copy_alloc_state = block_addr;
- UNLOCK();
- } else {
- GC_collect_nursery();
- GC_next_nursery_block = 0;
- UNLOCK();
- get_new_block(s);
- }
-}
-
-GC_PTR GC_copying_malloc2(GC_copy_descriptor *d, GC_copy_alloc_state *s) {
- size_t sz = GC_SIZE_FROM_DESCRIPTOR(d);
- ptrdiff_t offset;
- ptr_t result = *s;
- ptr_t new = result + sz;
- if (new & COPY_BLOCK_MASK <= result & COPY_BLOCK_MASK> {
- GC_init_copy_alloc_state(s);
- result = *s;
- new = result + sz;
- GC_ASSERT(new & COPY_BLOCK_MASK > result & COPY_BLOCK_MASK>
- }
- (struct copy_obj *)result -> descr = d;
- (struct copy_obj *)result -> forward = 0;
- offset = (result - GC_nursery_start)/NURSERY_WORD_SIZE;
- GC_nursery_map[offset] = NURSERY_MAP_NOT_START;
-}
-
-GC_PTR GC_copying_malloc(GC_copy_descriptor *d) {
-}
diff --git a/gc/nursery.h b/gc/nursery.h
@@ -1,90 +0,0 @@
-
-/*
- * Copyright (c) 1999 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-
-/*
- * THIS IMPLEMENTATION FOR THIS INTERFACE IS INCOMPLETE.
- * NONE OF THIS HAS BEEN TESTED. DO NOT USE.
- *
- * Comments on the interface are appreciated, especially from
- * potential users of the interface.
- *
- * This is a Bartlett style copying collector for young objects.
- * We assume for now that all objects allocated through this
- * mechanism have pointers only in the first BITMAP_BITS words.
- * (On a 32-bit machine, BITMAP_BITS is 30.)
- * Objects allocated in this manner should be rarely referenced
- * by objects not allocated either through this interface, or through
- * the typed allocation interface.
- * If this interface is used, we assume that type information provided
- * through either this or the typed allocation interface is valid
- * in a stronger sense:
- *
- * 1) No pointers are stored in fields not marked as such.
- * (Otherwise it is only necessary that objects referenced by
- * fields marked as nonpointers are also reachable via another
- * path.)
- * 2) Values stored in pointer fields are either not addresses in
- * the heap, or they really are pointers. In the latter case, it
- * is acceptable to move the object they refer to, and to update
- * the pointer.
- *
- * GC_free may not be invoked on objects allocated with GC_copying_malloc.
- *
- * No extra space is added to the end of objects allocated through this
- * interface. If the client needs to maintain pointers past the
- * end, the size should be explicitly padded.
- *
- * We assume that calls to this will usually be compiler generated.
- * Hence the interface is allowed to be a bit ugly in return for speed.
- */
-
-#include "gc_copy_descr.h"
-
-/* GC_copy_descr.h must define */
-/* GC_SIZE_FROM_DESCRIPTOR(descr) and */
-/* GC_BIT_MAP_FROM_DESCRIPTOR(descr). */
-/* It may either be the GC supplied version of the header file, or a */
-/* client specific one that derives the information from a client- */
-/* specific type descriptor. */
-
-typedef GC_PTR GC_copy_alloc_state;
- /* Current allocator state. */
- /* Multiple allocation states */
- /* may be used for concurrent */
- /* allocation, or to enhance */
- /* locality. */
- /* Should be treated as opaque. */
-
-/* Allocate a memory block of size given in the descriptor, and with */
-/* pointer layout given by the descriptor. The resulting block may not */
-/* be cleared, and should immediately be initialized by the client. */
-/* (A concurrent GC may see an uninitialized pointer field. If it */
-/* points outside the nursery, that's fine. If it points inside, it */
-/* may retain an object, and be relocated. But that's also fine, since */
-/* the new value will be immediately overwritten. */
-/* This variant acquires the allocation lock, and uses a default */
-/* global allocation state. */
-GC_PTR GC_copying_malloc(GC_copy_descriptor);
-
-/* A variant of the above that does no locking on the fast path, */
-/* and passes an explicit pointer to an allocation state. */
-/* The allocation state is updated. */
-/* There will eventually need to be a macro or inline function version */
-/* of this. */
-GC_PTR GC_copying_malloc2(GC_copy_descriptor, GC_copy_alloc_state *);
-
-/* Initialize an allocation state so that it can be used for */
-/* allocation. This implicitly reserves a small section of the */
-/* nursery for use with this allocator. */
-void GC_init_copy_alloc_state(GC_copy_alloc_state *);
diff --git a/gc/obj_map.c b/gc/obj_map.c
@@ -1,6 +1,7 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991, 1992 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -11,7 +12,6 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, October 9, 1995 1:09 pm PDT */
/* Routines for maintaining maps describing heap block
* layouts for various object sizes. Allows fast pointer validity checks
@@ -19,9 +19,9 @@
* with slow division.
*/
-# include "gc_priv.h"
+# include "private/gc_priv.h"
-char * GC_invalid_map = 0;
+map_entry_type * GC_invalid_map = 0;
/* Invalidate the object map associated with a block. Free blocks */
/* are identified by invalid maps. */
@@ -31,7 +31,7 @@ hdr *hhdr;
register int displ;
if (GC_invalid_map == 0) {
- GC_invalid_map = GC_scratch_alloc(MAP_SIZE);
+ GC_invalid_map = (map_entry_type *)GC_scratch_alloc(MAP_SIZE);
if (GC_invalid_map == 0) {
GC_err_printf0(
"Cant initialize GC_invalid_map: insufficient memory\n");
@@ -54,7 +54,6 @@ hdr *hhdr;
GC_word offset;
# endif
{
-# ifndef ALL_INTERIOR_POINTERS
DCL_LOCK_STATE;
DISABLE_SIGNALS();
@@ -62,39 +61,40 @@ hdr *hhdr;
GC_register_displacement_inner(offset);
UNLOCK();
ENABLE_SIGNALS();
-# endif
}
void GC_register_displacement_inner(offset)
word offset;
{
-# ifndef ALL_INTERIOR_POINTERS
register unsigned i;
+ word map_entry = BYTES_TO_WORDS(offset);
- if (offset > MAX_OFFSET) {
+ if (offset >= VALID_OFFSET_SZ) {
ABORT("Bad argument to GC_register_displacement");
}
+ if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG;
if (!GC_valid_offsets[offset]) {
GC_valid_offsets[offset] = TRUE;
GC_modws_valid_offsets[offset % sizeof(word)] = TRUE;
- for (i = 0; i <= MAXOBJSZ; i++) {
+ if (!GC_all_interior_pointers) {
+ for (i = 0; i <= MAXOBJSZ; i++) {
if (GC_obj_map[i] != 0) {
if (i == 0) {
- GC_obj_map[i][offset + HDR_BYTES] = (char)BYTES_TO_WORDS(offset);
+ GC_obj_map[i][offset] = (map_entry_type)map_entry;
} else {
register unsigned j;
register unsigned lb = WORDS_TO_BYTES(i);
if (offset < lb) {
- for (j = offset + HDR_BYTES; j < HBLKSIZE; j += lb) {
- GC_obj_map[i][j] = (char)BYTES_TO_WORDS(offset);
+ for (j = offset; j < HBLKSIZE; j += lb) {
+ GC_obj_map[i][j] = (map_entry_type)map_entry;
}
}
}
}
+ }
}
}
-# endif
}
@@ -105,13 +105,14 @@ word sz;
{
register unsigned obj_start;
register unsigned displ;
- register char * new_map;
+ register map_entry_type * new_map;
+ word map_entry;
if (sz > MAXOBJSZ) sz = 0;
if (GC_obj_map[sz] != 0) {
return(TRUE);
}
- new_map = GC_scratch_alloc(MAP_SIZE);
+ new_map = (map_entry_type *)GC_scratch_alloc(MAP_SIZE);
if (new_map == 0) return(FALSE);
# ifdef PRINTSTATS
GC_printf1("Adding block map for size %lu\n", (unsigned long)sz);
@@ -120,19 +121,23 @@ word sz;
MAP_ENTRY(new_map,displ) = OBJ_INVALID;
}
if (sz == 0) {
- for(displ = 0; displ <= MAX_OFFSET; displ++) {
+ for(displ = 0; displ <= HBLKSIZE; displ++) {
if (OFFSET_VALID(displ)) {
- MAP_ENTRY(new_map,displ+HDR_BYTES) = BYTES_TO_WORDS(displ);
+ map_entry = BYTES_TO_WORDS(displ);
+ if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG;
+ MAP_ENTRY(new_map,displ) = (map_entry_type)map_entry;
}
}
} else {
- for (obj_start = HDR_BYTES;
+ for (obj_start = 0;
obj_start + WORDS_TO_BYTES(sz) <= HBLKSIZE;
obj_start += WORDS_TO_BYTES(sz)) {
for (displ = 0; displ < WORDS_TO_BYTES(sz); displ++) {
if (OFFSET_VALID(displ)) {
+ map_entry = BYTES_TO_WORDS(displ);
+ if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG;
MAP_ENTRY(new_map, obj_start + displ) =
- BYTES_TO_WORDS(displ);
+ (map_entry_type)map_entry;
}
}
}
diff --git a/gc/os_dep.c b/gc/os_dep.c
@@ -1,6 +1,8 @@
/*
+ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
- * Copyright (c) 1996-1997 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -12,7 +14,7 @@
* modified is included with the above copyright notice.
*/
-# include "gc_priv.h"
+# include "private/gc_priv.h"
# if defined(LINUX) && !defined(POWERPC)
# include <linux/version.h>
@@ -31,7 +33,7 @@
/* make sure the former gets defined to be the latter if appropriate. */
# include <features.h>
# if 2 <= __GLIBC__
-# if 0 == __GLIBC_MINOR__
+# if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__
/* glibc 2.1 no longer has sigcontext.h. But signal.h */
/* has the right declaration for glibc 2.1. */
# include <sigcontext.h>
@@ -43,7 +45,8 @@
# endif /* 2 <= __GLIBC__ */
# endif
# endif
-# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS)
+# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \
+ && !defined(MSWINCE)
# include <sys/types.h>
# if !defined(MSWIN32) && !defined(SUNOS4)
# include <unistd.h>
@@ -51,29 +54,33 @@
# endif
# include <stdio.h>
-# include <signal.h>
+# if defined(MSWINCE)
+# define SIGSEGV 0 /* value is irrelevant */
+# else
+# include <signal.h>
+# endif
/* Blatantly OS dependent routines, except for those that are related */
-/* dynamic loading. */
+/* to dynamic loading. */
-# if !defined(THREADS) && !defined(STACKBOTTOM) && defined(HEURISTIC2)
+# if defined(HEURISTIC2) || defined(SEARCH_FOR_DATA_START)
# define NEED_FIND_LIMIT
# endif
-# if defined(IRIX_THREADS)
+# if !defined(STACKBOTTOM) && defined(HEURISTIC2)
# define NEED_FIND_LIMIT
# endif
-# if (defined(SUNOS4) & defined(DYNAMIC_LOADING)) && !defined(PCR)
+# if defined(IRIX_THREADS) || defined(HPUX_THREADS)
# define NEED_FIND_LIMIT
# endif
-# if (defined(SVR4) || defined(AUX) || defined(DGUX)) && !defined(PCR)
+# if (defined(SUNOS4) && defined(DYNAMIC_LOADING)) && !defined(PCR)
# define NEED_FIND_LIMIT
# endif
-# if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || \
- defined(ALPHA) || defined(MIPS))
+# if (defined(SVR4) || defined(AUX) || defined(DGUX) \
+ || (defined(LINUX) && defined(SPARC))) && !defined(PCR)
# define NEED_FIND_LIMIT
# endif
@@ -86,13 +93,12 @@
#endif
#ifdef AMIGA
-# include <proto/exec.h>
-# include <proto/dos.h>
-# include <dos/dosextens.h>
-# include <workbench/startup.h>
+# define GC_AMIGA_DEF
+# include "AmigaOS.c"
+# undef GC_AMIGA_DEF
#endif
-#ifdef MSWIN32
+#if defined(MSWIN32) || defined(MSWINCE)
# define WIN32_LEAN_AND_MEAN
# define NOSERVICE
# include <windows.h>
@@ -110,11 +116,16 @@
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
+#endif
+
+#ifdef UNIX_LIKE
# include <fcntl.h>
#endif
-#ifdef SUNOS5SIGS
-# include <sys/siginfo.h>
+#if defined(SUNOS5SIGS) || defined (HURD) || defined(LINUX)
+# ifdef SUNOS5SIGS
+# include <sys/siginfo.h>
+# endif
# undef setjmp
# undef longjmp
# define setjmp(env) sigsetjmp(env, 1)
@@ -123,7 +134,7 @@
#endif
#ifdef DJGPP
- /* Apparently necessary for djgpp 2.01. May casuse problems with */
+ /* Apparently necessary for djgpp 2.01. May cause problems with */
/* other versions. */
typedef long unsigned int caddr_t;
#endif
@@ -140,21 +151,84 @@
# define OPT_PROT_EXEC 0
#endif
-#if defined(LINUX) && (defined(POWERPC) || defined(SPARC) || \
- defined(ALPHA) || defined(MIPS))
+#if defined(SEARCH_FOR_DATA_START)
/* The I386 case can be handled without a search. The Alpha case */
/* used to be handled differently as well, but the rules changed */
/* for recent Linux versions. This seems to be the easiest way to */
/* cover all versions. */
- ptr_t GC_data_start;
- extern char * GC_copyright[]; /* Any data symbol would do. */
+# ifdef LINUX
+# pragma weak __data_start
+ extern int __data_start;
+# pragma weak data_start
+ extern int data_start;
+# endif /* LINUX */
+ extern int _end;
+
+ ptr_t GC_data_start;
void GC_init_linux_data_start()
{
extern ptr_t GC_find_limit();
- GC_data_start = GC_find_limit((ptr_t)GC_copyright, FALSE);
+# ifdef LINUX
+ /* Try the easy approaches first: */
+ if (&__data_start != 0) {
+ GC_data_start = (ptr_t)(&__data_start);
+ return;
+ }
+ if (&data_start != 0) {
+ GC_data_start = (ptr_t)(&data_start);
+ return;
+ }
+# endif /* LINUX */
+ GC_data_start = GC_find_limit((ptr_t)(&_end), FALSE);
+ }
+#endif
+
+# ifdef ECOS
+
+# ifndef ECOS_GC_MEMORY_SIZE
+# define ECOS_GC_MEMORY_SIZE (448 * 1024)
+# endif /* ECOS_GC_MEMORY_SIZE */
+
+// setjmp() function, as described in ANSI para 7.6.1.1
+#define setjmp( __env__ ) hal_setjmp( __env__ )
+
+// FIXME: This is a simple way of allocating memory which is
+// compatible with ECOS early releases. Later releases use a more
+// sophisticated means of allocating memory than this simple static
+// allocator, but this method is at least bound to work.
+static char memory[ECOS_GC_MEMORY_SIZE];
+static char *brk = memory;
+
+static void *tiny_sbrk(ptrdiff_t increment)
+{
+ void *p = brk;
+
+ brk += increment;
+
+ if (brk > memory + sizeof memory)
+ {
+ brk -= increment;
+ return NULL;
+ }
+
+ return p;
+}
+#define sbrk tiny_sbrk
+# endif /* ECOS */
+
+#if defined(NETBSD) && defined(__ELF__)
+ ptr_t GC_data_start;
+
+ void GC_init_netbsd_elf()
+ {
+ extern ptr_t GC_find_limit();
+ extern char **environ;
+ /* This may need to be environ, without the underscore, for */
+ /* some versions. */
+ GC_data_start = GC_find_limit((ptr_t)&environ, FALSE);
}
#endif
@@ -262,9 +336,10 @@ void GC_enable_signals(void)
# else
# if !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
+ && !defined(MSWINCE) \
&& !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW)
-# if defined(sigmask) && !defined(UTS4)
+# if defined(sigmask) && !defined(UTS4) && !defined(HURD)
/* Use the traditional BSD interface */
# define SIGSET_T int
# define SIG_DEL(set, signal) (set) &= ~(sigmask(signal))
@@ -337,7 +412,7 @@ void GC_enable_signals()
# endif /*!OS/2 */
/* Ivan Demakov: simplest way (to me) */
-#ifdef DOS4GW
+#if defined (DOS4GW)
void GC_disable_signals() { }
void GC_enable_signals() { }
#endif
@@ -345,13 +420,11 @@ void GC_enable_signals()
/* Find the page size */
word GC_page_size;
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
void GC_setpagesize()
{
- SYSTEM_INFO sysinfo;
-
- GetSystemInfo(&sysinfo);
- GC_page_size = sysinfo.dwPageSize;
+ GetSystemInfo(&GC_sysinfo);
+ GC_page_size = GC_sysinfo.dwPageSize;
}
# else
@@ -376,7 +449,7 @@ word GC_page_size;
* With threads, GC_mark_roots needs to know how to do this.
* Called with allocator lock held.
*/
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
# define is_writable(prot) ((prot) == PAGE_READWRITE \
|| (prot) == PAGE_WRITECOPY \
|| (prot) == PAGE_EXECUTE_READWRITE \
@@ -413,7 +486,17 @@ ptr_t GC_get_stack_base()
}
-# else
+# endif /* MS Windows */
+
+# ifdef BEOS
+# include <kernel/OS.h>
+ptr_t GC_get_stack_base(){
+ thread_info th;
+ get_thread_info(find_thread(NULL),&th);
+ return th.stack_end;
+}
+# endif /* BEOS */
+
# ifdef OS2
@@ -429,67 +512,15 @@ ptr_t GC_get_stack_base()
return((ptr_t)(ptib -> tib_pstacklimit));
}
-# else
+# endif /* OS2 */
# ifdef AMIGA
+# define GC_AMIGA_SB
+# include "AmigaOS.c"
+# undef GC_AMIGA_SB
+# endif /* AMIGA */
-ptr_t GC_get_stack_base()
-{
- struct Process *proc = (struct Process*)SysBase->ThisTask;
-
- /* Reference: Amiga Guru Book Pages: 42,567,574 */
- if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS
- && proc->pr_CLI != NULL) {
- /* first ULONG is StackSize */
- /*longPtr = proc->pr_ReturnAddr;
- size = longPtr[0];*/
-
- return (char *)proc->pr_ReturnAddr + sizeof(ULONG);
- } else {
- return (char *)proc->pr_Task.tc_SPUpper;
- }
-}
-
-#if 0 /* old version */
-ptr_t GC_get_stack_base()
-{
- extern struct WBStartup *_WBenchMsg;
- extern long __base;
- extern long __stack;
- struct Task *task;
- struct Process *proc;
- struct CommandLineInterface *cli;
- long size;
-
- if ((task = FindTask(0)) == 0) {
- GC_err_puts("Cannot find own task structure\n");
- ABORT("task missing");
- }
- proc = (struct Process *)task;
- cli = BADDR(proc->pr_CLI);
-
- if (_WBenchMsg != 0 || cli == 0) {
- size = (char *)task->tc_SPUpper - (char *)task->tc_SPLower;
- } else {
- size = cli->cli_DefaultStack * 4;
- }
- return (ptr_t)(__base + GC_max(size, __stack));
-}
-#endif /* 0 */
-
-# else /* !AMIGA, !OS2, ... */
-
-# ifdef NEED_FIND_LIMIT
- /* Some tools to implement HEURISTIC2 */
-# define MIN_PAGE_SIZE 256 /* Smallest conceivable page size, bytes */
- /* static */ jmp_buf GC_jmp_buf;
-
- /*ARGSUSED*/
- void GC_fault_handler(sig)
- int sig;
- {
- longjmp(GC_jmp_buf, 1);
- }
+# if defined(NEED_FIND_LIMIT) || (defined(UNIX_LIKE) && !defined(ECOS))
# ifdef __STDC__
typedef void (*handler)(int);
@@ -497,22 +528,32 @@ ptr_t GC_get_stack_base()
typedef void (*handler)();
# endif
-# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1)
+# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) || defined(HURD)
static struct sigaction old_segv_act;
-# if defined(_sigargs) /* !Irix6.x */
+# if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) || defined(HURD)
static struct sigaction old_bus_act;
# endif
# else
static handler old_segv_handler, old_bus_handler;
# endif
- void GC_setup_temporary_fault_handler()
+# ifdef __STDC__
+ void GC_set_and_save_fault_handler(handler h)
+# else
+ void GC_set_and_save_fault_handler(h)
+ handler h;
+# endif
{
-# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1)
+# if defined(SUNOS5SIGS) || defined(IRIX5) \
+ || defined(OSF1) || defined(HURD)
struct sigaction act;
- act.sa_handler = GC_fault_handler;
- act.sa_flags = SA_RESTART | SA_NODEFER;
+ act.sa_handler = h;
+# ifdef SUNOS5SIGS
+ act.sa_flags = SA_RESTART | SA_NODEFER;
+# else
+ act.sa_flags = SA_RESTART;
+# endif
/* The presence of SA_NODEFER represents yet another gross */
/* hack. Under Solaris 2.3, siglongjmp doesn't appear to */
/* interact correctly with -lthread. We hide the confusion */
@@ -527,26 +568,47 @@ ptr_t GC_get_stack_base()
(void) sigaction(SIGSEGV, &act, 0);
# else
(void) sigaction(SIGSEGV, &act, &old_segv_act);
-# ifdef _sigargs /* Irix 5.x, not 6.x */
- /* Under 5.x, we may get SIGBUS. */
- /* Pthreads doesn't exist under 5.x, so we don't */
- /* have to worry in the threads case. */
+# if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
+ || defined(HPUX) || defined(HURD)
+ /* Under Irix 5.x or HP/UX, we may get SIGBUS. */
+ /* Pthreads doesn't exist under Irix 5.x, so we */
+ /* don't have to worry in the threads case. */
(void) sigaction(SIGBUS, &act, &old_bus_act);
# endif
# endif /* IRIX_THREADS */
# else
- old_segv_handler = signal(SIGSEGV, GC_fault_handler);
+ old_segv_handler = signal(SIGSEGV, h);
# ifdef SIGBUS
- old_bus_handler = signal(SIGBUS, GC_fault_handler);
+ old_bus_handler = signal(SIGBUS, h);
# endif
# endif
}
+# endif /* NEED_FIND_LIMIT || UNIX_LIKE */
+
+# ifdef NEED_FIND_LIMIT
+ /* Some tools to implement HEURISTIC2 */
+# define MIN_PAGE_SIZE 256 /* Smallest conceivable page size, bytes */
+ /* static */ jmp_buf GC_jmp_buf;
+
+ /*ARGSUSED*/
+ void GC_fault_handler(sig)
+ int sig;
+ {
+ longjmp(GC_jmp_buf, 1);
+ }
+
+ void GC_setup_temporary_fault_handler()
+ {
+ GC_set_and_save_fault_handler(GC_fault_handler);
+ }
void GC_reset_fault_handler()
{
-# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1)
+# if defined(SUNOS5SIGS) || defined(IRIX5) \
+ || defined(OSF1) || defined(HURD)
(void) sigaction(SIGSEGV, &old_segv_act, 0);
-# ifdef _sigargs /* Irix 5.x, not 6.x */
+# if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \
+ || defined(HPUX) || defined(HURD)
(void) sigaction(SIGBUS, &old_bus_act, 0);
# endif
# else
@@ -591,6 +653,104 @@ ptr_t GC_get_stack_base()
}
# endif
+#ifdef LINUX_STACKBOTTOM
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+# define STAT_SKIP 27 /* Number of fields preceding startstack */
+ /* field in /proc/self/stat */
+
+# pragma weak __libc_stack_end
+ extern ptr_t __libc_stack_end;
+
+# ifdef IA64
+# pragma weak __libc_ia64_register_backing_store_base
+ extern ptr_t __libc_ia64_register_backing_store_base;
+
+ ptr_t GC_get_register_stack_base(void)
+ {
+ if (0 != &__libc_ia64_register_backing_store_base) {
+ return __libc_ia64_register_backing_store_base;
+ } else {
+ word result = (word)GC_stackbottom - BACKING_STORE_DISPLACEMENT;
+ result += BACKING_STORE_ALIGNMENT - 1;
+ result &= ~(BACKING_STORE_ALIGNMENT - 1);
+ return (ptr_t)result;
+ }
+ }
+# endif
+
+ ptr_t GC_linux_stack_base(void)
+ {
+ /* We read the stack base value from /proc/self/stat. We do this */
+ /* using direct I/O system calls in order to avoid calling malloc */
+ /* in case REDIRECT_MALLOC is defined. */
+# define STAT_BUF_SIZE 4096
+# if defined(GC_USE_LD_WRAP)
+# define STAT_READ __real_read
+# else
+# define STAT_READ read
+# endif
+ char stat_buf[STAT_BUF_SIZE];
+ int f;
+ char c;
+ word result = 0;
+ size_t i, buf_offset = 0;
+
+ /* First try the easy way. This should work for glibc 2.2 */
+ if (0 != &__libc_stack_end) {
+ return __libc_stack_end;
+ }
+ f = open("/proc/self/stat", O_RDONLY);
+ if (f < 0 || STAT_READ(f, stat_buf, STAT_BUF_SIZE) < 2 * STAT_SKIP) {
+ ABORT("Couldn't read /proc/self/stat");
+ }
+ c = stat_buf[buf_offset++];
+ /* Skip the required number of fields. This number is hopefully */
+ /* constant across all Linux implementations. */
+ for (i = 0; i < STAT_SKIP; ++i) {
+ while (isspace(c)) c = stat_buf[buf_offset++];
+ while (!isspace(c)) c = stat_buf[buf_offset++];
+ }
+ while (isspace(c)) c = stat_buf[buf_offset++];
+ while (isdigit(c)) {
+ result *= 10;
+ result += c - '0';
+ c = stat_buf[buf_offset++];
+ }
+ close(f);
+ if (result < 0x10000000) ABORT("Absurd stack bottom value");
+ return (ptr_t)result;
+ }
+
+#endif /* LINUX_STACKBOTTOM */
+
+#ifdef FREEBSD_STACKBOTTOM
+
+/* This uses an undocumented sysctl call, but at least one expert */
+/* believes it will stay. */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+ ptr_t GC_freebsd_stack_base(void)
+ {
+ int nm[2] = { CTL_KERN, KERN_USRSTACK}, base, len, r;
+
+ len = sizeof(int);
+ r = sysctl(nm, 2, &base, &len, NULL, 0);
+
+ if (r) ABORT("Error getting stack base");
+
+ return (ptr_t)base;
+ }
+
+#endif /* FREEBSD_STACKBOTTOM */
+
+#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
+ && !defined(MSWINCE) && !defined(OS2) && !defined(ECOS)
ptr_t GC_get_stack_base()
{
@@ -612,6 +772,12 @@ ptr_t GC_get_stack_base()
& ~STACKBOTTOM_ALIGNMENT_M1);
# endif
# endif /* HEURISTIC1 */
+# ifdef LINUX_STACKBOTTOM
+ result = GC_linux_stack_base();
+# endif
+# ifdef FREEBSD_STACKBOTTOM
+ result = GC_freebsd_stack_base();
+# endif
# ifdef HEURISTIC2
# ifdef STACK_GROWS_DOWN
result = GC_find_limit((ptr_t)(&dummy), TRUE);
@@ -639,9 +805,7 @@ ptr_t GC_get_stack_base()
# endif /* STACKBOTTOM */
}
-# endif /* ! AMIGA */
-# endif /* ! OS2 */
-# endif /* ! MSWIN32 */
+# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS */
/*
* Register static data segment(s) as roots.
@@ -741,7 +905,9 @@ void GC_register_data_segments()
}
}
-# else
+# else /* !OS2 */
+
+# if defined(MSWIN32) || defined(MSWINCE)
# ifdef MSWIN32
/* Unfortunately, we have to handle win32s very differently from NT, */
@@ -765,21 +931,19 @@ void GC_register_data_segments()
{
GC_win32s = GC_is_win32s();
}
-
+
/* Return the smallest address a such that VirtualQuery */
/* returns correct results for all addresses between a and start. */
/* Assumes VirtualQuery returns correct information for start. */
ptr_t GC_least_described_address(ptr_t start)
{
MEMORY_BASIC_INFORMATION buf;
- SYSTEM_INFO sysinfo;
DWORD result;
LPVOID limit;
ptr_t p;
LPVOID q;
- GetSystemInfo(&sysinfo);
- limit = sysinfo.lpMinimumApplicationAddress;
+ limit = GC_sysinfo.lpMinimumApplicationAddress;
p = (ptr_t)((word)start & ~(GC_page_size - 1));
for (;;) {
q = (LPVOID)(p - GC_page_size);
@@ -790,6 +954,7 @@ void GC_register_data_segments()
}
return(p);
}
+# endif
/* Is p the start of either the malloc heap, or of one of our */
/* heap sections? */
@@ -803,7 +968,11 @@ void GC_register_data_segments()
if (0 == malloc_heap_pointer) {
MEMORY_BASIC_INFORMATION buf;
- register DWORD result = VirtualQuery(malloc(1), &buf, sizeof(buf));
+ void *pTemp = malloc( 1 );
+ register DWORD result = VirtualQuery(pTemp, &buf, sizeof(buf));
+
+ free( pTemp );
+
if (result != sizeof(buf)) {
ABORT("Weird VirtualQuery result");
@@ -817,11 +986,11 @@ void GC_register_data_segments()
}
return(FALSE);
}
-
+
+# ifdef MSWIN32
void GC_register_root_section(ptr_t static_root)
{
MEMORY_BASIC_INFORMATION buf;
- SYSTEM_INFO sysinfo;
DWORD result;
DWORD protect;
LPVOID p;
@@ -830,8 +999,7 @@ void GC_register_data_segments()
if (!GC_win32s) return;
p = base = limit = GC_least_described_address(static_root);
- GetSystemInfo(&sysinfo);
- while (p < sysinfo.lpMaximumApplicationAddress) {
+ while (p < GC_sysinfo.lpMaximumApplicationAddress) {
result = VirtualQuery(p, &buf, sizeof(buf));
if (result != sizeof(buf) || buf.AllocationBase == 0
|| GC_is_heap_base(buf.AllocationBase)) break;
@@ -852,129 +1020,20 @@ void GC_register_data_segments()
}
if (base != limit) GC_add_roots_inner(base, limit, FALSE);
}
+#endif
void GC_register_data_segments()
{
+# ifdef MSWIN32
static char dummy;
-
GC_register_root_section((ptr_t)(&dummy));
- }
-# else
-# ifdef AMIGA
-
- void GC_register_data_segments()
- {
- struct Process *proc;
- struct CommandLineInterface *cli;
- BPTR myseglist;
- ULONG *data;
-
- int num;
-
-
-# ifdef __GNUC__
- ULONG dataSegSize;
- GC_bool found_segment = FALSE;
- extern char __data_size[];
-
- dataSegSize=__data_size+8;
- /* Can`t find the Location of __data_size, because
- it`s possible that is it, inside the segment. */
-
# endif
-
- proc= (struct Process*)SysBase->ThisTask;
-
- /* Reference: Amiga Guru Book Pages: 538ff,565,573
- and XOper.asm */
- if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS) {
- if (proc->pr_CLI == NULL) {
- myseglist = proc->pr_SegList;
- } else {
- /* ProcLoaded 'Loaded as a command: '*/
- cli = BADDR(proc->pr_CLI);
- myseglist = cli->cli_Module;
- }
- } else {
- ABORT("Not a Process.");
- }
-
- if (myseglist == NULL) {
- ABORT("Arrrgh.. can't find segments, aborting");
- }
-
- /* xoper hunks Shell Process */
-
- num=0;
- for (data = (ULONG *)BADDR(myseglist); data != NULL;
- data = (ULONG *)BADDR(data[0])) {
- if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
- ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
-# ifdef __GNUC__
- if (dataSegSize == data[-1]) {
- found_segment = TRUE;
- }
-# endif
- GC_add_roots_inner((char *)&data[1],
- ((char *)&data[1]) + data[-1], FALSE);
- }
- ++num;
- } /* for */
-# ifdef __GNUC__
- if (!found_segment) {
- ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library");
- }
-# endif
}
-#if 0 /* old version */
- void GC_register_data_segments()
- {
- extern struct WBStartup *_WBenchMsg;
- struct Process *proc;
- struct CommandLineInterface *cli;
- BPTR myseglist;
- ULONG *data;
-
- if ( _WBenchMsg != 0 ) {
- if ((myseglist = _WBenchMsg->sm_Segment) == 0) {
- GC_err_puts("No seglist from workbench\n");
- return;
- }
- } else {
- if ((proc = (struct Process *)FindTask(0)) == 0) {
- GC_err_puts("Cannot find process structure\n");
- return;
- }
- if ((cli = BADDR(proc->pr_CLI)) == 0) {
- GC_err_puts("No CLI\n");
- return;
- }
- if ((myseglist = cli->cli_Module) == 0) {
- GC_err_puts("No seglist from CLI\n");
- return;
- }
- }
-
- for (data = (ULONG *)BADDR(myseglist); data != 0;
- data = (ULONG *)BADDR(data[0])) {
-# ifdef AMIGA_SKIP_SEG
- if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
- ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
-# else
- {
-# endif /* AMIGA_SKIP_SEG */
- GC_add_roots_inner((char *)&data[1],
- ((char *)&data[1]) + data[-1], FALSE);
- }
- }
- }
-#endif /* old version */
-
-
-# else
+# else /* !OS2 && !Windows */
-# if (defined(SVR4) || defined(AUX) || defined(DGUX)) && !defined(PCR)
+# if (defined(SVR4) || defined(AUX) || defined(DGUX) \
+ || (defined(LINUX) && defined(SPARC))) && !defined(PCR)
char * GC_SysVGetDataStart(max_page_size, etext_addr)
int max_page_size;
int * etext_addr;
@@ -1008,6 +1067,14 @@ int * etext_addr;
# endif
+#ifdef AMIGA
+
+# define GC_AMIGA_DS
+# include "AmigaOS.c"
+# undef GC_AMIGA_DS
+
+#else /* !OS2 && !Windows && !AMIGA */
+
void GC_register_data_segments()
{
# if !defined(PCR) && !defined(SRC_M3) && !defined(NEXT) && !defined(MACOS) \
@@ -1067,15 +1134,16 @@ void GC_register_data_segments()
}
# endif /* ! AMIGA */
-# endif /* ! MSWIN32 */
+# endif /* ! MSWIN32 && ! MSWINCE*/
# endif /* ! OS2 */
/*
* Auxiliary routines for obtaining memory from OS.
*/
-
+
# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) \
- && !defined(MSWIN32) && !defined(MACOS) && !defined(DOS4GW)
+ && !defined(MSWIN32) && !defined(MSWINCE) \
+ && !defined(MACOS) && !defined(DOS4GW)
# ifdef SUNOS4
extern caddr_t sbrk();
@@ -1086,6 +1154,7 @@ void GC_register_data_segments()
# define SBRK_ARG_T int
# endif
+
# ifdef RS6000
/* The compiler seems to generate speculative reads one past the end of */
/* an allocated object. Hence we need to make sure that the page */
@@ -1118,7 +1187,7 @@ word bytes;
#else /* Not RS6000 */
#if defined(USE_MMAP)
-/* Tested only under IRIX5 and Solaris 2 */
+/* Tested only under Linux, IRIX5 and Solaris 2 */
#ifdef USE_MMAP_FIXED
# define GC_MMAP_FLAGS MAP_FIXED | MAP_PRIVATE
@@ -1128,6 +1197,10 @@ word bytes;
# define GC_MMAP_FLAGS MAP_PRIVATE
#endif
+#ifndef HEAP_START
+# define HEAP_START 0
+#endif
+
ptr_t GC_unix_get_mem(bytes)
word bytes;
{
@@ -1146,6 +1219,18 @@ word bytes;
if (result == MAP_FAILED) return(0);
last_addr = (ptr_t)result + bytes + GC_page_size - 1;
last_addr = (ptr_t)((word)last_addr & ~(GC_page_size - 1));
+# if !defined(LINUX)
+ if (last_addr == 0) {
+ /* Oops. We got the end of the address space. This isn't */
+ /* usable by arbitrary C code, since one-past-end pointers */
+ /* don't work, so we discard it and try again. */
+ munmap(result, (size_t)(-GC_page_size) - (size_t)result);
+ /* Leave last page mapped, so we can't repeat. */
+ return GC_unix_get_mem(bytes);
+ }
+# else
+ GC_ASSERT(last_addr != 0);
+# endif
return((ptr_t)result);
}
@@ -1199,6 +1284,11 @@ void * os2_alloc(size_t bytes)
# endif /* OS2 */
+# if defined(MSWIN32) || defined(MSWINCE)
+SYSTEM_INFO GC_sysinfo;
+# endif
+
+
# ifdef MSWIN32
word GC_n_heap_bases = 0;
@@ -1206,7 +1296,7 @@ ptr_t GC_win32_get_mem(bytes)
word bytes;
{
ptr_t result;
-
+
if (GC_win32s) {
/* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE. */
/* There are also unconfirmed rumors of other */
@@ -1235,20 +1325,81 @@ void GC_win32_free_heap ()
}
}
}
+# endif
+
+#ifdef AMIGA
+# define GC_AMIGA_AM
+# include "AmigaOS.c"
+# undef GC_AMIGA_AM
+#endif
+
+# ifdef MSWINCE
+word GC_n_heap_bases = 0;
+
+ptr_t GC_wince_get_mem(bytes)
+word bytes;
+{
+ ptr_t result;
+ word i;
+
+ /* Round up allocation size to multiple of page size */
+ bytes = (bytes + GC_page_size-1) & ~(GC_page_size-1);
+
+ /* Try to find reserved, uncommitted pages */
+ for (i = 0; i < GC_n_heap_bases; i++) {
+ if (((word)(-(signed_word)GC_heap_lengths[i])
+ & (GC_sysinfo.dwAllocationGranularity-1))
+ >= bytes) {
+ result = GC_heap_bases[i] + GC_heap_lengths[i];
+ break;
+ }
+ }
+
+ if (i == GC_n_heap_bases) {
+ /* Reserve more pages */
+ word res_bytes = (bytes + GC_sysinfo.dwAllocationGranularity-1)
+ & ~(GC_sysinfo.dwAllocationGranularity-1);
+ result = (ptr_t) VirtualAlloc(NULL, res_bytes,
+ MEM_RESERVE | MEM_TOP_DOWN,
+ PAGE_EXECUTE_READWRITE);
+ if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result");
+ /* If I read the documentation correctly, this can */
+ /* only happen if HBLKSIZE > 64k or not a power of 2. */
+ if (GC_n_heap_bases >= MAX_HEAP_SECTS) ABORT("Too many heap sections");
+ GC_heap_bases[GC_n_heap_bases] = result;
+ GC_heap_lengths[GC_n_heap_bases] = 0;
+ GC_n_heap_bases++;
+ }
+
+ /* Commit pages */
+ result = (ptr_t) VirtualAlloc(result, bytes,
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE);
+ if (result != NULL) {
+ if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result");
+ GC_heap_lengths[i] += bytes;
+ }
+ return(result);
+}
# endif
#ifdef USE_MUNMAP
-/* For now, this only works on some Unix-like systems. If you */
-/* have something else, don't define USE_MUNMAP. */
+/* For now, this only works on Win32/WinCE and some Unix-like */
+/* systems. If you have something else, don't define */
+/* USE_MUNMAP. */
/* We assume ANSI C to support this feature. */
+
+#if !defined(MSWIN32) && !defined(MSWINCE)
+
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <fcntl.h>
+
+#endif
/* Compute a page aligned starting address for the unmap */
/* operation on a block of size bytes starting at start. */
@@ -1272,6 +1423,14 @@ ptr_t GC_unmap_end(ptr_t start, word bytes)
return end_addr;
}
+/* Under Win32/WinCE we commit (map) and decommit (unmap) */
+/* memory using VirtualAlloc and VirtualFree. These functions */
+/* work on individual allocations of virtual memory, made */
+/* previously using VirtualAlloc with the MEM_RESERVE flag. */
+/* The ranges we need to (de)commit may span several of these */
+/* allocations; therefore we use VirtualQuery to check */
+/* allocation lengths, and split up the range as necessary. */
+
/* We assume that GC_remap is called on exactly the same range */
/* as a previous call to GC_unmap. It is safe to consistently */
/* round the endpoints in both places. */
@@ -1281,8 +1440,24 @@ void GC_unmap(ptr_t start, word bytes)
ptr_t end_addr = GC_unmap_end(start, bytes);
word len = end_addr - start_addr;
if (0 == start_addr) return;
- if (munmap(start_addr, len) != 0) ABORT("munmap failed");
- GC_unmapped_bytes += len;
+# if defined(MSWIN32) || defined(MSWINCE)
+ while (len != 0) {
+ MEMORY_BASIC_INFORMATION mem_info;
+ GC_word free_len;
+ if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info))
+ != sizeof(mem_info))
+ ABORT("Weird VirtualQuery result");
+ free_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize;
+ if (!VirtualFree(start_addr, free_len, MEM_DECOMMIT))
+ ABORT("VirtualFree failed");
+ GC_unmapped_bytes += free_len;
+ start_addr += free_len;
+ len -= free_len;
+ }
+# else
+ if (munmap(start_addr, len) != 0) ABORT("munmap failed");
+ GC_unmapped_bytes += len;
+# endif
}
@@ -1294,14 +1469,35 @@ void GC_remap(ptr_t start, word bytes)
word len = end_addr - start_addr;
ptr_t result;
- if (-1 == zero_descr) zero_descr = open("/dev/zero", O_RDWR);
- if (0 == start_addr) return;
- result = mmap(start_addr, len, PROT_READ | PROT_WRITE | OPT_PROT_EXEC,
- MAP_FIXED | MAP_PRIVATE, zero_descr, 0);
- if (result != start_addr) {
- ABORT("mmap remapping failed");
- }
- GC_unmapped_bytes -= len;
+# if defined(MSWIN32) || defined(MSWINCE)
+ if (0 == start_addr) return;
+ while (len != 0) {
+ MEMORY_BASIC_INFORMATION mem_info;
+ GC_word alloc_len;
+ if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info))
+ != sizeof(mem_info))
+ ABORT("Weird VirtualQuery result");
+ alloc_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize;
+ result = VirtualAlloc(start_addr, alloc_len,
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE);
+ if (result != start_addr) {
+ ABORT("VirtualAlloc remapping failed");
+ }
+ GC_unmapped_bytes -= alloc_len;
+ start_addr += alloc_len;
+ len -= alloc_len;
+ }
+# else
+ if (-1 == zero_descr) zero_descr = open("/dev/zero", O_RDWR);
+ if (0 == start_addr) return;
+ result = mmap(start_addr, len, PROT_READ | PROT_WRITE | OPT_PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE, zero_descr, 0);
+ if (result != start_addr) {
+ ABORT("mmap remapping failed");
+ }
+ GC_unmapped_bytes -= len;
+# endif
}
/* Two adjacent blocks have already been unmapped and are about to */
@@ -1322,16 +1518,31 @@ void GC_unmap_gap(ptr_t start1, word bytes1, ptr_t start2, word bytes2)
if (0 == start2_addr) end_addr = GC_unmap_end(start1, bytes1 + bytes2);
if (0 == start_addr) return;
len = end_addr - start_addr;
- if (len != 0 && munmap(start_addr, len) != 0) ABORT("munmap failed");
- GC_unmapped_bytes += len;
+# if defined(MSWIN32) || defined(MSWINCE)
+ while (len != 0) {
+ MEMORY_BASIC_INFORMATION mem_info;
+ GC_word free_len;
+ if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info))
+ != sizeof(mem_info))
+ ABORT("Weird VirtualQuery result");
+ free_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize;
+ if (!VirtualFree(start_addr, free_len, MEM_DECOMMIT))
+ ABORT("VirtualFree failed");
+ GC_unmapped_bytes += free_len;
+ start_addr += free_len;
+ len -= free_len;
+ }
+# else
+ if (len != 0 && munmap(start_addr, len) != 0) ABORT("munmap failed");
+ GC_unmapped_bytes += len;
+# endif
}
#endif /* USE_MUNMAP */
/* Routine for pushing any additional roots. In THREADS */
/* environment, this is also responsible for marking from */
-/* thread stacks. In the SRC_M3 case, it also handles */
-/* global variables. */
+/* thread stacks. */
#ifndef THREADS
void (*GC_push_other_roots)() = 0;
#else /* THREADS */
@@ -1358,7 +1569,7 @@ PCR_ERes GC_push_old_obj(void *p, size_t size, PCR_Any data)
}
-void GC_default_push_other_roots()
+void GC_default_push_other_roots GC_PROTO((void))
{
/* Traverse data allocated by previous memory managers. */
{
@@ -1386,6 +1597,10 @@ void GC_default_push_other_roots()
--> misconfigured
# endif
+void GC_push_thread_structures GC_PROTO((void))
+{
+ /* Not our responsibibility. */
+}
extern void ThreadF__ProcessStacks();
@@ -1403,37 +1618,19 @@ int dummy3;
{
word q = *p;
- if ((ptr_t)(q) >= GC_least_plausible_heap_addr
- && (ptr_t)(q) < GC_greatest_plausible_heap_addr) {
- GC_push_one_checked(q,FALSE);
- }
+ GC_PUSH_ONE_STACK(q, p);
}
/* M3 set equivalent to RTHeap.TracedRefTypes */
typedef struct { int elts[1]; } RefTypeSet;
RefTypeSet GC_TracedRefTypes = {{0x1}};
-/* From finalize.c */
-extern void GC_push_finalizer_structures();
-
-/* From stubborn.c: */
-# ifdef STUBBORN_ALLOC
- extern GC_PTR * GC_changing_list_start;
-# endif
-
-
-void GC_default_push_other_roots()
+void GC_default_push_other_roots GC_PROTO((void))
{
- /* Use the M3 provided routine for finding static roots. */
- /* This is a bit dubious, since it presumes no C roots. */
- /* We handle the collector roots explicitly. */
- {
-# ifdef STUBBORN_ALLOC
- GC_push_one(GC_changing_list_start);
-# endif
- GC_push_finalizer_structures();
- RTMain__GlobalMapProc(GC_m3_push_root, 0, GC_TracedRefTypes);
- }
+ /* Use the M3 provided routine for finding static roots. */
+ /* This is a bit dubious, since it presumes no C roots. */
+ /* We handle the collector roots explicitly in GC_push_roots */
+ RTMain__GlobalMapProc(GC_m3_push_root, 0, GC_TracedRefTypes);
if (GC_words_allocd > 0) {
ThreadF__ProcessStacks(GC_push_thread_stack);
}
@@ -1445,24 +1642,24 @@ void GC_default_push_other_roots()
# if defined(SOLARIS_THREADS) || defined(WIN32_THREADS) \
|| defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(IRIX_PCR_THREADS)
+ || defined(HPUX_THREADS)
extern void GC_push_all_stacks();
-void GC_default_push_other_roots()
+void GC_default_push_other_roots GC_PROTO((void))
{
GC_push_all_stacks();
}
# endif /* SOLARIS_THREADS || ... */
-void (*GC_push_other_roots)() = GC_default_push_other_roots;
+void (*GC_push_other_roots) GC_PROTO((void)) = GC_default_push_other_roots;
#endif
/*
* Routines for accessing dirty bits on virtual pages.
- * We plan to eventaually implement four strategies for doing so:
+ * We plan to eventually implement four strategies for doing so:
* DEFAULT_VDB: A simple dummy implementation that treats every page
* as possibly dirty. This makes incremental collection
* useless, but the implementation is still correct.
@@ -1565,26 +1762,28 @@ struct hblk *h;
* not to work under a number of other systems.
*/
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
# include <sys/mman.h>
# include <signal.h>
# include <sys/syscall.h>
# define PROTECT(addr, len) \
- if (mprotect((caddr_t)(addr), (int)(len), \
+ if (mprotect((caddr_t)(addr), (size_t)(len), \
PROT_READ | OPT_PROT_EXEC) < 0) { \
ABORT("mprotect failed"); \
}
# define UNPROTECT(addr, len) \
- if (mprotect((caddr_t)(addr), (int)(len), \
+ if (mprotect((caddr_t)(addr), (size_t)(len), \
PROT_WRITE | PROT_READ | OPT_PROT_EXEC ) < 0) { \
ABORT("un-mprotect failed"); \
}
# else
-# include <signal.h>
+# ifndef MSWINCE
+# include <signal.h>
+# endif
static DWORD protect_junk;
# define PROTECT(addr, len) \
@@ -1605,30 +1804,57 @@ struct hblk *h;
#if defined(SUNOS4) || defined(FREEBSD)
typedef void (* SIG_PF)();
#endif
-#if defined(SUNOS5SIGS) || defined(OSF1) || defined(LINUX)
+#if defined(SUNOS5SIGS) || defined(OSF1) || defined(LINUX) \
+ || defined(MACOSX) || defined(HURD)
+# ifdef __STDC__
typedef void (* SIG_PF)(int);
+# else
+ typedef void (* SIG_PF)();
+# endif
#endif
#if defined(MSWIN32)
typedef LPTOP_LEVEL_EXCEPTION_FILTER SIG_PF;
# undef SIG_DFL
# define SIG_DFL (LPTOP_LEVEL_EXCEPTION_FILTER) (-1)
#endif
+#if defined(MSWINCE)
+ typedef LONG (WINAPI *SIG_PF)(struct _EXCEPTION_POINTERS *);
+# undef SIG_DFL
+# define SIG_DFL (SIG_PF) (-1)
+#endif
-#if defined(IRIX5) || defined(OSF1)
+#if defined(IRIX5) || defined(OSF1) || defined(HURD)
typedef void (* REAL_SIG_PF)(int, int, struct sigcontext *);
#endif
#if defined(SUNOS5SIGS)
- typedef void (* REAL_SIG_PF)(int, struct siginfo *, void *);
+# ifdef HPUX
+# define SIGINFO __siginfo
+# else
+# define SIGINFO siginfo
+# endif
+# ifdef __STDC__
+ typedef void (* REAL_SIG_PF)(int, struct SIGINFO *, void *);
+# else
+ typedef void (* REAL_SIG_PF)();
+# endif
#endif
#if defined(LINUX)
# include <linux/version.h>
-# if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA)
+# if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA) || defined(IA64)
typedef struct sigcontext s_c;
# else
typedef struct sigcontext_struct s_c;
# endif
+# if defined(ALPHA) || defined(M68K)
+ typedef void (* REAL_SIG_PF)(int, int, s_c *);
+# else
+# if defined(IA64) || defined(HP_PA)
+ typedef void (* REAL_SIG_PF)(int, siginfo_t *, s_c *);
+# else
+ typedef void (* REAL_SIG_PF)(int, s_c);
+# endif
+# endif
# ifdef ALPHA
- typedef void (* REAL_SIG_PF)(int, int, s_c *);
/* Retrieve fault address from sigcontext structure by decoding */
/* instruction. */
char * get_fault_addr(s_c *sc) {
@@ -1640,14 +1866,187 @@ struct hblk *h;
faultaddr += (word) (((int)instr << 16) >> 16);
return (char *)faultaddr;
}
-# else /* !ALPHA */
- typedef void (* REAL_SIG_PF)(int, s_c);
# endif /* !ALPHA */
# endif
+# if defined(MACOSX) /* Should also test for PowerPC? */
+ typedef void (* REAL_SIG_PF)(int, int, struct sigcontext *);
+
+/* Decodes the machine instruction which was responsible for the sending of the
+ SIGBUS signal. Sadly this is the only way to find the faulting address because
+ the signal handler doesn't get it directly from the kernel (although it is
+ available on the Mach level, but droppped by the BSD personality before it
+ calls our signal handler...)
+ This code should be able to deal correctly with all PPCs starting from the
+ 601 up to and including the G4s (including Velocity Engine). */
+#define EXTRACT_OP1(iw) (((iw) & 0xFC000000) >> 26)
+#define EXTRACT_OP2(iw) (((iw) & 0x000007FE) >> 1)
+#define EXTRACT_REGA(iw) (((iw) & 0x001F0000) >> 16)
+#define EXTRACT_REGB(iw) (((iw) & 0x03E00000) >> 21)
+#define EXTRACT_REGC(iw) (((iw) & 0x0000F800) >> 11)
+#define EXTRACT_DISP(iw) ((short *) &(iw))[1]
+
+static char *get_fault_addr(struct sigcontext *scp)
+{
+ unsigned int instr = *((unsigned int *) scp->sc_ir);
+ unsigned int * regs = &((unsigned int *) scp->sc_regs)[2];
+ int disp = 0, tmp;
+ unsigned int baseA = 0, baseB = 0;
+ unsigned int addr, alignmask = 0xFFFFFFFF;
+
+#ifdef GC_DEBUG_DECODER
+ GC_err_printf1("Instruction: 0x%lx\n", instr);
+ GC_err_printf1("Opcode 1: d\n", (int)EXTRACT_OP1(instr));
+#endif
+ switch(EXTRACT_OP1(instr)) {
+ case 38: /* stb */
+ case 39: /* stbu */
+ case 54: /* stfd */
+ case 55: /* stfdu */
+ case 52: /* stfs */
+ case 53: /* stfsu */
+ case 44: /* sth */
+ case 45: /* sthu */
+ case 47: /* stmw */
+ case 36: /* stw */
+ case 37: /* stwu */
+ tmp = EXTRACT_REGA(instr);
+ if(tmp > 0)
+ baseA = regs[tmp];
+ disp = EXTRACT_DISP(instr);
+ break;
+ case 31:
+#ifdef GC_DEBUG_DECODER
+ GC_err_printf1("Opcode 2: %d\n", (int)EXTRACT_OP2(instr));
+#endif
+ switch(EXTRACT_OP2(instr)) {
+ case 86: /* dcbf */
+ case 54: /* dcbst */
+ case 1014: /* dcbz */
+ case 247: /* stbux */
+ case 215: /* stbx */
+ case 759: /* stfdux */
+ case 727: /* stfdx */
+ case 983: /* stfiwx */
+ case 695: /* stfsux */
+ case 663: /* stfsx */
+ case 918: /* sthbrx */
+ case 439: /* sthux */
+ case 407: /* sthx */
+ case 661: /* stswx */
+ case 662: /* stwbrx */
+ case 150: /* stwcx. */
+ case 183: /* stwux */
+ case 151: /* stwx */
+ case 135: /* stvebx */
+ case 167: /* stvehx */
+ case 199: /* stvewx */
+ case 231: /* stvx */
+ case 487: /* stvxl */
+ tmp = EXTRACT_REGA(instr);
+ if(tmp > 0)
+ baseA = regs[tmp];
+ baseB = regs[EXTRACT_REGC(instr)];
+ /* determine Altivec alignment mask */
+ switch(EXTRACT_OP2(instr)) {
+ case 167: /* stvehx */
+ alignmask = 0xFFFFFFFE;
+ break;
+ case 199: /* stvewx */
+ alignmask = 0xFFFFFFFC;
+ break;
+ case 231: /* stvx */
+ alignmask = 0xFFFFFFF0;
+ break;
+ case 487: /* stvxl */
+ alignmask = 0xFFFFFFF0;
+ break;
+ }
+ break;
+ case 725: /* stswi */
+ tmp = EXTRACT_REGA(instr);
+ if(tmp > 0)
+ baseA = regs[tmp];
+ break;
+ default: /* ignore instruction */
+#ifdef GC_DEBUG_DECODER
+ GC_err_printf("Ignored by inner handler\n");
+#endif
+ return NULL;
+ break;
+ }
+ break;
+ default: /* ignore instruction */
+#ifdef GC_DEBUG_DECODER
+ GC_err_printf("Ignored by main handler\n");
+#endif
+ return NULL;
+ break;
+ }
+
+ addr = (baseA + baseB) + disp;
+ addr &= alignmask;
+#ifdef GC_DEBUG_DECODER
+ GC_err_printf1("BaseA: %d\n", baseA);
+ GC_err_printf1("BaseB: %d\n", baseB);
+ GC_err_printf1("Disp: %d\n", disp);
+ GC_err_printf1("Address: %d\n", addr);
+#endif
+ return (char *)addr;
+}
+#endif /* MACOSX */
+
SIG_PF GC_old_bus_handler;
SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
+#ifdef THREADS
+/* We need to lock around the bitmap update in the write fault handler */
+/* in order to avoid the risk of losing a bit. We do this with a */
+/* test-and-set spin lock if we know how to do that. Otherwise we */
+/* check whether we are already in the handler and use the dumb but */
+/* safe fallback algorithm of setting all bits in the word. */
+/* Contention should be very rare, so we do the minimum to handle it */
+/* correctly. */
+#ifdef GC_TEST_AND_SET_DEFINED
+ static VOLATILE unsigned int fault_handler_lock = 0;
+ void async_set_pht_entry_from_index(VOLATILE page_hash_table db, int index) {
+ while (GC_test_and_set(&fault_handler_lock)) {}
+ /* Could also revert to set_pht_entry_from_index_safe if initial */
+ /* GC_test_and_set fails. */
+ set_pht_entry_from_index(db, index);
+ GC_clear(&fault_handler_lock);
+ }
+#else /* !GC_TEST_AND_SET_DEFINED */
+ /* THIS IS INCORRECT! The dirty bit vector may be temporarily wrong, */
+ /* just before we notice the conflict and correct it. We may end up */
+ /* looking at it while it's wrong. But this requires contention */
+ /* exactly when a GC is triggered, which seems far less likely to */
+ /* fail than the old code, which had no reported failures. Thus we */
+ /* leave it this way while we think of something better, or support */
+ /* GC_test_and_set on the remaining platforms. */
+ static VOLATILE word currently_updating = 0;
+ void async_set_pht_entry_from_index(VOLATILE page_hash_table db, int index) {
+ unsigned int update_dummy;
+ currently_updating = (word)(&update_dummy);
+ set_pht_entry_from_index(db, index);
+ /* If we get contention in the 10 or so instruction window here, */
+ /* and we get stopped by a GC between the two updates, we lose! */
+ if (currently_updating != (word)(&update_dummy)) {
+ set_pht_entry_from_index_safe(db, index);
+ /* We claim that if two threads concurrently try to update the */
+ /* dirty bit vector, the first one to execute UPDATE_START */
+ /* will see it changed when UPDATE_END is executed. (Note that */
+ /* &update_dummy must differ in two distinct threads.) It */
+ /* will then execute set_pht_entry_from_index_safe, thus */
+ /* returning us to a safe state, though not soon enough. */
+ }
+ }
+#endif /* !GC_TEST_AND_SET_DEFINED */
+#else /* !THREADS */
+# define async_set_pht_entry_from_index(db, index) \
+ set_pht_entry_from_index(db, index)
+#endif /* !THREADS */
+
/*ARGSUSED*/
# if defined (SUNOS4) || defined(FREEBSD)
void GC_write_fault_handler(sig, code, scp, addr)
@@ -1665,43 +2064,78 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
# define CODE_OK (code == BUS_PAGE_FAULT)
# endif
# endif
-# if defined(IRIX5) || defined(OSF1)
+# if defined(IRIX5) || defined(OSF1) || defined(HURD)
# include <errno.h>
void GC_write_fault_handler(int sig, int code, struct sigcontext *scp)
-# define SIG_OK (sig == SIGSEGV)
# ifdef OSF1
+# define SIG_OK (sig == SIGSEGV)
# define CODE_OK (code == 2 /* experimentally determined */)
# endif
# ifdef IRIX5
+# define SIG_OK (sig == SIGSEGV)
# define CODE_OK (code == EACCES)
# endif
+# ifdef HURD
+# define SIG_OK (sig == SIGBUS || sig == SIGSEGV)
+# define CODE_OK TRUE
+# endif
# endif
# if defined(LINUX)
-# ifdef ALPHA
+# if defined(ALPHA) || defined(M68K)
void GC_write_fault_handler(int sig, int code, s_c * sc)
# else
- void GC_write_fault_handler(int sig, s_c sc)
+# if defined(IA64) || defined(HP_PA)
+ void GC_write_fault_handler(int sig, siginfo_t * si, s_c * scp)
+# else
+ void GC_write_fault_handler(int sig, s_c sc)
+# endif
# endif
# define SIG_OK (sig == SIGSEGV)
# define CODE_OK TRUE
- /* Empirically c.trapno == 14, but is that useful? */
- /* We assume Intel architecture, so alignment */
- /* faults are not possible. */
+ /* Empirically c.trapno == 14, on IA32, but is that useful? */
+ /* Should probably consider alignment issues on other */
+ /* architectures. */
# endif
# if defined(SUNOS5SIGS)
- void GC_write_fault_handler(int sig, struct siginfo *scp, void * context)
-# define SIG_OK (sig == SIGSEGV)
-# define CODE_OK (scp -> si_code == SEGV_ACCERR)
+# ifdef __STDC__
+ void GC_write_fault_handler(int sig, struct SIGINFO *scp, void * context)
+# else
+ void GC_write_fault_handler(sig, scp, context)
+ int sig;
+ struct SIGINFO *scp;
+ void * context;
+# endif
+# ifdef HPUX
+# define SIG_OK (sig == SIGSEGV || sig == SIGBUS)
+# define CODE_OK (scp -> si_code == SEGV_ACCERR) \
+ || (scp -> si_code == BUS_ADRERR) \
+ || (scp -> si_code == BUS_UNKNOWN) \
+ || (scp -> si_code == SEGV_UNKNOWN) \
+ || (scp -> si_code == BUS_OBJERR)
+# else
+# define SIG_OK (sig == SIGSEGV)
+# define CODE_OK (scp -> si_code == SEGV_ACCERR)
+# endif
+# endif
+
+# if defined(MACOSX)
+ void GC_write_fault_handler(int sig, int code, struct sigcontext *scp)
+# define SIG_OK (sig == SIGBUS)
+# define CODE_OK (code == 0 /* experimentally determined */)
# endif
-# if defined(MSWIN32)
+
+# if defined(MSWIN32) || defined(MSWINCE)
LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info)
# define SIG_OK (exc_info -> ExceptionRecord -> ExceptionCode == \
- EXCEPTION_ACCESS_VIOLATION)
+ STATUS_ACCESS_VIOLATION)
# define CODE_OK (exc_info -> ExceptionRecord -> ExceptionInformation[0] == 1)
/* Write fault */
# endif
{
register unsigned i;
+# if defined(HURD)
+ char *addr = (char *) code;
+# endif
# ifdef IRIX5
char * addr = (char *) (size_t) (scp -> sc_badvaddr);
# endif
@@ -1718,7 +2152,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
# if defined(M68K)
char * addr = NULL;
- struct sigcontext *scp = (struct sigcontext *)(&sc);
+ struct sigcontext *scp = (struct sigcontext *)(sc);
int format = (scp->sc_formatvec >> 12) & 0xf;
unsigned long *framedata = (unsigned long *)(scp + 1);
@@ -1730,6 +2164,10 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
} else if (format == 7) {
/* 68040 */
ea = framedata[3];
+ if (framedata[1] & 0x08000000) {
+ /* correct addr on misaligned access */
+ ea = (ea+4095)&(~4095);
+ }
} else if (format == 4) {
/* 68060 */
ea = framedata[0];
@@ -1743,12 +2181,26 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
# ifdef ALPHA
char * addr = get_fault_addr(sc);
# else
+# if defined(IA64) || defined(HP_PA)
+ char * addr = si -> si_addr;
+ /* I believe this is claimed to work on all platforms for */
+ /* Linux 2.3.47 and later. Hopefully we don't have to */
+ /* worry about earlier kernels on IA64. */
+# else
+# if defined(POWERPC)
+ char * addr = (char *) (sc.regs->dar);
+# else
--> architecture not supported
+# endif
+# endif
# endif
# endif
# endif
# endif
-# if defined(MSWIN32)
+# if defined(MACOSX)
+ char * addr = get_fault_addr(scp);
+# endif
+# if defined(MSWIN32) || defined(MSWINCE)
char * addr = (char *) (exc_info -> ExceptionRecord
-> ExceptionInformation[1]);
# define sig SIGSEGV
@@ -1780,7 +2232,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
old_handler = GC_old_bus_handler;
}
if (old_handler == SIG_DFL) {
-# ifndef MSWIN32
+# if !defined(MSWIN32) && !defined(MSWINCE)
GC_err_printf1("Segfault at 0x%lx\n", addr);
ABORT("Unexpected bus error or segmentation fault");
# else
@@ -1796,41 +2248,59 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
return;
# endif
# if defined (LINUX)
-# ifdef ALPHA
+# if defined(ALPHA) || defined(M68K)
(*(REAL_SIG_PF)old_handler) (sig, code, sc);
# else
+# if defined(IA64) || defined(HP_PA)
+ (*(REAL_SIG_PF)old_handler) (sig, si, scp);
+# else
(*(REAL_SIG_PF)old_handler) (sig, sc);
+# endif
# endif
return;
# endif
-# if defined (IRIX5) || defined(OSF1)
+# if defined (IRIX5) || defined(OSF1) || defined(HURD)
(*(REAL_SIG_PF)old_handler) (sig, code, scp);
return;
# endif
+# ifdef MACOSX
+ (*(REAL_SIG_PF)old_handler) (sig, code, scp);
+# endif
# ifdef MSWIN32
return((*old_handler)(exc_info));
# endif
}
}
+ UNPROTECT(h, GC_page_size);
+ /* We need to make sure that no collection occurs between */
+ /* the UNPROTECT and the setting of the dirty bit. Otherwise */
+ /* a write by a third thread might go unnoticed. Reversing */
+ /* the order is just as bad, since we would end up unprotecting */
+ /* a page in a GC cycle during which it's not marked. */
+ /* Currently we do this by disabling the thread stopping */
+ /* signals while this handler is running. An alternative might */
+ /* be to record the fact that we're about to unprotect, or */
+ /* have just unprotected a page in the GC's thread structure, */
+ /* and then to have the thread stopping code set the dirty */
+ /* flag, if necessary. */
for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
register int index = PHT_HASH(h+i);
- set_pht_entry_from_index(GC_dirty_pages, index);
+ async_set_pht_entry_from_index(GC_dirty_pages, index);
}
- UNPROTECT(h, GC_page_size);
-# if defined(OSF1) || defined(LINUX)
+# if defined(OSF1)
/* These reset the signal handler each time by default. */
signal(SIGSEGV, (SIG_PF) GC_write_fault_handler);
# endif
/* The write may not take place before dirty bits are read. */
/* But then we'll fault again ... */
-# ifdef MSWIN32
+# if defined(MSWIN32) || defined(MSWINCE)
return(EXCEPTION_CONTINUE_EXECUTION);
# else
return;
# endif
}
-#ifdef MSWIN32
+#if defined(MSWIN32) || defined(MSWINCE)
return EXCEPTION_CONTINUE_SEARCH;
#else
GC_err_printf1("Segfault at 0x%lx\n", addr);
@@ -1857,7 +2327,7 @@ struct hblk *h;
if (!get_pht_entry_from_index(GC_dirty_pages, index)) {
found_clean = TRUE;
- set_pht_entry_from_index(GC_dirty_pages, index);
+ async_set_pht_entry_from_index(GC_dirty_pages, index);
}
}
if (found_clean) {
@@ -1867,17 +2337,33 @@ struct hblk *h;
void GC_dirty_init()
{
-#if defined(SUNOS5SIGS) || defined(IRIX5) /* || defined(OSF1) */
- struct sigaction act, oldact;
-# ifdef IRIX5
+# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(LINUX) || \
+ defined(OSF1) || defined(HURD)
+ struct sigaction act, oldact;
+ /* We should probably specify SA_SIGINFO for Linux, and handle */
+ /* the different architectures more uniformly. */
+# if defined(IRIX5) || defined(LINUX) || defined(OSF1) || defined(HURD)
act.sa_flags = SA_RESTART;
- act.sa_handler = GC_write_fault_handler;
-# else
+ act.sa_handler = (SIG_PF)GC_write_fault_handler;
+# else
act.sa_flags = SA_RESTART | SA_SIGINFO;
act.sa_sigaction = GC_write_fault_handler;
+# endif
+ (void)sigemptyset(&act.sa_mask);
+# ifdef SIG_SUSPEND
+ /* Arrange to postpone SIG_SUSPEND while we're in a write fault */
+ /* handler. This effectively makes the handler atomic w.r.t. */
+ /* stopping the world for GC. */
+ (void)sigaddset(&act.sa_mask, SIG_SUSPEND);
+# endif /* SIG_SUSPEND */
+# endif
+# if defined(MACOSX)
+ struct sigaction act, oldact;
+
+ act.sa_flags = SA_RESTART;
+ act.sa_handler = GC_write_fault_handler;
+ sigemptyset(&act.sa_mask);
# endif
- (void)sigemptyset(&act.sa_mask);
-#endif
# ifdef PRINTSTATS
GC_printf0("Inititalizing mprotect virtual dirty bit implementation\n");
# endif
@@ -1898,7 +2384,7 @@ void GC_dirty_init()
# endif
}
# endif
-# if defined(OSF1) || defined(SUNOS4) || defined(LINUX)
+# if defined(SUNOS4)
GC_old_segv_handler = signal(SIGSEGV, (SIG_PF)GC_write_fault_handler);
if (GC_old_segv_handler == SIG_IGN) {
GC_err_printf0("Previously ignored segmentation violation!?");
@@ -1910,18 +2396,20 @@ void GC_dirty_init()
# endif
}
# endif
-# if defined(SUNOS5SIGS) || defined(IRIX5)
-# if defined(IRIX_THREADS) || defined(IRIX_PCR_THREADS)
+# if defined(SUNOS5SIGS) || defined(IRIX5) || defined(LINUX) \
+ || defined(OSF1) || defined(HURD)
+ /* SUNOS5SIGS includes HPUX */
+# if defined(IRIX_THREADS)
sigaction(SIGSEGV, 0, &oldact);
sigaction(SIGSEGV, &act, 0);
# else
sigaction(SIGSEGV, &act, &oldact);
# endif
-# if defined(_sigargs)
+# if defined(_sigargs) || defined(HURD)
/* This is Irix 5.x, not 6.x. Irix 5.x does not have */
/* sa_sigaction. */
GC_old_segv_handler = oldact.sa_handler;
-# else /* Irix 6.x or SUNOS5SIGS */
+# else /* Irix 6.x or SUNOS5SIGS or LINUX */
if (oldact.sa_flags & SA_SIGINFO) {
GC_old_segv_handler = (SIG_PF)(oldact.sa_sigaction);
} else {
@@ -1937,7 +2425,20 @@ void GC_dirty_init()
GC_err_printf0("Replaced other SIGSEGV handler\n");
# endif
}
-# endif
+# endif
+# if defined(MACOSX) || defined(HPUX) || defined(LINUX) || defined(HURD)
+ sigaction(SIGBUS, &act, &oldact);
+ GC_old_bus_handler = oldact.sa_handler;
+ if (GC_old_bus_handler == SIG_IGN) {
+ GC_err_printf0("Previously ignored bus error!?");
+ GC_old_bus_handler = SIG_DFL;
+ }
+ if (GC_old_bus_handler != SIG_DFL) {
+# ifdef PRINTSTATS
+ GC_err_printf0("Replaced other SIGBUS handler\n");
+# endif
+ }
+# endif /* MACOS || HPUX || LINUX */
# if defined(MSWIN32)
GC_old_segv_handler = SetUnhandledExceptionFilter(GC_write_fault_handler);
if (GC_old_segv_handler != NULL) {
@@ -1990,15 +2491,23 @@ struct hblk * h;
* happens to work.
* On other systems, SET_LOCK_HOLDER and friends must be suitably defined.
*/
+
+static GC_bool syscall_acquired_lock = FALSE; /* Protected by GC lock. */
void GC_begin_syscall()
{
- if (!I_HOLD_LOCK()) LOCK();
+ if (!I_HOLD_LOCK()) {
+ LOCK();
+ syscall_acquired_lock = TRUE;
+ }
}
void GC_end_syscall()
{
- if (!I_HOLD_LOCK()) UNLOCK();
+ if (syscall_acquired_lock) {
+ syscall_acquired_lock = FALSE;
+ UNLOCK();
+ }
}
void GC_unprotect_range(addr, len)
@@ -2022,18 +2531,20 @@ word len;
for (h = start_block; h <= end_block; h++) {
register word index = PHT_HASH(h);
- set_pht_entry_from_index(GC_dirty_pages, index);
+ async_set_pht_entry_from_index(GC_dirty_pages, index);
}
UNPROTECT(start_block,
((ptr_t)end_block - (ptr_t)start_block) + HBLKSIZE);
}
-#ifndef MSWIN32
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(LINUX_THREADS) \
+ && !defined(GC_USE_LD_WRAP)
/* Replacement for UNIX system call. */
/* Other calls that write to the heap */
/* should be handled similarly. */
# if defined(__STDC__) && !defined(SUNOS4)
# include <unistd.h>
+# include <sys/uio.h>
ssize_t read(int fd, void *buf, size_t nbyte)
# else
# ifndef LINT
@@ -2050,10 +2561,12 @@ word len;
GC_begin_syscall();
GC_unprotect_range(buf, (word)nbyte);
-# ifdef IRIX5
+# if defined(IRIX5) || defined(LINUX_THREADS)
/* Indirect system call may not always be easily available. */
/* We could call _read, but that would interfere with the */
/* libpthread interception of read. */
+ /* On Linux, we have to be careful with the linuxthreads */
+ /* read interception. */
{
struct iovec iov;
@@ -2062,12 +2575,41 @@ word len;
result = readv(fd, &iov, 1);
}
# else
- result = syscall(SYS_read, fd, buf, nbyte);
+# if defined(HURD)
+ result = __read(fd, buf, nbyte);
+# else
+ /* The two zero args at the end of this list are because one
+ IA-64 syscall() implementation actually requires six args
+ to be passed, even though they aren't always used. */
+ result = syscall(SYS_read, fd, buf, nbyte, 0, 0);
+# endif /* !HURD */
# endif
GC_end_syscall();
return(result);
}
-#endif /* !MSWIN32 */
+#endif /* !MSWIN32 && !MSWINCE && !LINUX_THREADS */
+
+#ifdef GC_USE_LD_WRAP
+ /* We use the GNU ld call wrapping facility. */
+ /* This requires that the linker be invoked with "--wrap read". */
+ /* This can be done by passing -Wl,"--wrap read" to gcc. */
+ /* I'm not sure that this actually wraps whatever version of read */
+ /* is called by stdio. That code also mentions __read. */
+# include <unistd.h>
+ ssize_t __wrap_read(int fd, void *buf, size_t nbyte)
+ {
+ int result;
+
+ GC_begin_syscall();
+ GC_unprotect_range(buf, (word)nbyte);
+ result = __real_read(fd, buf, nbyte);
+ GC_end_syscall();
+ return(result);
+ }
+
+ /* We should probably also do this for __read, or whatever stdio */
+ /* actually calls. */
+#endif
/*ARGSUSED*/
GC_bool GC_page_was_ever_dirty(h)
@@ -2084,6 +2626,13 @@ word n;
{
}
+# else /* !MPROTECT_VDB */
+
+# ifdef GC_USE_LD_WRAP
+ ssize_t __wrap_read(int fd, void *buf, size_t nbyte)
+ { return __real_read(fd, buf, nbyte); }
+# endif
+
# endif /* MPROTECT_VDB */
# ifdef PROC_VDB
@@ -2106,7 +2655,6 @@ word n;
#include <sys/syscall.h>
#include <sys/procfs.h>
#include <sys/stat.h>
-#include <fcntl.h>
#define INITIAL_BUF_SZ 4096
word GC_proc_buf_size = INITIAL_BUF_SZ;
@@ -2402,29 +2950,56 @@ struct hblk *h;
* Call stack save code for debugging.
* Should probably be in mach_dep.c, but that requires reorganization.
*/
-#if defined(SPARC) && !defined(LINUX)
-# if defined(SUNOS4)
-# include <machine/frame.h>
-# else
-# if defined (DRSNX)
-# include <sys/sparc/frame.h>
-# else
-# if defined(OPENBSD)
-# include <frame.h>
-# else
-# include <sys/frame.h>
-# endif
-# endif
-# endif
-# if NARGS > 6
+
+/* I suspect the following works for most X86 *nix variants, so */
+/* long as the frame pointer is explicitly stored. In the case of gcc, */
+/* compiler flags (e.g. -fomit-frame-pointer) determine whether it is. */
+#if defined(I386) && defined(LINUX) && defined(SAVE_CALL_CHAIN)
+ struct frame {
+ struct frame *fr_savfp;
+ long fr_savpc;
+ long fr_arg[NARGS]; /* All the arguments go here. */
+ };
+#endif
+
+#if defined(SPARC)
+# if defined(LINUX)
+ struct frame {
+ long fr_local[8];
+ long fr_arg[6];
+ struct frame *fr_savfp;
+ long fr_savpc;
+# ifndef __arch64__
+ char *fr_stret;
+# endif
+ long fr_argd[6];
+ long fr_argx[0];
+ };
+# else
+# if defined(SUNOS4)
+# include <machine/frame.h>
+# else
+# if defined (DRSNX)
+# include <sys/sparc/frame.h>
+# else
+# if defined(OPENBSD) || defined(NETBSD)
+# include <frame.h>
+# else
+# include <sys/frame.h>
+# endif
+# endif
+# endif
+# endif
+# if NARGS > 6
--> We only know how to to get the first 6 arguments
-# endif
+# endif
+#endif /* SPARC */
#ifdef SAVE_CALL_CHAIN
/* Fill in the pc and argument information for up to NFRAMES of my */
/* callers. Ignore my frame and my callers frame. */
-#ifdef OPENBSD
+#if (defined(OPENBSD) || defined(NETBSD)) && defined(SPARC)
# define FR_SAVFP fr_fp
# define FR_SAVPC fr_pc
#else
@@ -2432,30 +3007,95 @@ struct hblk *h;
# define FR_SAVPC fr_savpc
#endif
+#if defined(SPARC) && (defined(__arch64__) || defined(__sparcv9))
+# define BIAS 2047
+#else
+# define BIAS 0
+#endif
+
void GC_save_callers (info)
struct callinfo info[NFRAMES];
{
struct frame *frame;
struct frame *fp;
int nframes = 0;
- word GC_save_regs_in_stack();
+# ifdef I386
+ /* We assume this is turned on only with gcc as the compiler. */
+ asm("movl %%ebp,%0" : "=r"(frame));
+ fp = frame;
+# else
+ word GC_save_regs_in_stack();
- frame = (struct frame *) GC_save_regs_in_stack ();
+ frame = (struct frame *) GC_save_regs_in_stack ();
+ fp = (struct frame *)((long) frame -> FR_SAVFP + BIAS);
+#endif
- for (fp = frame -> FR_SAVFP; fp != 0 && nframes < NFRAMES;
- fp = fp -> FR_SAVFP, nframes++) {
+ for (; (!(fp HOTTER_THAN frame) && !(GC_stackbottom HOTTER_THAN (ptr_t)fp)
+ && (nframes < NFRAMES));
+ fp = (struct frame *)((long) fp -> FR_SAVFP + BIAS), nframes++) {
register int i;
info[nframes].ci_pc = fp->FR_SAVPC;
- for (i = 0; i < NARGS; i++) {
- info[nframes].ci_arg[i] = ~(fp->fr_arg[i]);
- }
+# if NARGS > 0
+ for (i = 0; i < NARGS; i++) {
+ info[nframes].ci_arg[i] = ~(fp->fr_arg[i]);
+ }
+# endif /* NARGS > 0 */
}
if (nframes < NFRAMES) info[nframes].ci_pc = 0;
}
#endif /* SAVE_CALL_CHAIN */
-#endif /* SPARC */
+#if defined(LINUX) && defined(__ELF__) && \
+ (!defined(SMALL_CONFIG) || defined(USE_PROC_FOR_LIBRARIES))
+#ifdef GC_USE_LD_WRAP
+# define READ __real_read
+#else
+# define READ read
+#endif
+
+
+/* Repeatedly perform a read call until the buffer is filled or */
+/* we encounter EOF. */
+ssize_t GC_repeat_read(int fd, char *buf, size_t count)
+{
+ ssize_t num_read = 0;
+ ssize_t result;
+
+ while (num_read < count) {
+ result = READ(fd, buf + num_read, count - num_read);
+ if (result < 0) return result;
+ if (result == 0) break;
+ num_read += result;
+ }
+ return num_read;
+}
+#endif /* LINUX && ... */
+
+
+#if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG)
+
+/* Dump /proc/self/maps to GC_stderr, to enable looking up names for
+ addresses in FIND_LEAK output. */
+
+void GC_print_address_map()
+{
+ int f;
+ int result;
+ char maps_temp[32768];
+ GC_err_printf0("---------- Begin address map ----------\n");
+ f = open("/proc/self/maps", O_RDONLY);
+ if (-1 == f) ABORT("Couldn't open /proc/self/maps");
+ do {
+ result = GC_repeat_read(f, maps_temp, sizeof(maps_temp));
+ if (result <= 0) ABORT("Couldn't read /proc/self/maps");
+ GC_err_write(maps_temp, result);
+ } while (result == sizeof(maps_temp));
+
+ GC_err_printf0("---------- End address map ----------\n");
+}
+
+#endif
diff --git a/gc/pc_excludes b/gc/pc_excludes
@@ -1,4 +1,6 @@
solaris_threads.c
+solaris_pthreads.c
+irix_threads.c
pcr_interface.c
real_malloc.c
mips_mach_dep.s
@@ -8,8 +10,12 @@ sparc_mach_dep.s
PCR-Makefile
setjmp_t.c
callprocs
-gc.man
+doc/gc.man
pc_excludes
barrett_diagram
include/gc_c++.h
-include/gc_inline.h
-\ No newline at end of file
+include/gc_inline.h
+doc/README.hp
+doc/README.rs6000
+doc/README.sgi
+
diff --git a/gc/pcr_interface.c b/gc/pcr_interface.c
@@ -10,8 +10,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, February 7, 1996 11:09 am PST */
-# include "gc_priv.h"
+# include "private/gc_priv.h"
# ifdef PCR
/*
@@ -170,4 +169,10 @@ PCR_GC_Run(void)
return PCR_ERes_okay;
}
+void GC_push_thread_structures(void)
+{
+ /* PCR doesn't work unless static roots are pushed. Can't get here. */
+ ABORT("In GC_push_thread_structures()");
+}
+
# endif
diff --git a/gc/powerpc_macosx_mach_dep.s b/gc/powerpc_macosx_mach_dep.s
@@ -0,0 +1,95 @@
+
+.text
+
+ .set linkageArea,24
+ .set params,4
+ .set alignment,4
+
+ .set spaceToSave,linkageArea+params+alignment
+ .set spaceToSave8,spaceToSave+8
+
+; Mark from machine registers that are saved by C compiler
+ .globl _GC_push_regs
+_GC_push_regs:
+ ; PROLOG
+ mflr r0 ; get return address
+ stw r0,8(r1) ; save return address
+ stwu r1,-spaceToSave(r1) ; skip over caller save area
+ ;
+ mr r3,r2 ; mark from r2. Well Im not really sure
+ ; that this is necessary or even the right
+ ; thing to do - at least it doesnt harm...
+ ; According to Apples docs it points to
+ ; the direct data area, whatever that is...
+ bl L_GC_push_one$stub
+ mr r3,r13 ; mark from r13-r31
+ bl L_GC_push_one$stub
+ mr r3,r14
+ bl L_GC_push_one$stub
+ mr r3,r15
+ bl L_GC_push_one$stub
+ mr r3,r16
+ bl L_GC_push_one$stub
+ mr r3,r17
+ bl L_GC_push_one$stub
+ mr r3,r18
+ bl L_GC_push_one$stub
+ mr r3,r19
+ bl L_GC_push_one$stub
+ mr r3,r20
+ bl L_GC_push_one$stub
+ mr r3,r21
+ bl L_GC_push_one$stub
+ mr r3,r22
+ bl L_GC_push_one$stub
+ mr r3,r23
+ bl L_GC_push_one$stub
+ mr r3,r24
+ bl L_GC_push_one$stub
+ mr r3,r25
+ bl L_GC_push_one$stub
+ mr r3,r26
+ bl L_GC_push_one$stub
+ mr r3,r27
+ bl L_GC_push_one$stub
+ mr r3,r28
+ bl L_GC_push_one$stub
+ mr r3,r29
+ bl L_GC_push_one$stub
+ mr r3,r30
+ bl L_GC_push_one$stub
+ mr r3,r31
+ bl L_GC_push_one$stub
+ ; EPILOG
+ lwz r0,spaceToSave8(r1) ; get return address back
+ mtlr r0 ; reset link register
+ addic r1,r1,spaceToSave ; restore stack pointer
+ blr
+
+.data
+.picsymbol_stub
+L_GC_push_one$stub:
+ .indirect_symbol _GC_push_one
+ mflr r0
+ bcl 20,31,L0$_GC_push_one
+L0$_GC_push_one:
+ mflr r11
+ addis r11,r11,ha16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)
+ mtlr r0
+ lwz r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11)
+ mtctr r12
+ addi r11,r11,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)
+ bctr
+.data
+.lazy_symbol_pointer
+L_GC_push_one$lazy_ptr:
+ .indirect_symbol _GC_push_one
+ .long dyld_stub_binding_helper
+.non_lazy_symbol_pointer
+L_GC_push_one$non_lazy_ptr:
+ .indirect_symbol _GC_push_one
+ .long 0
+
+
+
+
diff --git a/gc/ptr_chck.c b/gc/ptr_chck.c
@@ -10,10 +10,13 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, September 19, 1995 1:26 pm PDT */
-#include "gc_priv.h"
-#include "gc_mark.h"
+/*
+ * These are checking routines calls to which could be inserted by a
+ * preprocessor to validate C pointer arithmetic.
+ */
+
+#include "private/gc_pmark.h"
#ifdef __STDC__
void GC_default_same_obj_print_proc(GC_PTR p, GC_PTR q)
@@ -69,7 +72,7 @@ void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR, GC_PTR))
h = FORWARDED_ADDR(h, hhdr);
hhdr = HDR(h);
}
- limit = (ptr_t)((word *)h + HDR_WORDS + hhdr -> hb_sz);
+ limit = (ptr_t)((word *)h + hhdr -> hb_sz);
if ((ptr_t)p >= limit || (ptr_t)q >= limit || (ptr_t)q < (ptr_t)h ) {
goto fail;
}
@@ -83,28 +86,19 @@ void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR, GC_PTR))
goto fail;
}
} else {
-# ifdef ALL_INTERIOR_POINTERS
- register map_entry_type map_entry;
- register int pdispl;
-
- pdispl = HBLKDISPL(p);
- map_entry = MAP_ENTRY((hhdr -> hb_map), pdispl);
- if (map_entry == OBJ_INVALID) {
- goto fail;
- } else {
- base = (char *)((word)p & ~(WORDS_TO_BYTES(1) - 1));
- base -= WORDS_TO_BYTES(map_entry);
- }
-# else
- register int offset = HBLKDISPL(p) - HDR_BYTES;
- register word correction = offset % sz;
-
- if (HBLKPTR(p) != HBLKPTR(q)) {
- /* The following computation otherwise fails in this case */
- goto fail;
- }
- base = (ptr_t)p - correction;
-# endif
+ register int map_entry;
+ register int pdispl = HBLKDISPL(p);
+
+ map_entry = MAP_ENTRY((hhdr -> hb_map), pdispl);
+ if (map_entry > CPP_MAX_OFFSET) {
+ map_entry = BYTES_TO_WORDS(pdispl) % BYTES_TO_WORDS(sz);
+ if (HBLKPTR(p) != HBLKPTR(q)) goto fail;
+ /* W/o this check, we might miss an error if */
+ /* q points to the first object on a page, and */
+ /* points just before the page. */
+ }
+ base = (char *)((word)p & ~(WORDS_TO_BYTES(1) - 1));
+ base -= WORDS_TO_BYTES(map_entry);
limit = base + sz;
}
/* [base, limit) delimits the object containing p, if any. */
@@ -137,7 +131,7 @@ void (*GC_is_valid_displacement_print_proc) GC_PROTO((GC_PTR)) =
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
-/* Uninteresting with ALL_INTERIOR_POINTERS. */
+/* Uninteresting with GC_all_interior_pointers. */
/* Always returns its argument. */
/* Note that we don't lock, since nothing relevant about the header */
/* should change while we have a valid object pointer to the block. */
@@ -158,12 +152,12 @@ void (*GC_is_valid_displacement_print_proc) GC_PROTO((GC_PTR)) =
hhdr = HDR((word)p);
if (hhdr == 0) return(p);
h = HBLKPTR(p);
-# ifdef ALL_INTERIOR_POINTERS
+ if (GC_all_interior_pointers) {
while (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
h = FORWARDED_ADDR(h, hhdr);
hhdr = HDR(h);
}
-# endif
+ }
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
goto fail;
}
@@ -252,7 +246,8 @@ ptr_t p;
if (GC_is_static_root(p)) return(p);
/* Else do it again correctly: */
-# if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(PCR)) \
+# if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || \
+ defined(MSWINCE) || defined(PCR)) \
&& !defined(SRC_M3)
DISABLE_SIGNALS();
GC_register_dynamic_libraries();
@@ -270,23 +265,30 @@ ptr_t p;
if (HBLKPTR(base) != HBLKPTR(p)) hhdr = HDR((word)p);
descr = hhdr -> hb_descr;
retry:
- switch(descr & DS_TAGS) {
- case DS_LENGTH:
+ switch(descr & GC_DS_TAGS) {
+ case GC_DS_LENGTH:
if ((word)((ptr_t)p - (ptr_t)base) > (word)descr) goto fail;
break;
- case DS_BITMAP:
+ case GC_DS_BITMAP:
if ((ptr_t)p - (ptr_t)base
>= WORDS_TO_BYTES(BITMAP_BITS)
|| ((word)p & (sizeof(word) - 1))) goto fail;
if (!((1 << (WORDSZ - ((ptr_t)p - (ptr_t)base) - 1))
& descr)) goto fail;
break;
- case DS_PROC:
+ case GC_DS_PROC:
/* We could try to decipher this partially. */
/* For now we just punt. */
break;
- case DS_PER_OBJECT:
- descr = *(word *)((ptr_t)base + (descr & ~DS_TAGS));
+ case GC_DS_PER_OBJECT:
+ if ((signed_word)descr >= 0) {
+ descr = *(word *)((ptr_t)base + (descr & ~GC_DS_TAGS));
+ } else {
+ ptr_t type_descr = *(ptr_t *)base;
+ descr = *(word *)(type_descr
+ - (descr - (GC_DS_PER_OBJECT
+ - GC_INDIR_PER_OBJ_BIAS)));
+ }
goto retry;
}
return(p);
@@ -305,9 +307,9 @@ size_t how_much;
GC_PTR initial = *p;
GC_PTR result = GC_same_obj((GC_PTR)((word)initial + how_much), initial);
-# ifndef ALL_INTERIOR_POINTERS
+ if (!GC_all_interior_pointers) {
(void) GC_is_valid_displacement(result);
-# endif
+ }
return (*p = result);
}
@@ -318,9 +320,9 @@ size_t how_much;
GC_PTR initial = *p;
GC_PTR result = GC_same_obj((GC_PTR)((word)initial + how_much), initial);
-# ifndef ALL_INTERIOR_POINTERS
+ if (!GC_all_interior_pointers) {
(void) GC_is_valid_displacement(result);
-# endif
+ }
*p = result;
return(initial);
}
diff --git a/gc/reclaim.c b/gc/reclaim.c
@@ -1,6 +1,8 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
+ * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -11,14 +13,20 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, February 15, 1996 2:41 pm PST */
#include <stdio.h>
-#include "gc_priv.h"
+#include "private/gc_priv.h"
signed_word GC_mem_found = 0;
/* Number of words of memory reclaimed */
+#if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+ word GC_fl_builder_count = 0;
+ /* Number of threads currently building free lists without */
+ /* holding GC lock. It is not safe to collect if this is */
+ /* nonzero. */
+#endif /* PARALLEL_MARK */
+
static void report_leak(p, sz)
ptr_t p;
word sz;
@@ -28,13 +36,8 @@ word sz;
} else {
GC_err_printf0("Leaked composite object at ");
}
- if (GC_debugging_started && GC_has_debug_info(p)) {
- GC_print_obj(p);
- } else {
- GC_err_printf2("0x%lx (appr. size = %ld)\n",
- (unsigned long)p,
- (unsigned long)WORDS_TO_BYTES(sz));
- }
+ GC_print_heap_obj(p);
+ GC_err_printf0("\n");
}
# define FOUND_FREE(hblk, word_no) \
@@ -58,19 +61,207 @@ word sz;
GC_bool GC_block_empty(hhdr)
register hdr * hhdr;
{
+ /* We treat hb_marks as an array of words here, even if it is */
+ /* actually an array of bytes. Since we only check for zero, there */
+ /* are no endian-ness issues. */
register word *p = (word *)(&(hhdr -> hb_marks[0]));
register word * plim =
- (word *)(&(hhdr -> hb_marks[MARK_BITS_SZ]));
+ (word *)(&(hhdr -> hb_marks[MARK_BITS_SZ]));
while (p < plim) {
if (*p++) return(FALSE);
}
return(TRUE);
}
-# ifdef GATHERSTATS
+/* The following functions sometimes return a DONT_KNOW value. */
+#define DONT_KNOW 2
+
+#ifdef SMALL_CONFIG
+# define GC_block_nearly_full1(hhdr, pat1) DONT_KNOW
+# define GC_block_nearly_full3(hhdr, pat1, pat2) DONT_KNOW
+# define GC_block_nearly_full(hhdr) DONT_KNOW
+#endif
+
+#if !defined(SMALL_CONFIG) && defined(USE_MARK_BYTES)
+
+# define GC_block_nearly_full1(hhdr, pat1) GC_block_nearly_full(hhdr)
+# define GC_block_nearly_full3(hhdr, pat1, pat2) GC_block_nearly_full(hhdr)
+
+
+GC_bool GC_block_nearly_full(hhdr)
+register hdr * hhdr;
+{
+ /* We again treat hb_marks as an array of words, even though it */
+ /* isn't. We first sum up all the words, resulting in a word */
+ /* containing 4 or 8 separate partial sums. */
+ /* We then sum the bytes in the word of partial sums. */
+ /* This is still endian independant. This fails if the partial */
+ /* sums can overflow. */
+# if (BYTES_TO_WORDS(MARK_BITS_SZ)) >= 256
+ --> potential overflow; fix the code
+# endif
+ register word *p = (word *)(&(hhdr -> hb_marks[0]));
+ register word * plim =
+ (word *)(&(hhdr -> hb_marks[MARK_BITS_SZ]));
+ word sum_vector = 0;
+ unsigned sum;
+ while (p < plim) {
+ sum_vector += *p;
+ ++p;
+ }
+ sum = 0;
+ while (sum_vector > 0) {
+ sum += sum_vector & 0xff;
+ sum_vector >>= 8;
+ }
+ return (sum > BYTES_TO_WORDS(7*HBLKSIZE/8)/(hhdr -> hb_sz));
+}
+#endif /* USE_MARK_BYTES */
+
+#if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
+
+/*
+ * Test whether nearly all of the mark words consist of the same
+ * repeating pattern.
+ */
+#define FULL_THRESHOLD (MARK_BITS_SZ/16)
+
+GC_bool GC_block_nearly_full1(hhdr, pat1)
+hdr *hhdr;
+word pat1;
+{
+ unsigned i;
+ unsigned misses = 0;
+ GC_ASSERT((MARK_BITS_SZ & 1) == 0);
+ for (i = 0; i < MARK_BITS_SZ; ++i) {
+ if ((hhdr -> hb_marks[i] | ~pat1) != ONES) {
+ if (++misses > FULL_THRESHOLD) return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/*
+ * Test whether the same repeating 3 word pattern occurs in nearly
+ * all the mark bit slots.
+ * This is used as a heuristic, so we're a bit sloppy and ignore
+ * the last one or two words.
+ */
+GC_bool GC_block_nearly_full3(hhdr, pat1, pat2, pat3)
+hdr *hhdr;
+word pat1, pat2, pat3;
+{
+ unsigned i;
+ unsigned misses = 0;
+
+ if (MARK_BITS_SZ < 4) {
+ return DONT_KNOW;
+ }
+ for (i = 0; i < MARK_BITS_SZ - 2; i += 3) {
+ if ((hhdr -> hb_marks[i] | ~pat1) != ONES) {
+ if (++misses > FULL_THRESHOLD) return FALSE;
+ }
+ if ((hhdr -> hb_marks[i+1] | ~pat2) != ONES) {
+ if (++misses > FULL_THRESHOLD) return FALSE;
+ }
+ if ((hhdr -> hb_marks[i+2] | ~pat3) != ONES) {
+ if (++misses > FULL_THRESHOLD) return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/* Check whether a small object block is nearly full by looking at only */
+/* the mark bits. */
+/* We manually precomputed the mark bit patterns that need to be */
+/* checked for, and we give up on the ones that are unlikely to occur, */
+/* or have period > 3. */
+/* This would be a lot easier with a mark bit per object instead of per */
+/* word, but that would rewuire computing object numbers in the mark */
+/* loop, which would require different data structures ... */
+GC_bool GC_block_nearly_full(hhdr)
+hdr *hhdr;
+{
+ int sz = hhdr -> hb_sz;
+
+# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
+ return DONT_KNOW; /* Shouldn't be used in any standard config. */
+# endif
+# if CPP_WORDSZ == 32
+ switch(sz) {
+ case 1:
+ return GC_block_nearly_full1(hhdr, 0xffffffffl);
+ case 2:
+ return GC_block_nearly_full1(hhdr, 0x55555555l);
+ case 4:
+ return GC_block_nearly_full1(hhdr, 0x11111111l);
+ case 6:
+ return GC_block_nearly_full3(hhdr, 0x41041041l,
+ 0x10410410l,
+ 0x04104104l);
+ case 8:
+ return GC_block_nearly_full1(hhdr, 0x01010101l);
+ case 12:
+ return GC_block_nearly_full3(hhdr, 0x01001001l,
+ 0x10010010l,
+ 0x00100100l);
+ case 16:
+ return GC_block_nearly_full1(hhdr, 0x00010001l);
+ case 32:
+ return GC_block_nearly_full1(hhdr, 0x00000001l);
+ default:
+ return DONT_KNOW;
+ }
+# endif
+# if CPP_WORDSZ == 64
+ switch(sz) {
+ case 1:
+ return GC_block_nearly_full1(hhdr, 0xffffffffffffffffl);
+ case 2:
+ return GC_block_nearly_full1(hhdr, 0x5555555555555555l);
+ case 4:
+ return GC_block_nearly_full1(hhdr, 0x1111111111111111l);
+ case 6:
+ return GC_block_nearly_full3(hhdr, 0x1041041041041041l,
+ 0x4104104104104104l,
+ 0x0410410410410410l);
+ case 8:
+ return GC_block_nearly_full1(hhdr, 0x0101010101010101l);
+ case 12:
+ return GC_block_nearly_full3(hhdr, 0x1001001001001001l,
+ 0x0100100100100100l,
+ 0x0010010010010010l);
+ case 16:
+ return GC_block_nearly_full1(hhdr, 0x0001000100010001l);
+ case 32:
+ return GC_block_nearly_full1(hhdr, 0x0000000100000001l);
+ default:
+ return DONT_KNOW;
+ }
+# endif
+}
+#endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
+
+/* We keep track of reclaimed memory if we are either asked to, or */
+/* we are using the parallel marker. In the latter case, we assume */
+/* that most allocation goes through GC_malloc_many for scalability. */
+/* GC_malloc_many needs the count anyway. */
+# if defined(GATHERSTATS) || defined(PARALLEL_MARK)
# define INCR_WORDS(sz) n_words_found += (sz)
+# define COUNT_PARAM , count
+# define COUNT_ARG , count
+# define COUNT_DECL signed_word * count;
+# define NWORDS_DECL signed_word n_words_found = 0;
+# define COUNT_UPDATE *count += n_words_found;
+# define MEM_FOUND_ADDR , &GC_mem_found
# else
# define INCR_WORDS(sz)
+# define COUNT_PARAM
+# define COUNT_ARG
+# define COUNT_DECL
+# define NWORDS_DECL
+# define COUNT_UPDATE
+# define MEM_FOUND_ADDR
# endif
/*
* Restore unmarked small objects in h of size sz to the object
@@ -78,20 +269,20 @@ register hdr * hhdr;
* Clears unmarked objects.
*/
/*ARGSUSED*/
-ptr_t GC_reclaim_clear(hbp, hhdr, sz, list)
+ptr_t GC_reclaim_clear(hbp, hhdr, sz, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
register hdr * hhdr;
register ptr_t list;
register word sz;
+COUNT_DECL
{
register int word_no;
register word *p, *q, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
+ NWORDS_DECL
+ GC_ASSERT(hhdr == GC_find_header((ptr_t)hbp));
p = (word *)(hbp->hb_body);
- word_no = HDR_WORDS;
+ word_no = 0;
plim = (word *)((((word)hbp) + HBLKSIZE)
- WORDS_TO_BYTES(sz));
@@ -106,37 +297,45 @@ register word sz;
list = ((ptr_t)p);
/* Clear object, advance p to next object in the process */
q = p + sz;
- p++; /* Skip link field */
- while (p < q) {
+# ifdef USE_MARK_BYTES
+ GC_ASSERT(!(sz & 1)
+ && !((word)p & (2 * sizeof(word) - 1)));
+ p[1] = 0;
+ p += 2;
+ while (p < q) {
+ CLEAR_DOUBLE(p);
+ p += 2;
+ }
+# else
+ p++; /* Skip link field */
+ while (p < q) {
*p++ = 0;
- }
+ }
+# endif
}
word_no += sz;
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
}
-#ifndef SMALL_CONFIG
+#if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
/*
* A special case for 2 word composite objects (e.g. cons cells):
*/
/*ARGSUSED*/
-ptr_t GC_reclaim_clear2(hbp, hhdr, list)
+ptr_t GC_reclaim_clear2(hbp, hhdr, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
hdr * hhdr;
register ptr_t list;
+COUNT_DECL
{
- register word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ register word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
register word mark_word;
register int i;
+ NWORDS_DECL
# define DO_OBJ(start_displ) \
if (!(mark_word & ((word)1 << start_displ))) { \
p[start_displ] = (word)list; \
@@ -160,9 +359,7 @@ register ptr_t list;
mark_word >>= 8;
}
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
# undef DO_OBJ
}
@@ -171,24 +368,22 @@ register ptr_t list;
* Another special case for 4 word composite objects:
*/
/*ARGSUSED*/
-ptr_t GC_reclaim_clear4(hbp, hhdr, list)
+ptr_t GC_reclaim_clear4(hbp, hhdr, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
hdr * hhdr;
register ptr_t list;
+COUNT_DECL
{
- register word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ register word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
register word mark_word;
+ NWORDS_DECL
# define DO_OBJ(start_displ) \
if (!(mark_word & ((word)1 << start_displ))) { \
p[start_displ] = (word)list; \
list = (ptr_t)(p+start_displ); \
p[start_displ+1] = 0; \
- p[start_displ+2] = 0; \
- p[start_displ+3] = 0; \
+ CLEAR_DOUBLE(p + start_displ + 2); \
INCR_WORDS(4); \
}
@@ -218,31 +413,27 @@ register ptr_t list;
# endif
p += WORDSZ;
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
# undef DO_OBJ
}
-#endif /* !SMALL_CONFIG */
+#endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
/* The same thing, but don't clear objects: */
/*ARGSUSED*/
-ptr_t GC_reclaim_uninit(hbp, hhdr, sz, list)
+ptr_t GC_reclaim_uninit(hbp, hhdr, sz, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
register hdr * hhdr;
register ptr_t list;
register word sz;
+COUNT_DECL
{
- register int word_no;
+ register int word_no = 0;
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
+ NWORDS_DECL
p = (word *)(hbp->hb_body);
- word_no = HDR_WORDS;
plim = (word *)((((word)hbp) + HBLKSIZE)
- WORDS_TO_BYTES(sz));
@@ -257,9 +448,7 @@ register word sz;
p += sz;
word_no += sz;
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
}
@@ -270,14 +459,13 @@ register struct hblk *hbp; /* ptr to current heap block */
register hdr * hhdr;
register word sz;
{
- register int word_no;
+ register int word_no = 0;
register word *p, *plim;
# ifdef GATHERSTATS
register int n_words_found = 0;
# endif
p = (word *)(hbp->hb_body);
- word_no = HDR_WORDS;
plim = (word *)((((word)hbp) + HBLKSIZE)
- WORDS_TO_BYTES(sz));
@@ -291,23 +479,22 @@ register word sz;
}
}
-#ifndef SMALL_CONFIG
+#if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
/*
* Another special case for 2 word atomic objects:
*/
/*ARGSUSED*/
-ptr_t GC_reclaim_uninit2(hbp, hhdr, list)
+ptr_t GC_reclaim_uninit2(hbp, hhdr, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
hdr * hhdr;
register ptr_t list;
+COUNT_DECL
{
- register word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ register word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
register word mark_word;
register int i;
+ NWORDS_DECL
# define DO_OBJ(start_displ) \
if (!(mark_word & ((word)1 << start_displ))) { \
p[start_displ] = (word)list; \
@@ -330,9 +517,7 @@ register ptr_t list;
mark_word >>= 8;
}
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
# undef DO_OBJ
}
@@ -341,17 +526,16 @@ register ptr_t list;
* Another special case for 4 word atomic objects:
*/
/*ARGSUSED*/
-ptr_t GC_reclaim_uninit4(hbp, hhdr, list)
+ptr_t GC_reclaim_uninit4(hbp, hhdr, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
hdr * hhdr;
register ptr_t list;
+COUNT_DECL
{
- register word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ register word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
register word mark_word;
+ NWORDS_DECL
# define DO_OBJ(start_displ) \
if (!(mark_word & ((word)1 << start_displ))) { \
p[start_displ] = (word)list; \
@@ -385,27 +569,24 @@ register ptr_t list;
# endif
p += WORDSZ;
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
# undef DO_OBJ
}
/* Finally the one word case, which never requires any clearing: */
/*ARGSUSED*/
-ptr_t GC_reclaim1(hbp, hhdr, list)
+ptr_t GC_reclaim1(hbp, hhdr, list COUNT_PARAM)
register struct hblk *hbp; /* ptr to current heap block */
hdr * hhdr;
register ptr_t list;
+COUNT_DECL
{
- register word * mark_word_addr = &(hhdr->hb_marks[divWORDSZ(HDR_WORDS)]);
+ register word * mark_word_addr = &(hhdr->hb_marks[0]);
register word *p, *plim;
-# ifdef GATHERSTATS
- register int n_words_found = 0;
-# endif
register word mark_word;
register int i;
+ NWORDS_DECL
# define DO_OBJ(start_displ) \
if (!(mark_word & ((word)1 << start_displ))) { \
p[start_displ] = (word)list; \
@@ -428,77 +609,102 @@ register ptr_t list;
mark_word >>= 4;
}
}
-# ifdef GATHERSTATS
- GC_mem_found += n_words_found;
-# endif
+ COUNT_UPDATE
return(list);
# undef DO_OBJ
}
-#endif /* !SMALL_CONFIG */
+#endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
/*
- * Restore unmarked small objects in the block pointed to by hbp
- * to the appropriate object free list.
- * If entirely empty blocks are to be completely deallocated, then
- * caller should perform that check.
+ * Generic procedure to rebuild a free list in hbp.
+ * Also called directly from GC_malloc_many.
*/
-void GC_reclaim_small_nonempty_block(hbp, report_if_found)
-register struct hblk *hbp; /* ptr to current heap block */
-int report_if_found; /* Abort if a reclaimable object is found */
+ptr_t GC_reclaim_generic(hbp, hhdr, sz, init, list COUNT_PARAM)
+struct hblk *hbp; /* ptr to current heap block */
+hdr * hhdr;
+GC_bool init;
+ptr_t list;
+word sz;
+COUNT_DECL
{
- hdr * hhdr;
- register word sz; /* size of objects in current block */
- register struct obj_kind * ok;
- register ptr_t * flh;
- register int kind;
-
- hhdr = HDR(hbp);
- sz = hhdr -> hb_sz;
- hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
- kind = hhdr -> hb_obj_kind;
- ok = &GC_obj_kinds[kind];
- flh = &(ok -> ok_freelist[sz]);
- GC_write_hint(hbp);
+ ptr_t result = list;
- if (report_if_found) {
- GC_reclaim_check(hbp, hhdr, sz);
- } else if (ok -> ok_init) {
+ GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr);
+ if (init) {
switch(sz) {
-# ifndef SMALL_CONFIG
+# if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
case 1:
- *flh = GC_reclaim1(hbp, hhdr, *flh);
+ /* We now issue the hint even if GC_nearly_full returned */
+ /* DONT_KNOW. */
+ GC_write_hint(hbp);
+ result = GC_reclaim1(hbp, hhdr, list COUNT_ARG);
break;
case 2:
- *flh = GC_reclaim_clear2(hbp, hhdr, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_clear2(hbp, hhdr, list COUNT_ARG);
break;
case 4:
- *flh = GC_reclaim_clear4(hbp, hhdr, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_clear4(hbp, hhdr, list COUNT_ARG);
break;
-# endif
+# endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
default:
- *flh = GC_reclaim_clear(hbp, hhdr, sz, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_clear(hbp, hhdr, sz, list COUNT_ARG);
break;
}
} else {
switch(sz) {
-# ifndef SMALL_CONFIG
+# if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
case 1:
- *flh = GC_reclaim1(hbp, hhdr, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim1(hbp, hhdr, list COUNT_ARG);
break;
case 2:
- *flh = GC_reclaim_uninit2(hbp, hhdr, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_uninit2(hbp, hhdr, list COUNT_ARG);
break;
case 4:
- *flh = GC_reclaim_uninit4(hbp, hhdr, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_uninit4(hbp, hhdr, list COUNT_ARG);
break;
-# endif
+# endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
default:
- *flh = GC_reclaim_uninit(hbp, hhdr, sz, *flh);
+ GC_write_hint(hbp);
+ result = GC_reclaim_uninit(hbp, hhdr, sz, list COUNT_ARG);
break;
}
}
- if (IS_UNCOLLECTABLE(kind)) GC_set_hdr_marks(hhdr);
+ if (IS_UNCOLLECTABLE(hhdr -> hb_obj_kind)) GC_set_hdr_marks(hhdr);
+ return result;
+}
+
+/*
+ * Restore unmarked small objects in the block pointed to by hbp
+ * to the appropriate object free list.
+ * If entirely empty blocks are to be completely deallocated, then
+ * caller should perform that check.
+ */
+void GC_reclaim_small_nonempty_block(hbp, report_if_found COUNT_PARAM)
+register struct hblk *hbp; /* ptr to current heap block */
+int report_if_found; /* Abort if a reclaimable object is found */
+COUNT_DECL
+{
+ hdr *hhdr = HDR(hbp);
+ word sz = hhdr -> hb_sz;
+ int kind = hhdr -> hb_obj_kind;
+ struct obj_kind * ok = &GC_obj_kinds[kind];
+ ptr_t * flh = &(ok -> ok_freelist[sz]);
+
+ hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no;
+
+ if (report_if_found) {
+ GC_reclaim_check(hbp, hhdr, sz);
+ } else {
+ *flh = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init,
+ *flh MEM_FOUND_ADDR);
+ }
}
/*
@@ -509,9 +715,13 @@ int report_if_found; /* Abort if a reclaimable object is found */
* If report_if_found is TRUE, then process any block immediately, and
* simply report free objects; do not actually reclaim them.
*/
-void GC_reclaim_block(hbp, report_if_found)
-register struct hblk *hbp; /* ptr to current heap block */
-word report_if_found; /* Abort if a reclaimable object is found */
+# if defined(__STDC__) || defined(__cplusplus)
+ void GC_reclaim_block(register struct hblk *hbp, word report_if_found)
+# else
+ void GC_reclaim_block(hbp, report_if_found)
+ register struct hblk *hbp; /* ptr to current heap block */
+ word report_if_found; /* Abort if a reclaimable object is found */
+# endif
{
register hdr * hhdr;
register word sz; /* size of objects in current block */
@@ -523,10 +733,14 @@ word report_if_found; /* Abort if a reclaimable object is found */
ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
if( sz > MAXOBJSZ ) { /* 1 big object */
- if( !mark_bit_from_hdr(hhdr, HDR_WORDS) ) {
+ if( !mark_bit_from_hdr(hhdr, 0) ) {
if (report_if_found) {
- FOUND_FREE(hbp, HDR_WORDS);
+ FOUND_FREE(hbp, 0);
} else {
+ word blocks = OBJ_SZ_TO_BLOCKS(sz);
+ if (blocks > 1) {
+ GC_large_allocd_bytes -= blocks * HBLKSIZE;
+ }
# ifdef GATHERSTATS
GC_mem_found += sz;
# endif
@@ -536,18 +750,23 @@ word report_if_found; /* Abort if a reclaimable object is found */
} else {
GC_bool empty = GC_block_empty(hhdr);
if (report_if_found) {
- GC_reclaim_small_nonempty_block(hbp, (int)report_if_found);
+ GC_reclaim_small_nonempty_block(hbp, (int)report_if_found
+ MEM_FOUND_ADDR);
} else if (empty) {
# ifdef GATHERSTATS
GC_mem_found += BYTES_TO_WORDS(HBLKSIZE);
# endif
GC_freehblk(hbp);
- } else {
+ } else if (TRUE != GC_block_nearly_full(hhdr)){
/* group of smaller objects, enqueue the real work */
rlh = &(ok -> ok_reclaim_list[sz]);
hhdr -> hb_next = *rlh;
*rlh = hbp;
- }
+ } /* else not worth salvaging. */
+ /* We used to do the nearly_full check later, but we */
+ /* already have the right cache context here. Also */
+ /* doing it here avoids some silly lock contention in */
+ /* GC_malloc_many. */
}
}
@@ -558,6 +777,23 @@ word report_if_found; /* Abort if a reclaimable object is found */
static size_t number_of_blocks;
static size_t total_bytes;
+#ifdef USE_MARK_BYTES
+
+/* Return the number of set mark bits in the given header */
+int GC_n_set_marks(hhdr)
+hdr * hhdr;
+{
+ register int result = 0;
+ register int i;
+
+ for (i = 0; i < MARK_BITS_SZ; i++) {
+ result += hhdr -> hb_marks[i];
+ }
+ return(result);
+}
+
+#else
+
/* Number of set bits in a word. Not performance critical. */
static int set_bits(n)
word n;
@@ -585,10 +821,16 @@ hdr * hhdr;
return(result);
}
+#endif /* !USE_MARK_BYTES */
+
/*ARGSUSED*/
-void GC_print_block_descr(h, dummy)
-struct hblk *h;
-word dummy;
+# if defined(__STDC__) || defined(__cplusplus)
+ void GC_print_block_descr(struct hblk *h, word dummy)
+# else
+ void GC_print_block_descr(h, dummy)
+ struct hblk *h;
+ word dummy;
+# endif
{
register hdr * hhdr = HDR(h);
register size_t bytes = WORDS_TO_BYTES(hhdr -> hb_sz);
@@ -596,7 +838,7 @@ word dummy;
GC_printf3("(%lu:%lu,%lu)", (unsigned long)(hhdr -> hb_obj_kind),
(unsigned long)bytes,
(unsigned long)(GC_n_set_marks(hhdr)));
- bytes += HDR_BYTES + HBLKSIZE-1;
+ bytes += HBLKSIZE-1;
bytes &= ~(HBLKSIZE-1);
total_bytes += bytes;
number_of_blocks++;
@@ -624,6 +866,9 @@ int report_if_found; /* Abort if a GC_reclaimable object is found */
{
int kind;
+# if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+ GC_ASSERT(0 == GC_fl_builder_count);
+# endif
/* Clear reclaim- and free-lists */
for (kind = 0; kind < GC_n_kinds; kind++) {
register ptr_t *fop;
@@ -654,6 +899,15 @@ int report_if_found; /* Abort if a GC_reclaimable object is found */
/* Go through all heap blocks (in hblklist) and reclaim unmarked objects */
/* or enqueue the block for later processing. */
GC_apply_to_all_blocks(GC_reclaim_block, (word)report_if_found);
+
+# ifdef EAGER_SWEEP
+ /* This is a very stupid thing to do. We make it possible anyway, */
+ /* so that you can convince yourself that it really is very stupid. */
+ GC_reclaim_all((GC_stop_func)0, FALSE);
+# endif
+# if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
+ GC_ASSERT(0 == GC_fl_builder_count);
+# endif
}
@@ -677,7 +931,7 @@ int kind;
while ((hbp = *rlh) != 0) {
hhdr = HDR(hbp);
*rlh = hhdr -> hb_next;
- GC_reclaim_small_nonempty_block(hbp, FALSE);
+ GC_reclaim_small_nonempty_block(hbp, FALSE MEM_FOUND_ADDR);
if (*flh != 0) break;
}
}
@@ -687,7 +941,7 @@ int kind;
* Abort and return FALSE when/if (*stop_func)() returns TRUE.
* If this returns TRUE, then it's safe to restart the world
* with incorrectly cleared mark bits.
- * If ignore_old is TRUE, then reclain only blocks that have been
+ * If ignore_old is TRUE, then reclaim only blocks that have been
* recently reclaimed, and discard the rest.
* Stop_func may be 0.
*/
@@ -725,7 +979,7 @@ GC_bool ignore_old;
/* It's likely we'll need it this time, too */
/* It's been touched recently, so this */
/* shouldn't trigger paging. */
- GC_reclaim_small_nonempty_block(hbp, FALSE);
+ GC_reclaim_small_nonempty_block(hbp, FALSE MEM_FOUND_ADDR);
}
}
}
diff --git a/gc/setjmp_t.c b/gc/setjmp_t.c
@@ -10,7 +10,6 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, September 21, 1995 5:39 pm PDT */
/* Check whether setjmp actually saves registers in jmp_buf. */
/* If it doesn't, the generic mark_regs code won't work. */
@@ -21,11 +20,11 @@
/* recommended that this be run optimized. (If the machine */
/* has no callee-save registers, then the generic code is */
/* safe, but this will not be noticed by this piece of */
-/* code.) */
+/* code.) This test appears to be far from perfect. */
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
-#include "gcconfig.h"
+#include "private/gcconfig.h"
#ifdef OS2
/* GETPAGESIZE() is set to getpagesize() by default, but that */
diff --git a/gc/solaris_pthreads.c b/gc/solaris_pthreads.c
@@ -18,8 +18,8 @@
/* Boehm, September 14, 1994 4:44 pm PDT */
/* $Id$ */
-# if defined(_SOLARIS_PTHREADS)
-# include "gc_priv.h"
+# if defined(GC_SOLARIS_PTHREADS) || defined(_SOLARIS_PTHREADS)
+# include "private/gc_priv.h"
# include <pthread.h>
# include <thread.h>
# include <signal.h>
@@ -36,7 +36,7 @@
# define _CLASSIC_XOPEN_TYPES
# include <unistd.h>
# include <errno.h>
-# include "solaris_threads.h"
+# include "private/solaris_threads.h"
# include <stdio.h>
#undef pthread_join
@@ -77,14 +77,16 @@ GC_pthread_create(pthread_t *new_thread,
pthread_attr_t attr;
word my_flags = 0;
int flag;
- void * stack;
- size_t stack_size;
+ void * stack = 0;
+ size_t stack_size = 0;
int n;
struct sched_param schedparam;
- (void)pthread_attr_getstacksize(attr_in, &stack_size);
- (void)pthread_attr_getstackaddr(attr_in, &stack);
(void)pthread_attr_init(&attr);
+ if (attr_in != 0) {
+ (void)pthread_attr_getstacksize(attr_in, &stack_size);
+ (void)pthread_attr_getstackaddr(attr_in, &stack);
+ }
LOCK();
if (!GC_thr_initialized) {
@@ -94,7 +96,11 @@ GC_pthread_create(pthread_t *new_thread,
if (stack == 0) {
if (stack_size == 0)
- stack_size = GC_min_stack_sz;
+ stack_size = 1048576;
+ /* ^-- 1 MB (this was GC_min_stack_sz, but that
+ * violates the pthread_create documentation which
+ * says the default value if none is supplied is
+ * 1MB) */
else
stack_size += thr_min_stack();
@@ -110,20 +116,22 @@ GC_pthread_create(pthread_t *new_thread,
}
(void)pthread_attr_setstacksize(&attr, stack_size);
(void)pthread_attr_setstackaddr(&attr, stack);
- (void)pthread_attr_getscope(attr_in, &n);
- (void)pthread_attr_setscope(&attr, n);
- (void)pthread_attr_getschedparam(attr_in, &schedparam);
- (void)pthread_attr_setschedparam(&attr, &schedparam);
- (void)pthread_attr_getschedpolicy(attr_in, &n);
- (void)pthread_attr_setschedpolicy(&attr, n);
- (void)pthread_attr_getinheritsched(attr_in, &n);
- (void)pthread_attr_setinheritsched(&attr, n);
-
- (void)pthread_attr_getdetachstate(attr_in, &flag);
- if (flag == PTHREAD_CREATE_DETACHED) {
- my_flags |= DETACHED;
+ if (attr_in != 0) {
+ (void)pthread_attr_getscope(attr_in, &n);
+ (void)pthread_attr_setscope(&attr, n);
+ (void)pthread_attr_getschedparam(attr_in, &schedparam);
+ (void)pthread_attr_setschedparam(&attr, &schedparam);
+ (void)pthread_attr_getschedpolicy(attr_in, &n);
+ (void)pthread_attr_setschedpolicy(&attr, n);
+ (void)pthread_attr_getinheritsched(attr_in, &n);
+ (void)pthread_attr_setinheritsched(&attr, n);
+
+ (void)pthread_attr_getdetachstate(attr_in, &flag);
+ if (flag == PTHREAD_CREATE_DETACHED) {
+ my_flags |= DETACHED;
+ }
+ (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
}
- (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
/*
* thr_create can call malloc(), which if redirected will
* attempt to acquire the allocation lock.
diff --git a/gc/solaris_threads.c b/gc/solaris_threads.c
@@ -16,10 +16,10 @@
*/
/* Boehm, September 14, 1994 4:44 pm PDT */
-# if defined(SOLARIS_THREADS)
+# if defined(GC_SOLARIS_THREADS) || defined(SOLARIS_THREADS)
-# include "gc_priv.h"
-# include "solaris_threads.h"
+# include "private/gc_priv.h"
+# include "private/solaris_threads.h"
# include <thread.h>
# include <synch.h>
# include <signal.h>
@@ -558,6 +558,11 @@ void GC_old_stacks_are_fresh()
# define THREAD_TABLE_SZ 128 /* Must be power of 2 */
volatile GC_thread GC_threads[THREAD_TABLE_SZ];
+void GC_push_thread_structures GC_PROTO((void))
+{
+ GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads));
+}
+
/* Add a thread to GC_threads. We assume it wasn't already there. */
/* Caller holds allocation lock. */
GC_thread GC_new_thread(thread_t id)
@@ -573,7 +578,7 @@ GC_thread GC_new_thread(thread_t id)
/* Dont acquire allocation lock, since we may already hold it. */
} else {
result = (struct GC_Thread_Rep *)
- GC_generic_malloc_inner(sizeof(struct GC_Thread_Rep), NORMAL);
+ GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL);
}
if (result == 0) return(0);
result -> id = id;
@@ -627,7 +632,7 @@ word GC_get_orig_stack_size() {
result = (word)rl.rlim_cur & ~(HBLKSIZE-1);
if (result > MAX_ORIG_STACK_SIZE) {
if (!warned) {
- WARN("Large stack limit(%ld): only scanning 8 MB", result);
+ WARN("Large stack limit(%ld): only scanning 8 MB\n", result);
warned = 1;
}
result = MAX_ORIG_STACK_SIZE;
@@ -661,7 +666,8 @@ void GC_my_stack_limits()
}
-/* We hold allocation lock. We assume the world is stopped. */
+/* We hold allocation lock. Should do exactly the right thing if the */
+/* world is stopped. Should not fail if it isn't. */
void GC_push_all_stacks()
{
register int i;
@@ -672,7 +678,7 @@ void GC_push_all_stacks()
# define PUSH(bottom,top) \
if (GC_dirty_maintained) { \
- GC_push_dirty((bottom), (top), GC_page_was_ever_dirty, \
+ GC_push_selected((bottom), (top), GC_page_was_ever_dirty, \
GC_push_all_stack); \
} else { \
GC_push_all_stack((bottom), (top)); \
@@ -702,7 +708,6 @@ int GC_is_thread_stack(ptr_t addr)
register int i;
register GC_thread p;
register ptr_t bottom, top;
- struct rlimit rl;
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
@@ -713,6 +718,7 @@ int GC_is_thread_stack(ptr_t addr)
}
}
}
+ return 0;
}
/* The only thread that ever really performs a thr_join. */
@@ -900,7 +906,7 @@ GC_thr_create(void *stack_base, size_t stack_size,
}
GC_multithreaded++;
if (stack == 0) {
- if (stack_size == 0) stack_size = GC_min_stack_sz;
+ if (stack_size == 0) stack_size = 1024*1024;
stack = (void *)GC_stack_alloc(&stack_size);
if (stack == 0) {
GC_multithreaded--;
diff --git a/gc/sparc_netbsd_mach_dep.s b/gc/sparc_netbsd_mach_dep.s
@@ -0,0 +1,34 @@
+! SPARCompiler 3.0 and later apparently no longer handles
+! asm outside functions. So we need a separate .s file
+! This is only set up for SunOS 4.
+! Assumes this is called before the stack contents are
+! examined.
+
+#include "machine/asm.h"
+
+ .seg "text"
+ .globl _C_LABEL(GC_save_regs_in_stack)
+ .globl _C_LABEL(GC_push_regs)
+_C_LABEL(GC_save_regs_in_stack):
+_C_LABEL(GC_push_regs):
+ ta 0x3 ! ST_FLUSH_WINDOWS
+ mov %sp,%o0
+ retl
+ nop
+
+ .globl _C_LABEL(GC_clear_stack_inner)
+_C_LABEL(GC_clear_stack_inner):
+ mov %sp,%o2 ! Save sp
+ add %sp,-8,%o3 ! p = sp-8
+ clr %g1 ! [g0,g1] = 0
+ add %o1,-0x60,%sp ! Move sp out of the way,
+ ! so that traps still work.
+ ! Includes some extra words
+ ! so we can be sloppy below.
+loop:
+ std %g0,[%o3] ! *(long long *)p = 0
+ cmp %o3,%o1
+ bgu loop ! if (p > limit) goto loop
+ add %o3,-8,%o3 ! p -= 8 (delay slot)
+ retl
+ mov %o2,%sp ! Restore sp., delay slot
diff --git a/gc/specific.c b/gc/specific.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+#if defined(LINUX_THREADS) || defined(GC_LINUX_THREADS)
+
+#include "private/gc_priv.h" /* For GC_compare_and_exchange, GC_memory_barrier */
+#include "private/specific.h"
+
+static tse invalid_tse; /* 0 qtid is guaranteed to be invalid */
+
+int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)) {
+ int i;
+ tsd * result = (tsd *)MALLOC_CLEAR(sizeof (tsd));
+
+ if (0 == result) return ENOMEM;
+ pthread_mutex_init(&(result -> lock), NULL);
+ for (i = 0; i < TS_CACHE_SIZE; ++i) {
+ result -> cache[i] = &invalid_tse;
+ }
+ *key_ptr = result;
+ return 0;
+}
+
+int PREFIXED(setspecific) (tsd * key, void * value) {
+ pthread_t self = pthread_self();
+ int hash_val = HASH(self);
+ volatile tse * entry = (volatile tse *)MALLOC_CLEAR(sizeof (tse));
+
+ if (0 == entry) return ENOMEM;
+ pthread_mutex_lock(&(key -> lock));
+ /* Could easily check for an existing entry here. */
+ entry -> next = key -> hash[hash_val];
+ entry -> thread = self;
+ entry -> value = value;
+ /* There can only be one writer at a time, but this needs to be */
+ /* atomic with respect to concurrent readers. */
+ *(volatile tse **)(key -> hash + hash_val) = entry;
+ pthread_mutex_unlock(&(key -> lock));
+ return 0;
+}
+
+/* Remove thread-specific data for this thread. Should be called on */
+/* thread exit. */
+void PREFIXED(remove_specific) (tsd * key) {
+ pthread_t self = pthread_self();
+ unsigned hash_val = HASH(self);
+ tse *entry;
+ tse **link = key -> hash + hash_val;
+
+ pthread_mutex_lock(&(key -> lock));
+ entry = *link;
+ while (entry != NULL && entry -> thread != self) {
+ link = &(entry -> next);
+ entry = *link;
+ }
+ /* Invalidate qtid field, since qtids may be reused, and a later */
+ /* cache lookup could otherwise find this entry. */
+ entry -> qtid = INVALID_QTID;
+ if (entry != NULL) {
+ *link = entry -> next;
+ /* Atomic! concurrent accesses still work. */
+ /* They must, since readers don't lock. */
+ }
+ /* If we wanted to deallocate the entry, we'd first have to clear */
+ /* any cache entries pointing to it. That probably requires */
+ /* additional synchronization, since we can't prevent a concurrent */
+ /* cache lookup, which should still be examining deallocated memory.*/
+ /* This can only happen if the concurrent access is from another */
+ /* thread, and hence has missed the cache, but still... */
+
+ /* With GC, we're done, since the pointers from the cache will */
+ /* be overwritten, all local pointers to the entries will be */
+ /* dropped, and the entry will then be reclaimed. */
+ pthread_mutex_unlock(&(key -> lock));
+}
+
+/* Note that even the slow path doesn't lock. */
+void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid,
+ tse * volatile * cache_ptr) {
+ pthread_t self = pthread_self();
+ unsigned hash_val = HASH(self);
+ tse *entry = key -> hash[hash_val];
+
+ while (entry != NULL && entry -> thread != self) {
+ entry = entry -> next;
+ }
+ if (entry == NULL) return NULL;
+ /* Set cache_entry. */
+ entry -> qtid = qtid;
+ /* It's safe to do this asynchronously. Either value */
+ /* is safe, though may produce spurious misses. */
+ *cache_ptr = entry;
+ /* Again this is safe since pointer assignments are */
+ /* presumed atomic, and either pointer is valid. */
+ return entry -> value;
+}
+
+#endif /* LINUX_THREADS */
diff --git a/gc/stubborn.c b/gc/stubborn.c
@@ -14,7 +14,7 @@
/* Boehm, July 31, 1995 5:02 pm PDT */
-#include "gc_priv.h"
+#include "private/gc_priv.h"
# ifdef STUBBORN_ALLOC
/* Stubborn object (hard to change, nearly immutable) allocation. */
@@ -31,6 +31,12 @@ extern ptr_t GC_clear_stack(); /* in misc.c, behaves like identity */
GC_PTR * GC_changing_list_start;
+void GC_push_stubborn_structures GC_PROTO((void))
+{
+ GC_push_all((ptr_t)(&GC_changing_list_start),
+ (ptr_t)(&GC_changing_list_start) + sizeof(GC_PTR *));
+}
+
# ifdef THREADS
VOLATILE GC_PTR * VOLATILE GC_changing_list_current;
# else
@@ -50,7 +56,7 @@ void GC_stubborn_init()
# define INIT_SIZE 10
GC_changing_list_start = (GC_PTR *)
- GC_generic_malloc_inner(
+ GC_INTERNAL_MALLOC(
(word)(INIT_SIZE * sizeof(GC_PTR)),
PTRFREE);
BZERO(GC_changing_list_start,
@@ -88,7 +94,7 @@ GC_bool GC_compact_changing_list()
}
if (2 * count > old_size) new_size = 2 * count;
new_list = (GC_PTR *)
- GC_generic_malloc_inner(
+ GC_INTERNAL_MALLOC(
new_size * sizeof(GC_PTR), PTRFREE);
/* PTRFREE is a lie. But we don't want the collector to */
/* consider these. We do want the list itself to be */
@@ -313,5 +319,8 @@ GC_PTR p;
{
}
+void GC_push_stubborn_structures GC_PROTO((void))
+{
+}
#endif
diff --git a/gc/test.c b/gc/test.c
@@ -1,1263 +0,0 @@
-/*
- * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
- * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
- *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
- *
- * Permission is hereby granted to use or copy this program
- * for any purpose, provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
- */
-/* An incomplete test for the garbage collector. */
-/* Some more obscure entry points are not tested at all. */
-
-# if defined(mips) && defined(SYSTYPE_BSD43)
- /* MIPS RISCOS 4 */
-# else
-# include <stdlib.h>
-# endif
-# include <stdio.h>
-# include <assert.h> /* Not normally used, but handy for debugging. */
-# include "gc.h"
-# include "gc_typed.h"
-# include "gc_priv.h" /* For output, locking, and some statistics */
-# include "gcconfig.h"
-
-# ifdef MSWIN32
-# include <windows.h>
-# endif
-
-# ifdef PCR
-# include "th/PCR_ThCrSec.h"
-# include "th/PCR_Th.h"
-# undef GC_printf0
-# define GC_printf0 printf
-# undef GC_printf1
-# define GC_printf1 printf
-# endif
-
-# ifdef SOLARIS_THREADS
-# include <thread.h>
-# include <synch.h>
-# endif
-
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
-# include <pthread.h>
-# endif
-
-# ifdef WIN32_THREADS
-# include <process.h>
- static CRITICAL_SECTION incr_cs;
-# endif
-# if defined(PCR) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS)
-# define THREADS
-# endif
-
-# ifdef AMIGA
- long __stack = 200000;
-# endif
-
-# define FAIL (void)abort()
-
-/* AT_END may be defined to excercise the interior pointer test */
-/* if the collector is configured with ALL_INTERIOR_POINTERS. */
-/* As it stands, this test should succeed with either */
-/* configuration. In the FIND_LEAK configuration, it should */
-/* find lots of leaks, since we free almost nothing. */
-
-struct SEXPR {
- struct SEXPR * sexpr_car;
- struct SEXPR * sexpr_cdr;
-};
-
-
-typedef struct SEXPR * sexpr;
-
-# define INT_TO_SEXPR(x) ((sexpr)(unsigned long)(x))
-
-# undef nil
-# define nil (INT_TO_SEXPR(0))
-# define car(x) ((x) -> sexpr_car)
-# define cdr(x) ((x) -> sexpr_cdr)
-# define is_nil(x) ((x) == nil)
-
-
-int extra_count = 0; /* Amount of space wasted in cons node */
-
-/* Silly implementation of Lisp cons. Intentionally wastes lots of space */
-/* to test collector. */
-sexpr cons (x, y)
-sexpr x;
-sexpr y;
-{
- register sexpr r;
- register int *p;
- register int my_extra = extra_count;
-
- r = (sexpr) GC_MALLOC_STUBBORN(sizeof(struct SEXPR) + my_extra);
- if (r == 0) {
- (void)GC_printf0("Out of memory\n");
- exit(1);
- }
- for (p = (int *)r;
- ((char *)p) < ((char *)r) + my_extra + sizeof(struct SEXPR); p++) {
- if (*p) {
- (void)GC_printf1("Found nonzero at 0x%lx - allocator is broken\n",
- (unsigned long)p);
- FAIL;
- }
- *p = 13;
- }
-# ifdef AT_END
- r = (sexpr)((char *)r + (my_extra & ~7));
-# endif
- r -> sexpr_car = x;
- r -> sexpr_cdr = y;
- my_extra++;
- if ( my_extra >= 5000 ) {
- extra_count = 0;
- } else {
- extra_count = my_extra;
- }
- GC_END_STUBBORN_CHANGE((char *)r);
- return(r);
-}
-
-sexpr small_cons (x, y)
-sexpr x;
-sexpr y;
-{
- register sexpr r;
-
- r = (sexpr) GC_MALLOC(sizeof(struct SEXPR));
- if (r == 0) {
- (void)GC_printf0("Out of memory\n");
- exit(1);
- }
- r -> sexpr_car = x;
- r -> sexpr_cdr = y;
- return(r);
-}
-
-sexpr small_cons_uncollectable (x, y)
-sexpr x;
-sexpr y;
-{
- register sexpr r;
-
- r = (sexpr) GC_MALLOC_UNCOLLECTABLE(sizeof(struct SEXPR));
-assert(GC_is_marked(r));
- if (r == 0) {
- (void)GC_printf0("Out of memory\n");
- exit(1);
- }
- r -> sexpr_car = x;
- r -> sexpr_cdr = (sexpr)(~(unsigned long)y);
- return(r);
-}
-
-/* Return reverse(x) concatenated with y */
-sexpr reverse1(x, y)
-sexpr x, y;
-{
- if (is_nil(x)) {
- return(y);
- } else {
- return( reverse1(cdr(x), cons(car(x), y)) );
- }
-}
-
-sexpr reverse(x)
-sexpr x;
-{
- return( reverse1(x, nil) );
-}
-
-sexpr ints(low, up)
-int low, up;
-{
- if (low > up) {
- return(nil);
- } else {
- return(small_cons(small_cons(INT_TO_SEXPR(low), nil), ints(low+1, up)));
- }
-}
-
-/* To check uncollectable allocation we build lists with disguised cdr */
-/* pointers, and make sure they don't go away. */
-sexpr uncollectable_ints(low, up)
-int low, up;
-{
- if (low > up) {
- return(nil);
- } else {
- return(small_cons_uncollectable(small_cons(INT_TO_SEXPR(low), nil),
- uncollectable_ints(low+1, up)));
- }
-}
-
-void check_ints(list, low, up)
-sexpr list;
-int low, up;
-{
- if ((int)(GC_word)(car(car(list))) != low) {
- (void)GC_printf0(
- "List reversal produced incorrect list - collector is broken\n");
- FAIL;
- }
- if (low == up) {
- if (cdr(list) != nil) {
- (void)GC_printf0("List too long - collector is broken\n");
- FAIL;
- }
- } else {
- check_ints(cdr(list), low+1, up);
- }
-}
-
-# define UNCOLLECTABLE_CDR(x) (sexpr)(~(unsigned long)(cdr(x)))
-
-void check_uncollectable_ints(list, low, up)
-sexpr list;
-int low, up;
-{
-assert(GC_is_marked(list));
- if ((int)(GC_word)(car(car(list))) != low) {
- (void)GC_printf0(
- "Uncollectable list corrupted - collector is broken\n");
- FAIL;
- }
- if (low == up) {
- if (UNCOLLECTABLE_CDR(list) != nil) {
- (void)GC_printf0("Uncollectable list too long - collector is broken\n");
- FAIL;
- }
- } else {
- check_uncollectable_ints(UNCOLLECTABLE_CDR(list), low+1, up);
- }
-}
-
-/* Not used, but useful for debugging: */
-void print_int_list(x)
-sexpr x;
-{
- if (is_nil(x)) {
- (void)GC_printf0("NIL\n");
- } else {
- (void)GC_printf1("(%ld)", (long)(car(car(x))));
- if (!is_nil(cdr(x))) {
- (void)GC_printf0(", ");
- (void)print_int_list(cdr(x));
- } else {
- (void)GC_printf0("\n");
- }
- }
-}
-
-/* Try to force a to be strangely aligned */
-struct {
- char dummy;
- sexpr aa;
-} A;
-#define a A.aa
-
-/*
- * A tiny list reversal test to check thread creation.
- */
-#ifdef THREADS
-
-# ifdef WIN32_THREADS
- unsigned __stdcall tiny_reverse_test(void * arg)
-# else
- void * tiny_reverse_test(void * arg)
-# endif
-{
- check_ints(reverse(reverse(ints(1,10))), 1, 10);
- return 0;
-}
-
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS) \
- || defined(SOLARIS_PTHREADS)
- void fork_a_thread()
- {
- pthread_t t;
- int code;
- if ((code = pthread_create(&t, 0, tiny_reverse_test, 0)) != 0) {
- (void)GC_printf1("Small thread creation failed %lu\n",
- (unsigned long)code);
- FAIL;
- }
- if ((code = pthread_join(t, 0)) != 0) {
- (void)GC_printf1("Small thread join failed %lu\n",
- (unsigned long)code);
- FAIL;
- }
- }
-
-# elif defined(WIN32_THREADS)
- void fork_a_thread()
- {
- unsigned thread_id;
- HANDLE h;
- h = (HANDLE)_beginthreadex(NULL, 0, tiny_reverse_test,
- 0, 0, &thread_id);
- if (h == (HANDLE)-1) {
- (void)GC_printf1("Small thread creation failed %lu\n",
- (unsigned long)GetLastError());
- FAIL;
- }
- if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) {
- (void)GC_printf1("Small thread wait failed %lu\n",
- (unsigned long)GetLastError());
- FAIL;
- }
- }
-
-/* # elif defined(SOLARIS_THREADS) */
-
-# else
-
-# define fork_a_thread()
-
-# endif
-
-#else
-
-# define fork_a_thread()
-
-#endif
-
-/*
- * Repeatedly reverse lists built out of very different sized cons cells.
- * Check that we didn't lose anything.
- */
-void reverse_test()
-{
- int i;
- sexpr b;
- sexpr c;
- sexpr d;
- sexpr e;
- sexpr *f, *g, *h;
-# if defined(MSWIN32) || defined(MACOS)
- /* Win32S only allows 128K stacks */
-# define BIG 1000
-# else
-# if defined PCR
- /* PCR default stack is 100K. Stack frames are up to 120 bytes. */
-# define BIG 700
-# else
-# define BIG 4500
-# endif
-# endif
-
- A.dummy = 17;
- a = ints(1, 49);
- b = ints(1, 50);
- c = ints(1, BIG);
- d = uncollectable_ints(1, 100);
- e = uncollectable_ints(1, 1);
- /* Check that realloc updates object descriptors correctly */
- f = (sexpr *)GC_MALLOC(4 * sizeof(sexpr));
- f = (sexpr *)GC_REALLOC((GC_PTR)f, 6 * sizeof(sexpr));
- f[5] = ints(1,17);
- g = (sexpr *)GC_MALLOC(513 * sizeof(sexpr));
- g = (sexpr *)GC_REALLOC((GC_PTR)g, 800 * sizeof(sexpr));
- g[799] = ints(1,18);
- h = (sexpr *)GC_MALLOC(1025 * sizeof(sexpr));
- h = (sexpr *)GC_REALLOC((GC_PTR)h, 2000 * sizeof(sexpr));
- h[1999] = ints(1,19);
- /* Try to force some collections and reuse of small list elements */
- for (i = 0; i < 10; i++) {
- (void)ints(1, BIG);
- }
- /* Superficially test interior pointer recognition on stack */
- c = (sexpr)((char *)c + sizeof(char *));
- d = (sexpr)((char *)d + sizeof(char *));
-
-# ifdef __STDC__
- GC_FREE((void *)e);
-# else
- GC_FREE((char *)e);
-# endif
- check_ints(b,1,50);
- check_ints(a,1,49);
- for (i = 0; i < 50; i++) {
- check_ints(b,1,50);
- b = reverse(reverse(b));
- }
- check_ints(b,1,50);
- check_ints(a,1,49);
- for (i = 0; i < 60; i++) {
- if (i % 10 == 0) fork_a_thread();
- /* This maintains the invariant that a always points to a list of */
- /* 49 integers. Thus this is thread safe without locks, */
- /* assuming atomic pointer assignments. */
- a = reverse(reverse(a));
-# if !defined(AT_END) && !defined(THREADS)
- /* This is not thread safe, since realloc explicitly deallocates */
- if (i & 1) {
- a = (sexpr)GC_REALLOC((GC_PTR)a, 500);
- } else {
- a = (sexpr)GC_REALLOC((GC_PTR)a, 8200);
- }
-# endif
- }
- check_ints(a,1,49);
- check_ints(b,1,50);
- c = (sexpr)((char *)c - sizeof(char *));
- d = (sexpr)((char *)d - sizeof(char *));
- check_ints(c,1,BIG);
- check_uncollectable_ints(d, 1, 100);
- check_ints(f[5], 1,17);
- check_ints(g[799], 1,18);
- check_ints(h[1999], 1,19);
-# ifndef THREADS
- a = 0;
-# endif
- b = c = 0;
-}
-
-/*
- * The rest of this builds balanced binary trees, checks that they don't
- * disappear, and tests finalization.
- */
-typedef struct treenode {
- int level;
- struct treenode * lchild;
- struct treenode * rchild;
-} tn;
-
-int finalizable_count = 0;
-int finalized_count = 0;
-VOLATILE int dropped_something = 0;
-
-# ifdef __STDC__
- void finalizer(void * obj, void * client_data)
-# else
- void finalizer(obj, client_data)
- char * obj;
- char * client_data;
-# endif
-{
- tn * t = (tn *)obj;
-
-# ifdef PCR
- PCR_ThCrSec_EnterSys();
-# endif
-# ifdef SOLARIS_THREADS
- static mutex_t incr_lock;
- mutex_lock(&incr_lock);
-# endif
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
- static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;
- pthread_mutex_lock(&incr_lock);
-# endif
-# ifdef WIN32_THREADS
- EnterCriticalSection(&incr_cs);
-# endif
- if ((int)(GC_word)client_data != t -> level) {
- (void)GC_printf0("Wrong finalization data - collector is broken\n");
- FAIL;
- }
- finalized_count++;
-# ifdef PCR
- PCR_ThCrSec_ExitSys();
-# endif
-# ifdef SOLARIS_THREADS
- mutex_unlock(&incr_lock);
-# endif
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
- pthread_mutex_unlock(&incr_lock);
-# endif
-# ifdef WIN32_THREADS
- LeaveCriticalSection(&incr_cs);
-# endif
-}
-
-size_t counter = 0;
-
-# define MAX_FINALIZED 8000
-
-# if !defined(MACOS)
- GC_FAR GC_word live_indicators[MAX_FINALIZED] = {0};
-#else
- /* Too big for THINK_C. have to allocate it dynamically. */
- GC_word *live_indicators = 0;
-#endif
-
-int live_indicators_count = 0;
-
-tn * mktree(n)
-int n;
-{
- tn * result = (tn *)GC_MALLOC(sizeof(tn));
-
-#if defined(MACOS)
- /* get around static data limitations. */
- if (!live_indicators)
- live_indicators =
- (GC_word*)NewPtrClear(MAX_FINALIZED * sizeof(GC_word));
- if (!live_indicators) {
- (void)GC_printf0("Out of memory\n");
- exit(1);
- }
-#endif
- if (n == 0) return(0);
- if (result == 0) {
- (void)GC_printf0("Out of memory\n");
- exit(1);
- }
- result -> level = n;
- result -> lchild = mktree(n-1);
- result -> rchild = mktree(n-1);
- if (counter++ % 17 == 0 && n >= 2) {
- tn * tmp = result -> lchild -> rchild;
-
- result -> lchild -> rchild = result -> rchild -> lchild;
- result -> rchild -> lchild = tmp;
- }
- if (counter++ % 119 == 0) {
- int my_index;
-
- {
-# ifdef PCR
- PCR_ThCrSec_EnterSys();
-# endif
-# ifdef SOLARIS_THREADS
- static mutex_t incr_lock;
- mutex_lock(&incr_lock);
-# endif
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
- static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER;
- pthread_mutex_lock(&incr_lock);
-# endif
-# ifdef WIN32_THREADS
- EnterCriticalSection(&incr_cs);
-# endif
- /* Losing a count here causes erroneous report of failure. */
- finalizable_count++;
- my_index = live_indicators_count++;
-# ifdef PCR
- PCR_ThCrSec_ExitSys();
-# endif
-# ifdef SOLARIS_THREADS
- mutex_unlock(&incr_lock);
-# endif
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
- pthread_mutex_unlock(&incr_lock);
-# endif
-# ifdef WIN32_THREADS
- LeaveCriticalSection(&incr_cs);
-# endif
- }
-
- GC_REGISTER_FINALIZER((GC_PTR)result, finalizer, (GC_PTR)(GC_word)n,
- (GC_finalization_proc *)0, (GC_PTR *)0);
- if (my_index >= MAX_FINALIZED) {
- GC_printf0("live_indicators overflowed\n");
- FAIL;
- }
- live_indicators[my_index] = 13;
- if (GC_GENERAL_REGISTER_DISAPPEARING_LINK(
- (GC_PTR *)(&(live_indicators[my_index])),
- (GC_PTR)result) != 0) {
- GC_printf0("GC_general_register_disappearing_link failed\n");
- FAIL;
- }
- if (GC_unregister_disappearing_link(
- (GC_PTR *)
- (&(live_indicators[my_index]))) == 0) {
- GC_printf0("GC_unregister_disappearing_link failed\n");
- FAIL;
- }
- if (GC_GENERAL_REGISTER_DISAPPEARING_LINK(
- (GC_PTR *)(&(live_indicators[my_index])),
- (GC_PTR)result) != 0) {
- GC_printf0("GC_general_register_disappearing_link failed 2\n");
- FAIL;
- }
- }
- return(result);
-}
-
-void chktree(t,n)
-tn *t;
-int n;
-{
- if (n == 0 && t != 0) {
- (void)GC_printf0("Clobbered a leaf - collector is broken\n");
- FAIL;
- }
- if (n == 0) return;
- if (t -> level != n) {
- (void)GC_printf1("Lost a node at level %lu - collector is broken\n",
- (unsigned long)n);
- FAIL;
- }
- if (counter++ % 373 == 0) (void) GC_MALLOC(counter%5001);
- chktree(t -> lchild, n-1);
- if (counter++ % 73 == 0) (void) GC_MALLOC(counter%373);
- chktree(t -> rchild, n-1);
-}
-
-# if defined(SOLARIS_THREADS) && !defined(_SOLARIS_PTHREADS)
-thread_key_t fl_key;
-
-void * alloc8bytes()
-{
-# if defined(SMALL_CONFIG) || defined(GC_DEBUG)
- return(GC_MALLOC(8));
-# else
- void ** my_free_list_ptr;
- void * my_free_list;
-
- if (thr_getspecific(fl_key, (void **)(&my_free_list_ptr)) != 0) {
- (void)GC_printf0("thr_getspecific failed\n");
- FAIL;
- }
- if (my_free_list_ptr == 0) {
- my_free_list_ptr = GC_NEW_UNCOLLECTABLE(void *);
- if (thr_setspecific(fl_key, my_free_list_ptr) != 0) {
- (void)GC_printf0("thr_setspecific failed\n");
- FAIL;
- }
- }
- my_free_list = *my_free_list_ptr;
- if (my_free_list == 0) {
- my_free_list = GC_malloc_many(8);
- if (my_free_list == 0) {
- (void)GC_printf0("alloc8bytes out of memory\n");
- FAIL;
- }
- }
- *my_free_list_ptr = GC_NEXT(my_free_list);
- GC_NEXT(my_free_list) = 0;
- return(my_free_list);
-# endif
-}
-
-#else
-
-# if defined(_SOLARIS_PTHREADS) || defined(IRIX_THREADS) \
- || defined(LINUX_THREADS)
-pthread_key_t fl_key;
-
-void * alloc8bytes()
-{
-# ifdef SMALL_CONFIG
- return(GC_malloc(8));
-# else
- void ** my_free_list_ptr;
- void * my_free_list;
-
- my_free_list_ptr = (void **)pthread_getspecific(fl_key);
- if (my_free_list_ptr == 0) {
- my_free_list_ptr = GC_NEW_UNCOLLECTABLE(void *);
- if (pthread_setspecific(fl_key, my_free_list_ptr) != 0) {
- (void)GC_printf0("pthread_setspecific failed\n");
- FAIL;
- }
- }
- my_free_list = *my_free_list_ptr;
- if (my_free_list == 0) {
- my_free_list = GC_malloc_many(8);
- if (my_free_list == 0) {
- (void)GC_printf0("alloc8bytes out of memory\n");
- FAIL;
- }
- }
- *my_free_list_ptr = GC_NEXT(my_free_list);
- GC_NEXT(my_free_list) = 0;
- return(my_free_list);
-# endif
-}
-
-# else
-# define alloc8bytes() GC_MALLOC_ATOMIC(8)
-# endif
-#endif
-
-void alloc_small(n)
-int n;
-{
- register int i;
-
- for (i = 0; i < n; i += 8) {
- if (alloc8bytes() == 0) {
- (void)GC_printf0("Out of memory\n");
- FAIL;
- }
- }
-}
-
-# if defined(THREADS) && defined(GC_DEBUG)
-# define TREE_HEIGHT 15
-# else
-# define TREE_HEIGHT 16
-# endif
-void tree_test()
-{
- tn * root;
- register int i;
-
- root = mktree(TREE_HEIGHT);
- alloc_small(5000000);
- chktree(root, TREE_HEIGHT);
- if (finalized_count && ! dropped_something) {
- (void)GC_printf0("Premature finalization - collector is broken\n");
- FAIL;
- }
- dropped_something = 1;
- GC_noop(root); /* Root needs to remain live until */
- /* dropped_something is set. */
- root = mktree(TREE_HEIGHT);
- chktree(root, TREE_HEIGHT);
- for (i = TREE_HEIGHT; i >= 0; i--) {
- root = mktree(i);
- chktree(root, i);
- }
- alloc_small(5000000);
-}
-
-unsigned n_tests = 0;
-
-GC_word bm_huge[10] = {
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0xffffffff,
- 0x00ffffff,
-};
-
-
-/* A very simple test of explicitly typed allocation */
-void typed_test()
-{
- GC_word * old, * new;
- GC_word bm3 = 0x3;
- GC_word bm2 = 0x2;
- GC_word bm_large = 0xf7ff7fff;
- GC_descr d1 = GC_make_descriptor(&bm3, 2);
- GC_descr d2 = GC_make_descriptor(&bm2, 2);
-# ifndef LINT
- GC_descr dummy = GC_make_descriptor(&bm_large, 32);
-# endif
- GC_descr d3 = GC_make_descriptor(&bm_large, 32);
- GC_descr d4 = GC_make_descriptor(bm_huge, 320);
- GC_word * x = (GC_word *)GC_malloc_explicitly_typed(2000, d4);
- register int i;
-
- old = 0;
- for (i = 0; i < 4000; i++) {
- new = (GC_word *) GC_malloc_explicitly_typed(4 * sizeof(GC_word), d1);
- new[0] = 17;
- new[1] = (GC_word)old;
- old = new;
- new = (GC_word *) GC_malloc_explicitly_typed(4 * sizeof(GC_word), d2);
- new[0] = 17;
- new[1] = (GC_word)old;
- old = new;
- new = (GC_word *) GC_malloc_explicitly_typed(33 * sizeof(GC_word), d3);
- new[0] = 17;
- new[1] = (GC_word)old;
- old = new;
- new = (GC_word *) GC_calloc_explicitly_typed(4, 2 * sizeof(GC_word),
- d1);
- new[0] = 17;
- new[1] = (GC_word)old;
- old = new;
- if (i & 0xff) {
- new = (GC_word *) GC_calloc_explicitly_typed(7, 3 * sizeof(GC_word),
- d2);
- } else {
- new = (GC_word *) GC_calloc_explicitly_typed(1001,
- 3 * sizeof(GC_word),
- d2);
- }
- new[0] = 17;
- new[1] = (GC_word)old;
- old = new;
- }
- for (i = 0; i < 20000; i++) {
- if (new[0] != 17) {
- (void)GC_printf1("typed alloc failed at %lu\n",
- (unsigned long)i);
- FAIL;
- }
- new[0] = 0;
- old = new;
- new = (GC_word *)(old[1]);
- }
- GC_gcollect();
- GC_noop(x);
-}
-
-int fail_count = 0;
-
-#ifndef __STDC__
-/*ARGSUSED*/
-void fail_proc1(x)
-GC_PTR x;
-{
- fail_count++;
-}
-
-#else
-
-/*ARGSUSED*/
-void fail_proc1(GC_PTR x)
-{
- fail_count++;
-}
-
-#endif /* __STDC__ */
-
-#ifdef THREADS
-# define TEST_FAIL_COUNT(n) 1
-#else
-# define TEST_FAIL_COUNT(n) (fail_count >= (n))
-#endif
-
-void run_one_test()
-{
- char *x;
-# ifdef LINT
- char *y = 0;
-# else
- char *y = (char *)(size_t)fail_proc1;
-# endif
- DCL_LOCK_STATE;
-
-# ifdef FIND_LEAK
- (void)GC_printf0(
- "This test program is not designed for leak detection mode\n");
- (void)GC_printf0("Expect lots of problems.\n");
-# endif
- if (GC_size(GC_malloc(7)) != 8
- || GC_size(GC_malloc(15)) != 16) {
- (void)GC_printf0("GC_size produced unexpected results\n");
- FAIL;
- }
- if (GC_size(GC_malloc(0)) != 4 && GC_size(GC_malloc(0)) != 8) {
- (void)GC_printf0("GC_malloc(0) failed\n");
- FAIL;
- }
- if (GC_size(GC_malloc_uncollectable(0)) != 4
- && GC_size(GC_malloc_uncollectable(0)) != 8) {
- (void)GC_printf0("GC_malloc_uncollectable(0) failed\n");
- FAIL;
- }
- GC_is_valid_displacement_print_proc = fail_proc1;
- GC_is_visible_print_proc = fail_proc1;
- x = GC_malloc(16);
- if (GC_base(x + 13) != x) {
- (void)GC_printf0("GC_base(heap ptr) produced incorrect result\n");
- FAIL;
- }
-# ifndef PCR
- if (GC_base(y) != 0) {
- (void)GC_printf0("GC_base(fn_ptr) produced incorrect result\n");
- FAIL;
- }
-# endif
- if (GC_same_obj(x+5, x) != x + 5) {
- (void)GC_printf0("GC_same_obj produced incorrect result\n");
- FAIL;
- }
- if (GC_is_visible(y) != y || GC_is_visible(x) != x) {
- (void)GC_printf0("GC_is_visible produced incorrect result\n");
- FAIL;
- }
- if (!TEST_FAIL_COUNT(1)) {
-# if!(defined(RS6000) || defined(POWERPC))
- /* ON RS6000s function pointers point to a descriptor in the */
- /* data segment, so there should have been no failures. */
- (void)GC_printf0("GC_is_visible produced wrong failure indication\n");
- FAIL;
-# endif
- }
- if (GC_is_valid_displacement(y) != y
- || GC_is_valid_displacement(x) != x
- || GC_is_valid_displacement(x + 3) != x + 3) {
- (void)GC_printf0(
- "GC_is_valid_displacement produced incorrect result\n");
- FAIL;
- }
-# ifndef ALL_INTERIOR_POINTERS
-# if defined(RS6000) || defined(POWERPC)
- if (!TEST_FAIL_COUNT(1)) {
-# else
- if (!TEST_FAIL_COUNT(2)) {
-# endif
- (void)GC_printf0("GC_is_valid_displacement produced wrong failure indication\n");
- FAIL;
- }
-# endif
- /* Test floating point alignment */
- *(double *)GC_MALLOC(sizeof(double)) = 1.0;
- *(double *)GC_MALLOC(sizeof(double)) = 1.0;
- /* Repeated list reversal test. */
- reverse_test();
-# ifdef PRINTSTATS
- GC_printf0("-------------Finished reverse_test\n");
-# endif
- typed_test();
-# ifdef PRINTSTATS
- GC_printf0("-------------Finished typed_test\n");
-# endif
- tree_test();
- LOCK();
- n_tests++;
- UNLOCK();
- /* GC_printf1("Finished %x\n", pthread_self()); */
-}
-
-void check_heap_stats()
-{
- unsigned long max_heap_sz;
- register int i;
- int still_live;
- int late_finalize_count = 0;
-
- if (sizeof(char *) > 4) {
- max_heap_sz = 15000000;
- } else {
- max_heap_sz = 11000000;
- }
-# ifdef GC_DEBUG
- max_heap_sz *= 2;
-# ifdef SPARC
- max_heap_sz *= 2;
-# endif
-# endif
- /* Garbage collect repeatedly so that all inaccessible objects */
- /* can be finalized. */
- while (GC_collect_a_little()) { }
- for (i = 0; i < 16; i++) {
- GC_gcollect();
- late_finalize_count += GC_invoke_finalizers();
- }
- (void)GC_printf1("Completed %lu tests\n", (unsigned long)n_tests);
- (void)GC_printf2("Finalized %lu/%lu objects - ",
- (unsigned long)finalized_count,
- (unsigned long)finalizable_count);
-# ifdef FINALIZE_ON_DEMAND
- if (finalized_count != late_finalize_count) {
- (void)GC_printf0("Demand finalization error\n");
- FAIL;
- }
-# endif
- if (finalized_count > finalizable_count
- || finalized_count < finalizable_count/2) {
- (void)GC_printf0("finalization is probably broken\n");
- FAIL;
- } else {
- (void)GC_printf0("finalization is probably ok\n");
- }
- still_live = 0;
- for (i = 0; i < MAX_FINALIZED; i++) {
- if (live_indicators[i] != 0) {
- still_live++;
- }
- }
- i = finalizable_count - finalized_count - still_live;
- if (0 != i) {
- (void)GC_printf2
- ("%lu disappearing links remain and %lu more objects were not finalized\n",
- (unsigned long) still_live, (unsigned long)i);
- if (i > 10) {
- GC_printf0("\tVery suspicious!\n");
- } else {
- GC_printf0("\tSlightly suspicious, but probably OK.\n");
- }
- }
- (void)GC_printf1("Total number of bytes allocated is %lu\n",
- (unsigned long)
- WORDS_TO_BYTES(GC_words_allocd + GC_words_allocd_before_gc));
- (void)GC_printf1("Final heap size is %lu bytes\n",
- (unsigned long)GC_get_heap_size());
- if (WORDS_TO_BYTES(GC_words_allocd + GC_words_allocd_before_gc)
- < 33500000*n_tests) {
- (void)GC_printf0("Incorrect execution - missed some allocations\n");
- FAIL;
- }
- if (GC_get_heap_size() > max_heap_sz*n_tests) {
- (void)GC_printf0("Unexpected heap growth - collector may be broken\n");
- FAIL;
- }
- (void)GC_printf0("Collector appears to work\n");
-}
-
-#if defined(MACOS)
-void SetMinimumStack(long minSize)
-{
- long newApplLimit;
-
- if (minSize > LMGetDefltStack())
- {
- newApplLimit = (long) GetApplLimit()
- - (minSize - LMGetDefltStack());
- SetApplLimit((Ptr) newApplLimit);
- MaxApplZone();
- }
-}
-
-#define cMinStackSpace (512L * 1024L)
-
-#endif
-
-#ifdef __STDC__
- void warn_proc(char *msg, GC_word p)
-#else
- void warn_proc(msg, p)
- char *msg;
- GC_word p;
-#endif
-{
- GC_printf1(msg, (unsigned long)p);
- FAIL;
-}
-
-
-#if !defined(PCR) && !defined(SOLARIS_THREADS) && !defined(WIN32_THREADS) \
- && !defined(IRIX_THREADS) && !defined(LINUX_THREADS) || defined(LINT)
-#ifdef MSWIN32
- int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n)
-#else
- int main()
-#endif
-{
-# if defined(DJGPP)
- int dummy;
-# endif
- n_tests = 0;
-
-# if defined(DJGPP)
- /* No good way to determine stack base from library; do it */
- /* manually on this platform. */
- GC_stackbottom = (GC_PTR)(&dummy);
-# endif
-# if defined(MACOS)
- /* Make sure we have lots and lots of stack space. */
- SetMinimumStack(cMinStackSpace);
- /* Cheat and let stdio initialize toolbox for us. */
- printf("Testing GC Macintosh port.\n");
-# endif
- GC_INIT(); /* Only needed if gc is dynamic library. */
- (void) GC_set_warn_proc(warn_proc);
-# if defined(MPROTECT_VDB) || defined(PROC_VDB)
- GC_enable_incremental();
- (void) GC_printf0("Switched to incremental mode\n");
-# if defined(MPROTECT_VDB)
- (void)GC_printf0("Emulating dirty bits with mprotect/signals\n");
-# else
- (void)GC_printf0("Reading dirty bits from /proc\n");
-# endif
-# endif
- run_one_test();
- check_heap_stats();
- (void)fflush(stdout);
-# ifdef LINT
- /* Entry points we should be testing, but aren't. */
- /* Some can be tested by defining GC_DEBUG at the top of this file */
- /* This is a bit SunOS4 specific. */
- GC_noop(GC_expand_hp, GC_add_roots, GC_clear_roots,
- GC_register_disappearing_link,
- GC_register_finalizer_ignore_self,
- GC_debug_register_displacement,
- GC_print_obj, GC_debug_change_stubborn,
- GC_debug_end_stubborn_change, GC_debug_malloc_uncollectable,
- GC_debug_free, GC_debug_realloc, GC_generic_malloc_words_small,
- GC_init, GC_make_closure, GC_debug_invoke_finalizer,
- GC_page_was_ever_dirty, GC_is_fresh,
- GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page,
- GC_set_max_heap_size, GC_get_bytes_since_gc,
- GC_pre_incr, GC_post_incr);
-# endif
-# ifdef MSWIN32
- GC_win32_free_heap();
-# endif
- return(0);
-}
-# endif
-
-#ifdef WIN32_THREADS
-
-unsigned __stdcall thr_run_one_test(void *arg)
-{
- run_one_test();
- return 0;
-}
-
-#define NTEST 2
-
-int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n)
-{
-# if NTEST > 0
- HANDLE h[NTEST];
-# endif
- int i;
- unsigned thread_id;
-# if 0
- GC_enable_incremental();
-# endif
- InitializeCriticalSection(&incr_cs);
- (void) GC_set_warn_proc(warn_proc);
- for (i = 0; i < NTEST; i++) {
- h[i] = (HANDLE)_beginthreadex(NULL, 0, thr_run_one_test, 0, 0, &thread_id);
- if (h[i] == (HANDLE)-1) {
- (void)GC_printf1("Thread creation failed %lu\n", (unsigned long)GetLastError());
- FAIL;
- }
- }
- run_one_test();
- for (i = 0; i < NTEST; i++)
- if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) {
- (void)GC_printf1("Thread wait failed %lu\n", (unsigned long)GetLastError());
- FAIL;
- }
- check_heap_stats();
- (void)fflush(stdout);
- return(0);
-}
-
-#endif /* WIN32_THREADS */
-
-
-#ifdef PCR
-test()
-{
- PCR_Th_T * th1;
- PCR_Th_T * th2;
- int code;
-
- n_tests = 0;
- /* GC_enable_incremental(); */
- (void) GC_set_warn_proc(warn_proc);
- th1 = PCR_Th_Fork(run_one_test, 0);
- th2 = PCR_Th_Fork(run_one_test, 0);
- run_one_test();
- if (PCR_Th_T_Join(th1, &code, NIL, PCR_allSigsBlocked, PCR_waitForever)
- != PCR_ERes_okay || code != 0) {
- (void)GC_printf0("Thread 1 failed\n");
- }
- if (PCR_Th_T_Join(th2, &code, NIL, PCR_allSigsBlocked, PCR_waitForever)
- != PCR_ERes_okay || code != 0) {
- (void)GC_printf0("Thread 2 failed\n");
- }
- check_heap_stats();
- (void)fflush(stdout);
- return(0);
-}
-#endif
-
-#if defined(SOLARIS_THREADS) || defined(IRIX_THREADS) || defined(LINUX_THREADS)
-void * thr_run_one_test(void * arg)
-{
- run_one_test();
- return(0);
-}
-
-#ifdef GC_DEBUG
-# define GC_free GC_debug_free
-#endif
-
-#ifdef SOLARIS_THREADS
-main()
-{
- thread_t th1;
- thread_t th2;
- int code;
-
- n_tests = 0;
- GC_INIT(); /* Only needed if gc is dynamic library. */
- GC_enable_incremental();
- (void) GC_set_warn_proc(warn_proc);
- if (thr_keycreate(&fl_key, GC_free) != 0) {
- (void)GC_printf1("Key creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if ((code = thr_create(0, 1024*1024, thr_run_one_test, 0, 0, &th1)) != 0) {
- (void)GC_printf1("Thread 1 creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if ((code = thr_create(0, 1024*1024, thr_run_one_test, 0, THR_NEW_LWP, &th2)) != 0) {
- (void)GC_printf1("Thread 2 creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- run_one_test();
- if ((code = thr_join(th1, 0, 0)) != 0) {
- (void)GC_printf1("Thread 1 failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if (thr_join(th2, 0, 0) != 0) {
- (void)GC_printf1("Thread 2 failed %lu\n", (unsigned long)code);
- FAIL;
- }
- check_heap_stats();
- (void)fflush(stdout);
- return(0);
-}
-#else /* pthreads */
-main()
-{
- pthread_t th1;
- pthread_t th2;
- pthread_attr_t attr;
- int code;
-
-# ifdef IRIX_THREADS
- /* Force a larger stack to be preallocated */
- /* Since the initial cant always grow later. */
- *((volatile char *)&code - 1024*1024) = 0; /* Require 1 Mb */
-# endif /* IRIX_THREADS */
- pthread_attr_init(&attr);
-# ifdef IRIX_THREADS
- pthread_attr_setstacksize(&attr, 1000000);
-# endif
- n_tests = 0;
-# ifdef MPROTECT_VDB
- GC_enable_incremental();
- (void) GC_printf0("Switched to incremental mode\n");
- (void) GC_printf0("Emulating dirty bits with mprotect/signals\n");
-# endif
- (void) GC_set_warn_proc(warn_proc);
- if (pthread_key_create(&fl_key, 0) != 0) {
- (void)GC_printf1("Key creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if ((code = pthread_create(&th1, &attr, thr_run_one_test, 0)) != 0) {
- (void)GC_printf1("Thread 1 creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if ((code = pthread_create(&th2, &attr, thr_run_one_test, 0)) != 0) {
- (void)GC_printf1("Thread 2 creation failed %lu\n", (unsigned long)code);
- FAIL;
- }
- run_one_test();
- if ((code = pthread_join(th1, 0)) != 0) {
- (void)GC_printf1("Thread 1 failed %lu\n", (unsigned long)code);
- FAIL;
- }
- if (pthread_join(th2, 0) != 0) {
- (void)GC_printf1("Thread 2 failed %lu\n", (unsigned long)code);
- FAIL;
- }
- check_heap_stats();
- (void)fflush(stdout);
- pthread_attr_destroy(&attr);
- GC_printf1("Completed %d collections\n", GC_gc_no);
- return(0);
-}
-#endif /* pthreads */
-#endif /* SOLARIS_THREADS || IRIX_THREADS || LINUX_THREADS */
diff --git a/gc/test_cpp.cc b/gc/test_cpp.cc
@@ -1,265 +0,0 @@
-/****************************************************************************
-Copyright (c) 1994 by Xerox Corporation. All rights reserved.
-
-THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
-OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-
-Permission is hereby granted to use or copy this program for any
-purpose, provided the above notices are retained on all copies.
-Permission to modify the code and to distribute modified code is
-granted, provided the above notices are retained, and a notice that
-the code was modified is included with the above copyright notice.
-****************************************************************************
-Last modified on Mon Jul 10 21:06:03 PDT 1995 by ellis
- modified on December 20, 1994 7:27 pm PST by boehm
-
-usage: test_cpp number-of-iterations
-
-This program tries to test the specific C++ functionality provided by
-gc_c++.h that isn't tested by the more general test routines of the
-collector.
-
-A recommended value for number-of-iterations is 10, which will take a
-few minutes to complete.
-
-***************************************************************************/
-
-#include "gc_cpp.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifndef __GNUC__
-# include "gc_alloc.h"
-#endif
-extern "C" {
-#include "gc_priv.h"
-}
-#ifdef MSWIN32
-# include <windows.h>
-#endif
-
-
-#define my_assert( e ) \
- if (! (e)) { \
- GC_printf1( "Assertion failure in " __FILE__ ", line %d: " #e "\n", \
- __LINE__ ); \
- exit( 1 ); }
-
-
-class A {public:
- /* An uncollectable class. */
-
- A( int iArg ): i( iArg ) {}
- void Test( int iArg ) {
- my_assert( i == iArg );}
- int i;};
-
-
-class B: public gc, public A {public:
- /* A collectable class. */
-
- B( int j ): A( j ) {}
- ~B() {
- my_assert( deleting );}
- static void Deleting( int on ) {
- deleting = on;}
- static int deleting;};
-
-int B::deleting = 0;
-
-
-class C: public gc_cleanup, public A {public:
- /* A collectable class with cleanup and virtual multiple inheritance. */
-
- C( int levelArg ): A( levelArg ), level( levelArg ) {
- nAllocated++;
- if (level > 0) {
- left = new C( level - 1 );
- right = new C( level - 1 );}
- else {
- left = right = 0;}}
- ~C() {
- this->A::Test( level );
- nFreed++;
- my_assert( level == 0 ?
- left == 0 && right == 0 :
- level == left->level + 1 && level == right->level + 1 );
- left = right = 0;
- level = -123456;}
- static void Test() {
- my_assert( nFreed <= nAllocated && nFreed >= .8 * nAllocated );}
-
- static int nFreed;
- static int nAllocated;
- int level;
- C* left;
- C* right;};
-
-int C::nFreed = 0;
-int C::nAllocated = 0;
-
-
-class D: public gc {public:
- /* A collectable class with a static member function to be used as
- an explicit clean-up function supplied to ::new. */
-
- D( int iArg ): i( iArg ) {
- nAllocated++;}
- static void CleanUp( void* obj, void* data ) {
- D* self = (D*) obj;
- nFreed++;
- my_assert( self->i == (int) (long) data );}
- static void Test() {
- my_assert( nFreed >= .8 * nAllocated );}
-
- int i;
- static int nFreed;
- static int nAllocated;};
-
-int D::nFreed = 0;
-int D::nAllocated = 0;
-
-
-class E: public gc_cleanup {public:
- /* A collectable class with clean-up for use by F. */
-
- E() {
- nAllocated++;}
- ~E() {
- nFreed++;}
-
- static int nFreed;
- static int nAllocated;};
-
-int E::nFreed = 0;
-int E::nAllocated = 0;
-
-
-class F: public E {public:
- /* A collectable class with clean-up, a base with clean-up, and a
- member with clean-up. */
-
- F() {
- nAllocated++;}
- ~F() {
- nFreed++;}
- static void Test() {
- my_assert( nFreed >= .8 * nAllocated );
- my_assert( 2 * nFreed == E::nFreed );}
-
- E e;
- static int nFreed;
- static int nAllocated;};
-
-int F::nFreed = 0;
-int F::nAllocated = 0;
-
-
-long Disguise( void* p ) {
- return ~ (long) p;}
-
-void* Undisguise( long i ) {
- return (void*) ~ i;}
-
-
-#ifdef MSWIN32
-int APIENTRY WinMain(
- HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int cmdShow )
-{
- int argc;
- char* argv[ 3 ];
-
- for (argc = 1; argc < sizeof( argv ) / sizeof( argv[ 0 ] ); argc++) {
- argv[ argc ] = strtok( argc == 1 ? cmd : 0, " \t" );
- if (0 == argv[ argc ]) break;}
-
-#else
-# ifdef MACOS
- int main() {
-# else
- int main( int argc, char* argv[] ) {
-# endif
-#endif
-
-# if defined(MACOS) // MacOS
- char* argv_[] = {"test_cpp", "10"}; // doesn't
- argv = argv_; // have a
- argc = sizeof(argv_)/sizeof(argv_[0]); // commandline
-# endif
- int i, iters, n;
-# if !defined(__GNUC__) && !defined(MACOS)
- int *x = (int *)alloc::allocate(sizeof(int));
-
- *x = 29;
- x -= 3;
-# endif
- if (argc != 2 || (0 >= (n = atoi( argv[ 1 ] )))) {
- GC_printf0( "usage: test_cpp number-of-iterations\n" );
- exit( 1 );}
-
- for (iters = 1; iters <= n; iters++) {
- GC_printf1( "Starting iteration %d\n", iters );
-
- /* Allocate some uncollectable As and disguise their pointers.
- Later we'll check to see if the objects are still there. We're
- checking to make sure these objects really are uncollectable. */
- long as[ 1000 ];
- long bs[ 1000 ];
- for (i = 0; i < 1000; i++) {
- as[ i ] = Disguise( new (NoGC) A( i ) );
- bs[ i ] = Disguise( new (NoGC) B( i ) );}
-
- /* Allocate a fair number of finalizable Cs, Ds, and Fs.
- Later we'll check to make sure they've gone away. */
- for (i = 0; i < 1000; i++) {
- C* c = new C( 2 );
- C c1( 2 ); /* stack allocation should work too */
- D* d = ::new (GC, D::CleanUp, (void*) i) D( i );
- F* f = new F;
- if (0 == i % 10) delete c;}
-
- /* Allocate a very large number of collectable As and Bs and
- drop the references to them immediately, forcing many
- collections. */
- for (i = 0; i < 1000000; i++) {
- A* a = new (GC) A( i );
- B* b = new B( i );
- b = new (GC) B( i );
- if (0 == i % 10) {
- B::Deleting( 1 );
- delete b;
- B::Deleting( 0 );}
-# ifdef FINALIZE_ON_DEMAND
- GC_invoke_finalizers();
-# endif
- }
-
- /* Make sure the uncollectable As and Bs are still there. */
- for (i = 0; i < 1000; i++) {
- A* a = (A*) Undisguise( as[ i ] );
- B* b = (B*) Undisguise( bs[ i ] );
- a->Test( i );
- delete a;
- b->Test( i );
- B::Deleting( 1 );
- delete b;
- B::Deleting( 0 );
-# ifdef FINALIZE_ON_DEMAND
- GC_invoke_finalizers();
-# endif
-
- }
-
- /* Make sure most of the finalizable Cs, Ds, and Fs have
- gone away. */
- C::Test();
- D::Test();
- F::Test();}
-
-# if !defined(__GNUC__) && !defined(MACOS)
- my_assert (29 == x[3]);
-# endif
- GC_printf0( "The test appears to have succeeded.\n" );
- return( 0 );}
-
-
diff --git a/gc/threadlibs b/gc/threadlibs
Binary files differ.
diff --git a/gc/threadlibs.c b/gc/threadlibs.c
@@ -1,14 +1,29 @@
-# include "gcconfig.h"
+# include "private/gcconfig.h"
# include <stdio.h>
int main()
{
-# if defined(IRIX_THREADS) || defined(LINUX_THREADS)
+# if defined(GC_USE_LD_WRAP)
+ printf("-Wl,--wrap -Wl,read -Wl,--wrap -Wl,dlopen "
+ "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join "
+ "-Wl,--wrap -Wl,pthread_detach "
+ "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
+# endif
+# if defined(LINUX_THREADS)
+ printf("-lpthread\n");
+# endif
+# if defined(IRIX_THREADS)
printf("-lpthread\n");
# endif
+# if defined(HPUX_THREADS)
+ printf("-lpthread -lrt\n");
+# endif
# ifdef SOLARIS_THREADS
printf("-lthread -ldl\n");
# endif
+# ifdef GC_OSF1_THREADS
+ printf("-lpthread -lrt\n");
+# endif
return 0;
}
diff --git a/gc/typd_mlc.c b/gc/typd_mlc.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * opyright (c) 1999-2000 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -11,7 +12,6 @@
* modified is included with the above copyright notice.
*
*/
-/* Boehm, July 31, 1995 5:02 pm PDT */
/*
@@ -36,15 +36,10 @@
* since they are not accessible through the current interface.
*/
-#include "gc_priv.h"
-#include "gc_mark.h"
+#include "private/gc_pmark.h"
#include "gc_typed.h"
-# ifdef ADD_BYTE_AT_END
-# define EXTRA_BYTES (sizeof(word) - 1)
-# else
-# define EXTRA_BYTES (sizeof(word))
-# endif
+# define TYPD_EXTRA_BYTES (sizeof(word) - EXTRA_BYTES)
GC_bool GC_explicit_typing_initialized = FALSE;
@@ -170,15 +165,15 @@ GC_descr GC_bm_table[WORDSZ/2];
/* each of which is described by descriptor. */
/* The result is known to be short enough to fit into a bitmap */
/* descriptor. */
-/* Descriptor is a DS_LENGTH or DS_BITMAP descriptor. */
+/* Descriptor is a GC_DS_LENGTH or GC_DS_BITMAP descriptor. */
GC_descr GC_double_descr(descriptor, nwords)
register GC_descr descriptor;
register word nwords;
{
- if (descriptor && DS_TAGS == DS_LENGTH) {
+ if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) {
descriptor = GC_bm_table[BYTES_TO_WORDS((word)descriptor)];
};
- descriptor |= (descriptor & ~DS_TAGS) >> nwords;
+ descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords;
return(descriptor);
}
@@ -196,7 +191,7 @@ complex_descriptor * GC_make_sequence_descriptor();
/* is returned in *simple_d. */
/* If the result is NO_MEM, then */
/* we failed to allocate the descriptor. */
-/* The implementation knows that DS_LENGTH is 0. */
+/* The implementation knows that GC_DS_LENGTH is 0. */
/* *leaf, *complex_d, and *simple_d may be used as temporaries */
/* during the construction. */
# define COMPLEX 2
@@ -216,7 +211,7 @@ struct LeafDescriptor * leaf;
/* For larger arrays, we try to combine descriptors of adjacent */
/* descriptors to speed up marking, and to reduce the amount */
/* of space needed on the mark stack. */
- if ((descriptor & DS_TAGS) == DS_LENGTH) {
+ if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) {
if ((word)descriptor == size) {
*simple_d = nelements * descriptor;
return(SIMPLE);
@@ -236,7 +231,7 @@ struct LeafDescriptor * leaf;
}
}
} else if (size <= BITMAP_BITS/2
- && (descriptor & DS_TAGS) != DS_PROC
+ && (descriptor & GC_DS_TAGS) != GC_DS_PROC
&& (size & (sizeof(word)-1)) == 0) {
int result =
GC_make_array_descriptor(nelements/2, 2*size,
@@ -343,9 +338,15 @@ ptr_t * GC_eobjfreelist;
ptr_t * GC_arobjfreelist;
-mse * GC_typed_mark_proc();
+mse * GC_typed_mark_proc GC_PROTO((register word * addr,
+ register mse * mark_stack_ptr,
+ mse * mark_stack_limit,
+ word env));
-mse * GC_array_mark_proc();
+mse * GC_array_mark_proc GC_PROTO((register word * addr,
+ register mse * mark_stack_ptr,
+ mse * mark_stack_limit,
+ word env));
GC_descr GC_generic_array_descr;
@@ -370,14 +371,14 @@ void GC_init_explicit_typing()
GC_explicit_typing_initialized = TRUE;
/* Set up object kind with simple indirect descriptor. */
GC_eobjfreelist = (ptr_t *)
- GC_generic_malloc_inner((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
+ GC_INTERNAL_MALLOC((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
if (GC_eobjfreelist == 0) ABORT("Couldn't allocate GC_eobjfreelist");
BZERO(GC_eobjfreelist, (MAXOBJSZ+1)*sizeof(ptr_t));
GC_explicit_kind = GC_n_kinds++;
GC_obj_kinds[GC_explicit_kind].ok_freelist = GC_eobjfreelist;
GC_obj_kinds[GC_explicit_kind].ok_reclaim_list = 0;
GC_obj_kinds[GC_explicit_kind].ok_descriptor =
- (((word)WORDS_TO_BYTES(-1)) | DS_PER_OBJECT);
+ (((word)WORDS_TO_BYTES(-1)) | GC_DS_PER_OBJECT);
GC_obj_kinds[GC_explicit_kind].ok_relocate_descr = TRUE;
GC_obj_kinds[GC_explicit_kind].ok_init = TRUE;
/* Descriptors are in the last word of the object. */
@@ -387,7 +388,7 @@ void GC_init_explicit_typing()
/* Moving this up breaks DEC AXP compiler. */
/* Set up object kind with array descriptor. */
GC_arobjfreelist = (ptr_t *)
- GC_generic_malloc_inner((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
+ GC_INTERNAL_MALLOC((MAXOBJSZ+1)*sizeof(ptr_t), PTRFREE);
if (GC_arobjfreelist == 0) ABORT("Couldn't allocate GC_arobjfreelist");
BZERO(GC_arobjfreelist, (MAXOBJSZ+1)*sizeof(ptr_t));
if (GC_n_mark_procs >= MAX_MARK_PROCS)
@@ -399,26 +400,33 @@ void GC_init_explicit_typing()
GC_obj_kinds[GC_array_kind].ok_freelist = GC_arobjfreelist;
GC_obj_kinds[GC_array_kind].ok_reclaim_list = 0;
GC_obj_kinds[GC_array_kind].ok_descriptor =
- MAKE_PROC(GC_array_mark_proc_index, 0);;
+ GC_MAKE_PROC(GC_array_mark_proc_index, 0);;
GC_obj_kinds[GC_array_kind].ok_relocate_descr = FALSE;
GC_obj_kinds[GC_array_kind].ok_init = TRUE;
/* Descriptors are in the last word of the object. */
GC_mark_procs[GC_array_mark_proc_index] = GC_array_mark_proc;
for (i = 0; i < WORDSZ/2; i++) {
GC_descr d = (((word)(-1)) >> (WORDSZ - i)) << (WORDSZ - i);
- d |= DS_BITMAP;
+ d |= GC_DS_BITMAP;
GC_bm_table[i] = d;
}
- GC_generic_array_descr = MAKE_PROC(GC_array_mark_proc_index, 0);
+ GC_generic_array_descr = GC_MAKE_PROC(GC_array_mark_proc_index, 0);
UNLOCK();
ENABLE_SIGNALS();
}
-mse * GC_typed_mark_proc(addr, mark_stack_ptr, mark_stack_limit, env)
-register word * addr;
-register mse * mark_stack_ptr;
-mse * mark_stack_limit;
-word env;
+# if defined(__STDC__) || defined(__cplusplus)
+ mse * GC_typed_mark_proc(register word * addr,
+ register mse * mark_stack_ptr,
+ mse * mark_stack_limit,
+ word env)
+# else
+ mse * GC_typed_mark_proc(addr, mark_stack_ptr, mark_stack_limit, env)
+ register word * addr;
+ register mse * mark_stack_ptr;
+ mse * mark_stack_limit;
+ word env;
+# endif
{
register word bm = GC_ext_descriptors[env].ed_bitmap;
register word * current_p = addr;
@@ -430,7 +438,7 @@ word env;
if (bm & 1) {
current = *current_p;
if ((ptr_t)current >= least_ha && (ptr_t)current <= greatest_ha) {
- PUSH_CONTENTS(current, mark_stack_ptr,
+ PUSH_CONTENTS((ptr_t)current, mark_stack_ptr,
mark_stack_limit, current_p, exit1);
}
}
@@ -446,7 +454,7 @@ word env;
}
mark_stack_ptr -> mse_start = addr + WORDSZ;
mark_stack_ptr -> mse_descr =
- MAKE_PROC(GC_typed_mark_proc_index, env+1);
+ GC_MAKE_PROC(GC_typed_mark_proc_index, env+1);
}
return(mark_stack_ptr);
}
@@ -533,11 +541,18 @@ mse * msl;
}
/*ARGSUSED*/
-mse * GC_array_mark_proc(addr, mark_stack_ptr, mark_stack_limit, env)
-register word * addr;
-register mse * mark_stack_ptr;
-mse * mark_stack_limit;
-word env;
+# if defined(__STDC__) || defined(__cplusplus)
+ mse * GC_array_mark_proc(register word * addr,
+ register mse * mark_stack_ptr,
+ mse * mark_stack_limit,
+ word env)
+# else
+ mse * GC_array_mark_proc(addr, mark_stack_ptr, mark_stack_limit, env)
+ register word * addr;
+ register mse * mark_stack_ptr;
+ mse * mark_stack_limit;
+ word env;
+# endif
{
register hdr * hhdr = HDR(addr);
register word sz = hhdr -> hb_sz;
@@ -563,12 +578,12 @@ word env;
GC_mark_stack_too_small = TRUE;
new_mark_stack_ptr = orig_mark_stack_ptr + 1;
new_mark_stack_ptr -> mse_start = addr;
- new_mark_stack_ptr -> mse_descr = WORDS_TO_BYTES(sz) | DS_LENGTH;
+ new_mark_stack_ptr -> mse_descr = WORDS_TO_BYTES(sz) | GC_DS_LENGTH;
} else {
/* Push descriptor itself */
new_mark_stack_ptr++;
new_mark_stack_ptr -> mse_start = addr + sz - 1;
- new_mark_stack_ptr -> mse_descr = sizeof(word) | DS_LENGTH;
+ new_mark_stack_ptr -> mse_descr = sizeof(word) | GC_DS_LENGTH;
}
return(new_mark_stack_ptr);
}
@@ -600,7 +615,7 @@ word env;
}
if (all_bits_set) {
/* An initial section contains all pointers. Use length descriptor. */
- return(WORDS_TO_BYTES(last_set_bit+1) | DS_LENGTH);
+ return(WORDS_TO_BYTES(last_set_bit+1) | GC_DS_LENGTH);
}
}
# endif
@@ -612,16 +627,16 @@ word env;
result >>= 1;
if (GC_get_bit(bm, i)) result |= HIGH_BIT;
}
- result |= DS_BITMAP;
+ result |= GC_DS_BITMAP;
return(result);
} else {
signed_word index;
index = GC_add_ext_descriptor(bm, (word)last_set_bit+1);
- if (index == -1) return(WORDS_TO_BYTES(last_set_bit+1) | DS_LENGTH);
+ if (index == -1) return(WORDS_TO_BYTES(last_set_bit+1) | GC_DS_LENGTH);
/* Out of memory: use conservative */
/* approximation. */
- result = MAKE_PROC(GC_typed_mark_proc_index, (word)index);
+ result = GC_MAKE_PROC(GC_typed_mark_proc_index, (word)index);
return(result);
}
}
@@ -647,7 +662,7 @@ register ptr_t * opp;
register word lw;
DCL_LOCK_STATE;
- lb += EXTRA_BYTES;
+ lb += TYPD_EXTRA_BYTES;
if( SMALL_OBJ(lb) ) {
# ifdef MERGE_SIZES
lw = GC_size_map[lb];
@@ -665,6 +680,7 @@ DCL_LOCK_STATE;
# endif
} else {
*opp = obj_link(op);
+ obj_link(op) = 0;
GC_words_allocd += lw;
FASTUNLOCK();
}
@@ -691,7 +707,7 @@ register ptr_t * opp;
register word lw;
DCL_LOCK_STATE;
- lb += EXTRA_BYTES;
+ lb += TYPD_EXTRA_BYTES;
if( SMALL_OBJ(lb) ) {
# ifdef MERGE_SIZES
lw = GC_size_map[lb];
@@ -708,6 +724,7 @@ DCL_LOCK_STATE;
# endif
} else {
*opp = obj_link(op);
+ obj_link(op) = 0;
GC_words_allocd += lw;
FASTUNLOCK();
}
@@ -717,7 +734,7 @@ DCL_LOCK_STATE;
lw = BYTES_TO_WORDS(GC_size(op));
}
if (op != NULL)
- ((word *)op)[lw - 1] = d;
+ ((word *)op)[lw - 1] = d;
return((GC_PTR) op);
}
@@ -748,11 +765,11 @@ DCL_LOCK_STATE;
case SIMPLE: return(GC_malloc_explicitly_typed(n*lb, simple_descr));
case LEAF:
lb *= n;
- lb += sizeof(struct LeafDescriptor) + EXTRA_BYTES;
+ lb += sizeof(struct LeafDescriptor) + TYPD_EXTRA_BYTES;
break;
case COMPLEX:
lb *= n;
- lb += EXTRA_BYTES;
+ lb += TYPD_EXTRA_BYTES;
break;
}
if( SMALL_OBJ(lb) ) {
@@ -772,6 +789,7 @@ DCL_LOCK_STATE;
# endif
} else {
*opp = obj_link(op);
+ obj_link(op) = 0;
GC_words_allocd += lw;
FASTUNLOCK();
}
diff --git a/gc/version.h b/gc/version.h
@@ -1,6 +1,6 @@
-#define GC_VERSION_MAJOR 5
+#define GC_VERSION_MAJOR 6
#define GC_VERSION_MINOR 0
-#define GC_ALPHA_VERSION 3
+#define GC_ALPHA_VERSION GC_NOT_ALPHA
# define GC_NOT_ALPHA 0xff
diff --git a/gc/weakpointer.h b/gc/weakpointer.h
@@ -1,221 +0,0 @@
-#ifndef _weakpointer_h_
-#define _weakpointer_h_
-
-/****************************************************************************
-
-WeakPointer and CleanUp
-
- Copyright (c) 1991 by Xerox Corporation. All rights reserved.
-
- THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
-
- Permission is hereby granted to copy this code for any purpose,
- provided the above notices are retained on all copies.
-
- Last modified on Mon Jul 17 18:16:01 PDT 1995 by ellis
-
-****************************************************************************/
-
-/****************************************************************************
-
-WeakPointer
-
-A weak pointer is a pointer to a heap-allocated object that doesn't
-prevent the object from being garbage collected. Weak pointers can be
-used to track which objects haven't yet been reclaimed by the
-collector. A weak pointer is deactivated when the collector discovers
-its referent object is unreachable by normal pointers (reachability
-and deactivation are defined more precisely below). A deactivated weak
-pointer remains deactivated forever.
-
-****************************************************************************/
-
-
-template< class T > class WeakPointer {
-public:
-
-WeakPointer( T* t = 0 )
- /* Constructs a weak pointer for *t. t may be null. It is an error
- if t is non-null and *t is not a collected object. */
- {impl = _WeakPointer_New( t );}
-
-T* Pointer()
- /* wp.Pointer() returns a pointer to the referent object of wp or
- null if wp has been deactivated (because its referent object
- has been discovered unreachable by the collector). */
- {return (T*) _WeakPointer_Pointer( this->impl );}
-
-int operator==( WeakPointer< T > wp2 )
- /* Given weak pointers wp1 and wp2, if wp1 == wp2, then wp1 and
- wp2 refer to the same object. If wp1 != wp2, then either wp1
- and wp2 don't refer to the same object, or if they do, one or
- both of them has been deactivated. (Note: If objects t1 and t2
- are never made reachable by their clean-up functions, then
- WeakPointer<T>(t1) == WeakPointer<T>(t2) if and only t1 == t2.) */
- {return _WeakPointer_Equal( this->impl, wp2.impl );}
-
-int Hash()
- /* Returns a hash code suitable for use by multiplicative- and
- division-based hash tables. If wp1 == wp2, then wp1.Hash() ==
- wp2.Hash(). */
- {return _WeakPointer_Hash( this->impl );}
-
-private:
-void* impl;
-};
-
-/*****************************************************************************
-
-CleanUp
-
-A garbage-collected object can have an associated clean-up function
-that will be invoked some time after the collector discovers the
-object is unreachable via normal pointers. Clean-up functions can be
-used to release resources such as open-file handles or window handles
-when their containing objects become unreachable. If a C++ object has
-a non-empty explicit destructor (i.e. it contains programmer-written
-code), the destructor will be automatically registered as the object's
-initial clean-up function.
-
-There is no guarantee that the collector will detect every unreachable
-object (though it will find almost all of them). Clients should not
-rely on clean-up to cause some action to occur immediately -- clean-up
-is only a mechanism for improving resource usage.
-
-Every object with a clean-up function also has a clean-up queue. When
-the collector finds the object is unreachable, it enqueues it on its
-queue. The clean-up function is applied when the object is removed
-from the queue. By default, objects are enqueued on the garbage
-collector's queue, and the collector removes all objects from its
-queue after each collection. If a client supplies another queue for
-objects, it is his responsibility to remove objects (and cause their
-functions to be called) by polling it periodically.
-
-Clean-up queues allow clean-up functions accessing global data to
-synchronize with the main program. Garbage collection can occur at any
-time, and clean-ups invoked by the collector might access data in an
-inconsistent state. A client can control this by defining an explicit
-queue for objects and polling it at safe points.
-
-The following definitions are used by the specification below:
-
-Given a pointer t to a collected object, the base object BO(t) is the
-value returned by new when it created the object. (Because of multiple
-inheritance, t and BO(t) may not be the same address.)
-
-A weak pointer wp references an object *t if BO(wp.Pointer()) ==
-BO(t).
-
-***************************************************************************/
-
-template< class T, class Data > class CleanUp {
-public:
-
-static void Set( T* t, void c( Data* d, T* t ), Data* d = 0 )
- /* Sets the clean-up function of object BO(t) to be <c, d>,
- replacing any previously defined clean-up function for BO(t); c
- and d can be null, but t cannot. Sets the clean-up queue for
- BO(t) to be the collector's queue. When t is removed from its
- clean-up queue, its clean-up will be applied by calling c(d,
- t). It is an error if *t is not a collected object. */
- {_CleanUp_Set( t, c, d );}
-
-static void Call( T* t )
- /* Sets the new clean-up function for BO(t) to be null and, if the
- old one is non-null, calls it immediately, even if BO(t) is
- still reachable. Deactivates any weak pointers to BO(t). */
- {_CleanUp_Call( t );}
-
-class Queue {public:
- Queue()
- /* Constructs a new queue. */
- {this->head = _CleanUp_Queue_NewHead();}
-
- void Set( T* t )
- /* q.Set(t) sets the clean-up queue of BO(t) to be q. */
- {_CleanUp_Queue_Set( this->head, t );}
-
- int Call()
- /* If q is non-empty, q.Call() removes the first object and
- calls its clean-up function; does nothing if q is
- empty. Returns true if there are more objects in the
- queue. */
- {return _CleanUp_Queue_Call( this->head );}
-
- private:
- void* head;
- };
-};
-
-/**********************************************************************
-
-Reachability and Clean-up
-
-An object O is reachable if it can be reached via a non-empty path of
-normal pointers from the registers, stacks, global variables, or an
-object with a non-null clean-up function (including O itself),
-ignoring pointers from an object to itself.
-
-This definition of reachability ensures that if object B is accessible
-from object A (and not vice versa) and if both A and B have clean-up
-functions, then A will always be cleaned up before B. Note that as
-long as an object with a clean-up function is contained in a cycle of
-pointers, it will always be reachable and will never be cleaned up or
-collected.
-
-When the collector finds an unreachable object with a null clean-up
-function, it atomically deactivates all weak pointers referencing the
-object and recycles its storage. If object B is accessible from object
-A via a path of normal pointers, A will be discovered unreachable no
-later than B, and a weak pointer to A will be deactivated no later
-than a weak pointer to B.
-
-When the collector finds an unreachable object with a non-null
-clean-up function, the collector atomically deactivates all weak
-pointers referencing the object, redefines its clean-up function to be
-null, and enqueues it on its clean-up queue. The object then becomes
-reachable again and remains reachable at least until its clean-up
-function executes.
-
-The clean-up function is assured that its argument is the only
-accessible pointer to the object. Nothing prevents the function from
-redefining the object's clean-up function or making the object
-reachable again (for example, by storing the pointer in a global
-variable).
-
-If the clean-up function does not make its object reachable again and
-does not redefine its clean-up function, then the object will be
-collected by a subsequent collection (because the object remains
-unreachable and now has a null clean-up function). If the clean-up
-function does make its object reachable again and a clean-up function
-is subsequently redefined for the object, then the new clean-up
-function will be invoked the next time the collector finds the object
-unreachable.
-
-Note that a destructor for a collected object cannot safely redefine a
-clean-up function for its object, since after the destructor executes,
-the object has been destroyed into "raw memory". (In most
-implementations, destroying an object mutates its vtbl.)
-
-Finally, note that calling delete t on a collected object first
-deactivates any weak pointers to t and then invokes its clean-up
-function (destructor).
-
-**********************************************************************/
-
-extern "C" {
- void* _WeakPointer_New( void* t );
- void* _WeakPointer_Pointer( void* wp );
- int _WeakPointer_Equal( void* wp1, void* wp2 );
- int _WeakPointer_Hash( void* wp );
- void _CleanUp_Set( void* t, void (*c)( void* d, void* t ), void* d );
- void _CleanUp_Call( void* t );
- void* _CleanUp_Queue_NewHead ();
- void _CleanUp_Queue_Set( void* h, void* t );
- int _CleanUp_Queue_Call( void* h );
-}
-
-#endif /* _weakpointer_h_ */
-
-
diff --git a/gc/win32_threads.c b/gc/win32_threads.c
@@ -1,9 +1,11 @@
-#ifdef WIN32_THREADS
+#if defined(GC_WIN32_THREADS) || defined(WIN32_THREADS)
-#include "gc_priv.h"
+#include "private/gc_priv.h"
+#if 0
#define STRICT
#include <windows.h>
+#endif
#define MAX_THREADS 64
@@ -22,6 +24,13 @@ volatile GC_bool GC_please_stop = FALSE;
volatile struct thread_entry thread_table[MAX_THREADS];
+void GC_push_thread_structures GC_PROTO((void))
+{
+ /* Unlike the other threads implementations, the thread table here */
+ /* contains no pointers to the collectable heap. Thus we have */
+ /* no private structures we need to preserve. */
+}
+
void GC_stop_world()
{
DWORD thread_id = GetCurrentThreadId();
@@ -31,8 +40,28 @@ void GC_stop_world()
for (i = 0; i < MAX_THREADS; i++)
if (thread_table[i].stack != 0
&& thread_table[i].id != thread_id) {
- if (SuspendThread(thread_table[i].handle) == (DWORD)-1)
- ABORT("SuspendThread failed");
+# ifdef MSWINCE
+ /* SuspendThread will fail if thread is running kernel code */
+ while (SuspendThread(thread_table[i].handle) == (DWORD)-1)
+ Sleep(10);
+# else
+ /* Apparently the Windows 95 GetOpenFileName call creates */
+ /* a thread that does not properly get cleaned up, and */
+ /* SuspendThread on its descriptor may provoke a crash. */
+ /* This reduces the probability of that event, though it still */
+ /* appears there's a race here. */
+ DWORD exitCode;
+ if (GetExitCodeThread(thread_table[i].handle,&exitCode) &&
+ exitCode != STILL_ACTIVE) {
+ thread_table[i].stack = 0;
+ thread_table[i].in_use = FALSE;
+ CloseHandle(thread_table[i].handle);
+ BZERO((void *)(&thread_table[i].context), sizeof(CONTEXT));
+ continue;
+ }
+ if (SuspendThread(thread_table[i].handle) == (DWORD)-1)
+ ABORT("SuspendThread failed");
+# endif
thread_table[i].suspended = TRUE;
}
}
@@ -51,6 +80,9 @@ void GC_start_world()
GC_please_stop = FALSE;
}
+# ifdef _MSC_VER
+# pragma warning(disable:4715)
+# endif
ptr_t GC_current_stackbottom()
{
DWORD thread_id = GetCurrentThreadId();
@@ -60,18 +92,30 @@ ptr_t GC_current_stackbottom()
return thread_table[i].stack;
ABORT("no thread table entry for current thread");
}
+# ifdef _MSC_VER
+# pragma warning(default:4715)
+# endif
-ptr_t GC_get_lo_stack_addr(ptr_t s)
-{
- ptr_t bottom;
- MEMORY_BASIC_INFORMATION info;
- VirtualQuery(s, &info, sizeof(info));
- do {
- bottom = info.BaseAddress;
- VirtualQuery(bottom - 1, &info, sizeof(info));
- } while ((info.Protect & PAGE_READWRITE) && !(info.Protect & PAGE_GUARD));
- return(bottom);
-}
+# ifdef MSWINCE
+ /* The VirtualQuery calls below won't work properly on WinCE, but */
+ /* since each stack is restricted to an aligned 64K region of */
+ /* virtual memory we can just take the next lowest multiple of 64K. */
+# define GC_get_lo_stack_addr(s) \
+ ((ptr_t)(((DWORD)(s) - 1) & 0xFFFF0000))
+# else
+ static ptr_t GC_get_lo_stack_addr(ptr_t s)
+ {
+ ptr_t bottom;
+ MEMORY_BASIC_INFORMATION info;
+ VirtualQuery(s, &info, sizeof(info));
+ do {
+ bottom = info.BaseAddress;
+ VirtualQuery(bottom - 1, &info, sizeof(info));
+ } while ((info.Protect & PAGE_READWRITE)
+ && !(info.Protect & PAGE_GUARD));
+ return(bottom);
+ }
+# endif
void GC_push_all_stacks()
{
@@ -81,23 +125,186 @@ void GC_push_all_stacks()
if (thread_table[i].stack) {
ptr_t bottom = GC_get_lo_stack_addr(thread_table[i].stack);
if (thread_table[i].id == thread_id)
- GC_push_all(&i, thread_table[i].stack);
+ GC_push_all_stack((ptr_t)&i, thread_table[i].stack);
else {
thread_table[i].context.ContextFlags
= (CONTEXT_INTEGER|CONTEXT_CONTROL);
if (!GetThreadContext(thread_table[i].handle,
- &thread_table[i].context))
+ /* cast away volatile qualifier */
+ (LPCONTEXT)&thread_table[i].context))
ABORT("GetThreadContext failed");
- if (thread_table[i].context.Esp >= (DWORD)thread_table[i].stack
- || thread_table[i].context.Esp < (DWORD)bottom)
- ABORT("Thread stack pointer out of range");
- GC_push_one ((word) thread_table[i].context.Edi);
- GC_push_one ((word) thread_table[i].context.Esi);
- GC_push_one ((word) thread_table[i].context.Ebx);
- GC_push_one ((word) thread_table[i].context.Edx);
- GC_push_one ((word) thread_table[i].context.Ecx);
- GC_push_one ((word) thread_table[i].context.Eax);
- GC_push_all_stack(thread_table[i].context.Esp, thread_table[i].stack);
+# ifdef I386
+ if (thread_table[i].context.Esp >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.Esp < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.Edi);
+ GC_push_one ((word) thread_table[i].context.Esi);
+ GC_push_one ((word) thread_table[i].context.Ebp);
+ GC_push_one ((word) thread_table[i].context.Ebx);
+ GC_push_one ((word) thread_table[i].context.Edx);
+ GC_push_one ((word) thread_table[i].context.Ecx);
+ GC_push_one ((word) thread_table[i].context.Eax);
+ GC_push_all_stack((char *) thread_table[i].context.Esp,
+ thread_table[i].stack);
+# else
+# ifdef ARM32
+ if (thread_table[i].context.Sp >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.Sp < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.R0);
+ GC_push_one ((word) thread_table[i].context.R1);
+ GC_push_one ((word) thread_table[i].context.R2);
+ GC_push_one ((word) thread_table[i].context.R3);
+ GC_push_one ((word) thread_table[i].context.R4);
+ GC_push_one ((word) thread_table[i].context.R5);
+ GC_push_one ((word) thread_table[i].context.R6);
+ GC_push_one ((word) thread_table[i].context.R7);
+ GC_push_one ((word) thread_table[i].context.R8);
+ GC_push_one ((word) thread_table[i].context.R9);
+ GC_push_one ((word) thread_table[i].context.R10);
+ GC_push_one ((word) thread_table[i].context.R11);
+ GC_push_one ((word) thread_table[i].context.R12);
+ GC_push_all_stack((char *) thread_table[i].context.Sp,
+ thread_table[i].stack);
+# else
+# ifdef SHx
+ if (thread_table[i].context.R15 >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.R15 < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.R0);
+ GC_push_one ((word) thread_table[i].context.R1);
+ GC_push_one ((word) thread_table[i].context.R2);
+ GC_push_one ((word) thread_table[i].context.R3);
+ GC_push_one ((word) thread_table[i].context.R4);
+ GC_push_one ((word) thread_table[i].context.R5);
+ GC_push_one ((word) thread_table[i].context.R6);
+ GC_push_one ((word) thread_table[i].context.R7);
+ GC_push_one ((word) thread_table[i].context.R8);
+ GC_push_one ((word) thread_table[i].context.R9);
+ GC_push_one ((word) thread_table[i].context.R10);
+ GC_push_one ((word) thread_table[i].context.R11);
+ GC_push_one ((word) thread_table[i].context.R12);
+ GC_push_one ((word) thread_table[i].context.R13);
+ GC_push_one ((word) thread_table[i].context.R14);
+ GC_push_all_stack((char *) thread_table[i].context.R15,
+ thread_table[i].stack);
+# else
+# ifdef MIPS
+ if (thread_table[i].context.IntSp >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.IntSp < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.IntAt);
+ GC_push_one ((word) thread_table[i].context.IntV0);
+ GC_push_one ((word) thread_table[i].context.IntV1);
+ GC_push_one ((word) thread_table[i].context.IntA0);
+ GC_push_one ((word) thread_table[i].context.IntA1);
+ GC_push_one ((word) thread_table[i].context.IntA2);
+ GC_push_one ((word) thread_table[i].context.IntA3);
+ GC_push_one ((word) thread_table[i].context.IntT0);
+ GC_push_one ((word) thread_table[i].context.IntT1);
+ GC_push_one ((word) thread_table[i].context.IntT2);
+ GC_push_one ((word) thread_table[i].context.IntT3);
+ GC_push_one ((word) thread_table[i].context.IntT4);
+ GC_push_one ((word) thread_table[i].context.IntT5);
+ GC_push_one ((word) thread_table[i].context.IntT6);
+ GC_push_one ((word) thread_table[i].context.IntT7);
+ GC_push_one ((word) thread_table[i].context.IntS0);
+ GC_push_one ((word) thread_table[i].context.IntS1);
+ GC_push_one ((word) thread_table[i].context.IntS2);
+ GC_push_one ((word) thread_table[i].context.IntS3);
+ GC_push_one ((word) thread_table[i].context.IntS4);
+ GC_push_one ((word) thread_table[i].context.IntS5);
+ GC_push_one ((word) thread_table[i].context.IntS6);
+ GC_push_one ((word) thread_table[i].context.IntS7);
+ GC_push_one ((word) thread_table[i].context.IntT8);
+ GC_push_one ((word) thread_table[i].context.IntT9);
+ GC_push_one ((word) thread_table[i].context.IntK0);
+ GC_push_one ((word) thread_table[i].context.IntK1);
+ GC_push_one ((word) thread_table[i].context.IntS8);
+ GC_push_all_stack((char *) thread_table[i].context.IntSp,
+ thread_table[i].stack);
+# else
+# ifdef PPC
+ if (thread_table[i].context.Gpr1 >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.Gpr1 < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.Gpr0);
+ /* Gpr1 is stack pointer */
+ /* Gpr2 is global pointer */
+ GC_push_one ((word) thread_table[i].context.Gpr3);
+ GC_push_one ((word) thread_table[i].context.Gpr4);
+ GC_push_one ((word) thread_table[i].context.Gpr5);
+ GC_push_one ((word) thread_table[i].context.Gpr6);
+ GC_push_one ((word) thread_table[i].context.Gpr7);
+ GC_push_one ((word) thread_table[i].context.Gpr8);
+ GC_push_one ((word) thread_table[i].context.Gpr9);
+ GC_push_one ((word) thread_table[i].context.Gpr10);
+ GC_push_one ((word) thread_table[i].context.Gpr11);
+ GC_push_one ((word) thread_table[i].context.Gpr12);
+ /* Gpr13 is reserved for the kernel */
+ GC_push_one ((word) thread_table[i].context.Gpr14);
+ GC_push_one ((word) thread_table[i].context.Gpr15);
+ GC_push_one ((word) thread_table[i].context.Gpr16);
+ GC_push_one ((word) thread_table[i].context.Gpr17);
+ GC_push_one ((word) thread_table[i].context.Gpr18);
+ GC_push_one ((word) thread_table[i].context.Gpr19);
+ GC_push_one ((word) thread_table[i].context.Gpr20);
+ GC_push_one ((word) thread_table[i].context.Gpr21);
+ GC_push_one ((word) thread_table[i].context.Gpr22);
+ GC_push_one ((word) thread_table[i].context.Gpr23);
+ GC_push_one ((word) thread_table[i].context.Gpr24);
+ GC_push_one ((word) thread_table[i].context.Gpr25);
+ GC_push_one ((word) thread_table[i].context.Gpr26);
+ GC_push_one ((word) thread_table[i].context.Gpr27);
+ GC_push_one ((word) thread_table[i].context.Gpr28);
+ GC_push_one ((word) thread_table[i].context.Gpr29);
+ GC_push_one ((word) thread_table[i].context.Gpr30);
+ GC_push_one ((word) thread_table[i].context.Gpr31);
+ GC_push_all_stack((char *) thread_table[i].context.Gpr1,
+ thread_table[i].stack);
+# else
+# ifdef ALPHA
+ if (thread_table[i].context.IntSp >= (DWORD)thread_table[i].stack
+ || thread_table[i].context.IntSp < (DWORD)bottom)
+ ABORT("Thread stack pointer out of range");
+ GC_push_one ((word) thread_table[i].context.IntV0);
+ GC_push_one ((word) thread_table[i].context.IntT0);
+ GC_push_one ((word) thread_table[i].context.IntT1);
+ GC_push_one ((word) thread_table[i].context.IntT2);
+ GC_push_one ((word) thread_table[i].context.IntT3);
+ GC_push_one ((word) thread_table[i].context.IntT4);
+ GC_push_one ((word) thread_table[i].context.IntT5);
+ GC_push_one ((word) thread_table[i].context.IntT6);
+ GC_push_one ((word) thread_table[i].context.IntT7);
+ GC_push_one ((word) thread_table[i].context.IntS0);
+ GC_push_one ((word) thread_table[i].context.IntS1);
+ GC_push_one ((word) thread_table[i].context.IntS2);
+ GC_push_one ((word) thread_table[i].context.IntS3);
+ GC_push_one ((word) thread_table[i].context.IntS4);
+ GC_push_one ((word) thread_table[i].context.IntS5);
+ GC_push_one ((word) thread_table[i].context.IntFp);
+ GC_push_one ((word) thread_table[i].context.IntA0);
+ GC_push_one ((word) thread_table[i].context.IntA1);
+ GC_push_one ((word) thread_table[i].context.IntA2);
+ GC_push_one ((word) thread_table[i].context.IntA3);
+ GC_push_one ((word) thread_table[i].context.IntA4);
+ GC_push_one ((word) thread_table[i].context.IntA5);
+ GC_push_one ((word) thread_table[i].context.IntT8);
+ GC_push_one ((word) thread_table[i].context.IntT9);
+ GC_push_one ((word) thread_table[i].context.IntT10);
+ GC_push_one ((word) thread_table[i].context.IntT11);
+ GC_push_one ((word) thread_table[i].context.IntT12);
+ GC_push_one ((word) thread_table[i].context.IntAt);
+ GC_push_all_stack((char *) thread_table[i].context.IntSp,
+ thread_table[i].stack);
+# else
+ --> architecture not supported
+# endif /* !ALPHA */
+# endif /* !PPC */
+# endif /* !MIPS */
+# endif /* !SHx */
+# endif /* !ARM32 */
+# endif /* !I386 */
}
}
}
@@ -124,6 +331,177 @@ void GC_get_next_stack(char *start, char **lo, char **hi)
if (*lo < start) *lo = start;
}
+
+# ifdef MSWINCE
+
+typedef struct {
+ HANDLE child_ready_h, parent_ready_h;
+ volatile struct thread_entry * entry;
+ LPTHREAD_START_ROUTINE start;
+ LPVOID param;
+} thread_args;
+
+DWORD WINAPI thread_start(LPVOID arg);
+
+HANDLE WINAPI GC_CreateThread(
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
+ LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId )
+{
+ HANDLE thread_h = NULL;
+ HANDLE child_ready_h, parent_ready_h;
+
+ int i;
+ thread_args args;
+
+ /* allocate thread slot */
+ LOCK();
+ for (i = 0; i != MAX_THREADS && thread_table[i].in_use; i++)
+ ;
+ if (i != MAX_THREADS) {
+ thread_table[i].in_use = TRUE;
+ }
+ UNLOCK();
+
+ if (i != MAX_THREADS) {
+
+ /* create unnamed unsignalled events */
+ if (child_ready_h = CreateEvent(NULL, FALSE, FALSE, NULL)) {
+ if (parent_ready_h = CreateEvent(NULL, FALSE, FALSE, NULL)) {
+
+ /* set up thread arguments */
+ args.child_ready_h = child_ready_h;
+ args.parent_ready_h = parent_ready_h;
+ args.entry = &thread_table[i];
+ args.start = lpStartAddress;
+ args.param = lpParameter;
+
+ thread_h = CreateThread(lpThreadAttributes,
+ dwStackSize, thread_start,
+ &args,
+ dwCreationFlags & ~CREATE_SUSPENDED,
+ lpThreadId);
+
+ if (thread_h) {
+
+ /* fill in ID and handle; tell child this is done */
+ thread_table[i].id = *lpThreadId;
+ thread_table[i].handle = thread_h;
+ SetEvent (parent_ready_h);
+
+ /* wait for child to fill in stack and copy args */
+ WaitForSingleObject (child_ready_h, INFINITE);
+
+ /* suspend the child if requested */
+ if (dwCreationFlags & CREATE_SUSPENDED)
+ SuspendThread (thread_h);
+
+ /* let child call given function now (or when resumed) */
+ SetEvent (parent_ready_h);
+
+ } else {
+ CloseHandle (parent_ready_h);
+ }
+ }
+ }
+
+ CloseHandle (child_ready_h);
+
+ if (thread_h == NULL)
+ thread_table[i].in_use = FALSE;
+
+ } else { /* no thread slot found */
+ SetLastError (ERROR_TOO_MANY_TCBS);
+ }
+
+ return thread_h;
+}
+
+static DWORD WINAPI thread_start(LPVOID arg)
+{
+ DWORD ret = 0;
+ thread_args args = *(thread_args *)arg;
+
+ /* wait for parent to fill in ID and handle */
+ WaitForSingleObject (args.parent_ready_h, INFINITE);
+ ResetEvent (args.parent_ready_h);
+
+ /* fill in stack; tell parent this is done */
+ args.entry->stack = GC_get_stack_base();
+ SetEvent (args.child_ready_h);
+
+ /* wait for parent to tell us to go (in case it needs to suspend us) */
+ WaitForSingleObject (args.parent_ready_h, INFINITE);
+ CloseHandle (args.parent_ready_h);
+
+ /* Clear the thread entry even if we exit with an exception. */
+ /* This is probably pointless, since an uncaught exception is */
+ /* supposed to result in the process being killed. */
+ __try {
+ ret = args.start (args.param);
+ } __finally {
+ LOCK();
+ args.entry->stack = 0;
+ args.entry->in_use = FALSE;
+ /* cast away volatile qualifier */
+ BZERO((void *) &args.entry->context, sizeof(CONTEXT));
+ UNLOCK();
+ }
+
+ return ret;
+}
+
+typedef struct {
+ HINSTANCE hInstance;
+ HINSTANCE hPrevInstance;
+ LPWSTR lpCmdLine;
+ int nShowCmd;
+} main_thread_args;
+
+DWORD WINAPI main_thread_start(LPVOID arg);
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPWSTR lpCmdLine, int nShowCmd)
+{
+ DWORD exit_code = 1;
+
+ main_thread_args args = {
+ hInstance, hPrevInstance, lpCmdLine, nShowCmd
+ };
+ HANDLE thread_h;
+ DWORD thread_id;
+
+ /* initialize everything */
+ InitializeCriticalSection(&GC_allocate_ml);
+ GC_init();
+
+ /* start the main thread */
+ thread_h = GC_CreateThread(
+ NULL, 0, main_thread_start, &args, 0, &thread_id);
+
+ if (thread_h != NULL)
+ {
+ WaitForSingleObject (thread_h, INFINITE);
+ GetExitCodeThread (thread_h, &exit_code);
+ CloseHandle (thread_h);
+ }
+
+ GC_deinit();
+ DeleteCriticalSection(&GC_allocate_ml);
+
+ return (int) exit_code;
+}
+
+DWORD WINAPI main_thread_start(LPVOID arg)
+{
+ main_thread_args * args = (main_thread_args *) arg;
+
+ return (DWORD) GC_WinMain (args->hInstance, args->hPrevInstance,
+ args->lpCmdLine, args->nShowCmd);
+}
+
+# else /* !MSWINCE */
+
LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
/*
@@ -151,11 +529,14 @@ BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
/* The following should be a noop according to the win32 */
/* documentation. There is empirical evidence that it */
/* isn't. - HB */
-# ifndef SMALL_CONFIG
+# ifdef MPROTECT_VDB
if (GC_incremental) SetUnhandledExceptionFilter(GC_write_fault_handler);
# endif
- for (i = 0; InterlockedExchange(&thread_table[i].in_use,1) != 0; i++) {
+ for (i = 0;
+ /* cast away volatile qualifier */
+ InterlockedExchange((LPLONG) &thread_table[i].in_use, 1) != 0;
+ i++) {
/* Compare-and-swap would make this cleaner, but that's not */
/* supported before Windows 98 and NT 4.0. In Windows 2000, */
/* InterlockedExchange is supposed to be replaced by */
@@ -166,15 +547,16 @@ BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
}
thread_table[i].id = GetCurrentThreadId();
if (!DuplicateHandle(GetCurrentProcess(),
- GetCurrentThread(),
+ GetCurrentThread(),
GetCurrentProcess(),
- &thread_table[i].handle,
+ /* cast away volatile qualifier */
+ (HANDLE *) &thread_table[i].handle,
0,
0,
DUPLICATE_SAME_ACCESS)) {
- DWORD last_error = GetLastError();
- GC_printf1("Last error code: %lx\n", last_error);
- ABORT("DuplicateHandle failed");
+ DWORD last_error = GetLastError();
+ GC_printf1("Last error code: %lx\n", last_error);
+ ABORT("DuplicateHandle failed");
}
thread_table[i].stack = GC_get_stack_base();
/* If this thread is being created while we are trying to stop */
@@ -183,27 +565,53 @@ BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved)
while (GC_please_stop) Sleep(20);
}
break;
- case DLL_PROCESS_DETACH:
case DLL_THREAD_DETACH:
{
int i;
DWORD thread_id = GetCurrentThreadId();
LOCK();
for (i = 0;
- thread_table[i].stack == 0 || thread_table[i].id != thread_id;
- i++) {
- if (i == MAX_THREADS - 1)
- ABORT("thread not found on detach");
+ i < MAX_THREADS &&
+ (thread_table[i].stack == 0 || thread_table[i].id != thread_id);
+ i++) {}
+ if (i >= MAX_THREADS) {
+ WARN("thread %ld not found on detach", (GC_word)thread_id);
+ } else {
+ thread_table[i].stack = 0;
+ thread_table[i].in_use = FALSE;
+ CloseHandle(thread_table[i].handle);
+ /* cast away volatile qualifier */
+ BZERO((void *) &thread_table[i].context, sizeof(CONTEXT));
+ }
+ UNLOCK();
+ }
+ break;
+ case DLL_PROCESS_DETACH:
+ {
+ int i;
+
+ LOCK();
+ for (i = 0; i < MAX_THREADS; ++i)
+ {
+ if (thread_table[i].in_use)
+ {
+ thread_table[i].stack = 0;
+ thread_table[i].in_use = FALSE;
+ CloseHandle(thread_table[i].handle);
+ BZERO((void *) &thread_table[i].context, sizeof(CONTEXT));
+ }
}
- thread_table[i].stack = 0;
- thread_table[i].in_use = FALSE;
- CloseHandle(thread_table[i].handle);
- BZERO(&thread_table[i].context, sizeof(CONTEXT));
UNLOCK();
+
+ GC_deinit();
+ DeleteCriticalSection(&GC_allocate_ml);
}
break;
+
}
return TRUE;
}
+# endif /* !MSWINCE */
+
#endif /* WIN32_THREADS */
diff --git a/history.c b/history.c
@@ -14,7 +14,7 @@ historyBuffer(Hist * hist)
Strcat_charp(src, "<ol>\n");
if (hist && hist->list) {
for (item = hist->list->last; item; item = item->prev) {
- q = htmlquote_str((char *)item->ptr);
+ q = html_quote((char *)item->ptr);
Strcat_charp(src, "<li><a href=\"");
Strcat_charp(src, q);
Strcat_charp(src, "\">");
@@ -44,7 +44,7 @@ loadHistory(Hist * hist)
Strremovetrailingspaces(line);
if (line->length == 0)
continue;
- pushHist(hist, line->ptr);
+ pushHist(hist, url_quote(line->ptr));
}
fclose(f);
}
diff --git a/html.c b/html.c
@@ -32,13 +32,13 @@ unsigned char ALST_FRAME[] = {ATTR_SRC,ATTR_NAME,ATTR_CORE};
unsigned char ALST_FRAMESET[] = {ATTR_COLS,ATTR_ROWS,ATTR_CORE};
#define MAXA_FRAMESET MAXA_CORE + 2
unsigned char ALST_FORM[] =
-{ATTR_METHOD,ATTR_ACTION,ATTR_CHARSET,ATTR_ACCEPT_CHARSET,ATTR_ENCTYPE,ATTR_TARGET,ATTR_CORE};
-#define MAXA_FORM MAXA_CORE + 6
+{ATTR_METHOD,ATTR_ACTION,ATTR_CHARSET,ATTR_ACCEPT_CHARSET,ATTR_ENCTYPE,ATTR_TARGET,ATTR_NAME,ATTR_CORE};
+#define MAXA_FORM MAXA_CORE + 7
unsigned char ALST_INPUT[] =
-{ATTR_TYPE,ATTR_VALUE,ATTR_NAME,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_ALT,ATTR_CORE};
-#define MAXA_INPUT MAXA_CORE + 8
-unsigned char ALST_TEXTAREA[] = {ATTR_COLS,ATTR_ROWS,ATTR_NAME,ATTR_CORE};
-#define MAXA_TEXTAREA MAXA_CORE + 3
+{ATTR_TYPE,ATTR_VALUE,ATTR_NAME,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_ALT,ATTR_READONLY,ATTR_CORE};
+#define MAXA_INPUT MAXA_CORE + 9
+unsigned char ALST_TEXTAREA[] = {ATTR_COLS,ATTR_ROWS,ATTR_NAME,ATTR_READONLY,ATTR_CORE};
+#define MAXA_TEXTAREA MAXA_CORE + 4
unsigned char ALST_SELECT[] = {ATTR_NAME,ATTR_MULTIPLE,ATTR_CORE};
#define MAXA_SELECT MAXA_CORE + 2
unsigned char ALST_OPTION[] = {ATTR_VALUE,ATTR_LABEL,ATTR_SELECTED,ATTR_CORE};
@@ -67,11 +67,13 @@ unsigned char ALST_EMBED[] = {ATTR_SRC,ATTR_CORE};
unsigned char ALST_TABLE_ALT[] = {ATTR_TID};
#define MAXA_TABLE_ALT 1
+unsigned char ALST_RULE[] = {ATTR_TYPE};
+#define MAXA_RULE 1
unsigned char ALST_TITLE_ALT[] = {ATTR_TITLE};
#define MAXA_TITLE_ALT 1
unsigned char ALST_INPUT_ALT[] =
-{ATTR_HSEQ,ATTR_FID,ATTR_NO_EFFECT,ATTR_TYPE,ATTR_NAME,ATTR_VALUE,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_TEXTAREANUMBER,ATTR_SELECTNUMBER,ATTR_ROWS};
-#define MAXA_INPUT_ALT 13
+{ATTR_HSEQ,ATTR_FID,ATTR_NO_EFFECT,ATTR_TYPE,ATTR_NAME,ATTR_VALUE,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_READONLY,ATTR_TEXTAREANUMBER,ATTR_SELECTNUMBER,ATTR_ROWS,ATTR_TOP_MARGIN,ATTR_BOTTOM_MARGIN};
+#define MAXA_INPUT_ALT 16
unsigned char ALST_IMG_ALT[] = {ATTR_SRC};
#define MAXA_IMG_ALT 1
unsigned char ALST_NOP[] = {ATTR_CORE};
@@ -79,137 +81,137 @@ unsigned char ALST_NOP[] = {ATTR_CORE};
TagInfo TagMAP[MAX_HTMLTAG] =
{
- {NULL, 0, 0}, /* 0 HTML_UNKNOWN */
- {ALST_A, MAXA_A, 0}, /* 1 HTML_A */
- {NULL, 0, TFLG_END}, /* 2 HTML_N_A */
- {ALST_P, MAXA_P, 0}, /* 3 HTML_H */
- {NULL, 0, TFLG_END}, /* 4 HTML_N_H */
- {ALST_P, MAXA_P, 0}, /* 5 HTML_P */
- {NULL, 0, 0}, /* 6 HTML_BR */
- {NULL, 0, 0}, /* 7 HTML_B */
- {NULL, 0, TFLG_END}, /* 8 HTML_N_B */
- {ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */
- {NULL, 0, TFLG_END}, /* 10 HTML_N_UL */
- {ALST_LI, MAXA_LI, 0}, /* 11 HTML_LI */
- {ALST_UL, MAXA_UL, 0}, /* 12 HTML_OL */
- {NULL, 0, TFLG_END}, /* 13 HTML_N_OL */
- {NULL, 0, 0}, /* 14 HTML_TITLE */
- {NULL, 0, TFLG_END}, /* 15 HTML_N_TITLE */
- {ALST_HR, MAXA_HR, 0}, /* 16 HTML_HR */
- {ALST_DL, MAXA_DL, 0}, /* 17 HTML_DL */
- {NULL, 0, TFLG_END}, /* 18 HTML_N_DL */
- {NULL, 0, 0}, /* 19 HTML_DT */
- {NULL, 0, 0}, /* 20 HTML_DD */
- {ALST_PRE, MAXA_PRE, 0}, /* 21 HTML_PRE */
- {NULL, 0, TFLG_END}, /* 22 HTML_N_PRE */
- {NULL, 0, 0}, /* 23 HTML_BLQ */
- {NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */
- {ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */
- {NULL, 0, 0}, /* 26 HTML_LISTING */
- {NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */
- {NULL, 0, 0}, /* 28 HTML_XMP */
- {NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */
- {NULL, 0, 0}, /* 30 HTML_PLAINTEXT */
- {ALST_TABLE, MAXA_TABLE, 0}, /* 31 HTML_TABLE */
- {NULL, 0, TFLG_END}, /* 32 HTML_N_TABLE */
- {ALST_META, MAXA_META, 0}, /* 33 HTML_META */
- {NULL, 0, TFLG_END}, /* 34 HTML_N_P */
- {ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */
- {ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */
- {NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */
- {NULL, 0, 0}, /* 38 HTML_CENTER */
- {NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */
- {NULL, 0, 0}, /* 40 HTML_FONT */
- {NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */
- {ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */
- {NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */
- {ALST_INPUT, MAXA_INPUT, 0}, /* 44 HTML_INPUT */
- {ALST_TEXTAREA, MAXA_TEXTAREA, 0}, /* 45 HTML_TEXTAREA */
- {NULL, 0, TFLG_END}, /* 46 HTML_N_TEXTAREA */
- {ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */
- {NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */
- {ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */
- {NULL, 0, 0}, /* 50 HTML_NOBR */
- {NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */
- {ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */
- {NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */
- {ALST_ISINDEX, MAXA_ISINDEX, 0}, /* 54 HTML_ISINDEX */
- {ALST_MAP, MAXA_MAP, 0}, /* 55 HTML_MAP */
- {NULL, 0, TFLG_END}, /* 56 HTML_N_MAP */
- {ALST_AREA, MAXA_AREA, 0}, /* 57 HTML_AREA */
- {NULL, 0, 0}, /* 58 HTML_SCRIPT */
- {NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */
- {ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */
- {NULL, 0, 0}, /* 61 HTML_DEL */
- {NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */
- {NULL, 0, 0}, /* 63 HTML_INS */
- {NULL, 0, TFLG_END}, /* 64 HTML_N_INS */
- {NULL, 0, 0}, /* 65 HTML_U */
- {NULL, 0, TFLG_END}, /* 66 HTML_N_U */
- {NULL, 0, 0}, /* 67 HTML_STYLE */
- {NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */
- {NULL, 0, 0}, /* 69 HTML_WBR */
- {NULL, 0, 0}, /* 70 HTML_EM */
- {NULL, 0, TFLG_END}, /* 71 HTML_N_EM */
- {ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */
- {NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */
- {ALST_TR, MAXA_TR, 0}, /* 74 HTML_TR */
- {NULL, 0, TFLG_END}, /* 75 HTML_N_TR */
- {ALST_TD, MAXA_TD, 0}, /* 76 HTML_TD */
- {NULL, 0, TFLG_END}, /* 77 HTML_N_TD */
- {NULL, 0, 0}, /* 78 HTML_CAPTION */
- {NULL, 0, TFLG_END}, /* 79 HTML_N_CAPTION */
- {ALST_TD, MAXA_TD, 0}, /* 80 HTML_TH */
- {NULL, 0, TFLG_END}, /* 81 HTML_N_TH */
- {NULL, 0, 0}, /* 82 HTML_THEAD */
- {NULL, 0, TFLG_END}, /* 83 HTML_N_THEAD */
- {NULL, 0, 0}, /* 84 HTML_TBODY */
- {NULL, 0, TFLG_END}, /* 85 HTML_N_TBODY */
- {NULL, 0, 0}, /* 86 HTML_TFOOT */
- {NULL, 0, TFLG_END}, /* 87 HTML_N_TFOOT */
- {NULL, 0, 0}, /* 88 HTML_COLGROUP */
- {NULL, 0, TFLG_END}, /* 89 HTML_N_COLGROUP */
- {NULL, 0, 0}, /* 90 HTML_COL */
- {ALST_BGSOUND, MAX_BGSOUND, 0}, /* 91 HTML_BGSOUND */
- {ALST_APPLET, MAX_APPLET, 0}, /* 92 HTML_APPLET */
- {ALST_EMBED, MAX_EMBED, 0}, /* 93 HTML_EMBED */
- {NULL, 0, TFLG_END}, /* 94 HTML_N_OPTION */
- {NULL, 0, 0}, /* 95 HTML_HEAD */
- {NULL, 0, TFLG_END}, /* 96 HTML_N_HEAD */
- {NULL, 0, 0}, /* 97 HTML_DOCTYPE */
-
- {NULL, 0, 0}, /* 98 Undefined */
- {NULL, 0, 0}, /* 99 Undefined */
- {NULL, 0, 0}, /* 100 Undefined */
- {NULL, 0, 0}, /* 101 Undefined */
- {NULL, 0, 0}, /* 102 Undefined */
- {NULL, 0, 0}, /* 103 Undefined */
- {NULL, 0, 0}, /* 104 Undefined */
- {NULL, 0, 0}, /* 105 Undefined */
- {NULL, 0, 0}, /* 106 Undefined */
- {NULL, 0, 0}, /* 107 Undefined */
- {NULL, 0, 0}, /* 108 Undefined */
- {NULL, 0, 0}, /* 109 Undefined */
- {NULL, 0, 0}, /* 110 Undefined */
- {NULL, 0, 0}, /* 111 Undefined */
- {NULL, 0, 0}, /* 112 Undefined */
+ {NULL, NULL, 0, 0}, /* 0 HTML_UNKNOWN */
+ {"a", ALST_A, MAXA_A, 0}, /* 1 HTML_A */
+ {"/a", NULL, 0, TFLG_END}, /* 2 HTML_N_A */
+ {"h", ALST_P, MAXA_P, 0}, /* 3 HTML_H */
+ {"/h", NULL, 0, TFLG_END}, /* 4 HTML_N_H */
+ {"p", ALST_P, MAXA_P, 0}, /* 5 HTML_P */
+ {"br", NULL, 0, 0}, /* 6 HTML_BR */
+ {"b", NULL, 0, 0}, /* 7 HTML_B */
+ {"/b", NULL, 0, TFLG_END}, /* 8 HTML_N_B */
+ {"ul", ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */
+ {"/ul", NULL, 0, TFLG_END}, /* 10 HTML_N_UL */
+ {"li", ALST_LI, MAXA_LI, 0}, /* 11 HTML_LI */
+ {"ol", ALST_UL, MAXA_UL, 0}, /* 12 HTML_OL */
+ {"/ol", NULL, 0, TFLG_END}, /* 13 HTML_N_OL */
+ {"title", NULL, 0, 0}, /* 14 HTML_TITLE */
+ {"/title", NULL, 0, TFLG_END}, /* 15 HTML_N_TITLE */
+ {"hr", ALST_HR, MAXA_HR, 0}, /* 16 HTML_HR */
+ {"dl", ALST_DL, MAXA_DL, 0}, /* 17 HTML_DL */
+ {"/dl", NULL, 0, TFLG_END}, /* 18 HTML_N_DL */
+ {"dt", NULL, 0, 0}, /* 19 HTML_DT */
+ {"dd", NULL, 0, 0}, /* 20 HTML_DD */
+ {"pre", ALST_PRE, MAXA_PRE, 0}, /* 21 HTML_PRE */
+ {"/pre", NULL, 0, TFLG_END}, /* 22 HTML_N_PRE */
+ {"blockquote", NULL, 0, 0}, /* 23 HTML_BLQ */
+ {"/blockquote", NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */
+ {"img", ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */
+ {"listing", NULL, 0, 0}, /* 26 HTML_LISTING */
+ {"/listing", NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */
+ {"xmp", NULL, 0, 0}, /* 28 HTML_XMP */
+ {"/xmp", NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */
+ {"plaintext", NULL, 0, 0}, /* 30 HTML_PLAINTEXT */
+ {"table", ALST_TABLE, MAXA_TABLE, 0}, /* 31 HTML_TABLE */
+ {"/table", NULL, 0, TFLG_END}, /* 32 HTML_N_TABLE */
+ {"meta", ALST_META, MAXA_META, 0}, /* 33 HTML_META */
+ {"/p", NULL, 0, TFLG_END}, /* 34 HTML_N_P */
+ {"frame", ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */
+ {"frameset", ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */
+ {"/frameset", NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */
+ {"center", NULL, 0, 0}, /* 38 HTML_CENTER */
+ {"/center", NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */
+ {"font", NULL, 0, 0}, /* 40 HTML_FONT */
+ {"/font", NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */
+ {"form", ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */
+ {"/form", NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */
+ {"input", ALST_INPUT, MAXA_INPUT, 0}, /* 44 HTML_INPUT */
+ {"textarea", ALST_TEXTAREA, MAXA_TEXTAREA, 0}, /* 45 HTML_TEXTAREA */
+ {"/textarea", NULL, 0, TFLG_END}, /* 46 HTML_N_TEXTAREA */
+ {"select", ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */
+ {"/select", NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */
+ {"option", ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */
+ {"nobr", NULL, 0, 0}, /* 50 HTML_NOBR */
+ {"/nobr", NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */
+ {"div", ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */
+ {"/div", NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */
+ {"isindex", ALST_ISINDEX, MAXA_ISINDEX, 0}, /* 54 HTML_ISINDEX */
+ {"map", ALST_MAP, MAXA_MAP, 0}, /* 55 HTML_MAP */
+ {"/map", NULL, 0, TFLG_END}, /* 56 HTML_N_MAP */
+ {"area", ALST_AREA, MAXA_AREA, 0}, /* 57 HTML_AREA */
+ {"script", NULL, 0, 0}, /* 58 HTML_SCRIPT */
+ {"/script", NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */
+ {"base", ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */
+ {"del", NULL, 0, 0}, /* 61 HTML_DEL */
+ {"/del", NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */
+ {"ins", NULL, 0, 0}, /* 63 HTML_INS */
+ {"/ins", NULL, 0, TFLG_END}, /* 64 HTML_N_INS */
+ {"u", NULL, 0, 0}, /* 65 HTML_U */
+ {"/u", NULL, 0, TFLG_END}, /* 66 HTML_N_U */
+ {"style", NULL, 0, 0}, /* 67 HTML_STYLE */
+ {"/style", NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */
+ {"wbr", NULL, 0, 0}, /* 69 HTML_WBR */
+ {"em", NULL, 0, 0}, /* 70 HTML_EM */
+ {"/em", NULL, 0, TFLG_END}, /* 71 HTML_N_EM */
+ {"body", ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */
+ {"/body", NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */
+ {"tr", ALST_TR, MAXA_TR, 0}, /* 74 HTML_TR */
+ {"/tr", NULL, 0, TFLG_END}, /* 75 HTML_N_TR */
+ {"td", ALST_TD, MAXA_TD, 0}, /* 76 HTML_TD */
+ {"/td", NULL, 0, TFLG_END}, /* 77 HTML_N_TD */
+ {"caption", NULL, 0, 0}, /* 78 HTML_CAPTION */
+ {"/caption", NULL, 0, TFLG_END}, /* 79 HTML_N_CAPTION */
+ {"th", ALST_TD, MAXA_TD, 0}, /* 80 HTML_TH */
+ {"/th", NULL, 0, TFLG_END}, /* 81 HTML_N_TH */
+ {"thead", NULL, 0, 0}, /* 82 HTML_THEAD */
+ {"/thead", NULL, 0, TFLG_END}, /* 83 HTML_N_THEAD */
+ {"tbody", NULL, 0, 0}, /* 84 HTML_TBODY */
+ {"/tbody", NULL, 0, TFLG_END}, /* 85 HTML_N_TBODY */
+ {"tfoot", NULL, 0, 0}, /* 86 HTML_TFOOT */
+ {"/tfoot", NULL, 0, TFLG_END}, /* 87 HTML_N_TFOOT */
+ {"colgroup", NULL, 0, 0}, /* 88 HTML_COLGROUP */
+ {"/colgroup", NULL, 0, TFLG_END}, /* 89 HTML_N_COLGROUP */
+ {"col", NULL, 0, 0}, /* 90 HTML_COL */
+ {"bgsound", ALST_BGSOUND, MAX_BGSOUND, 0}, /* 91 HTML_BGSOUND */
+ {"applet", ALST_APPLET, MAX_APPLET, 0}, /* 92 HTML_APPLET */
+ {"embed", ALST_EMBED, MAX_EMBED, 0}, /* 93 HTML_EMBED */
+ {"/option", NULL, 0, TFLG_END}, /* 94 HTML_N_OPTION */
+ {"head", NULL, 0, 0}, /* 95 HTML_HEAD */
+ {"/head", NULL, 0, TFLG_END}, /* 96 HTML_N_HEAD */
+ {"doctype", NULL, 0, 0}, /* 97 HTML_DOCTYPE */
+
+ {NULL, NULL, 0, 0}, /* 98 Undefined */
+ {NULL, NULL, 0, 0}, /* 99 Undefined */
+ {NULL, NULL, 0, 0}, /* 100 Undefined */
+ {NULL, NULL, 0, 0}, /* 101 Undefined */
+ {NULL, NULL, 0, 0}, /* 102 Undefined */
+ {NULL, NULL, 0, 0}, /* 103 Undefined */
+ {NULL, NULL, 0, 0}, /* 104 Undefined */
+ {NULL, NULL, 0, 0}, /* 105 Undefined */
+ {NULL, NULL, 0, 0}, /* 106 Undefined */
+ {NULL, NULL, 0, 0}, /* 107 Undefined */
+ {NULL, NULL, 0, 0}, /* 108 Undefined */
+ {NULL, NULL, 0, 0}, /* 109 Undefined */
+ {NULL, NULL, 0, 0}, /* 110 Undefined */
+ {NULL, NULL, 0, 0}, /* 111 Undefined */
+ {NULL, NULL, 0, 0}, /* 112 Undefined */
/* pseudo tag */
- {ALST_TABLE_ALT,MAXA_TABLE_ALT,TFLG_INT}, /* 113 HTML_TABLE_ALT */
- {NULL, 0, TFLG_INT}, /* 114 HTML_RULE */
- {NULL, 0, TFLG_INT|TFLG_END}, /* 115 HTML_N_RULE */
- {NULL, 0, TFLG_INT}, /* 116 HTML_PRE_INT */
- {NULL, 0, TFLG_INT|TFLG_END}, /* 117 HTML_N_PRE_INT */
- {ALST_TITLE_ALT,MAXA_TITLE_ALT,TFLG_INT}, /* 118 HTML_TITLE_ALT */
- {ALST_FORM, MAXA_FORM, TFLG_INT}, /* 119 HTML_FORM_INT */
- {NULL, 0, TFLG_INT|TFLG_END}, /* 120 HTML_N_FORM_INT */
- {NULL, 0, TFLG_INT}, /* 121 HTML_DL_COMPACT */
- {ALST_INPUT_ALT,MAXA_INPUT_ALT,TFLG_INT}, /* 122 HTML_INPUT_ALT */
- {NULL, 0, TFLG_INT|TFLG_END}, /* 123 HTML_N_INPUT_ALT */
- {ALST_IMG_ALT, MAXA_IMG_ALT, TFLG_INT}, /* 124 HTML_IMG_ALT */
- {NULL, 0, TFLG_INT|TFLG_END}, /* 125 HTML_N_IMG_ALT */
- {NULL, 0, TFLG_INT}, /* 126 HTML_EOL */
- {ALST_NOP, MAXA_NOP, TFLG_INT}, /* 127 HTML_NOP */
+ {"table_alt", ALST_TABLE_ALT,MAXA_TABLE_ALT,TFLG_INT}, /* 113 HTML_TABLE_ALT */
+ {"rule", ALST_RULE, MAXA_RULE, TFLG_INT}, /* 114 HTML_RULE */
+ {"/rule", NULL, 0, TFLG_INT|TFLG_END}, /* 115 HTML_N_RULE */
+ {"pre_int", NULL, 0, TFLG_INT}, /* 116 HTML_PRE_INT */
+ {"/pre_int", NULL, 0, TFLG_INT|TFLG_END}, /* 117 HTML_N_PRE_INT */
+ {"title_alt", ALST_TITLE_ALT,MAXA_TITLE_ALT,TFLG_INT}, /* 118 HTML_TITLE_ALT */
+ {"form_int", ALST_FORM, MAXA_FORM, TFLG_INT}, /* 119 HTML_FORM_INT */
+ {"/form_int", NULL, 0, TFLG_INT|TFLG_END}, /* 120 HTML_N_FORM_INT */
+ {"dl_compat", NULL, 0, TFLG_INT}, /* 121 HTML_DL_COMPACT */
+ {"input_alt", ALST_INPUT_ALT,MAXA_INPUT_ALT,TFLG_INT}, /* 122 HTML_INPUT_ALT */
+ {"/input_alt", NULL, 0, TFLG_INT|TFLG_END}, /* 123 HTML_N_INPUT_ALT */
+ {"img_alt", ALST_IMG_ALT, MAXA_IMG_ALT, TFLG_INT}, /* 124 HTML_IMG_ALT */
+ {"/img_alt", NULL, 0, TFLG_INT|TFLG_END}, /* 125 HTML_N_IMG_ALT */
+ {"eol", NULL, 0, TFLG_INT}, /* 126 HTML_EOL */
+ {" ", ALST_NOP, MAXA_NOP, TFLG_INT}, /* 127 HTML_NOP */
};
TagAttrInfo AttrMAP[MAX_TAGATTR] =
@@ -257,8 +259,8 @@ TagAttrInfo AttrMAP[MAX_TAGATTR] =
{"start" , VTYPE_NUMBER, 0}, /* 40 ATTR_START */
{"selected" , VTYPE_NONE, 0}, /* 41 ATTR_SELECTED */
{"label" , VTYPE_STR, 0}, /* 42 ATTR_LABEL */
+ {"readonly" , VTYPE_NONE, 0}, /* 43 ATTR_READONLY */
- {NULL , VTYPE_NONE, 0}, /* 43 Undefined */
{NULL , VTYPE_NONE, 0}, /* 44 Undefined */
{NULL , VTYPE_NONE, 0}, /* 45 Undefined */
{NULL , VTYPE_NONE, 0}, /* 46 Undefined */
@@ -266,10 +268,10 @@ TagAttrInfo AttrMAP[MAX_TAGATTR] =
{NULL , VTYPE_NONE, 0}, /* 48 Undefined */
{NULL , VTYPE_NONE, 0}, /* 49 Undefined */
{NULL , VTYPE_NONE, 0}, /* 50 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 51 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 52 Undefined */
/* Internal attribute */
+ {"top_margin" , VTYPE_NUMBER, AFLG_INT}, /* 51 ATTR_TOP_MARGIN, */
+ {"bottom_margin" , VTYPE_NUMBER, AFLG_INT}, /* 52 ATTR_BOTTOM_MARGIN, */
{"tid" , VTYPE_NUMBER, AFLG_INT}, /* 53 ATTR_TID */
{"fid" , VTYPE_NUMBER, AFLG_INT}, /* 54 ATTR_FID */
{"for_table" , VTYPE_NONE, AFLG_INT}, /* 55 ATTR_FOR_TABLE */
diff --git a/html.h b/html.h
@@ -36,6 +36,7 @@ struct mailcap {
#define MCSTAT_REPNAME 0x01
#define MCSTAT_REPTYPE 0x02
+#define MCSTAT_REPPARAM 0x04
struct table2 {
char *item1;
@@ -54,6 +55,7 @@ typedef struct _ParsedURL {
char *host;
int port;
char *file;
+ char *real_file;
char *label;
int is_nocache;
} ParsedURL;
@@ -77,6 +79,7 @@ typedef struct {
#define ENC_7BIT 0
#define ENC_BASE64 1
#define ENC_QUOTE 2
+#define ENC_UUENCODE 3
#define HTML_UNKNOWN 0
#define HTML_A 1
@@ -242,8 +245,11 @@ typedef struct {
#define ATTR_START 40
#define ATTR_SELECTED 41
#define ATTR_LABEL 42
+#define ATTR_READONLY 43
/* Internal attribute */
+#define ATTR_TOP_MARGIN 51
+#define ATTR_BOTTOM_MARGIN 52
#define ATTR_TID 53
#define ATTR_FID 54
#define ATTR_FOR_TABLE 55
@@ -261,6 +267,7 @@ typedef struct {
/* HTML Tag Information Table */
typedef struct html_tag_info {
+ char *name;
unsigned char *accept_attribute;
unsigned char max_attribute;
unsigned char flag;
diff --git a/indep.c b/indep.c
@@ -5,286 +5,14 @@
#include <sys/param.h>
#include <sys/types.h>
#include <stdlib.h>
+#ifdef __EMX__
+#include <strings.h> /* for bcopy() */
+#endif /* __EMX__ */
#include "indep.h"
#include "Str.h"
#include "gc.h"
#include "myctype.h"
-
-#if defined(__EMX__)&&!defined(JP_CHARSET)
-int CodePage=0;
-#endif
-
-static int is_safe(int);
-
-struct table3 {
- char *item1;
- unsigned char item2;
-};
-
-struct table3 escapetbl[] =
-{
- {"lt", '<'},
- {"gt", '>'},
- {"amp", '&'},
- {"quot", '"'},
- {"LT", '<'},
- {"GT", '>'},
- {"AMP", '&'},
- {"QUOT", '"'},
-/* for latin1_tbl */
- {"nbsp", 128 + 32},
- {"NBSP", 128 + 32},
- {"iexcl", 128 + 33},
- {"cent", 128 + 34},
- {"pound", 128 + 35},
- {"curren", 128 + 36},
- {"yen", 128 + 37},
- {"brvbar", 128 + 38},
- {"sect", 128 + 39},
- {"uml", 128 + 40},
- {"copy", 128 + 41},
- {"ordf", 128 + 42},
- {"laquo", 128 + 43},
- {"not", 128 + 44},
- {"shy", 128 + 45},
- {"reg", 128 + 46},
- {"macr", 128 + 47},
- {"deg", 128 + 48},
- {"plusmn", 128 + 49},
- {"sup2", 128 + 50},
- {"sup3", 128 + 51},
- {"acute", 128 + 52},
- {"micro", 128 + 53},
- {"para", 128 + 54},
- {"middot", 128 + 55},
- {"cedil", 128 + 56},
- {"sup1", 128 + 57},
- {"ordm", 128 + 58},
- {"raquo", 128 + 59},
- {"frac14", 128 + 60},
- {"frac12", 128 + 61},
- {"frac34", 128 + 62},
- {"iquest", 128 + 63},
- {"Agrave", 128 + 64},
- {"Aacute", 128 + 65},
- {"Acirc", 128 + 66},
- {"Atilde", 128 + 67},
- {"Auml", 128 + 68},
- {"Aring", 128 + 69},
- {"AElig", 128 + 70},
- {"Ccedil", 128 + 71},
- {"Egrave", 128 + 72},
- {"Eacute", 128 + 73},
- {"Ecirc", 128 + 74},
- {"Euml", 128 + 75},
- {"Igrave", 128 + 76},
- {"Iacute", 128 + 77},
- {"Icirc", 128 + 78},
- {"Iuml", 128 + 79},
- {"ETH", 128 + 80},
- {"Ntilde", 128 + 81},
- {"Ograve", 128 + 82},
- {"Oacute", 128 + 83},
- {"Ocirc", 128 + 84},
- {"Otilde", 128 + 85},
- {"Ouml", 128 + 86},
- {"times", 128 + 87},
- {"Oslash", 128 + 88},
- {"Ugrave", 128 + 89},
- {"Uacute", 128 + 90},
- {"Ucirc", 128 + 91},
- {"Uuml", 128 + 92},
- {"Yacute", 128 + 93},
- {"THORN", 128 + 94},
- {"szlig", 128 + 95},
- {"agrave", 128 + 96},
- {"aacute", 128 + 97},
- {"acirc", 128 + 98},
- {"atilde", 128 + 99},
- {"auml", 128 + 100},
- {"aring", 128 + 101},
- {"aelig", 128 + 102},
- {"ccedil", 128 + 103},
- {"egrave", 128 + 104},
- {"eacute", 128 + 105},
- {"ecirc", 128 + 106},
- {"euml", 128 + 107},
- {"igrave", 128 + 108},
- {"iacute", 128 + 109},
- {"icirc", 128 + 110},
- {"iuml", 128 + 111},
- {"eth", 128 + 112},
- {"ntilde", 128 + 113},
- {"ograve", 128 + 114},
- {"oacute", 128 + 115},
- {"ocirc", 128 + 116},
- {"otilde", 128 + 117},
- {"ouml", 128 + 118},
- {"divide", 128 + 119},
- {"oslash", 128 + 120},
- {"ugrave", 128 + 121},
- {"uacute", 128 + 122},
- {"ucirc", 128 + 123},
- {"uuml", 128 + 124},
- {"yacute", 128 + 125},
- {"thorn", 128 + 126},
- {"yuml", 128 + 127},
- {NULL, 0},
-};
-
-#ifdef JP_CHARSET
-static char *latin1_tbl[128] =
-{
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0- 7 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 8- 15 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 16- 23 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 24- 31 */
- NBSP, "!", "¡ñ", "¡ò", NULL, "¡ï", "|", "¡ø", /* 32- 39 */
- "¡¯", "(C)", NULL, "¢ã", "¢Ì", "-", "(R)", "¡±", /* 40- 47 */
- "¡ë", "¡Þ", "2", "3", "'", "¦Ì", "¢ù", "¡¦", /* 48- 55 */
- ",", "1", NULL, "¢ä", "1/4", "1/2", "3/4", "?", /* 56- 63 */
- "A`", "A'", "A^", "A~", "Ae", "¢ò", "AE", "C", /* 64- 71 */
- "E`", "E'", "E^", "E", "I`", "I'", "I^", "I", /* 72- 79 */
- "D", "N~", "O`", "O'", "O^", "O~", "Oe", "¡ß", /* 80- 87 */
- "¦Õ", "U`", "U'", "U^", "Ue", "Y'", "th", "ss", /* 88- 95 */
- "a`", "a'", "a^", "a~", "ae", "a", "ae", "c", /* 96-103 */
- "e`", "e'", "e^", "e", "i`", "i'", "i^", "i", /* 104-111 */
- "dh", "n~", "o`", "o'", "o^", "o~", "oe", "¡à", /* 112-119 */
- "¦Õ", "u`", "u'", "u^", "ue", "y'", "th", "y" /* 120-127 */
-};
-
-char *
-conv_latin1(int ch)
-{
- static char dummy[] = {0, 0};
- if (ch > 0xff) {
- /* it must be a unicode character; w3m can't handle it */
- return "??";
- }
- if (!IS_PRINT(ch) && !IS_CNTRL(ch)) {
- char *save;
- if (ch >= 0x80 && (save = latin1_tbl[ch - 0x80])) {
- return save;
- }
- return "?";
- }
- else {
- dummy[0] = ch;
- return dummy;
- }
-}
-#else /* not JP_CHARSET */
-#ifdef __EMX__
-/*
- * Character conversion table
- * ( to code page 850 from iso-8859-1 )
- *
- * Following character constants are in code page 850.
- */
-static char latin1_tbl[96] = {
- ' ', '\255', '\275', '\234', '\317', '\276', '\335', '\365',
- '\371', '\270', '\246', '\256', '\252', '\360', '\251', '\356',
- '\370', '\361', '\375', '\374', '\357', '\346', '\364', '\372',
- '\367', '\373', '\247', '\257', '\254', '\253', '\363', '\250',
- '\267', '\265', '\266', '\307', '\216', '\217', '\222', '\200',
- '\324', '\220', '\322', '\323', '\336', '\326', '\327', '\330',
- '\321', '\245', '\343', '\340', '\342', '\345', '\231', '\236',
- '\235', '\353', '\351', '\352', '\232', '\355', '\350', '\341',
- '\205', '\240', '\203', '\306', '\204', '\206', '\221', '\207',
- '\212', '\202', '\210', '\211', '\215', '\241', '\214', '\213',
- '\320', '\244', '\225', '\242', '\223', '\344', '\224', '\366',
- '\233', '\227', '\243', '\226', '\201', '\354', '\347', '\230'
-};
-#endif
-
-char *
-conv_latin1(int ch)
-{
- static char dummy[2] = {0, 0};
- if (ch > 0xff) {
- /* it must be a unicode character; w3m can't handle it */
- return "??";
- }
-#ifdef __EMX__
- {
- if(CodePage==850&&ch>=160)
- ch=latin1_tbl[(unsigned)ch-160];
- }
-#endif
- dummy[0] = ch;
- return dummy;
-}
-#endif /* not JP_CHARSET */
-
-int
-getescapechar(char **s)
-{
- int i, dummy = 0;
- char *save;
- Str tmp = Strnew();
-
- save = *s;
- if (**s == '&')
- (*s)++;
- if (**s == '#') {
- if (*(*s + 1) == 'x') {
- (*s)++;
- sscanf(*s + 1, "%x", &dummy);
- }
- else if (*(*s + 1) == 'X') {
- (*s)++;
- sscanf(*s + 1, "%X", &dummy);
- }
- else {
- sscanf(*s + 1, "%d", &dummy);
- }
- (*s)++;
- save = *s;
- while (**s && **s != ';') {
- if (!IS_ALNUM(**s)) {
- if (*s > save)
- break;
- else
- goto fail;
- }
- (*s)++;
- }
- if (**s == ';')
- (*s)++;
- return dummy;
- }
- while (IS_ALNUM(**s)) {
- Strcat_char(tmp, **s);
- (*s)++;
- }
- /* if (**s != ';') goto fail; */
- if (**s == ';')
- (*s)++;
- for (i = 0; escapetbl[i].item1 != NULL; i++)
- if (Strcmp_charp(tmp, escapetbl[i].item1) == 0) {
- return escapetbl[i].item2;
- }
- fail:
- return '\0';
-}
-
-char *
-getescapecmd(char **s)
-{
- char *save = *s;
- Str tmp, tmp2;
- int ch = getescapechar(s);
- if (ch)
- return conv_latin1(ch);
-
- tmp = Strnew_charp_n(save, *s - save);
- if (tmp->ptr[0] != '&') {
- tmp2 = Strnew_charp("&");
- Strcat(tmp2, tmp);
- return tmp2->ptr;
- }
- return tmp->ptr;
-}
+#include "entity.h"
char *
allocStr(const char *s, int len)
@@ -318,38 +46,21 @@ strCmp(const void *s1, const void *s2)
return (*p1 - *p2);
}
-void
-copydicname(char *s, char *fn)
-{
- strcpy(s, fn);
- for (fn = &s[strlen(s)]; s < fn; fn--) {
- if (*fn == '/') {
- *(fn + 1) = '\0';
- return;
- }
- }
- if (*fn == '/')
- *(fn + 1) = '\0';
- else
- *fn = '\0';
-}
-
-#ifndef __EMX__
char *
currentdir()
{
char *path;
#ifdef GETCWD
- path = New_N(char, MAXPATHLEN);
+ path = NewAtom_N(char, MAXPATHLEN);
getcwd(path, MAXPATHLEN);
#else /* not GETCWD */
#ifdef GETWD
- path = New_N(char, 1024);
+ path = NewAtom_N(char, 1024);
getwd(path);
#else /* not GETWD */
FILE *f;
char *p;
- path = New_N(char, 1024);
+ path = NewAtom_N(char, 1024);
f = popen("pwd", "r");
fgets(path, 1024, f);
pclose(f);
@@ -362,17 +73,16 @@ currentdir()
#endif /* not GETCWD */
return path;
}
-#endif /* __EMX__ */
char *
-cleanupName(char *name)
+cleanupName2(char *name, int flag)
{
char *buf, *p, *q;
buf = allocStr(name, 0);
p = buf;
q = name;
- while (*q != '\0' && *q != '?') {
+ while (*q != '\0' && (*q != '?' || ! flag)) {
if (strncmp(p, "/../", 4) == 0) { /* foo/bar/../FOO */
if (p - 2 == buf && strncmp(p - 2, "..", 2) == 0) {
/* ../../ */
@@ -415,13 +125,13 @@ cleanupName(char *name)
}
else if (strncmp(p, "//", 2) == 0) { /* foo//bar */
/* -> foo/bar */
-#ifdef CYGWIN
- if (p == buf) { /* //DRIVE/foo */
+#ifdef __CYGWIN__
+ if (p == buf) { /* //DRIVE/foo or //host/path */
p += 2;
q += 2;
continue;
}
-#endif /* CYGWIN */
+#endif /* __CYGWIN__ */
*p = '\0';
q++;
strcat(buf, q);
@@ -434,6 +144,41 @@ cleanupName(char *name)
return buf;
}
+char *
+expandPath(char *name)
+{
+ Str userName = NULL;
+ char *p;
+ struct passwd *passent, *getpwnam(const char *);
+ Str extpath = Strnew();
+
+ if (name == NULL)
+ return NULL;
+ p = name;
+ if (*p == '~') {
+ p++;
+ if (IS_ALPHA(*p)) {
+ userName = Strnew();
+ while (IS_ALNUM(*p) || *p == '_' || *p == '-')
+ Strcat_char(userName, *(p++));
+ passent = getpwnam(userName->ptr);
+ if (passent == NULL) {
+ p = name;
+ goto rest;
+ }
+ Strcat_charp(extpath, passent->pw_dir);
+ }
+ else {
+ Strcat_charp(extpath, getenv("HOME"));
+ }
+ if (Strcmp_charp(extpath, "/") == 0 && *p == '/')
+ p++;
+ }
+ rest:
+ Strcat_charp(extpath, p);
+ return extpath->ptr;
+}
+
/* string search using the simplest algorithm */
char *
strcasestr(char *s1, char *s2)
@@ -485,47 +230,131 @@ strcasemstr(char *str, char *srch[], char **ret_ptr)
}
char *
-cleanup_str(char *str)
+remove_space(char *str)
{
- Str tmp = NULL;
- char *s = str, *c;
+ char *p, *q;
+ for (p = str; *p && IS_SPACE(*p); p++)
+ ;
+ for (q = p; *q; q++)
+ ;
+ for (; q > p && IS_SPACE(*(q-1)); q--)
+ ;
+ if (*q != '\0')
+ return Strnew_charp_n(p, q - p)->ptr;
+ return p;
+}
+
+int
+non_null(char *s)
+{
+ if (s == NULL)
+ return FALSE;
while (*s) {
- if (*s == '&') {
- if (tmp == NULL) {
- tmp = Strnew();
- Strcat_charp_n(tmp, str, s - str);
- }
- c = getescapecmd(&s);
- Strcat_charp(tmp, c);
- }
- else {
- if (tmp)
- Strcat_char(tmp, *s);
- s++;
+ if (!IS_SPACE(*s))
+ return TRUE;
+ s++;
+ }
+ return FALSE;
+}
+
+void
+cleanup_line(Str s, int mode)
+{
+ if (s->length >= 2 &&
+ s->ptr[s->length - 2] == '\r' &&
+ s->ptr[s->length - 1] == '\n') {
+ Strshrink(s, 2);
+ Strcat_char(s, '\n');
+ }
+ else if (Strlastchar(s) == '\r')
+ s->ptr[s->length - 1] = '\n';
+ else if (Strlastchar(s) != '\n')
+ Strcat_char(s, '\n');
+ if (mode != PAGER_MODE) {
+ int i;
+ for (i = 0; i < s->length; i++) {
+ if (s->ptr[i] == '\0')
+ s->ptr[i] = ' ';
}
}
+}
- if (tmp)
- return tmp->ptr;
- else
- return str;
+int
+getescapechar(char **str)
+{
+ int i, dummy = -1;
+ char *p = *str, *q;
+
+ if (*p == '&')
+ p++;
+ if (*p == '#') {
+ p++;
+ if (*p == 'x' || *p == 'X') {
+ p++;
+ if (! IS_XDIGIT(*p)) {
+ *str = p;
+ return -1;
+ }
+ q = p;
+ for (p++; IS_XDIGIT(*p); p++)
+ ;
+ q = allocStr(q, p - q);
+ if (*p == ';')
+ p++;
+ *str = p;
+ sscanf(q, "%x", &dummy);
+ return dummy;
+ } else {
+ if (! IS_DIGIT(*p)) {
+ *str = p;
+ return -1;
+ }
+ q = p;
+ for (p++; IS_DIGIT(*p); p++)
+ ;
+ q = allocStr(q, p - q);
+ if (*p == ';')
+ p++;
+ *str = p;
+ sscanf(q, "%d", &dummy);
+ return dummy;
+ }
+ }
+ if (! IS_ALPHA(*p)) {
+ *str = p;
+ return -1;
+ }
+ q = p;
+ for (p++; IS_ALNUM(*p); p++)
+ ;
+ q = allocStr(q, p - q);
+ if (*p == ';')
+ p++;
+ *str = p;
+ return getHash_si(&entity, q, -1);
}
char *
-remove_space(char *str)
+getescapecmd(char **s)
{
- Str s = Strnew();
- while (*str) {
- if (!IS_SPACE(*str))
- Strcat_char(s, *str);
- str++;
- }
- return s->ptr;
+ char *save = *s;
+ Str tmp;
+ int ch = getescapechar(s);
+
+ if (ch >= 0)
+ return conv_entity(ch);
+
+ if (*save != '&')
+ tmp = Strnew_charp("&");
+ else
+ tmp = Strnew();
+ Strcat_charp_n(tmp, save, *s - save);
+ return tmp->ptr;
}
char *
-htmlquote_char(char c)
+html_quote_char(char c)
{
switch (c) {
case '&':
@@ -541,17 +370,16 @@ htmlquote_char(char c)
}
char *
-htmlquote_str(char *str)
+html_quote(char *str)
{
Str tmp = NULL;
char *p, *q;
+
for (p = str; *p; p++) {
- q = htmlquote_char(*p);
+ q = html_quote_char(*p);
if (q) {
- if (tmp == NULL) {
- tmp = Strnew();
- Strcat_charp_n(tmp, str, p - str);
- }
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
Strcat_charp(tmp, q);
}
else {
@@ -561,173 +389,276 @@ htmlquote_str(char *str)
}
if (tmp)
return tmp->ptr;
- else
- return str;
+ return str;
}
-Str
-form_quote(Str x)
+char *
+html_unquote(char *str)
{
- Str r = Strnew();
- int i;
- char c;
- for (i = 0; i < x->length; i++) {
- c = x->ptr[i];
- if (c == ' ')
- Strcat_char(r, '+');
- else if (IS_ALNUM(c) || is_safe(c)) {
- Strcat_char(r, c);
+ Str tmp = NULL;
+ char *p, *q;
+
+ for (p = str; *p; ) {
+ if (*p == '&') {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ q = getescapecmd(&p);
+ Strcat_charp(tmp, q);
}
else {
- Strcat_charp(r, "%");
- Strcat(r, Sprintf("%02X", (c & 0xff)));
+ if (tmp)
+ Strcat_char(tmp, *p);
+ p++;
}
}
- return r;
+
+ if (tmp)
+ return tmp->ptr;
+ return str;
}
-/* rfc1808 safe */
static int
-is_safe(int c)
+url_unquote_char(char **str)
{
- switch (c) {
- /* safe */
- case '$':
- case '-':
- case '_':
- case '.':
- return 1;
- default:
- return 0;
+ char *p = *str;
+ char buf[3];
+ int n;
+
+ if (*p != '%')
+ return -1;
+ p++;
+ if (IS_XDIGIT(*p)) {
+ buf[0] = *(p++);
+ if (IS_XDIGIT(*p)) {
+ buf[1] = *(p++);
+ buf[2] = '\0';
+ } else
+ buf[1] = '\0';
+ if (sscanf(buf, "%x", &n)) {
+ *str = p;
+ return n;
+ }
}
+ return -1;
}
-Str
-form_unquote(Str x)
+char *
+url_quote(char *str)
+{
+ Str tmp = NULL;
+ char *p;
+ char buf[4];
+
+ for (p = str; *p; p++) {
+ if (IS_CNTRL(*p) || *p == ' ' || ! IS_ASCII(*p)) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ sprintf(buf, "%%%02X", (unsigned char)*p);
+ Strcat_charp(tmp, buf);
+ } else {
+ if (tmp)
+ Strcat_char(tmp, *p);
+ }
+ }
+ if (tmp)
+ return tmp->ptr;
+ return str;
+}
+
+char *
+url_unquote(char *str)
{
- Str r = Strnew();
- int i, j;
- char c;
- Str num;
-
- for (i = 0; i < x->length; i++) {
- c = x->ptr[i];
- if (c == '+')
- Strcat_char(r, ' ');
- else if (c == '%') {
- num = Strnew_charp("0");
- if (IS_ALNUM(x->ptr[i + 1])) {
- Strcat_char(num, x->ptr[i + 1]);
- i++;
- if (IS_ALNUM(x->ptr[i + 1])) {
- Strcat_char(num, x->ptr[i + 1]);
- i++;
- }
+ Str tmp = NULL;
+ char *p, *q;
+ int c;
+
+ for (p = str; *p; ) {
+ if (*p == '%') {
+ q = p;
+ c = url_unquote_char(&q);
+ if (c >= 0 && (IS_CNTRL(c) || c == ' ' || ! IS_ASCII(c))) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ if (c != '\0' && c != '\n' && c != '\r')
+ Strcat_char(tmp, (char)c);
+ p = q;
+ continue;
}
- sscanf(num->ptr, "%x", &j);
- Strcat_char(r, (char) j);
}
- else
- Strcat_char(r, c);
+ if (tmp)
+ Strcat_char(tmp, *p);
+ p++;
}
- return r;
+ if (tmp)
+ return tmp->ptr;
+ return str;
}
char *
-expandPath(char *name)
+file_quote(char *str)
{
- Str userName = NULL;
+ Str tmp = NULL;
char *p;
- struct passwd *passent, *getpwnam(const char *);
- Str extpath = Strnew();
+ char buf[4];
- if (name == NULL)
- return NULL;
- p = name;
- if (*p == '~') {
- p++;
- if (IS_ALPHA(*p)) {
- userName = Strnew();
- while (IS_ALNUM(*p) || *p == '_' || *p == '-')
- Strcat_char(userName, *(p++));
- passent = getpwnam(userName->ptr);
- if (passent == NULL) {
- p = name;
- goto rest;
- }
- Strcat_charp(extpath, passent->pw_dir);
+ for (p = str; *p; p++) {
+ if (IS_CNTRL(*p) || *p == ' ' || ! IS_ASCII(*p) || *p == '+' ||
+ *p == ':' || *p == '#' || *p == '?' || *p == '&' || *p == '%') {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ sprintf(buf, "%%%02X", (unsigned char)*p);
+ Strcat_charp(tmp, buf);
+ } else {
+ if (tmp)
+ Strcat_char(tmp, *p);
}
- else {
- Strcat_charp(extpath, getenv("HOME"));
+ }
+ if (tmp)
+ return tmp->ptr;
+ return str;
+}
+
+char *
+file_unquote(char *str)
+{
+ Str tmp = NULL;
+ char *p, *q;
+ int c;
+
+ for (p = str; *p; ) {
+ if (*p == '%') {
+ q = p;
+ c = url_unquote_char(&q);
+ if (c >= 0) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ if (c != '\0' && c != '\n' && c != '\r')
+ Strcat_char(tmp, (char)c);
+ p = q;
+ continue;
+ }
}
- if (Strcmp_charp(extpath, "/") == 0 && *p == '/')
- p++;
+ if (tmp)
+ Strcat_char(tmp, *p);
+ p++;
+ }
+ if (tmp)
+ return tmp->ptr;
+ return str;
+}
+
+/* rfc1808 safe */
+static int
+is_url_safe(char c)
+{
+ switch (c) {
+ /* safe */
+ case '$':
+ case '-':
+ case '_':
+ case '.':
+ return 1;
+ default:
+ return IS_ALNUM(c);
}
- rest:
- Strcat_charp(extpath, p);
- return extpath->ptr;
}
Str
-escape_shellchar(Str s)
+Str_form_quote(Str x)
{
- Str x = Strnew();
- int i;
- for (i = 0; i < s->length; i++) {
- switch (s->ptr[i]) {
- case ';':
- case '&':
- case '|':
- case '$':
- case '!':
- case '(':
- case ')':
- case '{':
- case '}':
- case '*':
- case '?':
- Strcat_char(x, '\\');
- /* continue to the next */
- default:
- Strcat_char(x, s->ptr[i]);
+ Str tmp = NULL;
+ char *p = x->ptr, *ep = x->ptr + x->length;
+ char buf[4];
+
+ for (; p < ep; p++) {
+ if (*p == ' ') {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
+ Strcat_char(tmp, '+');
+ } else if (! is_url_safe(*p)) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
+ sprintf(buf, "%%%02X", (unsigned char)*p);
+ Strcat_charp(tmp, buf);
+ } else {
+ if (tmp)
+ Strcat_char(tmp, *p);
}
}
+ if (tmp)
+ return tmp;
return x;
}
-int
-non_null(char *s)
+Str
+Str_form_unquote(Str x)
{
- if (s == NULL)
- return FALSE;
- while (*s) {
- if (!IS_SPACE(*s))
- return TRUE;
- s++;
+ Str tmp = NULL;
+ char *p = x->ptr, *ep = x->ptr + x->length, *q;
+ int c;
+
+ for (; p < ep; ) {
+ if (*p == '+') {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
+ Strcat_char(tmp, ' ');
+ p++;
+ continue;
+ } else if (*p == '%') {
+ q = p;
+ c = url_unquote_char(&q);
+ if (c >= 0) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
+ Strcat_char(tmp, (char)c);
+ p = q;
+ continue;
+ }
+ }
+ if (tmp)
+ Strcat_char(tmp, *p);
+ p++;
}
- return FALSE;
+ if (tmp)
+ return tmp;
+ return x;
}
-void
-cleanup_line(Str s, int mode)
+static int
+is_shell_safe(char c)
{
- if (s->length >= 2 &&
- s->ptr[s->length - 2] == '\r' &&
- s->ptr[s->length - 1] == '\n') {
- Strshrink(s, 2);
- Strcat_char(s, '\n');
+ switch (c) {
+ /* safe */
+ case '/':
+ case '.':
+ case '_':
+ case ':':
+ return 1;
+ default:
+ return IS_ALNUM(c) || (c & 0x80);
}
- else if (Strlastchar(s) == '\r')
- s->ptr[s->length - 1] = '\n';
- else if (Strlastchar(s) != '\n')
- Strcat_char(s, '\n');
- if (mode != PAGER_MODE) {
- int i;
- for (i = 0; i < s->length; i++) {
- if (s->ptr[i] == '\0')
- s->ptr[i] = ' ';
+}
+
+char *
+shell_quote(char *str)
+{
+ Str tmp = NULL;
+ char *p;
+
+ for (p = str; *p; p++) {
+ if (! is_shell_safe(*p)) {
+ if (tmp == NULL)
+ tmp = Strnew_charp_n(str, (int)(p - str));
+ Strcat_char(tmp, '\\');
+ Strcat_char(tmp, *p);
+ } else {
+ if (tmp)
+ Strcat_char(tmp, *p);
}
}
+ if (tmp)
+ return tmp->ptr;
+ return str;
}
/* Local Variables: */
diff --git a/indep.h b/indep.h
@@ -14,25 +14,30 @@
#define HTML_MODE 1
#define HEADER_MODE 2
-extern char *conv_latin1(int ch);
+extern char *conv_entity(int ch);
extern int getescapechar(char **s);
extern char *getescapecmd(char **s);
extern char *allocStr(const char *s, int len);
extern int strCmp(const void *s1, const void *s2);
-extern void copydicname(char *s, char *fn);
extern char *currentdir(void);
-extern char *cleanupName(char *name);
+extern char *cleanupName2(char *name, int flag);
+#define cleanupName(name) cleanupName2((name), TRUE)
+extern char *expandPath(char *name);
extern char *strcasestr(char *s1, char *s2);
extern int strcasemstr(char *str, char *srch[], char **ret_ptr);
-extern char *cleanup_str(char *s);
extern char *remove_space(char *str);
-extern char *htmlquote_char(char c);
-extern char *htmlquote_str(char *str);
-extern Str form_quote(Str x);
-extern Str form_unquote(Str x);
-extern char *expandPath(char *name);
extern int non_null(char *s);
extern void cleanup_line(Str s, int mode);
+extern char *html_quote_char(char c);
+extern char *html_quote(char *str);
+extern char *html_unquote(char *str);
+extern char *file_quote(char *str);
+extern char *file_unquote(char *str);
+extern char *url_quote(char *str);
+extern char *url_unquote(char *str);
+extern Str Str_form_quote(Str x);
+extern Str Str_form_unquote(Str x);
+extern char *shell_quote(char *str);
#define New(type) ((type*)GC_MALLOC(sizeof(type)))
#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type)))
diff --git a/inflate.c b/inflate.c
@@ -0,0 +1,56 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <zlib.h>
+
+#undef BUFSIZE
+#define BUFSIZE 4096
+
+int
+main(int argc, char **argv)
+{
+ z_stream s;
+ FILE *f;
+ char inbuf[BUFSIZE], outbuf[BUFSIZE];
+ int status, flush;
+
+ if (argc > 1) {
+ f = fopen(argv[1], "rb");
+ if (! f)
+ exit(1);
+ } else
+ f = stdin;
+
+ s.zalloc = Z_NULL;
+ s.zfree = Z_NULL;
+ s.opaque = Z_NULL;
+ status = inflateInit(&s);
+ if (status != Z_OK)
+ exit(1);
+ s.avail_in = 0;
+ s.next_out = (Bytef *)outbuf;
+ s.avail_out = sizeof(outbuf);
+ flush = Z_NO_FLUSH;
+ while (1) {
+ if (s.avail_in == 0) {
+ s.next_in = (Bytef *)inbuf;
+ s.avail_in = fread(inbuf, 1, sizeof(inbuf), f);
+ }
+ status = inflate(&s, flush);
+ if (status == Z_STREAM_END) {
+ if (sizeof(outbuf) - s.avail_out)
+ fwrite(outbuf, 1, sizeof(outbuf) - s.avail_out, stdout);
+ break;
+ }
+ if (status != Z_OK)
+ exit(1);
+ if (s.avail_out == 0) {
+ fwrite(outbuf, 1, sizeof(outbuf), stdout);
+ s.next_out = (Bytef *)outbuf;
+ s.avail_out = sizeof(outbuf);
+ }
+ }
+ inflateEnd(&s);
+ fclose(f);
+ return 0;
+}
diff --git a/istream.c b/istream.c
@@ -2,6 +2,9 @@
#include "fm.h"
#include "istream.h"
#include <signal.h>
+#ifdef __EMX__
+#include <strings.h> /* for bzero() */
+#endif /* __EMX__ */
#define uchar unsigned char
@@ -156,7 +159,8 @@ InputStream
newEncodedStream(InputStream is, char encoding)
{
InputStream stream;
- if (is == NULL || (encoding != ENC_QUOTE && encoding != ENC_BASE64))
+ if (is == NULL || (encoding != ENC_QUOTE && encoding != ENC_BASE64 &&
+ encoding != ENC_UUENCODE))
return is;
stream = New(union input_stream);
init_base_stream(&stream->base, STREAM_BUF_SIZE);
@@ -464,11 +468,18 @@ ens_read(struct ens_handle *handle, char *buf, int len)
cleanup_line(handle->s, PAGER_MODE);
if (handle->encoding == ENC_BASE64)
Strchop(handle->s);
+ else if (handle->encoding == ENC_UUENCODE) {
+ if (! strncmp(handle->s->ptr, "begin", 5))
+ handle->s = StrmyISgets(handle->is);
+ Strchop(handle->s);
+ }
p = handle->s->ptr;
if (handle->encoding == ENC_QUOTE)
handle->s = decodeQP(&p);
else if (handle->encoding == ENC_BASE64)
handle->s = decodeB(&p);
+ else if (handle->encoding == ENC_UUENCODE)
+ handle->s = decodeU(&p);
handle->pos = 0;
}
diff --git a/istream.h b/istream.h
@@ -145,9 +145,9 @@ extern Str ssl_get_certificate(InputStream stream);
#define ssl_of(stream) ((stream)->ssl.handle->ssl)
#endif
-#ifdef __CYGWIN__
+#ifdef USE_BINMODE_STREAM
#define openIS(path) newInputStream(open((path),O_RDONLY|O_BINARY))
#else
#define openIS(path) newInputStream(open((path),O_RDONLY))
-#endif /* __CYGWIN__ */
+#endif /* USE_BINMODE_STREAM */
#endif
diff --git a/keybind.c b/keybind.c
@@ -36,7 +36,7 @@ char GlobalKeymap[128] =
/* h i j k l m n o */
movL, peekIMG,movD, movU, movR, nulcmd, srchnxt, ldOpt,
/* p q r s t u v w */
- nulcmd, qquitfm,nulcmd, selBuf, nulcmd, peekURL,vwSrc, movRW,
+ nulcmd, qquitfm,nulcmd, selMn, nulcmd, peekURL,vwSrc, movRW,
/* x y z { | } ~ DEL */
nulcmd, nulcmd, ctrCsrV,nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
diff --git a/keybind_lynx.c b/keybind_lynx.c
@@ -16,7 +16,7 @@
char GlobalKeymap[128] =
{
/* C-@ C-a C-b C-c C-d C-e C-f C-g */
- _mark, goLineF,backBf, nulcmd, nulcmd, goLineL,followA,nulcmd,
+ _mark, goLineF,backBf, nulcmd, nulcmd, goLineL,followA,curlno,
/* C-h C-i C-j C-k C-l C-m C-n C-o */
ldHist, nextA, followA, cooLst, rdrwSc, followA, nextA, nulcmd,
/* C-p C-q C-r C-s C-t C-u C-v C-w */
@@ -44,7 +44,7 @@ char GlobalKeymap[128] =
/* h i j k l m n o */
movL, peekIMG,movD, movU, movR, nulcmd, srchnxt,ldOpt,
/* p q r s t u v w */
- svBuf, qquitfm,nulcmd, selBuf, nulcmd, peekURL,ldBmark,wrapToggle,
+ svBuf, qquitfm,nulcmd, selMn, nulcmd, peekURL,ldBmark,wrapToggle,
/* x y z { | } ~ DEL */
nulcmd, nulcmd, ctrCsrV,nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
@@ -70,7 +70,7 @@ char EscKeymap[128] =
/* @ A B C D E F G */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
/* H I J K L M N O */
- nulcmd, svI, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, escbmap,
+ nulcmd, svI, nulcmd, nulcmd, nulcmd, linkbrz,nulcmd, escbmap,
/* P Q R S T U V W */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
/* X Y Z [ \ ] ^ _ */
diff --git a/linein.c b/linein.c
@@ -17,6 +17,13 @@ extern int do_getch();
#include <sys/kbdscan.h>
#endif
+#if defined(__CYGWIN__) && defined(JP_CHARSET)
+#include <windows.h>
+static HANDLE hConIn;
+static int isWin95;
+int isWinConsole = FALSE;
+#endif
+
#define STR_LEN 1024
#define CLEN (COLS - 2)
@@ -38,8 +45,8 @@ static void insertself(char c),
killn(void), killb(void), _inbrk(void), _esc(void),
_prev(void), _next(void), _compl(void), _rcompl(void), _tcompl(void),
_dcompl(void), _rdcompl(void);
-#ifdef _EMX_
-static int getcntrl();
+#ifdef __EMX__
+static int getcntrl(void);
#endif
static int terminated(unsigned char c);
@@ -78,6 +85,80 @@ static int in_kanji;
static void ins_kanji(Str tmp);
#endif
+#if defined(__CYGWIN__) && defined(JP_CHARSET)
+void
+check_win32_console(void)
+{
+ char *tty;
+
+ tty = ttyname(1);
+ if (!strncmp(tty, "/dev/con", 8)) {
+ isWinConsole = TRUE;
+ }
+ else {
+ isWinConsole = FALSE;
+ }
+}
+
+void
+init_win32_console_handle(void)
+{
+ OSVERSIONINFO winVersionInfo;
+
+ check_win32_console();
+ winVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ if (GetVersionEx (&winVersionInfo) == 0) {
+ fprintf(stderr, "can't get Windows version information.\n");
+ exit(1);
+ }
+ if (winVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
+ isWin95 = 1;
+ }
+ if (isWin95) {
+ if (isWinConsole) {
+ if (isatty(0)) {
+ hConIn = GetStdHandle(STD_INPUT_HANDLE);
+ }
+ else {
+ hConIn = CreateFile("CONIN$", GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL, OPEN_EXISTING,
+ 0, NULL);
+ }
+ }
+ }
+}
+
+int test_ReadConsole() {
+ unsigned char buff[3];
+ DWORD p = 0;
+
+ return (ReadConsole(hConIn, buff, 1, &p, NULL) != 0);
+}
+
+char getch_Win95JP() {
+ static unsigned char buff[3];
+ static DWORD p = 0;
+ char c;
+ int i;
+
+ if (p == 0) {
+ if (ReadConsole(hConIn, buff, 1, &p, NULL) == 0) {
+ return getch();
+ }
+ }
+ if (p == 0) {
+ return getch();
+ }
+ c = buff[0];
+ for (i = 0; i < p-1; i++) {
+ buff[i] = buff[i+1];
+ }
+ p--;
+ return c;
+}
+#endif
+
char *
inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
{
@@ -138,6 +219,13 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
cm_next = FALSE;
cm_disp_next = -1;
need_redraw = FALSE;
+#if defined(__CYGWIN__) && defined(JP_CHARSET)
+ if (isWin95 && (hConIn != INVALID_HANDLE_VALUE)) {
+ if (test_ReadConsole() == 0) {
+ hConIn = INVALID_HANDLE_VALUE;
+ }
+ }
+#endif
do {
x = calcPosition(strBuf->ptr, strProp, CLen, CPos, 0, CP_FORCE);
if (x - rpos > offset) {
@@ -163,7 +251,16 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
refresh();
next_char:
+#if !defined(__CYGWIN__) || !defined(JP_CHARSET)
c = getch();
+#else
+ if (isWin95 && (hConIn != INVALID_HANDLE_VALUE)) {
+ c = getch_Win95JP();
+ }
+ else {
+ c = getch();
+ }
+#endif
#ifdef __EMX__
if (c == 0) {
if (!(c = getcntrl()))
@@ -256,6 +353,8 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
CPos++;
mode = PC_ASCII;
}
+ if (CLen && (flag & IN_CHAR))
+ break;
} while (i_cont);
if (need_redraw)
@@ -288,7 +387,7 @@ getcntrl(void)
case K_DEL:
return CTRL_D;
case K_LEFT:
- retrun CTRL_B;
+ return CTRL_B;
case K_RIGHT:
return CTRL_F;
case K_UP:
@@ -737,7 +836,7 @@ next_dcompl(int next)
return;
cm_disp_next = 0;
- d = Strdup(CDirBuf);
+ d = Str_conv_to_system(Strdup(CDirBuf));
if (d->length > 0 && Strlastchar(d) != '/')
Strcat_char(d, '/');
if (cm_mode & CPL_URL && d->ptr[0] == 'f') {
@@ -797,7 +896,7 @@ disp_next:
clrtoeolx();
f = Strdup(d);
Strcat_charp(f, CFileBuf[n]);
- addstr(CFileBuf[n]);
+ addstr(conv_from_system(CFileBuf[n]));
if (stat(expandName(f->ptr), &st) != -1 && S_ISDIR(st.st_mode))
addstr("/");
}
@@ -827,6 +926,7 @@ doComplete(Str ifn, int *status, int next)
if (!cm_next) {
NCFileBuf = 0;
+ ifn = Str_conv_to_system(ifn);
CompleteBuf = Strdup(ifn);
while (Strlastchar(CompleteBuf) != '/' &&
CompleteBuf->length > 0)
@@ -843,7 +943,7 @@ doComplete(Str ifn, int *status, int next)
else {
CompleteBuf = Strdup(ifn);
*status = CPL_FAIL;
- return CompleteBuf;
+ return Str_conv_to_system(CompleteBuf);
}
}
if (CompleteBuf->length == 0) {
@@ -869,7 +969,7 @@ doComplete(Str ifn, int *status, int next)
if (!strncmp(dir->d_name, fn, fl)) { /* match */
NCFileBuf++;
CFileBuf = New_Reuse(char *, CFileBuf, NCFileBuf);
- CFileBuf[NCFileBuf - 1] = New_N(char, strlen(dir->d_name) + 1);
+ CFileBuf[NCFileBuf - 1] = NewAtom_N(char, strlen(dir->d_name) + 1);
strcpy(CFileBuf[NCFileBuf - 1], dir->d_name);
if (NCFileBuf == 1) {
CFileName = Strnew_charp(dir->d_name);
@@ -923,7 +1023,7 @@ doComplete(Str ifn, int *status, int next)
if (stat(expandName(p), &st) != -1 && S_ISDIR(st.st_mode))
Strcat_char(CompleteBuf, '/');
}
- return CompleteBuf;
+ return Str_conv_from_system(CompleteBuf);
}
static void
diff --git a/local.c b/local.c
@@ -2,9 +2,15 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <errno.h>
#ifdef READLINK
#include <unistd.h>
#endif /* READLINK */
+#ifdef __EMX__
+#include <limits.h>
+#endif /* __EMX__ */
#include "local.h"
#define CGIFN_NORMAL 0
@@ -18,6 +24,7 @@ setLocalCookie()
Str buf;
char hostname[256];
gethostname(hostname,256);
+
buf = Sprintf("%d.%ld@%s",getpid(),lrand48(),hostname);
Local_cookie = buf->ptr;
}
@@ -39,12 +46,13 @@ dirBuffer(char *dname)
int i, l, nrow, n = 0, maxlen = 0;
int nfile, nfile_max = 100;
Str dirname;
+ Buffer *buf;
d = opendir(dname);
if (d == NULL)
return NULL;
dirname = Strnew_charp(dname);
- qdir = htmlquote_str(dirname->ptr);
+ qdir = html_quote(Str_conv_from_system(dirname)->ptr);
tmp = Sprintf("<title>Directory list of %s</title><h1>Directory list of %s</h1>\n", qdir, qdir);
flist = New_N(char *, nfile_max);
nfile = 0;
@@ -99,10 +107,10 @@ dirBuffer(char *dname)
else
Strcat_charp(tmp, "[FILE] ");
}
- Strcat_m_charp(tmp, "<A HREF=\"", htmlquote_str(fbuf->ptr), NULL);
+ Strcat_m_charp(tmp, "<A HREF=\"", file_to_url(fbuf->ptr), NULL);
if (S_ISDIR(st.st_mode))
Strcat_char(tmp, '/');
- Strcat_m_charp(tmp, "\">", htmlquote_str(p), NULL);
+ Strcat_m_charp(tmp, "\">", html_quote(conv_from_system(p)), NULL);
if (S_ISDIR(st.st_mode))
Strcat_char(tmp, '/');
Strcat_charp(tmp, "</a>");
@@ -120,7 +128,7 @@ dirBuffer(char *dname)
if (S_ISLNK(lst.st_mode)) {
if ((l = readlink(fbuf->ptr, lbuf, sizeof(lbuf))) > 0) {
lbuf[l] = '\0';
- Strcat_m_charp(tmp, " -> ", htmlquote_str(lbuf), NULL);
+ Strcat_m_charp(tmp, " -> ", html_quote(conv_from_system(lbuf)), NULL);
if (S_ISDIR(st.st_mode))
Strcat_char(tmp, '/');
}
@@ -133,7 +141,12 @@ dirBuffer(char *dname)
Strcat_charp(tmp, "</TR></TABLE>\n");
}
- return loadHTMLString(tmp);
+ buf = loadHTMLString(tmp);
+#ifdef JP_CHARSET
+ if (buf)
+ buf->document_code = SystemCode;
+#endif
+ return buf;
}
#ifdef __EMX__
@@ -157,21 +170,32 @@ check_local_cgi(char *file, int status)
#ifdef __EMX__
if (status != CGIFN_CGIBIN) {
char tmp[_MAX_PATH];
+ int len;
_abspath(tmp, lib_dir, _MAX_PATH); /* Translate '\\' to '/'
*
*/
- if (strnicmp(file, tmp, strlen(tmp))) /* and ignore case */
+ len = strlen(tmp);
+ while (len > 1 && tmp[len-1] == '/')
+ len--;
+ if (strnicmp(file, tmp, len) || /* and ignore case */
+ (file[len] != '/'))
return -1;
}
#else /* not __EMX__ */
- if (status != CGIFN_CGIBIN &&
- strncmp(file, lib_dir, strlen(lib_dir)) != 0) {
+ if (status != CGIFN_CGIBIN) {
+ char *tmp = Strnew_charp(lib_dir)->ptr;
+ int len = strlen(tmp);
+
+ while (len > 1 && tmp[len-1] == '/')
+ len--;
+ if (strncmp(file, tmp, len) ||
+ (file[len] != '/'))
/*
* a local-CGI script should be located on either
* /cgi-bin/ directory or LIB_DIR (typically /usr/local/lib/w3m).
*/
- return -1;
+ return -1;
}
#endif /* not __EMX__ */
if (stat(file, &st) < 0)
@@ -300,19 +324,85 @@ cgi_filename(char *fn, int *status)
return fn;
}
+static pid_t
+localcgi_popen_r(FILE **p_fp)
+{
+ int fd[2];
+ FILE *fp;
+ pid_t pid;
+ Str emsg;
+
+ if (pipe(fd) < 0) {
+ emsg = Sprintf("localcgi_popen_r: pipe: %s", strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ return (pid_t)-1;
+ }
+
+ flush_tty();
+ if ((pid = fork()) < 0) {
+ emsg = Sprintf("localcgi_popen_r: fork: %s", strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ close(fd[0]);
+ close(fd[1]);
+ return (pid_t)-1;
+ }
+ else if (!pid) {
+ close_tty();
+ dup2(fd[1], 1);
+
+ if (fd[1] > 1)
+ close(fd[1]);
+
+ close(fd[0]);
+ }
+ else {
+ close(fd[1]);
+
+ if (!(fp = fdopen(fd[0], "r"))) {
+ emsg = Sprintf("localcgi_popen_r: fdopen(%d, \"r\"): %s", fd[0], strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ kill(pid, SIGTERM);
+ close(fd[0]);
+ return (pid_t)-1;
+ }
+
+ *p_fp = fp;
+ }
+
+ return pid;
+}
+
FILE *
-localcgi_post(char *file, FormList * request, char *referer)
+localcgi_post(char *uri, FormList * request, char *referer)
{
- FILE *f;
- Str tmp1, tmp2;
+ FILE *f, *f1;
+ Str tmp1;
int status;
+ pid_t pid;
+ char *name, *file, *qstr;
- tmp1 = Strnew_charp(file);
- file = cgi_filename(file, &status);
+ if ((qstr = strchr(uri, '?'))) {
+ name = allocStr(uri, qstr - uri);
+ qstr = allocStr(qstr + 1, 0);
+ }
+ else
+ name = uri;
+ file = cgi_filename(name, &status);
if (check_local_cgi(file, status) < 0)
return NULL;
- set_cgi_environ(tmp1->ptr, file, tmp1->ptr);
+ tmp1 = tmpfname(TMPF_DFL, NULL);
+ f1 = fopen(tmp1->ptr, "w");
+ if (f1 == NULL)
+ return NULL;
+ pushText(fileToDelete, tmp1->ptr);
+ if ((pid = localcgi_popen_r(&f))) {
+ fclose(f1);
+ return pid > 0 ? f : NULL;
+ }
+ set_cgi_environ(Strnew_charp(name)->ptr, file, Strnew_charp(uri)->ptr);
set_environ("REQUEST_METHOD", "POST");
+ if (qstr)
+ set_environ("QUERY_STRING", qstr);
set_environ("CONTENT_LENGTH", Sprintf("%d", request->length)->ptr);
if (referer && referer != NO_REFERER)
set_environ("HTTP_REFERER",referer);
@@ -323,66 +413,65 @@ localcgi_post(char *file, FormList * request, char *referer)
else {
set_environ("CONTENT_TYPE", "application/x-www-form-urlencoded");
}
- tmp1 = tmpfname(TMPF_DFL, NULL);
- f = fopen(tmp1->ptr, "w");
- if (f == NULL)
- return NULL;
- pushText(fileToDelete, tmp1->ptr);
if (request->enctype == FORM_ENCTYPE_MULTIPART) {
FILE *fd;
int c;
fd = fopen(request->body, "r");
if (fd != NULL) {
while ((c = fgetc(fd)) != EOF)
- fputc(c, f);
+ fputc(c, f1);
fclose(fd);
}
}
else {
- fputs(request->body, f);
+ fputs(request->body, f1);
}
- fclose(f);
- tmp2 = Sprintf("%s < %s", file, tmp1->ptr);
-#ifdef __EMX__
- f = popen(tmp2->ptr, "r");
-#else
- tmp1 = Strnew_charp(CurrentDir);
+ fclose(f1);
+ freopen( tmp1->ptr, "r", stdin);
+#ifndef __EMX__
chdir(mydirname(file));
- f = popen(tmp2->ptr, "r");
- chdir(tmp1->ptr);
#endif
- return f;
+ execl(file, mybasename(file), NULL);
+ fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n",
+ file, mybasename(file), strerror(errno));
+ exit(1);
+ return NULL;
}
FILE *
-localcgi_get(char *file, char *request, char *referer)
+localcgi_get(char *uri, char *request, char *referer)
{
FILE *f;
- Str tmp1, tmp2;
int status;
+ pid_t pid;
+ char *file, *sh;
- tmp1 = Strnew_charp(file);
- file = cgi_filename(file, &status);
+ file = cgi_filename(uri, &status);
if (check_local_cgi(file, status) < 0)
return NULL;
+ if ((pid = localcgi_popen_r(&f)) < 0)
+ return NULL;
+ else if (pid)
+ return f;
if (!strcmp(request, "")) {
- set_cgi_environ(tmp1->ptr, file, tmp1->ptr);
+ set_cgi_environ(Strnew_charp(uri)->ptr, file, Strnew_charp(uri)->ptr);
} else {
- set_cgi_environ(tmp1->ptr, file,
- Strnew_m_charp(tmp1->ptr, "?", request, NULL)->ptr);
+ set_cgi_environ(Strnew_charp(uri)->ptr, file,
+ Strnew_m_charp(uri, "?", request, NULL)->ptr);
}
if (referer && referer != NO_REFERER)
set_environ("HTTP_REFERER",referer);
set_environ("REQUEST_METHOD", "GET");
set_environ("QUERY_STRING", request);
- tmp2 = Sprintf("%s", file);
#ifdef __EMX__
- f = popen(tmp2->ptr, "r");
+ freopen("nul", "r", stdin);
#else
- tmp1 = Strnew_charp(CurrentDir);
+ freopen("/dev/null", "r", stdin);
chdir(mydirname(file));
- f = popen(tmp2->ptr, "r");
- chdir(tmp1->ptr);
#endif
- return f;
+ execl(file, mybasename(file), NULL);
+ fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n",
+ file, mybasename(file), strerror(errno));
+ exit(1);
+ return NULL;
}
diff --git a/mailcap.c b/mailcap.c
@@ -5,6 +5,9 @@
#include <errno.h>
#include "parsetag.h"
#include "local.h"
+#ifdef __EMX__
+#include <strings.h> /* for bzero() */
+#endif /* __EMX__ */
static struct mailcap DefaultMailcap[] =
{
@@ -74,7 +77,7 @@ searchMailcap(struct mailcap *table, char *type)
i = mailcapMatch(table, type);
if (i > level) {
if (table->test) {
- Str command = unquote_mailcap(table->test, type, NULL, NULL);
+ Str command = unquote_mailcap(table->test, type, NULL, NULL, NULL);
if (system(command->ptr) != 0)
continue;
}
@@ -86,7 +89,7 @@ searchMailcap(struct mailcap *table, char *type)
}
static int
-matchattr(char *p, char *attr, int len, Str * value)
+matchMailcapAttr(char *p, char *attr, int len, Str * value)
{
int quoted;
char *q = NULL;
@@ -162,22 +165,23 @@ extractMailcapEntry(char *mcap_entry, struct mailcap *mcap)
while (*p == ';') {
p++;
SKIP_BLANKS(p);
- if (matchattr(p, "needsterminal", 13, NULL)) {
+ if (matchMailcapAttr(p, "needsterminal", 13, NULL)) {
mcap->flags |= MAILCAP_NEEDSTERMINAL;
}
- else if (matchattr(p, "copiousoutput", 13, NULL)) {
+ else if (matchMailcapAttr(p, "copiousoutput", 13, NULL)) {
mcap->flags |= MAILCAP_COPIOUSOUTPUT;
}
- else if (matchattr(p, "htmloutput", 10, NULL)) {
+ else if (matchMailcapAttr(p, "x-htmloutput", 12, NULL) ||
+ matchMailcapAttr(p, "htmloutput", 10, NULL)) {
mcap->flags |= MAILCAP_HTMLOUTPUT;
}
- else if (matchattr(p, "test", 4, &tmp)) {
+ else if (matchMailcapAttr(p, "test", 4, &tmp)) {
mcap->test = allocStr(tmp->ptr, tmp->length);
}
- else if (matchattr(p, "nametemplate", 12, &tmp)) {
+ else if (matchMailcapAttr(p, "nametemplate", 12, &tmp)) {
mcap->nametemplate = allocStr(tmp->ptr, tmp->length);
}
- else if (matchattr(p, "edit", 4, &tmp)) {
+ else if (matchMailcapAttr(p, "edit", 4, &tmp)) {
mcap->edit = allocStr(tmp->ptr, tmp->length);
}
quoted = 0;
@@ -255,12 +259,55 @@ searchExtViewer(char *type)
#define MC_PREC2 2
#define MC_QUOTED 3
+#define MCF_SQUOTED (1 << 0)
+#define MCF_DQUOTED (1 << 1)
+
Str
-unquote_mailcap(char *qstr, char *type, char *name, int *stat)
+quote_mailcap(char *s, int flag)
{
- Str str = Strnew();
- char *p;
- int status = MC_NORMAL;
+ Str d;
+
+ d = Strnew();
+
+ for (;; ++s)
+ switch (*s) {
+ case '\0':
+ goto end;
+ case '$':
+ case '`':
+ case '"':
+ case '\\':
+ if (!(flag & MCF_SQUOTED))
+ Strcat_char(d, '\\');
+
+ Strcat_char(d, *s);
+ break;
+ case '\'':
+ if (flag & MCF_SQUOTED) {
+ Strcat_charp(d, "'\\''");
+ break;
+ }
+ default:
+ if (!flag && !IS_ALNUM(*s))
+ Strcat_char(d, '\\');
+ case '_':
+ case '.':
+ case ':':
+ case '/':
+ Strcat_char(d, *s);
+ break;
+ }
+end:
+ return d;
+}
+
+
+static Str
+unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat, int flag0)
+{
+ Str str, tmp, test, then;
+ char *p, *q;
+ int status = MC_NORMAL, prev_status = MC_NORMAL, sp = 0, flag;
if (stat)
*stat = 0;
@@ -268,13 +315,20 @@ unquote_mailcap(char *qstr, char *type, char *name, int *stat)
if (qstr == NULL)
return NULL;
- for (p = qstr; *p; p++) {
+ str = Strnew();
+ tmp = test = then = NULL;
+
+ for (flag = flag0, p = qstr; *p; p++) {
if (status == MC_QUOTED) {
- Strcat_char(str, *p);
- status = MC_NORMAL;
+ if (prev_status == MC_PREC2)
+ Strcat_char(tmp, *p);
+ else
+ Strcat_char(str, *p);
+ status = prev_status;
continue;
}
else if (*p == '\\') {
+ prev_status = status;
status = MC_QUOTED;
continue;
}
@@ -283,22 +337,35 @@ unquote_mailcap(char *qstr, char *type, char *name, int *stat)
if (*p == '%') {
status = MC_PREC;
}
- else
- Strcat_char(str, *p);
+ else {
+ if (*p == '\'') {
+ if (!flag0 && flag & MCF_SQUOTED)
+ flag &= ~MCF_SQUOTED;
+ else if (!flag)
+ flag |= MCF_SQUOTED;
+ }
+ else if (*p == '"') {
+ if (!flag0 && flag & MCF_DQUOTED)
+ flag &= ~MCF_DQUOTED;
+ else if (!flag)
+ flag |= MCF_DQUOTED;
+ }
+ Strcat_char(str, *p);
+ }
break;
case MC_PREC:
if (IS_ALPHA(*p)) {
switch (*p) {
case 's':
if (name) {
- Strcat_charp(str, name);
+ Strcat_charp(str, quote_mailcap(name, flag)->ptr);
if (stat)
*stat |= MCSTAT_REPNAME;
}
break;
case 't':
if (type) {
- Strcat_charp(str, type);
+ Strcat_charp(str, quote_mailcap(type, flag)->ptr);
if (stat)
*stat |= MCSTAT_REPTYPE;
}
@@ -308,17 +375,50 @@ unquote_mailcap(char *qstr, char *type, char *name, int *stat)
}
else if (*p == '{') {
status = MC_PREC2;
+ test = then = NULL;
+ tmp = Strnew();
}
else if (*p == '%') {
Strcat_char(str, *p);
}
break;
case MC_PREC2:
- if (*p == '}') {
- status = MC_NORMAL;
+ if (sp > 0 || *p == '{') {
+ Strcat_char(tmp, *p);
+
+ switch (*p) {
+ case '{':
+ ++sp;
+ break;
+ case '}':
+ --sp;
+ break;
+ default:
+ break;
+ }
}
- break;
+ else if (*p == '}') {
+ char *q;
+ if (attr && (q = strcasestr(attr, tmp->ptr)) != NULL &&
+ (q == attr || IS_SPACE(*(q-1)) || *(q-1) == ';') &&
+ matchattr(q, tmp->ptr, tmp->length, &tmp)) {
+ Strcat_charp(str, quote_mailcap(tmp->ptr, flag)->ptr);
+ if (stat)
+ *stat |= MCSTAT_REPPARAM;
+ }
+ status = MC_NORMAL;
+ }
+ else {
+ Strcat_char(tmp, *p);
+ }
+ break;
}
}
return str;
}
+
+Str
+unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *stat)
+{
+ return unquote_mailcap_loop(qstr, type, name, attr, stat, 0);
+}
diff --git a/main.c b/main.c
@@ -6,12 +6,16 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
+#include <sys/wait.h>
#include "terms.h"
#include "myctype.h"
#ifdef MOUSE
#ifdef USE_GPM
#include <gpm.h>
#endif /* USE_GPM */
+#ifdef __EMX__
+#include <time.h> /* for time() */
+#endif /* __EMX__ */
#if defined(USE_GPM) || defined(USE_SYSMOUSE)
extern int do_getch();
#define getch() do_getch()
@@ -56,21 +60,18 @@ void show_params(FILE * fp);
#endif
static int display_ok = FALSE;
-int w3m_dump = 0;
-int w3m_dump_source = 0;
-int w3m_dump_head = 0;
static void dump_source(Buffer *);
static void dump_head(Buffer *);
+static void dump_extra(Buffer *);
int prec_num = 0;
int prev_key = -1;
int on_target = 1;
+static void _followForm(int);
static void _goLine(char*);
#define PREC_NUM (prec_num ? prec_num : 1)
#define PREC_LIMIT 10000
-#if 0
static int searchKeyNum(void);
-#endif
#include "gcmain.c"
@@ -91,6 +92,7 @@ fusage(FILE *f, int err)
fprintf(f, " -s Shift_JIS\n");
fprintf(f, " -j JIS\n");
#endif
+ fprintf(f, " -O e|s|j|N|m|n display code\n");
fprintf(f, " -I e|s document code\n");
#endif /* JP_CHARSET */
fprintf(f, " -B load bookmark\n");
@@ -102,11 +104,15 @@ fusage(FILE *f, int err)
fprintf(f, " -M monochrome display\n");
#endif /* COLOR */
fprintf(f, " -F automatically render frame\n");
- fprintf(f, " -dump dump formatted page into stdout\n");
fprintf(f, " -cols width specify column width (used with -dump)\n");
fprintf(f, " -ppc count specify the number of pixels per character (4.0...32.0)\n");
- fprintf(f, " -dump_source dump page source into stdout\n");
+ fprintf(f, " -dump dump formatted page into stdout\n");
fprintf(f, " -dump_head dump response of HEAD request into stdout\n");
+ fprintf(f, " -dump_source dump page source into stdout\n");
+ fprintf(f, " -dump_both dump HEAD and source into stdout\n");
+ fprintf(f, " -dump_extra dump HEAD, source, and extra information into stdout\n");
+ fprintf(f, " -post file use POST method with file content\n");
+ fprintf(f, " -header string insert string as a header\n");
fprintf(f, " +<num> goto <num> line\n");
fprintf(f, " -num show line number\n");
fprintf(f, " -no-proxy don't use proxy\n");
@@ -115,8 +121,8 @@ fusage(FILE *f, int err)
#endif /* MOUSE */
#ifdef USE_COOKIE
fprintf(f, " -cookie use cookie (-no-cookie: don't use cookie)\n");
- fprintf(f, " -pauth user:pass proxy authentication\n");
#endif /* USE_COOKIE */
+ fprintf(f, " -pauth user:pass proxy authentication\n");
#ifndef KANJI_SYMBOLS
fprintf(f, " -no-graph don't use graphic character\n");
#endif /* not KANJI_SYMBOLS */
@@ -187,6 +193,56 @@ wrap_GC_warn_proc(char *msg, GC_word arg)
fprintf(stderr, msg, (unsigned long)arg);
}
+static void
+sig_chld(int signo)
+{
+ int stat;
+#ifdef HAVE_WAITPID
+ pid_t pid;
+
+ while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) {
+ ;
+ }
+#elif HAVE_WAIT3
+ int pid;
+
+ while ((pid = wait3(&stat, WNOHANG, NULL)) > 0) {
+ ;
+ }
+#else
+ wait(&stat);
+#endif
+ signal(SIGCHLD, sig_chld);
+ return;
+}
+
+Str
+make_optional_header_string (char *s)
+{
+ char *p;
+ Str hs;
+
+ for (p = s; *p && *p != ':'; p++);
+ if (*p != ':' || p == s)
+ return NULL;
+ if (strchr(s, '\n')) {
+ return NULL;
+ }
+ hs = Strnew_size(p - s);
+ strncpy(hs->ptr, s, p - s);
+ hs->length = p - s;
+ if (!Strcasecmp_charp(hs, "content-type")) {
+ override_content_type = TRUE;
+ }
+ Strcat_charp(hs, ": ");
+ if (*(p + 1)) { /* not null header */
+ for (p = p + 1; isspace(*p); p++); /* skip white spaces */
+ Strcat_charp(hs, p);
+ }
+ Strcat_charp(hs, "\r\n");
+ return hs;
+}
+
int
MAIN(int argc, char **argv, char **envp)
{
@@ -200,6 +256,10 @@ MAIN(int argc, char **argv, char **envp)
int load_argc = 0;
int load_bookmark = FALSE;
int visual_start = FALSE;
+ char search_header = FALSE;
+ char *default_type = NULL;
+ char *post_file = NULL;
+ Str err_msg;
#ifndef SYS_ERRLIST
prepare_sys_errlist();
@@ -239,11 +299,6 @@ MAIN(int argc, char **argv, char **envp)
/* initializations */
init_rc(config_file);
- initKeymap();
-#ifdef MENU
- initMenu();
- CurrentMenuData = NULL;
-#endif /* MENU */
#ifdef USE_COOKIE
initCookie();
#endif /* USE_COOKIE */
@@ -320,10 +375,35 @@ MAIN(int argc, char **argv, char **envp)
else if (!strcmp("-e", argv[i]))
DisplayCode = CODE_EUC;
#endif
- else if (!strcmp("-I", argv[i])) {
- if (++i >= argc)
+ else if (!strncmp("-I", argv[i], 2)) {
+ if (argv[i][2])
+ argv[i] += 2;
+ else if (++i >= argc)
usage();
- DocumentCode = str_to_code(argv[i]);
+ c = str_to_code(argv[i]);
+ switch (c) {
+ case CODE_EUC:
+ case CODE_SJIS:
+ case CODE_INNER_EUC:
+ DocumentCode = c;
+ UseContentCharset = FALSE;
+ UseAutoDetect = FALSE;
+ break;
+ default:
+ DocumentCode = '\0';
+ UseContentCharset = TRUE;
+ UseAutoDetect = TRUE;
+ break;
+ }
+ }
+ else if (!strncmp("-O", argv[i], 2)) {
+ if (argv[i][2])
+ argv[i] += 2;
+ else if (++i >= argc)
+ usage();
+ c = str_to_code(argv[i]);
+ if (c != CODE_INNER_EUC && c != CODE_ASCII)
+ DisplayCode = c;
}
#endif /* JP_CHARSET */
#ifndef KANJI_SYMBOLS
@@ -333,10 +413,10 @@ MAIN(int argc, char **argv, char **envp)
else if (!strcmp("-T", argv[i])) {
if (++i >= argc)
usage();
- DefaultType = argv[i];
+ DefaultType = default_type = argv[i];
}
else if (!strcmp("-m", argv[i]))
- SearchHeader = TRUE;
+ SearchHeader = search_header = TRUE;
else if (!strcmp("-v", argv[i]))
visual_start = TRUE;
#ifdef COLOR
@@ -367,40 +447,22 @@ MAIN(int argc, char **argv, char **envp)
WrapSearch = TRUE;
}
}
- else if (!strcmp("-dump", argv[i])) {
- w3m_dump = TRUE;
- w3m_dump_source = FALSE;
- w3m_dump_head = FALSE;
- w3m_halfdump = FALSE;
- if (COLS == 0)
- COLS = 80;
- }
- else if (!strcmp("-dump_source", argv[i])) {
- w3m_dump = TRUE;
- w3m_dump_source = TRUE;
- w3m_dump_head = FALSE;
- w3m_halfdump = FALSE;
- if (COLS == 0)
- COLS = 80;
- }
- else if (!strcmp("-dump_head", argv[i])) {
- w3m_dump = TRUE;
- w3m_dump_head = TRUE;
- w3m_dump_source = FALSE;
- w3m_halfdump = FALSE;
- if (COLS == 0)
- COLS = 80;
- }
- else if (!strcmp("-halfdump", argv[i])) {
- w3m_halfdump = TRUE;
- w3m_dump = FALSE;
- if (COLS == 0)
- COLS = 80;
- }
+ else if (!strcmp("-dump", argv[i]))
+ w3m_dump = DUMP_BUFFER;
+ else if (!strcmp("-dump_source", argv[i]))
+ w3m_dump = DUMP_SOURCE;
+ else if (!strcmp("-dump_head", argv[i]))
+ w3m_dump = DUMP_HEAD;
+ else if (!strcmp("-dump_both", argv[i]))
+ w3m_dump = (DUMP_HEAD|DUMP_SOURCE);
+ else if (!strcmp("-dump_extra", argv[i]))
+ w3m_dump = (DUMP_HEAD|DUMP_SOURCE|DUMP_EXTRA);
+ else if (!strcmp("-halfdump", argv[i]))
+ w3m_dump = DUMP_HALFDUMP;
else if (!strcmp("-halfload", argv[i])) {
+ w3m_dump = 0;
w3m_halfload = TRUE;
- w3m_dump = FALSE;
- w3m_halfdump = FALSE;
+ DefaultType = default_type = "text/html";
}
else if (!strcmp("-backend", argv[i])) {
w3m_backend = TRUE;
@@ -431,19 +493,36 @@ MAIN(int argc, char **argv, char **envp)
showLineNum = TRUE;
else if (!strcmp("-no-proxy", argv[i]))
Do_not_use_proxy = TRUE;
+ else if (!strcmp("-post", argv[i])) {
+ if (++i >= argc)
+ usage();
+ post_file = argv[i];
+ }
+ else if (!strcmp("-header", argv[i])) {
+ Str hs;
+ if (++i >= argc)
+ usage();
+ if ((hs = make_optional_header_string(argv[i])) != NULL)
+ if (header_string == NULL)
+ header_string = hs;
+ else
+ Strcat (header_string, hs);
+ }
#ifdef MOUSE
else if (!strcmp("-no-mouse", argv[i])) {
- mouse_end();
use_mouse = FALSE;
}
#endif /* MOUSE */
#ifdef USE_COOKIE
else if (!strcmp("-no-cookie", argv[i])) {
use_cookie = FALSE;
+ accept_cookie = FALSE;
}
else if (!strcmp("-cookie", argv[i])) {
use_cookie = TRUE;
+ accept_cookie = TRUE;
}
+#endif /* USE_COOKIE */
else if (!strcmp("-pauth", argv[i])) {
if (++i >= argc)
usage();
@@ -453,7 +532,6 @@ MAIN(int argc, char **argv, char **envp)
argv[i]++;
}
}
-#endif /* USE_COOKIE */
#ifdef DEBIAN
else if (!strcmp("-s", argv[i]))
#else
@@ -502,9 +580,8 @@ MAIN(int argc, char **argv, char **envp)
i++;
}
- if (option_assigned) {
- parse_proxy();
- }
+ if (option_assigned)
+ sync_with_option();
#ifdef __WATT32__
if (w3m_debug)
@@ -518,21 +595,33 @@ MAIN(int argc, char **argv, char **envp)
if (BookmarkFile == NULL)
BookmarkFile = rcFile(BOOKMARK);
- if (!isatty(1) && !w3m_dump && !w3m_halfdump) {
+ if (!isatty(1) && !w3m_dump) {
/* redirected output */
- w3m_dump = TRUE;
+ w3m_dump = DUMP_BUFFER;
+ }
+ if (w3m_dump) {
if (COLS == 0)
COLS = 80;
}
+#ifdef USE_BINMODE_STREAM
+ setmode(fileno(stdout), O_BINARY);
+#endif
if (w3m_backend)
backend();
- if (!w3m_dump && !w3m_halfdump)
+ if (!w3m_dump) {
+ initKeymap();
+#ifdef MENU
+ initMenu();
+ CurrentMenuData = NULL;
+#endif /* MENU */
fmInit();
+ }
orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
- if (w3m_halfdump)
- printf("<pre>\n");
-
+ err_msg = Strnew();
if (load_argc == 0) {
+ if (w3m_halfdump)
+ printf("<pre>\n");
+ /* no URL specified */
if (!isatty(0)) {
redin = newFileStream(fdopen(dup(0), "rb"), (void (*)()) pclose);
newbuf = openGeneralPagerBuffer(redin);
@@ -541,7 +630,7 @@ MAIN(int argc, char **argv, char **envp)
else if (load_bookmark) {
newbuf = loadGeneralFile(BookmarkFile, NULL, NO_REFERER, 0, NULL);
if (newbuf == NULL)
- fprintf(stderr, "w3m: Can't load bookmark\n");
+ Strcat_charp(err_msg, "w3m: Can't load bookmark.\n");
}
else if (visual_start) {
Str s_page;
@@ -564,15 +653,15 @@ MAIN(int argc, char **argv, char **envp)
#endif /* DEBIAN */
newbuf = loadHTMLString(s_page);
if (newbuf == NULL)
- fprintf(stderr, "w3m: Can't load string\n");
- else
+ Strcat_charp(err_msg, "w3m: Can't load string.\n");
+ else if (newbuf != NO_BUFFER)
newbuf->bufferprop |= (BP_INTERNAL | BP_NO_URL);
}
else if ((p = getenv("HTTP_HOME")) != NULL ||
(p = getenv("WWW_HOME")) != NULL) {
newbuf = loadGeneralFile(p, NULL, NO_REFERER, 0, NULL);
if (newbuf == NULL)
- fprintf(stderr, "w3m: Can't load %s\n", p);
+ Strcat(err_msg, Sprintf("w3m: Can't load %s.\n", p));
}
else {
if (fmInitialized)
@@ -580,12 +669,11 @@ MAIN(int argc, char **argv, char **envp)
usage();
}
if (newbuf == NULL) {
- deleteFiles();
- if (fmInitialized) {
- sleep_till_anykey(1, 0);
+ if (fmInitialized)
fmTerm();
- }
- exit(2);
+ if (err_msg->length)
+ fprintf(stderr, "%s", err_msg->ptr);
+ w3m_exit(2);
}
i = -1;
}
@@ -594,16 +682,42 @@ MAIN(int argc, char **argv, char **envp)
}
for (; i < load_argc; i++) {
if (i >= 0) {
- if (w3m_dump && w3m_dump_head) {
+ SearchHeader = search_header;
+ DefaultType = default_type;
+ if (w3m_halfdump)
+ printf("<pre>\n");
+ if (w3m_dump == DUMP_HEAD) {
request = New(FormList);
request->method = FORM_METHOD_HEAD;
newbuf = loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, request);
}
else {
- newbuf = loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, NULL);
+ if (post_file && i == 0) {
+ FILE *fp;
+ Str body;
+ if (!strcmp (post_file, "-"))
+ fp = stdin;
+ else
+ fp = fopen (post_file, "r");
+ if (fp == NULL) {
+ Strcat(err_msg,
+ Sprintf("w3m: Can't open %s.\n", post_file));
+ continue;
+ }
+ body = Strfgetall (fp);
+ if (fp != stdin) fclose (fp);
+ request = newFormList (NULL, "post", NULL, NULL, NULL, NULL, NULL);
+ request->body = body->ptr;
+ request->boundary = NULL;
+ request->length = body->length;
+ }
+ else {
+ request = NULL;
+ }
+ newbuf = loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, request);
}
if (newbuf == NULL) {
- fprintf(stderr, "w3m: Can't load %s\n", load_argv[i]);
+ Strcat(err_msg, Sprintf("w3m: Can't load %s.\n", load_argv[i]));
continue;
}
else if (newbuf == NO_BUFFER)
@@ -617,67 +731,79 @@ MAIN(int argc, char **argv, char **envp)
break;
case SCM_LOCAL:
case SCM_LOCAL_CGI:
- unshiftHist(LoadHist, load_argv[i]);
+ unshiftHist(LoadHist, conv_from_system(load_argv[i]));
break;
default:
pushHashHist(URLHist, parsedURL2Str(&newbuf->currentURL)->ptr);
break;
}
- }
- if (newbuf == NO_BUFFER)
- continue;
- if (w3m_halfdump) {
- Currentbuf = Firstbuf = newbuf;
- printf("</pre><title>%s</title>\n", htmlquote_str(newbuf->buffername));
- deleteFiles();
- exit(0);
+ } else
+ if (newbuf == NO_BUFFER)
+ continue;
+ newbuf->search_header = search_header;
+ if (Currentbuf == NULL)
+ Firstbuf = Currentbuf = newbuf;
+ else {
+ Currentbuf->nextBuffer = newbuf;
+ Currentbuf = newbuf;
}
if (w3m_dump) {
- Currentbuf = Firstbuf = newbuf;
- if (w3m_dump_source)
- dump_source(Currentbuf);
- else if (w3m_dump_head)
+ if (w3m_dump & DUMP_EXTRA)
+ dump_extra(Currentbuf);
+ if (w3m_dump & DUMP_HEAD)
dump_head(Currentbuf);
- else {
+ if (w3m_dump & DUMP_SOURCE)
+ dump_source(Currentbuf);
+ if (w3m_dump == DUMP_BUFFER) {
if (Currentbuf->frameset != NULL && RenderFrame)
rFrame();
saveBuffer(Currentbuf, stdout);
}
- deleteFiles();
-#ifdef USE_COOKIES
- save_cookies();
-#endif /* USE_COOKIES */
- exit(0);
- }
- if (Currentbuf == NULL)
- Firstbuf = Currentbuf = newbuf;
- else {
- Currentbuf->nextBuffer = newbuf;
- Currentbuf = newbuf;
- }
- if (Currentbuf && Currentbuf != NO_BUFFER &&
- RenderFrame && Currentbuf->frameset != NULL) {
- rFrame();
+ if (w3m_halfdump)
+ printf("</pre><title>%s</title>\n", html_quote(newbuf->buffername));
+ } else {
+ if (Currentbuf->frameset != NULL && RenderFrame)
+ rFrame();
Currentbuf = newbuf;
- }
#ifdef BUFINFO
- saveBufferInfo();
+ saveBufferInfo();
#endif
-
+ }
}
+ if (w3m_dump) {
+#ifdef USE_COOKIE
+ save_cookies();
+#endif /* USE_COOKIE */
+ w3m_exit(0);
+ }
+
if (!Firstbuf || Firstbuf == NO_BUFFER) {
if (newbuf == NO_BUFFER) {
if (fmInitialized)
- inputStr("Hit any key to quit w3m:", "");
- quitfm();
+ inputChar("Hit any key to quit w3m:");
}
- deleteFiles();
- if (fmInitialized) {
- sleep_till_anykey(1, 0);
+ if (fmInitialized)
fmTerm();
+ if (err_msg->length)
+ fprintf(stderr, "%s", err_msg->ptr);
+ if (newbuf == NO_BUFFER) {
+#ifdef USE_COOKIE
+ save_cookies();
+#endif /* USE_COOKIE */
+ if (! err_msg->length)
+ w3m_exit(0);
}
- exit(2);
+ w3m_exit(2);
}
+ if (err_msg->length)
+ disp_message_nsec(err_msg->ptr, FALSE, 1, TRUE, FALSE);
+
+ SearchHeader = FALSE;
+ DefaultType = NULL;
+#ifdef JP_CHARSET
+ UseContentCharset = TRUE;
+ UseAutoDetect = TRUE;
+#endif
#ifdef SIGWINCH
signal(SIGWINCH, resize_hook);
@@ -685,12 +811,15 @@ MAIN(int argc, char **argv, char **envp)
setlinescols();
setupscreen();
#endif /* not SIGWINCH */
+#ifdef SIGCHLD
+ signal(SIGCHLD, sig_chld);
+#endif
Currentbuf = Firstbuf;
displayBuffer(Currentbuf, B_NORMAL);
- onA();
if (line_str) {
_goLine(line_str);
}
+ onA();
for (;;) {
/* event processing */
if (n_event_queue > 0) {
@@ -778,6 +907,17 @@ dump_head(Buffer * buf)
puts("");
}
+static void
+dump_extra(Buffer * buf)
+{
+ printf("W3m-current-url: %s\n",parsedURL2Str(&buf->currentURL)->ptr);
+ if (buf->baseURL)
+ printf("W3m-base-url: %s\n",parsedURL2Str(buf->baseURL)->ptr);
+#ifdef JP_CHARSET
+ printf("W3m-document-charset: %s\n", code_to_str(buf->document_code));
+#endif
+}
+
void
nulcmd(void)
{ /* do nothing */
@@ -787,7 +927,7 @@ nulcmd(void)
void
pcmap(void)
{
- w3mFuncList[(int) PcKeymap[(int) getch()].func();
+ w3mFuncList[(int) PcKeymap[(int) getch()]].func();
}
#else /* not __EMX__ */
void pcmap(void)
@@ -855,16 +995,16 @@ void
saveBufferInfo()
{
FILE *fp;
+
+ if (w3m_dump)
+ return;
if ((fp = fopen(rcFile("bufinfo"), "w")) == NULL) {
return;
}
- else {
- fprintf(fp, "%s\n", currentURL()->ptr);
- fclose(fp);
- }
+ fprintf(fp, "%s\n", currentURL()->ptr);
+ fclose(fp);
}
-
static void
pushBuffer(Buffer * buf)
{
@@ -953,7 +1093,11 @@ nscroll(int n, int mode)
} else {
tlnum = Currentbuf->topLine->linenumber;
llnum = Currentbuf->topLine->linenumber + LASTLINE - 1;
+#ifdef NEXTPAGE_TOPLINE
+ diff_n = 0;
+#else
diff_n = n - (tlnum - curtop->linenumber);
+#endif
if (lnum < tlnum)
lnum = tlnum + diff_n;
if (lnum > llnum)
@@ -969,9 +1113,9 @@ void
pgFore(void)
{
#ifdef VI_PREC_NUM
- nscroll(PREC_NUM * (LASTLINE - 1), B_NORMAL);
+ nscroll(searchKeyNum() * (LASTLINE - 1), B_NORMAL);
#else /* not VI_PREC_NUM */
- nscroll(prec_num ? prec_num : (LASTLINE - 1),
+ nscroll(prec_num ? searchKeyNum() : searchKeyNum() * (LASTLINE - 1),
prec_num ? B_SCROLL : B_NORMAL);
#endif /* not VI_PREC_NUM */
}
@@ -981,9 +1125,9 @@ void
pgBack(void)
{
#ifdef VI_PREC_NUM
- nscroll(- PREC_NUM * (LASTLINE - 1), B_NORMAL);
+ nscroll(- searchKeyNum() * (LASTLINE - 1), B_NORMAL);
#else /* not VI_PREC_NUM */
- nscroll(- (prec_num ? prec_num : (LASTLINE - 1)),
+ nscroll(- (prec_num ? searchKeyNum() : searchKeyNum() * (LASTLINE - 1)),
prec_num ? B_SCROLL : B_NORMAL);
#endif /* not VI_PREC_NUM */
}
@@ -992,14 +1136,14 @@ pgBack(void)
void
lup1(void)
{
- nscroll(PREC_NUM, B_SCROLL);
+ nscroll(searchKeyNum(), B_SCROLL);
}
/* 1 line down */
void
ldown1(void)
{
- nscroll(-PREC_NUM, B_SCROLL);
+ nscroll(- searchKeyNum(), B_SCROLL);
}
/* move cursor position to the center of screen */
@@ -1048,7 +1192,7 @@ srchfor(void)
{
MySignalHandler(*prevtrap) ();
char *str;
- int i;
+ int i, n = searchKeyNum();
int wrapped = 0;
str = inputStrHist("Forward: ", NULL, TextHist);
@@ -1062,11 +1206,12 @@ srchfor(void)
prevtrap = signal(SIGINT, intTrap);
crmode();
if (SETJMP(IntReturn) == 0)
- for (i = 0; i < PREC_NUM; i++)
+ for (i = 0; i < n; i++)
wrapped = forwardSearch(Currentbuf, SearchString);
signal(SIGINT, prevtrap);
term_raw();
displayBuffer(Currentbuf, B_NORMAL);
+ onA();
if (wrapped) {
disp_message("Search wrapped", FALSE);
}
@@ -1079,7 +1224,7 @@ srchbak(void)
{
MySignalHandler(*prevtrap) ();
char *str;
- int i;
+ int i, n = searchKeyNum();
int wrapped = 0;
str = inputStrHist("Backward: ", NULL, TextHist);
@@ -1093,11 +1238,17 @@ srchbak(void)
prevtrap = signal(SIGINT, intTrap);
crmode();
if (SETJMP(IntReturn) == 0)
- for (i = 0; i < PREC_NUM; i++)
+ for (i = 0; i < n; i++)
wrapped = backwardSearch(Currentbuf, SearchString);
signal(SIGINT, prevtrap);
term_raw();
displayBuffer(Currentbuf, B_NORMAL);
+ onA();
+/** by inu for 1902
+ disp_message(Sprintf("%s%s",
+ routine[reverse] == forwardSearch ? "Forward: " : "Backward: ",
+ SearchString)->ptr, FALSE);
+**/
if (wrapped) {
disp_message("Search wrapped", FALSE);
}
@@ -1119,12 +1270,6 @@ srch_nxtprv(int reverse)
disp_message("No previous regular expression", TRUE);
return;
}
- move(LASTLINE, 0);
- addstr(searchRoutine == forwardSearch ? "Forward: " : "Backward: ");
- addstr(SearchString);
- clrtoeolx();
- move(LASTLINE, 0);
- refresh();
if (reverse != 0)
reverse = 1;
if (searchRoutine == backwardSearch)
@@ -1137,6 +1282,10 @@ srch_nxtprv(int reverse)
signal(SIGINT, prevtrap);
term_raw();
displayBuffer(Currentbuf, B_NORMAL);
+ onA();
+ disp_message(Sprintf("%s%s",
+ routine[reverse] == forwardSearch ? "Forward: " : "Backward: ",
+ SearchString)->ptr, FALSE);
if (wrapped) {
disp_message("Search wrapped", FALSE);
}
@@ -1178,7 +1327,7 @@ shiftl(void)
if (Currentbuf->firstLine == NULL)
return;
column = Currentbuf->currentColumn;
- columnSkip(Currentbuf, PREC_NUM * (-COLS + 1) + 1);
+ columnSkip(Currentbuf, searchKeyNum() * (-COLS + 1) + 1);
shiftvisualpos(Currentbuf, Currentbuf->currentColumn - column);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1192,7 +1341,7 @@ shiftr(void)
if (Currentbuf->firstLine == NULL)
return;
column = Currentbuf->currentColumn;
- columnSkip(Currentbuf, PREC_NUM * (COLS - 1) - 1);
+ columnSkip(Currentbuf, searchKeyNum() * (COLS - 1) - 1);
shiftvisualpos(Currentbuf, Currentbuf->currentColumn - column);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1202,11 +1351,11 @@ col1R(void)
{
Buffer *buf = Currentbuf;
Line *l = buf->currentLine;
- int j, column;
+ int j, column, n = searchKeyNum();
if (l == NULL)
return;
- for (j = 0; j < PREC_NUM; j++) {
+ for (j = 0; j < n; j++) {
column = buf->currentColumn;
columnSkip(Currentbuf, 1);
if (column == buf->currentColumn)
@@ -1221,11 +1370,11 @@ col1L(void)
{
Buffer *buf = Currentbuf;
Line *l = buf->currentLine;
- int j;
+ int j, n = searchKeyNum();
if (l == NULL)
return;
- for (j = 0; j < PREC_NUM; j++) {
+ for (j = 0; j < n; j++) {
if (buf->currentColumn == 0)
break;
columnSkip(Currentbuf, -1);
@@ -1234,6 +1383,73 @@ col1L(void)
displayBuffer(Currentbuf, B_NORMAL);
}
+void
+setEnv(void)
+{
+ char *env;
+ char *var, *value;
+
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ env = searchKeyData();
+ if (env == NULL || *env == '\0' || strchr(env, '=') == NULL) {
+ if (env != NULL && *env != '\0')
+ env = Sprintf("%s=", env)->ptr;
+ env = inputStrHist("Set environ: ", env, TextHist);
+ if (env == NULL || *env == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
+ }
+ if ((value = strchr(env, '=')) != NULL && value > env) {
+ var = allocStr(env, value - env);
+ value++;
+ set_environ(var, value);
+ }
+ displayBuffer(Currentbuf, B_NORMAL);
+}
+
+void
+pipeBuf(void)
+{
+ Buffer *buf;
+ char *cmd, *tmpf;
+ FILE *f;
+
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ cmd = searchKeyData();
+ if (cmd == NULL || *cmd == '\0') {
+ cmd = inputLineHist("Pipe buffer to: ", "", IN_COMMAND, ShellHist);
+ if (cmd == NULL || *cmd == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
+ }
+ tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
+ f = fopen(tmpf, "w");
+ if (f == NULL) {
+ disp_message(Sprintf("Can't save buffer to %s", cmd)->ptr, TRUE);
+ return;
+ }
+ saveBuffer(Currentbuf, f);
+ fclose(f);
+ pushText(fileToDelete, tmpf);
+ if (strcasestr(cmd, "%s"))
+ cmd = Sprintf(cmd, tmpf)->ptr;
+ else
+ cmd = Sprintf("%s < %s", cmd, tmpf)->ptr;
+ buf = getpipe(cmd);
+ if (buf == NULL) {
+ disp_message("Execution failed", FALSE);
+ }
+ else {
+ buf->bufferprop |= (BP_INTERNAL | BP_NO_URL);
+ if (buf->type == NULL)
+ buf->type = "text/plain";
+ pushBuffer(buf);
+ }
+ displayBuffer(Currentbuf, B_FORCE_REDRAW);
+}
+
/* Execute shell command and read output ac pipe. */
void
pipesh(void)
@@ -1245,10 +1461,12 @@ pipesh(void)
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(read shell[pipe])!", "", IN_COMMAND, ShellHist);
- if (cmd == NULL || *cmd == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ }
+ if (cmd != NULL)
+ cmd = conv_to_system(cmd);
+ if (cmd == NULL || *cmd == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
}
buf = getpipe(cmd);
if (buf == NULL) {
@@ -1275,10 +1493,12 @@ readsh(void)
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(read shell)!", "", IN_COMMAND, ShellHist);
- if (cmd == NULL || *cmd == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ }
+ if (cmd != NULL)
+ cmd = conv_to_system(cmd);
+ if (cmd == NULL || *cmd == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
}
prevtrap = signal(SIGINT, intTrap);
crmode();
@@ -1301,9 +1521,6 @@ readsh(void)
void
execsh(void)
{
-#ifdef MOUSE
- int use_m = use_mouse;
-#endif
char *cmd;
CurrentKeyData = NULL; /* not allowed in w3m-control: */
@@ -1311,21 +1528,15 @@ execsh(void)
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(exec shell)!", "", IN_COMMAND, ShellHist);
}
+ if (cmd != NULL)
+ cmd = conv_to_system(cmd);
if (cmd != NULL && *cmd != '\0') {
fmTerm();
system(cmd);
printf("\n[Hit any key]");
fflush(stdout);
-#ifdef MOUSE
- use_mouse = FALSE;
-#endif
fmInit();
getch();
-#ifdef MOUSE
- use_mouse = use_m;
- if (use_mouse)
- mouse_init();
-#endif
}
displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
@@ -1339,10 +1550,12 @@ ldfile(void)
fn = searchKeyData();
if (fn == NULL || *fn == '\0') {
fn = inputFilenameHist("(Load)Filename? ", NULL, LoadHist);
- if (fn == NULL || *fn == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ }
+ if (fn != NULL)
+ fn = conv_to_system(fn);
+ if (fn == NULL || *fn == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
}
cmd_loadfile(fn);
}
@@ -1359,9 +1572,9 @@ cmd_loadfile(char *fn)
{
Buffer *buf;
- buf = loadGeneralFile(fn, NULL, NO_REFERER, 0, NULL);
+ buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
if (buf == NULL) {
- char *emsg = Sprintf("%s not found", fn)->ptr;
+ char *emsg = Sprintf("%s not found", conv_from_system(fn))->ptr;
disp_err_message(emsg, FALSE);
}
else if (buf != NO_BUFFER) {
@@ -1373,54 +1586,100 @@ cmd_loadfile(char *fn)
}
/* Move cursor left */
+static void
+_movL(int n)
+{
+ int i, m = searchKeyNum();
+ if (Currentbuf->firstLine == NULL)
+ return;
+ for (i = 0; i < m; i++)
+ cursorLeft(Currentbuf, n);
+ displayBuffer(Currentbuf, B_NORMAL);
+}
+
void
movL(void)
{
- int i;
+ _movL(COLS / 2);
+}
+
+void
+movL1(void)
+{
+ _movL(1);
+}
+
+/* Move cursor downward */
+static void
+_movD(int n)
+{
+ int i, m = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
- for (i = 0; i < PREC_NUM; i++)
- cursorLeft(Currentbuf);
+ for (i = 0; i < m; i++)
+ cursorDown(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
-/* Move cursor downward */
void
movD(void)
{
- int i;
+ _movD((LASTLINE + 1) / 2);
+}
+
+void
+movD1(void)
+{
+ _movD(1);
+}
+
+/* move cursor upward */
+static void
+_movU(int n)
+{
+ int i, m = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
- for (i = 0; i < PREC_NUM; i++)
- cursorDown(Currentbuf);
+ for (i = 0; i < m; i++)
+ cursorUp(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
-/* move cursor upward */
void
movU(void)
{
- int i;
- if (Currentbuf->firstLine == NULL)
- return;
- for (i = 0; i < PREC_NUM; i++)
- cursorUp(Currentbuf);
- displayBuffer(Currentbuf, B_NORMAL);
+ _movU((LASTLINE + 1) / 2);
}
-/* Move cursor right */
void
-movR(void)
+movU1(void)
{
- int i;
+ _movU(1);
+}
+
+/* Move cursor right */
+static void
+_movR(int n)
+{
+ int i, m = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
- for (i = 0; i < PREC_NUM; i++)
- cursorRight(Currentbuf);
+ for (i = 0; i < m; i++)
+ cursorRight(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
+void
+movR(void)
+{
+ _movR(COLS / 2);
+}
+void
+movR1(void)
+{
+ _movR(1);
+}
/* movLW, movRW */
/*
@@ -1451,12 +1710,12 @@ movLW(void)
Lineprop *pb;
Line *pline;
int ppos;
- int i;
+ int i, n = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
- for (i = 0; i < PREC_NUM; i++) {
+ for (i = 0; i < n; i++) {
pline = Currentbuf->currentLine;
ppos = Currentbuf->pos;
@@ -1515,12 +1774,12 @@ movRW(void)
Lineprop *pb;
Line *pline;
int ppos;
- int i;
+ int i, n = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
- for (i = 0; i < PREC_NUM; i++) {
+ for (i = 0; i < n; i++) {
pline = Currentbuf->currentLine;
ppos = Currentbuf->pos;
@@ -1562,7 +1821,7 @@ qquitfm(void)
char *ans;
if (!confirm_on_quit)
quitfm();
- ans = inputStr("Do you want to exit w3m? (y or n)", "");
+ ans = inputChar("Do you want to exit w3m? (y or n)");
if (ans != NULL && tolower(*ans) == 'y')
quitfm();
displayBuffer(Currentbuf, B_NORMAL);
@@ -1573,7 +1832,6 @@ void
quitfm(void)
{
fmTerm();
- deleteFiles();
#ifdef USE_COOKIE
save_cookies();
#endif /* USE_COOKIE */
@@ -1581,7 +1839,7 @@ quitfm(void)
if (SaveURLHist)
saveHistory(URLHist, URLHistSize);
#endif /* USE_HISTORY */
- exit(0);
+ w3m_exit(0);
}
/* Select buffer */
@@ -1679,9 +1937,10 @@ _goLine(char *l)
void
goLine(void)
{
- char *l = inputStr("Goto line: ", "");
+ if (prec_num)
+ _goLine("^");
+ _goLine(inputStr("Goto line: ", ""));
prec_num = 0;
- _goLine(l);
}
void
@@ -1754,10 +2013,12 @@ editBf(void)
if (Currentbuf->edit) {
cmd = unquote_mailcap(Currentbuf->edit,
Currentbuf->real_type,
- quoteShell(fn)->ptr, NULL);
+ fn,
+ checkHeader(Currentbuf, "Content-Type:"),
+ NULL);
}
else {
- char *file = quoteShell(fn)->ptr;
+ char *file = shell_quote(fn);
if (strcasestr(Editor, "%s")) {
if (strcasestr(Editor, "%d"))
cmd = Sprintf(Editor, linenum, file);
@@ -1776,7 +2037,11 @@ editBf(void)
fmTerm();
system(cmd->ptr);
fmInit();
- buf = loadGeneralFile(fn, NULL, NO_REFERER, 0, NULL);
+ SearchHeader = Currentbuf->search_header;
+ DefaultType = Currentbuf->real_type;
+ buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
+ SearchHeader = FALSE;
+ DefaultType = NULL;
if (buf == NULL) {
disp_err_message("Re-loading failed", FALSE);
buf = nullBuffer();
@@ -1784,6 +2049,7 @@ editBf(void)
else if (buf == NO_BUFFER) {
buf = nullBuffer();
}
+ buf->search_header = Currentbuf->search_header;
if (fbuf != NULL)
Firstbuf = deleteBuffer(Firstbuf, fbuf);
repBuffer(Currentbuf, buf);
@@ -1820,7 +2086,7 @@ editScr(void)
tmpf = tmpfname(TMPF_DFL, NULL);
f = fopen(tmpf->ptr, "w");
if (f == NULL) {
- cmd = Sprintf("Can't open %s\n", tmpf->ptr);
+ cmd = Sprintf("Can't open %s", tmpf->ptr);
disp_err_message(cmd->ptr, TRUE);
return;
}
@@ -2013,7 +2279,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
int flag = 0;
ParsedURL *base, pu;
- message(Sprintf("loading %s\n", url)->ptr, 0, 0);
+ message(Sprintf("loading %s", url)->ptr, 0, 0);
refresh();
base = baseURL(Currentbuf);
@@ -2028,7 +2294,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
flag,
request);
if (buf == NULL) {
- char *emsg = Sprintf("Can't load %s\n", url)->ptr;
+ char *emsg = Sprintf("Can't load %s", url)->ptr;
disp_err_message(emsg, FALSE);
return NULL;
}
@@ -2071,9 +2337,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
/* stack current frameset */
pushFrameTree(&(nfbuf->frameQ),
copyFrameSet(nfbuf->frameset),
- Currentbuf->currentLine ?
- Currentbuf->currentLine->linenumber : 0,
- Currentbuf->pos);
+ Currentbuf);
/* delete frame view buffer */
delBuffer(Currentbuf);
Currentbuf = nfbuf;
@@ -2094,6 +2358,11 @@ loadLink(char *url, char *target, char *referer, FormList * request)
}
if (al) {
gotoLine(Currentbuf, al->start.line);
+#ifdef LABEL_TOPLINE
+ Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
+ Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
+ FALSE);
+#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
}
@@ -2123,6 +2392,11 @@ gotoLabel(char *label)
(*buf->clone)++;
pushBuffer(buf);
gotoLine(Currentbuf, al->start.line);
+#ifdef LABEL_TOPLINE
+ Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
+ Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
+ FALSE);
+#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_FORCE_REDRAW);
@@ -2143,7 +2417,7 @@ followA(void)
a = retrieveCurrentAnchor(Currentbuf);
if (a == NULL) {
- followForm();
+ _followForm(FALSE);
return;
}
if (*a->url == '#') { /* index within this buffer */
@@ -2168,7 +2442,7 @@ followA(void)
if (!strncasecmp(a->url, "mailto:", 7)) {
/* invoke external mailer */
Str tmp;
- char *to = quoteShell(a->url + 7)->ptr;
+ char *to = shell_quote(url_unquote(a->url + 7));
if (strcasestr(Mailer, "%s"))
tmp = Sprintf(Mailer, to);
else
@@ -2215,11 +2489,11 @@ followI(void)
a = retrieveCurrentImg(Currentbuf);
if (a == NULL)
return;
- message(Sprintf("loading %s\n", a->url)->ptr, 0, 0);
+ message(Sprintf("loading %s", a->url)->ptr, 0, 0);
refresh();
buf = loadGeneralFile(cURLcode(a->url, Currentbuf), baseURL(Currentbuf), NULL, 0, NULL);
if (buf == NULL) {
- char *emsg = Sprintf("Can't load %s\n", a->url)->ptr;
+ char *emsg = Sprintf("Can't load %s", a->url)->ptr;
disp_err_message(emsg, FALSE);
}
else if (buf != NO_BUFFER) {
@@ -2228,13 +2502,6 @@ followI(void)
displayBuffer(Currentbuf, B_NORMAL);
}
-static void
-do_update_form_radio(FormItemList * f, void *data)
-{
- Buffer *buf = (Buffer *) data;
- formUpdateBuffer(&buf->formitem->anchors[f->anchor_num], buf, f);
-}
-
static FormItemList *
save_submit_formlist(FormItemList * src)
{
@@ -2272,6 +2539,7 @@ save_submit_formlist(FormItemList * src)
item->size = srcitem->size;
item->rows = srcitem->rows;
item->maxlength = srcitem->maxlength;
+ item->readonly = srcitem->readonly;
#ifdef MENU_SELECT
opt = curopt = NULL;
for (srcopt = srcitem->select_option; srcopt; srcopt = srcopt->next) {
@@ -2311,6 +2579,17 @@ save_submit_formlist(FormItemList * src)
return ret;
}
+#ifdef JP_CHARSET
+static Str
+conv_form_encoding(Str val, FormItemList *fi, Buffer *buf)
+{
+ return conv_str(val, InnerCode, fi->parent->charset ? fi->parent->charset
+ : (buf->document_code ? buf->document_code : CODE_EUC));
+}
+#else
+#define conv_form_encoding(val, fi, buf) (val)
+#endif
+
static void
query_from_followform(Str * query, FormItemList * fi, int multipart)
{
@@ -2351,63 +2630,47 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
}
if (multipart) {
if (f2->type == FORM_INPUT_IMAGE) {
- *query = Strdup(f2->name);
+ *query = Strdup(conv_form_encoding(f2->name, fi, Currentbuf));
Strcat_charp(*query, ".x");
form_write_data(body, fi->parent->boundary, (*query)->ptr, "1");
*query = Strdup(f2->name);
Strcat_charp(*query, ".y");
form_write_data(body, fi->parent->boundary, (*query)->ptr, "1");
}
- else if (f2->name && f2->name->length > 0) {
+ else if (f2->name && f2->name->length > 0 && f2->value != NULL) {
/* not IMAGE */
- if (f2->value != NULL) {
-#ifdef JP_CHARSET
- if (fi->parent->charset != 0)
- *query = conv_str(f2->value, InnerCode, fi->parent->charset);
- else
- *query = conv_str(f2->value, InnerCode, Currentbuf->document_code);
-#else /* not JP_CHARSET */
- *query = f2->value;
-#endif /* not JP_CHARSET */
- }
+ *query = conv_form_encoding(f2->value, fi, Currentbuf);
if (f2->type == FORM_INPUT_FILE)
- form_write_form_file(body, fi->parent->boundary, f2->name->ptr, (*query)->ptr);
+ form_write_from_file(body, fi->parent->boundary,
+ conv_form_encoding(f2->name, fi, Currentbuf)->ptr,
+ (*query)->ptr, Str_conv_to_system(f2->value)->ptr);
else
- form_write_data(body, fi->parent->boundary, f2->name->ptr, (*query)->ptr);
+ form_write_data(body, fi->parent->boundary,
+ conv_form_encoding(f2->name, fi, Currentbuf)->ptr,
+ (*query)->ptr);
}
}
else {
/* not multipart */
if (f2->type == FORM_INPUT_IMAGE) {
- Strcat(*query, f2->name);
+ Strcat(*query, conv_form_encoding(f2->name, fi, Currentbuf));
Strcat_charp(*query, ".x=1&");
- Strcat(*query, f2->name);
+ Strcat(*query, conv_form_encoding(f2->name, fi, Currentbuf));
Strcat_charp(*query, ".y=1");
}
else {
/* not IMAGE */
if (f2->name && f2->name->length > 0) {
- Strcat(*query, form_quote(f2->name));
+ Strcat(*query, Str_form_quote(conv_form_encoding(
+ f2->name, fi, Currentbuf)));
Strcat_char(*query, '=');
}
if (f2->value != NULL) {
if (fi->parent->method == FORM_METHOD_INTERNAL)
- Strcat(*query, form_quote(f2->value));
+ Strcat(*query, Str_form_quote(f2->value));
else {
-#ifdef JP_CHARSET
- if (fi->parent->charset != 0)
- Strcat(*query,
- form_quote(conv_str(f2->value,
- InnerCode,
- fi->parent->charset)));
- else
- Strcat(*query,
- form_quote(conv_str(f2->value,
- InnerCode,
- Currentbuf->document_code)));
-#else /* not JP_CHARSET */
- Strcat(*query, form_quote(f2->value));
-#endif /* not JP_CHARSET */
+ Strcat(*query, Str_form_quote(conv_form_encoding(
+ f2->value, fi, Currentbuf)));
}
}
}
@@ -2426,16 +2689,29 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
}
}
+/* submit form */
+void
+submitForm(void)
+{
+ _followForm(TRUE);
+}
+
/* process form */
void
followForm(void)
{
+ _followForm(FALSE);
+}
+
+static void
+_followForm(int submit)
+{
Line *l;
- Anchor *a;
+ Anchor *a, *a2;
char *p;
FormItemList *fi, *f2;
- Str tmp = Strnew(), tmp2 = Strnew();
- int multipart = 0;
+ Str tmp, tmp2;
+ int multipart = 0, i;
if (Currentbuf->firstLine == NULL)
return;
@@ -2447,8 +2723,12 @@ followForm(void)
fi = (FormItemList *) a->url;
switch (fi->type) {
case FORM_INPUT_TEXT:
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
p = inputStrHist("TEXT:", fi->value ? fi->value->ptr : NULL, TextHist);
- if (p == NULL)
+ if (p == NULL || fi->readonly)
return;
fi->value = Strnew_charp(p);
formUpdateBuffer(a, Currentbuf, fi);
@@ -2456,8 +2736,12 @@ followForm(void)
goto do_submit;
break;
case FORM_INPUT_FILE:
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
p = inputFilenameHist("Filename:", fi->value ? fi->value->ptr : NULL, NULL);
- if (p == NULL)
+ if (p == NULL || fi->readonly)
return;
fi->value = Strnew_charp(p);
formUpdateBuffer(a, Currentbuf, fi);
@@ -2465,6 +2749,12 @@ followForm(void)
goto do_submit;
break;
case FORM_INPUT_PASSWORD:
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
p = inputLine("TEXT:", fi->value ? fi->value->ptr : NULL, IN_PASSWORD);
if (p == NULL)
return;
@@ -2474,35 +2764,60 @@ followForm(void)
goto do_submit;
break;
case FORM_TEXTAREA:
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+/*
if (fi->rows == 1) {
p = inputStrHist("TEXT:", fi->value ? fi->value->ptr : NULL, TextHist);
if (p == NULL)
return;
fi->value = Strnew_charp(p);
}
- else
- input_textarea(fi);
+ else
+*/
+ input_textarea(fi);
formUpdateBuffer(a, Currentbuf, fi);
break;
case FORM_INPUT_RADIO:
- form_recheck_radio(fi, Currentbuf, do_update_form_radio);
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
+ formRecheckRadio(a, Currentbuf, fi);
break;
case FORM_INPUT_CHECKBOX:
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
fi->checked = !fi->checked;
formUpdateBuffer(a, Currentbuf, fi);
break;
#ifdef MENU_SELECT
case FORM_SELECT:
- formChooseOptionByMenu(fi,
- Currentbuf->cursorX - Currentbuf->pos + a->start.pos,
- Currentbuf->cursorY);
+ if (submit)
+ goto do_submit;
+ if (! formChooseOptionByMenu(fi,
+ Currentbuf->cursorX - Currentbuf->pos + a->start.pos,
+ Currentbuf->cursorY))
+ break;
formUpdateBuffer(a, Currentbuf, fi);
+ if (fi->parent->nitems == 1)
+ goto do_submit;
break;
#endif /* MENU_SELECT */
case FORM_INPUT_IMAGE:
case FORM_INPUT_SUBMIT:
case FORM_INPUT_BUTTON:
do_submit:
+ tmp = Strnew();
+ tmp2 = Strnew();
multipart = (fi->parent->method == FORM_METHOD_POST &&
fi->parent->enctype == FORM_ENCTYPE_MULTIPART);
query_from_followform(&tmp, fi, multipart);
@@ -2511,6 +2826,8 @@ followForm(void)
if (!Strcmp_charp(tmp2, "!CURRENT_URL!")) {
/* It means "current URL" */
tmp2 = parsedURL2Str(&Currentbuf->currentURL);
+ if ((p = strchr(tmp2->ptr, '?')) != NULL)
+ Strshrink(tmp2, (tmp2->ptr + tmp2->length) - p);
}
if (fi->parent->method == FORM_METHOD_GET) {
@@ -2552,15 +2869,21 @@ followForm(void)
}
break;
case FORM_INPUT_RESET:
- for (f2 = fi->parent->item; f2; f2 = f2->next) {
- if (f2->name && f2->value &&
- f2->type != FORM_INPUT_RADIO &&
- f2->type != FORM_INPUT_CHECKBOX &&
+ for (i = 0; i < Currentbuf->formitem->nanchor; i++) {
+ a2 = &Currentbuf->formitem->anchors[i];
+ f2 = (FormItemList *) a2->url;
+ if (f2->parent == fi->parent &&
+ f2->name && f2->value &&
f2->type != FORM_INPUT_SUBMIT &&
f2->type != FORM_INPUT_HIDDEN &&
f2->type != FORM_INPUT_RESET) {
- f2->value = Strnew();
- formUpdateBuffer(&Currentbuf->formitem->anchors[f2->anchor_num], Currentbuf, f2);
+ f2->value = f2->init_value;
+ f2->checked = f2->init_checked;
+#ifdef MENU_SELECT
+ f2->label = f2->init_label;
+ f2->selected = f2->init_selected;
+#endif /* MENU_SELECT */
+ formUpdateBuffer(a2, Currentbuf, f2);
}
}
break;
@@ -2716,7 +3039,7 @@ nextA(void)
HmarkerList *hl = Currentbuf->hmarklist;
BufferPoint *po;
Anchor *an, *pan;
- int i, x, y;
+ int i, x, y, n = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
@@ -2730,7 +3053,7 @@ nextA(void)
y = Currentbuf->currentLine->linenumber;
x = Currentbuf->pos;
- for (i = 0; i < PREC_NUM; i++) {
+ for (i = 0; i < n; i++) {
pan = an;
if (an && an->hseq >= 0) {
int hseq = an->hseq + 1;
@@ -2775,7 +3098,7 @@ prevA(void)
HmarkerList *hl = Currentbuf->hmarklist;
BufferPoint *po;
Anchor *an, *pan;
- int i, x, y;
+ int i, x, y, n = searchKeyNum();
if (Currentbuf->firstLine == NULL)
return;
@@ -2789,7 +3112,7 @@ prevA(void)
y = Currentbuf->currentLine->linenumber;
x = Currentbuf->pos;
- for (i = 0; i < PREC_NUM; i++) {
+ for (i = 0; i < n; i++) {
pan = an;
if (an && an->hseq >= 0) {
int hseq = an->hseq - 1;
@@ -2827,6 +3150,150 @@ prevA(void)
displayBuffer(Currentbuf, B_NORMAL);
}
+/* go to the next left/right anchor */
+static void
+nextX(int d, int dy)
+{
+ HmarkerList *hl = Currentbuf->hmarklist;
+ Anchor *an, *pan;
+ Line *l;
+ int i, x, y, n = searchKeyNum();
+
+ if (Currentbuf->firstLine == NULL)
+ return;
+ if (!hl || hl->nmark == 0)
+ return;
+
+ an = retrieveCurrentAnchor(Currentbuf);
+ if (an == NULL)
+ an = retrieveCurrentForm(Currentbuf);
+
+ l = Currentbuf->currentLine;
+ x = Currentbuf->pos;
+ y = l->linenumber;
+ pan = NULL;
+ for (i = 0; i < n; i++) {
+ if (an)
+ x = (d > 0) ? an->end.pos : an->start.pos - 1;
+ an = NULL;
+ while (1) {
+ for (; x >= 0 && x < l->len; x += d) {
+ an = retrieveAnchor(Currentbuf->href, y, x);
+ if (! an)
+ an = retrieveAnchor(Currentbuf->formitem, y, x);
+ if (an) {
+ pan = an;
+ break;
+ }
+ }
+ if (! dy || an)
+ break;
+ l = (dy > 0) ? l->next : l->prev;
+ if (! l)
+ break;
+ x = (d > 0) ? 0 : l->len - 1;
+ y = l->linenumber;
+ }
+ if (! an)
+ break;
+ }
+
+ if (pan == NULL)
+ return;
+ gotoLine(Currentbuf, y);
+ Currentbuf->pos = pan->start.pos;
+ arrangeCursor(Currentbuf);
+ displayBuffer(Currentbuf, B_NORMAL);
+}
+
+/* go to the next downward/upward anchor */
+static void
+nextY(int d)
+{
+ HmarkerList *hl = Currentbuf->hmarklist;
+ Anchor *an, *pan;
+ int i, x, y, n = searchKeyNum();
+ int hseq;
+
+ if (Currentbuf->firstLine == NULL)
+ return;
+ if (!hl || hl->nmark == 0)
+ return;
+
+ an = retrieveCurrentAnchor(Currentbuf);
+ if (an == NULL)
+ an = retrieveCurrentForm(Currentbuf);
+
+ x = Currentbuf->pos;
+ y = Currentbuf->currentLine->linenumber + d;
+ pan = NULL;
+ hseq = -1;
+ for (i = 0; i < n; i++) {
+ if (an)
+ hseq = abs(an->hseq);
+ an = NULL;
+ for (; y >= 0 && y <= Currentbuf->lastLine->linenumber; y += d) {
+ an = retrieveAnchor(Currentbuf->href, y, x);
+ if (! an)
+ an = retrieveAnchor(Currentbuf->formitem, y, x);
+ if (an && hseq != abs(an->hseq)) {
+ pan = an;
+ break;
+ }
+ }
+ if (! an)
+ break;
+ }
+
+ if (pan == NULL)
+ return;
+ gotoLine(Currentbuf, pan->start.line);
+ arrangeLine(Currentbuf);
+ displayBuffer(Currentbuf, B_NORMAL);
+}
+
+/* go to the next left anchor */
+void
+nextL(void)
+{
+ nextX(-1, 0);
+}
+
+/* go to the next left-up anchor */
+void
+nextLU(void)
+{
+ nextX(-1, -1);
+}
+
+/* go to the next right anchor */
+void
+nextR(void)
+{
+ nextX(1, 0);
+}
+
+/* go to the next right-down anchor */
+void
+nextRD(void)
+{
+ nextX(1, 1);
+}
+
+/* go to the next downward anchor */
+void
+nextD(void)
+{
+ nextY(1);
+}
+
+/* go to the next upward anchor */
+void
+nextU(void)
+{
+ nextY(-1);
+}
+
static int
checkBackBuffer(Buffer * buf)
{
@@ -2866,25 +3333,31 @@ backBf(void)
if (buf) {
if (buf->frameQ) {
- long linenumber;
- short pos;
struct frameset *fs;
+ long linenumber = buf->frameQ->linenumber;
+ long top = buf->frameQ->top_linenumber;
+ short pos = buf->frameQ->pos;
+ short currentColumn = buf->frameQ->currentColumn;
+ AnchorList *formitem = buf->frameQ->formitem;
- fs = popFrameTree(&(buf->frameQ), &linenumber, &pos);
+ fs = popFrameTree(&(buf->frameQ));
deleteFrameSet(buf->frameset);
buf->frameset = fs;
if (buf == Currentbuf) {
rFrame();
+ Currentbuf->topLine = lineSkip(Currentbuf,
+ Currentbuf->firstLine, top - 1, FALSE);
gotoLine(Currentbuf, linenumber);
+ Currentbuf->pos = pos;
+ Currentbuf->currentColumn = currentColumn;
arrangeCursor(Currentbuf);
+ formResetBuffer(Currentbuf, formitem);
}
} else if (RenderFrame && buf == Currentbuf) {
delBuffer(Currentbuf);
}
}
-
- clear();
displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
@@ -2904,7 +3377,7 @@ cmd_loadURL(char *url, ParsedURL * current)
if (!strncasecmp(url, "mailto:", 7)) {
/* invoke external mailer */
Str tmp;
- char *to = quoteShell(url + 7)->ptr;
+ char *to = shell_quote(url + 7);
if (strcasestr(Mailer, "%s"))
tmp = Sprintf(Mailer, to);
else
@@ -2924,11 +3397,11 @@ cmd_loadURL(char *url, ParsedURL * current)
}
#endif /* USE_NNTP */
-/* message(Sprintf("loading %s\n", url)->ptr, 0, 0); */
+/* message(Sprintf("loading %s", url)->ptr, 0, 0); */
refresh();
buf = loadGeneralFile(url, current, NO_REFERER, 0, NULL);
if (buf == NULL) {
- char *emsg = Sprintf("Can't load %s\n", url)->ptr;
+ char *emsg = Sprintf("Can't load %s", conv_from_system(url))->ptr;
disp_err_message(emsg, FALSE);
}
else if (buf != NO_BUFFER) {
@@ -2955,6 +3428,14 @@ goURL(void)
if (url != NULL)
SKIP_BLANKS(url);
}
+#ifdef JP_CHARSET
+ if (url != NULL) {
+ if (Currentbuf->document_code)
+ url = conv(url, InnerCode, Currentbuf->document_code)->ptr;
+ else
+ url = conv_to_system(url);
+ }
+#endif
if (url == NULL || *url == '\0') {
displayBuffer(Currentbuf, B_FORCE_REDRAW);
return;
@@ -2999,18 +3480,18 @@ ldBmark(void)
void
adBmark(void)
{
- Str url, title, tmp;
- /* cmd_loadBuffer(load_bookmark_panel(Currentbuf), BP_NO_URL, *
- * LB_NOLINK); */
- url = form_quote(parsedURL2Str(&Currentbuf->currentURL));
- title = form_quote(Strnew_charp(Currentbuf->buffername));
+ Str tmp;
+
#ifdef __EMX__
- tmp = Sprintf("%s/w3mbookmark.exe?mode=panel&bmark=%s&url=%s&title=%s",
- get_os2_dft("W3M_LIB_DIR", LIB_DIR), BookmarkFile, url->ptr, title->ptr);
+ tmp = Sprintf("file://%s/w3mbookmark.exe?mode=panel&bmark=%s&url=%s&title=%s",
+ get_os2_dft("W3M_LIB_DIR", LIB_DIR),
#else /* not __EMX__ */
- tmp = Sprintf("%s/w3mbookmark?mode=panel&bmark=%s&url=%s&title=%s",
- LIB_DIR, BookmarkFile, url->ptr, title->ptr);
+ tmp = Sprintf("file://%s/w3mbookmark?mode=panel&bmark=%s&url=%s&title=%s",
+ LIB_DIR,
#endif /* not __EMX__ */
+ (Str_form_quote(Strnew_charp(BookmarkFile)))->ptr,
+ (Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))->ptr,
+ (Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr);
cmd_loadURL(tmp->ptr, NULL);
}
@@ -3021,6 +3502,30 @@ ldOpt(void)
cmd_loadBuffer(load_option_panel(), BP_NO_URL, LB_NOLINK);
}
+/* set an option */
+void
+setOpt(void)
+{
+ char *opt;
+
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ opt = searchKeyData();
+ if (opt == NULL || *opt == '\0' || strchr(opt, '=') == NULL) {
+ if (opt != NULL && *opt != '\0') {
+ char *v = get_param_option(opt);
+ opt = Sprintf("%s=%s", opt, v ? v : "")->ptr;
+ }
+ opt = inputStrHist("Set option: ", opt, TextHist);
+ if (opt == NULL || *opt == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
+ }
+ if (set_param_option(opt))
+ sync_with_option();
+ displayBuffer(Currentbuf, B_FORCE_REDRAW);
+}
+
/* error message list */
void
msgs(void)
@@ -3136,10 +3641,12 @@ svBuf(void)
file = searchKeyData();
if (file == NULL || *file == '\0') {
file = inputLineHist("Save buffer to: ", NULL, IN_COMMAND, SaveHist);
- if (file == NULL || *file == '\0') {
- displayBuffer(Currentbuf, B_FORCE_REDRAW);
- return;
- }
+ }
+ if (file != NULL)
+ file = conv_to_system(file);
+ if (file == NULL || *file == '\0') {
+ displayBuffer(Currentbuf, B_FORCE_REDRAW);
+ return;
}
if (*file == '|') {
is_pipe = TRUE;
@@ -3153,7 +3660,7 @@ svBuf(void)
is_pipe = FALSE;
}
if (f == NULL) {
- char *emsg = Sprintf("Can't open %s\n", file)->ptr;
+ char *emsg = Sprintf("Can't open %s", conv_from_system(file))->ptr;
disp_err_message(emsg, TRUE);
return;
}
@@ -3169,12 +3676,18 @@ svBuf(void)
void
svSrc(void)
{
+ char *file;
+
if (Currentbuf->sourcefile == NULL)
return;
CurrentKeyData = NULL; /* not allowed in w3m-control: */
PermitSaveToPipe = TRUE;
- doFileCopy(Currentbuf->sourcefile,
- guess_save_name(Currentbuf->currentURL.file));
+ if (Currentbuf->real_scheme == SCM_LOCAL)
+ file = conv_from_system(guess_save_name(NULL,
+ Currentbuf->currentURL.real_file));
+ else
+ file = guess_save_name(Currentbuf, Currentbuf->currentURL.file);
+ doFileCopy(Currentbuf->sourcefile, file);
PermitSaveToPipe = FALSE;
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -3185,7 +3698,7 @@ _peekURL(int only_img){
Anchor *a;
ParsedURL pu;
static Str s = NULL;
- static int offset = 0;
+ static int offset = 0, n;
if (Currentbuf->firstLine == NULL)
return;
@@ -3212,8 +3725,9 @@ _peekURL(int only_img){
parseURL2(a->url, &pu, baseURL(Currentbuf));
s = parsedURL2Str(&pu);
disp:
- if (PREC_NUM > 1 && s->length > (PREC_NUM - 1) * (COLS - 1))
- disp_message_nomouse(&s->ptr[(PREC_NUM - 1) * (COLS - 1)], TRUE);
+ n = searchKeyNum();
+ if (n > 1 && s->length > (n - 1) * (COLS - 1))
+ disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
else
disp_message_nomouse(&s->ptr[offset], TRUE);
}
@@ -3245,7 +3759,7 @@ void
curURL(void)
{
static Str s = NULL;
- static int offset = 0;
+ static int offset = 0, n;
if (Currentbuf->bufferprop & BP_INTERNAL)
return;
@@ -3258,8 +3772,9 @@ curURL(void)
offset = 0;
s = currentURL();
}
- if (PREC_NUM > 1 && s->length > (PREC_NUM - 1) * (COLS - 1))
- disp_message_nomouse(&s->ptr[(PREC_NUM - 1) * (COLS - 1)], TRUE);
+ n = searchKeyNum();
+ if (n > 1 && s->length > (n - 1) * (COLS - 1))
+ disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
else
disp_message_nomouse(&s->ptr[offset], TRUE);
}
@@ -3323,10 +3838,9 @@ vwSrc(void)
Currentbuf->linkBuffer[LB_SOURCE] = buf;
}
else if (!strcasecmp(Currentbuf->type, "text/plain")) {
- char *old_type = DefaultType;
DefaultType = "text/html";
- buf = loadGeneralFile(fn, NULL, NO_REFERER, 0, NULL);
- DefaultType = old_type;
+ buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
+ DefaultType = NULL;
if (buf == NULL || buf == NO_BUFFER)
return;
if (Currentbuf->real_type &&
@@ -3334,7 +3848,7 @@ vwSrc(void)
buf->real_type = "text/html";
else
buf->real_type = Currentbuf->real_type;
- if (!strcmp(buf->buffername, mybasename(fn)))
+ if (!strcmp(buf->buffername, conv_from_system(lastFileName(fn))))
buf->buffername = Sprintf("HTML view of %s", Currentbuf->buffername)->ptr;
buf->linkBuffer[LB_SOURCE] = Currentbuf;
Currentbuf->linkBuffer[LB_N_SOURCE] = buf;
@@ -3434,7 +3948,11 @@ reload(void)
url = parsedURL2Str(&Currentbuf->currentURL);
message("Reloading...", 0, 0);
refresh();
+ SearchHeader = Currentbuf->search_header;
+ DefaultType = Currentbuf->real_type;
buf = loadGeneralFile(url->ptr, NULL, NO_REFERER, RG_NOCACHE, request);
+ SearchHeader = FALSE;
+ DefaultType = NULL;
if (multipart)
unlink(request->body);
if (buf == NULL) {
@@ -3444,6 +3962,7 @@ reload(void)
else if (buf == NO_BUFFER) {
return;
}
+ buf->search_header = Currentbuf->search_header;
buf->form_submit = Currentbuf->form_submit;
if (fbuf != NULL)
Firstbuf = deleteBuffer(Firstbuf, fbuf);
@@ -3575,11 +4094,15 @@ invoke_browser(char *url)
}
if (browser == NULL || *browser == '\0') {
browser = inputStr("Browse command: ", NULL);
- if (browser == NULL || *browser == '\0')
- return;
+ if (browser != NULL)
+ browser = conv_to_system(browser);
}
+ } else {
+ browser = conv_to_system(browser);
}
- url = quoteShell(url)->ptr;
+ if (browser == NULL || *browser == '\0')
+ return;
+ url = shell_quote(url);
if (strcasestr(browser, "%s")) {
tmp = Sprintf(browser, url);
Strremovetrailingspaces(tmp);
@@ -3870,6 +4393,12 @@ sysm_process_mouse(int x, int y, int nbs, int obs)
#endif /* MOUSE */
void
+dispVer()
+{
+ disp_message(Sprintf("w3m version %s", version)->ptr, FALSE);
+}
+
+void
wrapToggle(void)
{
if (WrapSearch) {
@@ -3911,7 +4440,7 @@ static void
execdict(char *word)
{
Buffer *buf;
- Str cmd, bn;
+ Str cmd;
MySignalHandler(*prevtrap) ();
if (word == NULL || *word == '\0') {
@@ -3924,9 +4453,9 @@ execdict(char *word)
prevtrap = signal(SIGINT, intTrap);
crmode();
buf = getshell(cmd->ptr);
- bn = Sprintf("%s %s", DICTBUFFERNAME, word);
- buf->buffername = bn->ptr;
buf->filename = word;
+ word = conv_from_system(word);
+ buf->buffername = Sprintf("%s %s", DICTBUFFERNAME, word)->ptr;
signal(SIGINT, prevtrap);
term_raw();
if (buf == NULL) {
@@ -3946,7 +4475,13 @@ execdict(char *word)
void
dictword(void)
{
- execdict(inputStr("(dictionary)!", ""));
+ char *word = inputStr("(dictionary)!", "");
+
+ if (word != NULL)
+ word = conv_to_system(word);
+ if (word == NULL || *word == '\0')
+ return;
+ execdict(word);
}
void
@@ -3975,7 +4510,6 @@ searchKeyData(void)
return allocStr(item->data, 0);
}
-#if 0
static int
searchKeyNum(void)
{
@@ -3987,4 +4521,27 @@ searchKeyNum(void)
n = atoi(d);
return n * PREC_NUM;
}
+
+void
+deleteFiles()
+{
+ Buffer *buf;
+ char *f;
+ while (Firstbuf && Firstbuf != NO_BUFFER) {
+ buf = Firstbuf->nextBuffer;
+ discardBuffer(Firstbuf);
+ Firstbuf = buf;
+ }
+ while ((f = popText(fileToDelete)) != NULL)
+ unlink(f);
+}
+
+void
+w3m_exit( int i )
+{
+ deleteFiles();
+#ifdef USE_SSL
+ free_ssl_ctx();
#endif
+ exit( i );
+}
diff --git a/map.c b/map.c
@@ -72,11 +72,11 @@ follow_map_panel(Buffer * buf, struct parsed_tagarg *arg)
t = t->next, s = s->next) {
parseURL2(t->ptr, &pu, baseURL(buf));
Strcat_charp(mappage, "<a href=\"");
- Strcat_charp(mappage, htmlquote_str(parsedURL2Str(&pu)->ptr));
+ Strcat_charp(mappage, html_quote(parsedURL2Str(&pu)->ptr));
Strcat_charp(mappage, "\">");
- Strcat_charp(mappage, htmlquote_str(s->ptr));
+ Strcat_charp(mappage, html_quote(s->ptr));
Strcat_charp(mappage, " ");
- Strcat_charp(mappage, htmlquote_str(t->ptr));
+ Strcat_charp(mappage, html_quote(t->ptr));
Strcat_charp(mappage, "</a><br>\n");
}
Strcat_charp(mappage, "</body></html>");
@@ -87,9 +87,9 @@ follow_map_panel(Buffer * buf, struct parsed_tagarg *arg)
/* append frame URL */
static void
-append_frame_info(Str html, struct frameset *set, int level)
+append_frame_info(Buffer *buf, Str html, struct frameset *set, int level)
{
- char *q;
+ char *p, *q;
int i, j;
if (!set)
@@ -105,17 +105,24 @@ append_frame_info(Str html, struct frameset *set, int level)
break;
for (j = 0; j < level; j++)
Strcat_charp(html, " ");
- q = htmlquote_str(frame.body->url);
+ q = html_quote(frame.body->url);
Strcat_charp(html, "<a href=\"");
Strcat_charp(html, q);
Strcat_charp(html, "\">");
- Strcat_charp(html, htmlquote_str(frame.body->name));
+ if (frame.body->name) {
+ p = file_unquote(frame.body->name);
+#ifdef JP_CHARSET
+ p = conv(p, buf->document_code, InnerCode)->ptr;
+#endif
+ p = html_quote(p);
+ Strcat_charp(html, p);
+ }
Strcat_charp(html, " ");
Strcat_charp(html, q);
Strcat_charp(html, "</a>\n");
break;
case F_FRAMESET:
- append_frame_info(html, frame.set, level + 1);
+ append_frame_info(buf, html, frame.set, level + 1);
break;
}
}
@@ -141,16 +148,16 @@ page_info_panel(Buffer * buf)
if (buf == NULL)
goto end;
Strcat_charp(tmp, "<tr><td nowrap>Title<td>");
- Strcat_charp(tmp, htmlquote_str(buf->buffername));
+ Strcat_charp(tmp, html_quote(buf->buffername));
Strcat_charp(tmp, "<tr><td nowrap>Current URL<td>");
- Strcat_charp(tmp, htmlquote_str(parsedURL2Str(&buf->currentURL)->ptr));
+ Strcat_charp(tmp, html_quote(parsedURL2Str(&buf->currentURL)->ptr));
Strcat_charp(tmp, "<tr><td nowrap>Document Type<td>");
if (buf->real_type)
Strcat_charp(tmp, buf->real_type);
else
Strcat_charp(tmp, "unknown");
Strcat_charp(tmp, "<tr><td nowrap>Last Modified<td>");
- Strcat_charp(tmp, htmlquote_str(last_modified(buf)));
+ Strcat_charp(tmp, html_quote(last_modified(buf)));
#ifdef JP_CHARSET
Strcat_charp(tmp, "<tr><td nowrap>Document Code<td>");
Strcat_charp(tmp, code_to_str(buf->document_code));
@@ -168,7 +175,7 @@ page_info_panel(Buffer * buf)
parseURL2(a->url, &pu, baseURL(buf));
s = parsedURL2Str(&pu);
Strcat_charp(tmp, "<tr><td nowrap>URL of current anchor<td>");
- Strcat_charp(tmp, htmlquote_str(s->ptr));
+ Strcat_charp(tmp, html_quote(s->ptr));
}
a = retrieveCurrentImg(buf);
if (a != NULL) {
@@ -176,23 +183,23 @@ page_info_panel(Buffer * buf)
s = parsedURL2Str(&pu);
Strcat_charp(tmp, "<tr><td nowrap>URL of current image<td>");
Strcat_charp(tmp, "<a href=\"");
- Strcat_charp(tmp, htmlquote_str(s->ptr));
+ Strcat_charp(tmp, html_quote(s->ptr));
Strcat_charp(tmp, "\">");
- Strcat_charp(tmp, htmlquote_str(s->ptr));
+ Strcat_charp(tmp, html_quote(s->ptr));
Strcat_charp(tmp, "</a>");
}
a = retrieveCurrentForm(buf);
if (a != NULL) {
s = Strnew_charp(form2str((FormItemList *) a->url));
Strcat_charp(tmp, "<tr><td nowrap>Method/type of current form<td>");
- Strcat_charp(tmp, htmlquote_str(s->ptr));
+ Strcat_charp(tmp, html_quote(s->ptr));
}
Strcat_charp(tmp, "</table>\n");
if (buf->document_header != NULL) {
Strcat_charp(tmp, "<hr width=50%>\n");
Strcat_charp(tmp, "<h1>Header information</h1>\n");
for (ti = buf->document_header->first; ti != NULL; ti = ti->next) {
- Strcat_charp(tmp, htmlquote_str(ti->ptr));
+ Strcat_charp(tmp, html_quote(ti->ptr));
Strcat_charp(tmp, "<br>");
}
}
@@ -205,7 +212,7 @@ page_info_panel(Buffer * buf)
if (f_set) {
Strcat_charp(tmp, "<hr width=50%><h1>Frame information</h1><pre>");
- append_frame_info(tmp, f_set, 0);
+ append_frame_info(buf, tmp, f_set, 0);
Strcat_charp(tmp, "</pre>");
}
#ifdef USE_SSL
diff --git a/menu.c b/menu.c
@@ -285,7 +285,7 @@ static MenuItem MainMenuItem[] =
{
/* type label variabel value func popup keys data */
{MENU_FUNC, "Ìá¤ë (b)", NULL, 0, backBf, NULL, "b", NULL},
- {MENU_FUNC, "¥Ð¥Ã¥Õ¥¡ÁªÂò (s)", NULL, 0, selBuf, NULL, "s", NULL},
+ {MENU_POPUP, "¥Ð¥Ã¥Õ¥¡ÁªÂò (s)", NULL, 0, NULL, &SelectMenu, "s", NULL},
{MENU_FUNC, "¥½¡¼¥¹¤òɽ¼¨ (v)", NULL, 0, vwSrc, NULL, "vV", NULL},
{MENU_FUNC, "¥½¡¼¥¹¤òÊÔ½¸ (e)", NULL, 0, editBf, NULL, "eE", NULL},
{MENU_FUNC, "¥½¡¼¥¹¤òÊݸ (S)", NULL, 0, svSrc, NULL, "S", NULL},
@@ -309,7 +309,7 @@ static MenuItem MainMenuItem[] =
{
/* type label variable value func popup keys data */
{MENU_FUNC, " Back (b) ", NULL, 0, backBf, NULL, "b", NULL},
- {MENU_FUNC, " Select Buffer(s) ", NULL, 0, selBuf, NULL, "s", NULL},
+ {MENU_POPUP, " Select Buffer(s) ", NULL, 0, NULL, &SelectMenu, "s", NULL},
{MENU_FUNC, " View Source (v) ", NULL, 0, vwSrc, NULL, "vV", NULL},
{MENU_FUNC, " Edit Source (e) ", NULL, 0, editBf, NULL, "eE", NULL},
{MENU_FUNC, " Save Source (S) ", NULL, 0, svSrc, NULL, "S", NULL},
@@ -932,13 +932,16 @@ menuForwardSearch (Menu* menu, char* str, int from)
message (p, 0, 0);
return -1;
}
+ if (from < 0)
+ from = 0;
for (i = from; i < menu->nitem; i++)
- if (regexMatch (menu->item[i].label, 0, 0) == 1)
- return i;
+ if (menu->item[i].type != MENU_NOP &&
+ regexMatch (menu->item[i].label, 0, 1) == 1)
+ return i;
return -1;
}
-int
+static int
menu_search_forward (Menu* menu, int from)
{
char *str;
@@ -947,15 +950,16 @@ menu_search_forward (Menu* menu, int from)
if (str != NULL && *str == '\0')
str = SearchString;
if (str == NULL || *str == '\0')
- return (MENU_NOTHING);
+ return -1;
SearchString = str;
- found = menuForwardSearch (menu, SearchString, from);
+ menuSearchRoutine = menuForwardSearch;
+ found = menuForwardSearch (menu, SearchString, from + 1);
if (WrapSearch && found == -1)
found = menuForwardSearch (menu, SearchString, 0);
- menuSearchRoutine = menuForwardSearch;
if (found >= 0)
return found;
- return from;
+ disp_message("Not found", TRUE);
+ return -1;
}
static int
@@ -963,7 +967,8 @@ mSrchF (char c)
{
int select;
select = menu_search_forward (CurrentMenu, CurrentMenu->select);
- goto_menu (CurrentMenu, select, 1);
+ if (select >= 0)
+ goto_menu (CurrentMenu, select, 1);
return (MENU_NOTHING);
}
@@ -976,13 +981,16 @@ menuBackwardSearch (Menu* menu, char* str, int from)
message (p, 0, 0);
return -1;
}
- for (i = from; i >= 0 ; i--)
- if (regexMatch (menu->item[i].label, 0, 0) == 1)
+ if (from >= menu->nitem)
+ from = menu->nitem - 1;
+ for (i = from; i >= 0; i--)
+ if (menu->item[i].type != MENU_NOP &&
+ regexMatch (menu->item[i].label, 0, 1) == 1)
return i;
return -1;
}
-int
+static int
menu_search_backward (Menu* menu, int from)
{
char *str;
@@ -993,13 +1001,14 @@ menu_search_backward (Menu* menu, int from)
if (str == NULL || *str == '\0')
return (MENU_NOTHING);
SearchString = str;
- found = menuBackwardSearch (menu, SearchString, from);
- if (WrapSearch && found == -1)
- found = menuBackwardSearch (menu, SearchString, 0);
menuSearchRoutine = menuBackwardSearch;
+ found = menuBackwardSearch (menu, SearchString, from - 1);
+ if (WrapSearch && found == -1)
+ found = menuBackwardSearch (menu, SearchString, menu->nitem);
if (found >= 0)
return found;
- return from;
+ disp_message("Not found", TRUE);
+ return -1;
}
static int
@@ -1007,7 +1016,8 @@ mSrchB (char c)
{
int select;
select = menu_search_backward (CurrentMenu, CurrentMenu->select);
- goto_menu (CurrentMenu, select, -1);
+ if (select >= 0)
+ goto_menu (CurrentMenu, select, -1);
return (MENU_NOTHING);
}
@@ -1015,7 +1025,6 @@ static int
menu_search_next_previous (Menu* menu, int from, int reverse)
{
int found;
- int new_from;
static int (*routine[2]) (Menu *, char *, int) =
{
menuForwardSearch, menuBackwardSearch
@@ -1023,25 +1032,20 @@ menu_search_next_previous (Menu* menu, int from, int reverse)
if (menuSearchRoutine == NULL) {
disp_message ("No previous regular expression", TRUE);
- return from;
+ return -1;
}
- addstr(menuSearchRoutine == menuForwardSearch ? "Forward: " : "Backward: ");
- addstr(SearchString);
if (reverse != 0)
reverse = 1;
if (menuSearchRoutine == menuBackwardSearch)
reverse ^= 1;
- new_from = from - reverse * 2 + 1;
- if (new_from >=0 && new_from < menu->nitem)
- found = (*routine[reverse]) (menu, SearchString, new_from);
- else
- found = (*routine[reverse]) (menu, SearchString, from);
- if (WrapSearch && found == -1) {
+ from += reverse ? -1 : 1;
+ found = (*routine[reverse]) (menu, SearchString, from);
+ if (WrapSearch && found == -1)
found = (*routine[reverse]) (menu, SearchString, reverse * menu->nitem);
- }
if (found >= 0)
return found;
- return from;
+ disp_message("Not found", TRUE);
+ return -1;
}
static int
@@ -1049,7 +1053,8 @@ mSrchN (char c)
{
int select;
select = menu_search_next_previous (CurrentMenu, CurrentMenu->select, 0);
- goto_menu (CurrentMenu, select, 1);
+ if (select >= 0)
+ goto_menu (CurrentMenu, select, 1);
return (MENU_NOTHING);
}
@@ -1058,7 +1063,8 @@ mSrchP (char c)
{
int select;
select = menu_search_next_previous (CurrentMenu, CurrentMenu->select, 1);
- goto_menu (CurrentMenu, select, -1);
+ if (select >= 0)
+ goto_menu (CurrentMenu, select, -1);
return (MENU_NOTHING);
}
@@ -1248,6 +1254,12 @@ mainMn(void)
/* --- SelectMenu --- */
+void
+selMn(void)
+{
+ popupMenu(Currentbuf->cursorX, Currentbuf->cursorY, &SelectMenu);
+}
+
static void
initSelectMenu(void)
{
@@ -1273,7 +1285,7 @@ initSelectMenu(void)
case SCM_LOCAL_CGI:
if (strcmp(buf->currentURL.file, "-")) {
Strcat_char(str, ' ');
- Strcat_charp(str, buf->filename);
+ Strcat_charp(str, conv_from_system(buf->currentURL.real_file));
}
break;
case SCM_UNKNOWN:
diff --git a/mimehead.c b/mimehead.c
@@ -110,6 +110,33 @@ decodeB(char **ww)
return ap;
}
+Str
+decodeU(char **ww)
+{
+ unsigned char c1, c2;
+ char *w = *ww;
+ int n, i;
+ Str a;
+
+ if (*w <= 0x20 || *w >= 0x60)
+ return Strnew_size(0);
+ n = *w - 0x20;
+ a = Strnew_size(n);
+ for (w++, i = 2; *w != '\0' && n; n--) {
+ c1 = (w[0] - 0x20) % 0x40;
+ c2 = (w[1] - 0x20) % 0x40;
+ Strcat_char(a, (c1 << i) | (c2 >> (6 - i)));
+ if (i == 6) {
+ w += 2;
+ i = 2;
+ } else {
+ w++;
+ i += 2;
+ }
+ }
+ return a;
+}
+
/* RFC2047 (4.2. The "Q" encoding) */
Str
decodeQ(char **ww)
@@ -166,21 +193,20 @@ decodeQP(char **ww)
Str
decodeWord(char **ow)
{
- char charset[32];
char *p, *w = *ow;
char method;
Str a = Strnew();
+ Str charset = Strnew();
if (*w != '=' || *(w + 1) != '?')
goto convert_fail;
w += 2;
- for (p = charset; *w != '?'; w++) {
+ for (; *w != '?'; w++) {
if (*w == '\0')
goto convert_fail;
- *(p++) = *w;
+ Strcat_char(charset,*w);
}
- *p = '\0';
- if (strcasecmp(charset, J_CHARSET) != 0) {
+ if (Strcasecmp_charp(charset, J_CHARSET) != 0) {
/* NOT ISO-2022-JP encoding ... don't convert */
goto convert_fail;
}
diff --git a/myctype.c b/myctype.c
@@ -9,11 +9,11 @@ unsigned char MYCTYPE_MAP[ 0x100 ] = {
/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16,
/* @ A B C D E F G H I J K L M N O */
- 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
/* P Q R S T U V W X Y Z [ \ ] ^ _ */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16,
/* ` a b c d e f g h i j k l m n o */
- 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
/* p q r s t u v w x y z { | } ~ DEL */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 1,
diff --git a/myctype.h b/myctype.h
@@ -6,7 +6,9 @@
#define MYCTYPE_ALPHA 4
#define MYCTYPE_DIGIT 8
#define MYCTYPE_PRINT 16
+#define MYCTYPE_HEX 32
#define MYCTYPE_ALNUM (MYCTYPE_ALPHA|MYCTYPE_DIGIT)
+#define MYCTYPE_XDIGIT (MYCTYPE_HEX|MYCTYPE_DIGIT)
#define GET_MYCTYPE(x) (MYCTYPE_MAP[(int)(unsigned char)(x)])
@@ -16,6 +18,7 @@
#define IS_DIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_DIGIT)
#define IS_PRINT(x) (GET_MYCTYPE(x) & MYCTYPE_PRINT)
#define IS_ALNUM(x) (GET_MYCTYPE(x) & MYCTYPE_ALNUM)
+#define IS_XDIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_XDIGIT)
extern unsigned char MYCTYPE_MAP[];
diff --git a/parsetag.c b/parsetag.c
@@ -1,3 +1,6 @@
+#ifdef __EMX__
+#include <strings.h> /* for bzero() */
+#endif /* __EMX__ */
#include "myctype.h"
#include "indep.h"
#include "Str.h"
@@ -38,7 +41,7 @@ cgistr2tagarg(char *cgistr)
tag = Strnew();
while (*cgistr && *cgistr != '=' && *cgistr != '&')
Strcat_char(tag, *cgistr++);
- t->arg = form_unquote(tag)->ptr;
+ t->arg = Str_form_unquote(tag)->ptr;
t->value = NULL;
if (*cgistr == '\0')
return t;
@@ -47,7 +50,7 @@ cgistr2tagarg(char *cgistr)
value = Strnew();
while (*cgistr && *cgistr != '&')
Strcat_char(value, *cgistr++);
- t->value = form_unquote(value)->ptr;
+ t->value = Str_form_unquote(value)->ptr;
}
else if (*cgistr == '&')
cgistr++;
diff --git a/parsetagx.c b/parsetagx.c
@@ -1,3 +1,6 @@
+#ifdef __EMX__
+#include <strings.h> /* for bzero() */
+#endif /* __EMX__ */
#include "fm.h"
#include "myctype.h"
#include "indep.h"
@@ -98,8 +101,7 @@ parse_tag(char **s, int internal)
{
struct parsed_tag *tag = NULL;
int tag_id;
- char *tagname = NewAtom_N(char, MAX_TAG_LEN),
- attrname[MAX_TAG_LEN];
+ char tagname[MAX_TAG_LEN], attrname[MAX_TAG_LEN];
char *p, *q;
int i, attr_id, nattr;
@@ -125,7 +127,6 @@ parse_tag(char **s, int internal)
tag = New(struct parsed_tag);
bzero(tag, sizeof(struct parsed_tag));
tag->tagid = tag_id;
- tag->tagname = tagname;
if ((nattr = TagMAP[tag_id].max_attribute) > 0) {
tag->attrid = NewAtom_N(unsigned char, nattr);
@@ -164,7 +165,7 @@ parse_tag(char **s, int internal)
while (*q && *q != '"') {
if (*q != '\n')
Strcat_char(value, *q);
- if (!tag->need_reconstruct && htmlquote_char(*q))
+ if (!tag->need_reconstruct && html_quote_char(*q))
tag->need_reconstruct = TRUE;
q++;
}
@@ -176,7 +177,7 @@ parse_tag(char **s, int internal)
while (*q && *q != '\'') {
if (*q != '\n')
Strcat_char(value, *q);
- if (!tag->need_reconstruct && htmlquote_char(*q))
+ if (!tag->need_reconstruct && html_quote_char(*q))
tag->need_reconstruct = TRUE;
q++;
}
@@ -206,7 +207,7 @@ parse_tag(char **s, int internal)
}
tag->attrid[i] = attr_id;
if (value)
- tag->value[i] = cleanup_str(value->ptr);
+ tag->value[i] = html_unquote(value->ptr);
else
tag->value[i] = NULL;
}
@@ -258,14 +259,14 @@ parsedtag2str(struct parsed_tag *tag)
int nattr = TagMAP[tag_id].max_attribute;
Str tagstr = Strnew();
Strcat_char(tagstr, '<');
- Strcat_charp(tagstr, tag->tagname);
+ Strcat_charp(tagstr, TagMAP[tag_id].name);
for (i = 0; i < nattr; i++) {
if (tag->attrid[i] != ATTR_UNKNOWN) {
Strcat_char(tagstr, ' ');
Strcat_charp(tagstr, AttrMAP[tag->attrid[i]].name);
if (tag->value[i])
Strcat(tagstr,
- Sprintf("=\"%s\"", htmlquote_str(tag->value[i])));
+ Sprintf("=\"%s\"", html_quote(tag->value[i])));
}
}
Strcat_char(tagstr, '>');
diff --git a/parsetagx.h b/parsetagx.h
@@ -8,7 +8,6 @@
struct parsed_tag {
unsigned char tagid;
- char *tagname;
unsigned char *attrid;
char **value;
unsigned char *map;
diff --git a/proto.h b/proto.h
@@ -25,15 +25,21 @@ extern void shiftl(void);
extern void shiftr(void);
extern void col1R(void);
extern void col1L(void);
+extern void setEnv(void);
+extern void pipeBuf(void);
extern void pipesh(void);
extern void readsh(void);
extern void execsh(void);
extern void ldfile(void);
extern void ldhelp(void);
extern void movL(void);
+extern void movL1(void);
extern void movD(void);
+extern void movD1(void);
extern void movU(void);
+extern void movU1(void);
extern void movR(void);
+extern void movR1(void);
extern void movLW(void);
extern void movRW(void);
extern void qquitfm(void);
@@ -50,6 +56,7 @@ extern void editScr(void);
extern void followA(void);
extern void bufferA(void);
extern void followI(void);
+extern void submitForm(void);
extern void followForm(void);
extern void topA(void);
extern void lastA(void);
@@ -57,12 +64,19 @@ extern void onA(void);
extern void nextA(void);
extern void prevA(void);
+extern void nextL(void);
+extern void nextLU(void);
+extern void nextR(void);
+extern void nextRD(void);
+extern void nextD(void);
+extern void nextU(void);
extern void backBf(void);
extern void deletePrevBuf(void);
extern void goURL(void);
extern void ldBmark(void);
extern void adBmark(void);
extern void ldOpt(void);
+extern void setOpt(void);
extern void pginfo(void);
extern void msgs(void);
extern void svA(void);
@@ -94,7 +108,7 @@ extern Buffer *loadFile(char *path);
extern Buffer *loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormList * request);
extern int is_boundary(int, int);
extern int is_blank_line(char *line, int indent);
-extern void push_render_image(Str str, int width, struct html_feed_environ *h_env);
+extern void push_render_image(Str str, int width, int limit, struct html_feed_environ *h_env);
extern void flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int force, int width);
extern void do_blankline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int indent_incr, int width);
extern void purgeline(struct html_feed_environ *h_env);
@@ -112,10 +126,8 @@ extern void process_option(void);
extern Str process_textarea(struct parsed_tag *tag, int width);
extern Str process_n_textarea(void);
extern void feed_textarea(char *str);
-#ifdef NEW_FORM
extern Str process_form(struct parsed_tag *tag);
extern Str process_n_form(void);
-#endif /* NEW_FORM */
extern int HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env);
extern void HTMLlineproc2(Buffer * buf, TextLineList * tl);
extern void HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal);
@@ -146,6 +158,8 @@ extern void doFileSave(URLFile uf, char *defstr);
extern int checkCopyFile(char *path1, char *path2);
extern int checkSaveFile(InputStream stream, char *path);
extern int checkOverWrite(char *path);
+extern int matchattr(char *p, char *attr, int len, Str *value);
+extern char *checkHeader(Buffer * buf, char *field);
extern Buffer *newBuffer(int width);
extern Buffer *nullBuffer(void);
extern void clearBuffer(Buffer * buf);
@@ -164,7 +178,6 @@ extern int writeBufferCache(Buffer *buf);
extern int readBufferCache(Buffer *buf);
extern void fmTerm(void);
extern void fmInit(void);
-extern void deleteFiles(void);
extern void displayBuffer(Buffer * buf, int mode);
extern void redrawBuffer(Buffer * buf);
extern void redrawNLine(Buffer * buf, int n);
@@ -187,11 +200,11 @@ extern void disp_message_nomouse(char *s, int redraw_current);
#else
#define disp_message_nomouse disp_message
#endif
-extern void cursorUp(Buffer * buf);
-extern void cursorDown(Buffer * buf);
+extern void cursorUp(Buffer * buf, int n);
+extern void cursorDown(Buffer * buf, int n);
extern void cursorUpDown(Buffer * buf, int n);
-extern void cursorRight(Buffer * buf);
-extern void cursorLeft(Buffer * buf);
+extern void cursorRight(Buffer * buf, int n);
+extern void cursorLeft(Buffer * buf, int n);
extern void cursorHome(Buffer * buf);
extern void arrangeCursor(Buffer * buf);
extern void arrangeLine(Buffer * buf);
@@ -246,18 +259,18 @@ extern int minimum_length(char *line);
extern int feed_table(struct table *tbl, char *line, struct table_mode *mode, int width, int internal);
extern void feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width);
extern void pushTable(struct table *, struct table *);
-extern struct form_list *newFormList(char *action, char *method, char *charset, char *enctype, char *target, struct form_list *_next);
+extern struct form_list *newFormList(char *action, char *method, char *charset, char *enctype, char *target, char *name, struct form_list *_next);
extern struct form_item_list *formList_addInput(struct form_list *fl, struct parsed_tag *tag);
extern char *form2str(FormItemList * fi);
extern int formtype(char *typestr);
-extern void form_recheck_radio(FormItemList * fi, void *data, void (*update_hook) (FormItemList *, void *));
+extern void formRecheckRadio(Anchor * a, Buffer * buf, FormItemList * form);
extern void formResetBuffer(Buffer * buf, AnchorList * formitem);
extern void formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form);
extern Str textfieldrep(Str s, int width);
extern void input_textarea(FormItemList * fi);
extern void do_internal(char *action, char *data);
extern void form_write_data(FILE * f, char *boundary, char *name, char *value);
-extern void form_write_form_file(FILE * f, char *boundary, char *name, char *file);
+extern void form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char *file);
extern void follow_map(struct parsed_tagarg *arg);
#ifdef MENU_MAP
extern char *follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int y);
@@ -265,15 +278,15 @@ extern char *follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int
extern Buffer *follow_map_panel(Buffer * buf, struct parsed_tagarg *arg);
#endif
extern Buffer *page_info_panel(Buffer * buf);
-extern struct frame_body *newFrame(struct parsed_tag *tag, ParsedURL * baseURL);
+extern struct frame_body *newFrame(struct parsed_tag *tag, Buffer *buf);
extern struct frameset *newFrameSet(struct parsed_tag *tag);
extern void addFrameSetElement(struct frameset *f, union frameset_element element);
extern void deleteFrame(struct frame_body *b);
extern void deleteFrameSet(struct frameset *f);
extern void deleteFrameSetElement(union frameset_element e);
extern struct frameset *copyFrameSet(struct frameset *of);
-extern void pushFrameTree(struct frameset_queue **fqpp, struct frameset *fs, long linenumber, short pos);
-extern struct frameset *popFrameTree(struct frameset_queue **fqpp, long *linenumber, short *pos);
+extern void pushFrameTree(struct frameset_queue **fqpp, struct frameset *fs, Buffer *buf);
+extern struct frameset *popFrameTree(struct frameset_queue **fqpp);
extern void resetFrameElement(union frameset_element *f_element, Buffer * buf, char *referer, FormList * request);
extern Buffer *renderFrame(Buffer * Cbuf, int force_reload);
extern union frameset_element *search_frame(struct frameset *fset, char *name);
@@ -361,7 +374,7 @@ extern struct mailcap *loadMailcap(char *filename);
extern struct mailcap *searchMailcap(struct mailcap *table, char *type);
extern void initMailcap();
extern struct mailcap *searchExtViewer(char *type);
-extern Str unquote_mailcap(char *qstr, char *type, char *name, int *stat);
+extern Str unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *stat);
extern char *guessContentTypeFromTable(struct table2 *table, char *filename);
extern char *guessContentType(char *filename);
extern TextList *make_domain_list(char *domain_list);
@@ -385,20 +398,24 @@ extern char *reAnchor(Buffer * buf, char *re);
#ifdef USE_NNTP
extern char *reAnchorNews(Buffer * buf, char *re);
#endif /* USE_NNTP */
+extern void addMultirowsForm(Buffer *buf, AnchorList *al);
extern Anchor *closest_next_anchor(AnchorList * a, Anchor * an, int x, int y);
extern Anchor *closest_prev_anchor(AnchorList * a, Anchor * an, int x, int y);
extern HmarkerList *putHmarker(HmarkerList * ml, int line, int pos, int seq);
extern Str decodeB(char **ww);
extern Str decodeQ(char **ww);
extern Str decodeQP(char **ww);
+extern Str decodeU(char **ww);
extern Str decodeWord(char **ow);
extern Str decodeMIME(char *orgstr);
extern Str encodeB(char *a);
extern int set_param_option(char *option);
+extern char *get_param_option(char *name);
extern void create_option_search_table();
extern void init_rc(char *config_file);
extern Buffer *load_option_panel(void);
extern void panel_set_option(struct parsed_tagarg *);
+extern void sync_with_option(void);
extern char *rcFile(char *base);
extern char *libFile(char *base);
extern char *helpFile(char *base);
@@ -411,8 +428,8 @@ extern void add_auth_cookie(char *host, char *realm, Str cookie);
extern char *last_modified(Buffer * buf);
extern Str romanNumeral(int n);
extern Str romanAlphabet(int n);
-extern Str quoteShell(char *command);
extern void mySystem(char *command, int background);
+extern char *file_to_url(char *file);
extern char *expandName(char *name);
extern Str tmpfname(int type, char *ext);
#ifdef USE_COOKIE
@@ -490,10 +507,12 @@ extern int getMenuN(MenuList * list, char *id);
extern void popupMenu(int x, int y, Menu *menu);
extern void mainMenu(int x, int y);
extern void mainMn(void);
+extern void selMn(void);
extern void optionMenu(int x, int y, char **label, int *variable, int initial, void (*func) ());
extern void initMenu(void);
#else /* not MENU */
#define mainMn nulcmd
+#define selMn selBuf
#endif /* not MENU */
#ifdef DICT
@@ -506,9 +525,17 @@ extern void dictwordat(void);
extern void reloadBuffer(Buffer * buf);
-extern char *guess_save_name(char *file);
+extern char *guess_save_name(Buffer *buf, char *file);
extern void wrapToggle(void);
extern void saveBufferInfo(void);
extern char*get_os2_dft(const char*,char*);
+
+extern void dispVer(void);
+
+#ifdef USE_INCLUDED_SRAND48
+void srand48(long);
+long lrand48(void);
+#endif
+
#include "indep.h"
diff --git a/rc.c b/rc.c
@@ -60,9 +60,11 @@ static int rc_initialized = 0;
#define CMT_SAVEHIST "URLÍúÎò¤ÎÊݸ"
#define CMT_KANJICODE "ɽ¼¨ÍÑ´Á»ú¥³¡¼¥É"
#define CMT_FRAME "¥Õ¥ì¡¼¥à¤Î¼«Æ°É½¼¨"
+#define CMT_ARGV_IS_URL "scheme ¤Î¤Ê¤¤°ú¿ô¤â URL ¤È¤ß¤Ê¤¹"
#define CMT_TSELF "target¤¬Ì¤»ØÄê¤Î¾ì¹ç¤Ë_self¤ò»ÈÍѤ¹¤ë"
#define CMT_DISPLINK "¥ê¥ó¥¯Àè¤Î¼«Æ°É½¼¨"
#define CMT_MULTICOL "¥Õ¥¡¥¤¥ë̾¤Î¥Þ¥ë¥Á¥«¥é¥àɽ¼¨"
+#define CMT_ALT_ENTITY "¥¨¥ó¥Æ¥£¥Æ¥£¤ò ASCII ¤ÎÂåÂØɽ¸½¤Çɽ¤¹"
#define CMT_COLOR "¥«¥é¡¼É½¼¨"
#define CMT_B_COLOR "ʸ»ú¤Î¿§"
#define CMT_A_COLOR "¥¢¥ó¥«¡¼¤Î¿§"
@@ -80,6 +82,7 @@ static int rc_initialized = 0;
#define CMT_FTP_PROXY "FTP¥×¥í¥¥·(URL¤ÇÆþÎÏ)"
#define CMT_NO_PROXY "¥×¥í¥¥·¤«¤é½ü³°¤¹¤ë¥É¥á¥¤¥ó"
#define CMT_NOPROXY_NETADDR "¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤Ç¥×¥í¥¥·½ü³°¤Î¥Á¥§¥Ã¥¯"
+#define CMT_NO_CACHE "Cache ¤ò»È¤ï¤Ê¤¤"
#define CMT_DNS_ORDER "̾Á°²ò·è¤Î½ç½ø"
#define CMT_DROOT "/ ¤Çɽ¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê(document root)"
#define CMT_PDROOT "/~user ¤Çɽ¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê"
@@ -97,6 +100,7 @@ static int rc_initialized = 0;
#define CMT_USERAGENT "User-Agent"
#define CMT_ACCEPTLANG "¼õ¤±¤Ä¤±¤ë¸À¸ì(Accept-Language:)"
#define CMT_DOCUMENTCODE "ʸ½ñ¤Îʸ»ú¥³¡¼¥É"
+#define CMT_SYSTEMCODE "¥·¥¹¥Æ¥à¤Îʸ»ú¥³¡¼¥É"
#define CMT_WRAP "ÀÞ¤êÊÖ¤·¸¡º÷"
#define CMT_VIEW_UNSEENOBJECTS "ÇطʲèÁüÅù¤Ø¤Î¥ê¥ó¥¯¤òºî¤ë"
#ifdef __EMX__
@@ -109,6 +113,7 @@ static int rc_initialized = 0;
#define CMT_IGNORE_NULL_IMG_ALT "¶õ¤ÎIMG ALT°À¤Î»þ¤Ë¥ê¥ó¥¯Ì¾¤òɽ¼¨¤¹¤ë"
#define CMT_IFILE "³Æ¥Ç¥£¥ì¥¯¥È¥ê¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¥Õ¥¡¥¤¥ë"
#define CMT_RETRY_HTTP "URL¤Ë¼«Æ°Åª¤Ë http:// ¤òÊ䤦"
+#define CMT_DECODE_CTE "Êݸ»þ¤Ë Content-Transfer-Encoding ¤ò¥Ç¥³¡¼¥É¤¹¤ë"
#ifdef MOUSE
#define CMT_MOUSE "¥Þ¥¦¥¹¤ò»È¤¦"
#define CMT_REVERSE_MOUSE "¥Þ¥¦¥¹¤Î¥É¥é¥Ã¥°Æ°ºî¤òµÕ¤Ë¤¹¤ë"
@@ -136,6 +141,7 @@ static int rc_initialized = 0;
#define CMT_COOKIE_ACCEPT_DOMAINS "¥¯¥Ã¥¡¼¤ò¼õ¤±ÉÕ¤±¤ë¥É¥á¥¤¥ó"
#endif
+#define CMT_FOLLOW_REDIRECTION "½¾¤¦¥ê¥À¥¤¥ì¥¯¥È¤Î²ó¿ô"
#else /* LANG != JA */
@@ -148,9 +154,11 @@ static int rc_initialized = 0;
#define CMT_SAVEHIST "Save URL history"
/* #define CMT_KANJICODE "Display Kanji Code" */
#define CMT_FRAME "Automatic rendering of frame"
+#define CMT_ARGV_IS_URL "Force argument without scheme to URL"
#define CMT_TSELF "use _self as default target"
#define CMT_DISPLINK "Automatic display of link URL"
#define CMT_MULTICOL "Multi-column output of file names"
+#define CMT_ALT_ENTITY "Use alternate expression with ASCII for entity"
#define CMT_COLOR "Display with color"
#define CMT_B_COLOR "Color of normal character"
#define CMT_A_COLOR "Color of anchor"
@@ -168,6 +176,7 @@ static int rc_initialized = 0;
#define CMT_FTP_PROXY "URL of FTP proxy host"
#define CMT_NO_PROXY "Domains for direct access (no proxy)"
#define CMT_NOPROXY_NETADDR "Check noproxy by network address"
+#define CMT_NO_CACHE "Don't use cache"
#define CMT_DNS_ORDER "Order of name resolution"
#define CMT_DROOT "Directory corresponds to / (document root)"
#define CMT_PDROOT "Directory corresponds to /~user"
@@ -185,6 +194,7 @@ static int rc_initialized = 0;
#define CMT_USERAGENT "User-Agent"
#define CMT_ACCEPTLANG "Accept-Language"
/* #define CMT_DOCUMENTCODE "Document Charset" */
+/* #define CMT_SYSTEMCODE "System Kanji Code" */
#define CMT_WRAP "Wrap search"
#define CMT_VIEW_UNSEENOBJECTS "Display unseenobjects (e.g. bgimage) tag"
#ifdef __EMX__
@@ -197,6 +207,7 @@ static int rc_initialized = 0;
#define CMT_IGNORE_NULL_IMG_ALT "Ignore IMG ALT=\"\" (display link name)"
#define CMT_IFILE "Index file for the directory"
#define CMT_RETRY_HTTP "Prepend http:// to URL automatically"
+#define CMT_DECODE_CTE "Decode Content-Transfer-Encoding when saving"
#ifdef MOUSE
#define CMT_MOUSE "Use mouse"
#define CMT_REVERSE_MOUSE "Reverse mouse dragging action"
@@ -223,6 +234,7 @@ static int rc_initialized = 0;
#define CMT_COOKIE_REJECT_DOMAINS "Domains from which should reject cookies"
#define CMT_COOKIE_ACCEPT_DOMAINS "Domains from which should accept cookies"
#endif
+#define CMT_FOLLOW_REDIRECTION "Follow this number of redirections"
#endif /* LANG != JA */
#define PI_TEXT 0
@@ -255,6 +267,13 @@ static struct sel_c dcodestr[] =
{CODE_INNER_EUC, "I", STR_INNER_EUC},
{0, NULL, NULL}
};
+
+static struct sel_c scodestr[] =
+{
+ {CODE_EUC, "E", STR_EUC},
+ {CODE_SJIS, "S", STR_SJIS},
+ {0, NULL, NULL}
+};
#endif /* JP_CHARSET */
#ifdef COLOR
@@ -313,14 +332,21 @@ struct param_ptr params1[] =
{"pixel_per_char", P_PIXELS, PI_TEXT, (void *) &pixel_per_char, CMT_PIXEL_PER_CHAR, NULL},
#ifdef JP_CHARSET
{"kanjicode", P_CODE, PI_SEL_C, (void *) &DisplayCode, CMT_KANJICODE, kcodestr},
+ {"document_code", P_CODE, PI_SEL_C, (void *) &DocumentCode, CMT_DOCUMENTCODE, dcodestr},
+ {"system_code", P_CODE, PI_SEL_C, (void *) &SystemCode, CMT_SYSTEMCODE, scodestr},
#endif /* JP_CHARSET */
- {"frame", P_CHARINT, PI_ONOFF, (void *) &RenderFrame, CMT_FRAME, NULL},
+ {"frame", P_CHARINT, PI_ONOFF, (void *) &RenderFrame, CMT_FRAME, NULL},
{"target_self", P_CHARINT, PI_ONOFF, (void *) &TargetSelf, CMT_TSELF, NULL},
{"display_link", P_INT, PI_ONOFF, (void *) &displayLink, CMT_DISPLINK, NULL},
{"ext_dirlist", P_INT, PI_ONOFF, (void *) &UseExternalDirBuffer, CMT_EXT_DIRLIST, NULL},
{"dirlist_cmd", P_STRING, PI_TEXT, (void *) &DirBufferCommand, CMT_DIRLIST_CMD, NULL},
-{"multicol", P_INT, PI_ONOFF, (void *) &multicolList, CMT_MULTICOL, NULL},
+ {"multicol", P_INT, PI_ONOFF, (void *) &multicolList, CMT_MULTICOL, NULL},
+ {"alt_entity", P_CHARINT, PI_ONOFF, (void *) &UseAltEntity, CMT_ALT_ENTITY, NULL},
{"ignore_null_img_alt", P_INT, PI_ONOFF, (void *) &ignore_null_img_alt, CMT_IGNORE_NULL_IMG_ALT, NULL},
+#ifdef VIEW_UNSEENOBJECTS
+ {"view_unseenobject", P_INT, PI_ONOFF, (void *) &view_unseenobject, CMT_VIEW_UNSEENOBJECTS, NULL},
+#endif /* VIEW_UNSEENOBJECTS */
+ {"show_lnum", P_INT, PI_ONOFF, (void *) &showLineNum, CMT_SHOW_NUM, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
@@ -346,34 +372,20 @@ struct param_ptr params2[] =
struct param_ptr params3[] =
{
- {"pagerline", P_INT, PI_TEXT, (void *) &PagerMax, CMT_PAGERLINE, NULL},
+ {"pagerline", P_INT, PI_TEXT, (void *) &PagerMax, CMT_PAGERLINE, NULL},
#ifdef USE_HISTORY
- {"history", P_INT, PI_TEXT, (void *) &URLHistSize, CMT_HISTSIZE, NULL},
-{"save_hist", P_INT, PI_ONOFF, (void *) &SaveURLHist, CMT_SAVEHIST, NULL},
+ {"history", P_INT, PI_TEXT, (void *) &URLHistSize, CMT_HISTSIZE, NULL},
+ {"save_hist", P_INT, PI_ONOFF, (void *) &SaveURLHist, CMT_SAVEHIST, NULL},
#endif /* USE_HISTORY */
{"confirm_qq", P_INT, PI_ONOFF, (void *) &confirm_on_quit, CMT_CONFIRM_QQ, NULL},
-{"show_lnum", P_INT, PI_ONOFF, (void *) &showLineNum, CMT_SHOW_NUM, NULL},
-{"ftppasswd", P_STRING, PI_TEXT, (void *) &ftppasswd, CMT_FTPPASS, NULL},
- {"user_agent", P_STRING, PI_TEXT, (void *) &UserAgent, CMT_USERAGENT, NULL},
- {"no_referer", P_INT, PI_ONOFF, (void *) &NoSendReferer, CMT_NOSENDREFERER, NULL},
- {"accept_language", P_STRING, PI_TEXT, (void *) &AcceptLang, CMT_ACCEPTLANG, NULL},
-#ifdef JP_CHARSET
- {"document_code", P_CODE, PI_SEL_C, (void *) &DocumentCode, CMT_DOCUMENTCODE, dcodestr},
-#endif
- {"wrap_search", P_INT, PI_ONOFF, (void *) &WrapDefault, CMT_WRAP, NULL},
- {"ignorecase_search", P_INT, PI_ONOFF, (void *) &IgnoreCase, CMT_IGNORE_CASE, NULL},
-#ifdef VIEW_UNSEENOBJECTS
- {"view_unseenobject", P_INT, PI_ONOFF, (void *) &view_unseenobject, CMT_VIEW_UNSEENOBJECTS, NULL},
-#endif /* VIEW_UNSEENOBJECTS */
+ {"wrap_search", P_INT, PI_ONOFF, (void *) &WrapDefault, CMT_WRAP, NULL},
+ {"ignorecase_search", P_INT, PI_ONOFF, (void *) &IgnoreCase, CMT_IGNORE_CASE, NULL},
#ifdef MOUSE
{"use_mouse", P_INT, PI_ONOFF, (void *) &use_mouse, CMT_MOUSE, NULL},
{"reverse_mouse", P_INT, PI_ONOFF, (void *) &reverse_mouse, CMT_REVERSE_MOUSE, NULL},
#endif /* MOUSE */
- {"retry_http", P_INT, PI_ONOFF, (void *) &retryAsHttp, CMT_RETRY_HTTP, NULL},
{"clear_buffer", P_INT, PI_ONOFF, (void *) &clear_buffer, CMT_CLEAR_BUF, NULL},
-#ifdef USE_SSL
- {"ssl_forbid_method", P_STRING, PI_TEXT, (void *) &ssl_forbid_method, CMT_SSL_FORBID_METHOD, NULL},
-#endif /* USE_SSL */
+ {"decode_cte", P_CHARINT, PI_ONOFF, (void *) &DecodeCTE, CMT_DECODE_CTE, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
@@ -386,9 +398,8 @@ struct param_ptr params4[] =
{"ftp_proxy", P_STRING, PI_TEXT, (void *) &FTP_proxy, CMT_FTP_PROXY, NULL},
{"no_proxy", P_STRING, PI_TEXT, (void *) &NO_proxy, CMT_NO_PROXY, NULL},
{"noproxy_netaddr", P_INT, PI_ONOFF, (void *) &NOproxy_netaddr, CMT_NOPROXY_NETADDR, NULL},
-#ifdef INET6
- {"dns_order", P_INT, PI_SEL_C, (void *) &DNS_order, CMT_DNS_ORDER, dnsorders},
-#endif /* INET6 */
+ {"no_cache", P_CHARINT, PI_ONOFF, (void *) &NoCache, CMT_NO_CACHE, NULL},
+
{NULL, 0, 0, NULL, NULL, NULL},
};
@@ -439,6 +450,23 @@ struct param_ptr params8[] =
{NULL, 0, 0, NULL, NULL, NULL},
};
#endif
+struct param_ptr params9[] =
+{
+ {"ftppasswd", P_STRING, PI_TEXT, (void *) &ftppasswd, CMT_FTPPASS, NULL},
+ {"user_agent", P_STRING, PI_TEXT, (void *) &UserAgent, CMT_USERAGENT, NULL},
+ {"no_referer", P_INT, PI_ONOFF, (void *) &NoSendReferer, CMT_NOSENDREFERER, NULL},
+ {"accept_language", P_STRING, PI_TEXT, (void *) &AcceptLang, CMT_ACCEPTLANG, NULL},
+ {"argv_is_url", P_CHARINT, PI_ONOFF, (void *) &ArgvIsURL, CMT_ARGV_IS_URL, NULL},
+ {"retry_http", P_INT, PI_ONOFF, (void *) &retryAsHttp, CMT_RETRY_HTTP, NULL},
+ {"follow_redirection", P_INT, PI_TEXT, &FollowRedirection, CMT_FOLLOW_REDIRECTION, NULL},
+#ifdef USE_SSL
+ {"ssl_forbid_method", P_STRING, PI_TEXT, (void *) &ssl_forbid_method, CMT_SSL_FORBID_METHOD, NULL},
+#endif /* USE_SSL */
+#ifdef INET6
+ {"dns_order", P_INT, PI_SEL_C, (void *) &DNS_order, CMT_DNS_ORDER, dnsorders},
+#endif /* INET6 */
+ {NULL, 0, 0, NULL, NULL, NULL},
+};
struct param_section sections[] =
{
@@ -447,17 +475,15 @@ struct param_section sections[] =
#ifdef COLOR
{"ɽ¼¨¿§", params2},
#endif /* COLOR */
- {"¤½¤Î¾¤ÎÀßÄê", params3},
- {"¥×¥í¥¥·¤ÎÀßÄê", params4},
+ {"»¨Â¿¤ÊÀßÄê", params3},
{"¥Ç¥£¥ì¥¯¥È¥êÀßÄê", params5},
{"³°Éô¥×¥í¥°¥é¥à", params6},
+ {"¥Í¥Ã¥È¥ï¡¼¥¯¤ÎÀßÄê", params9},
+ {"¥×¥í¥¥·¤ÎÀßÄê", params4},
#if defined(USE_SSL) && defined(USE_SSL_VERIFY)
{"SSLǧ¾ÚÀßÄê", params7},
#endif /* defined(USE_SSL) &&
* defined(USE_SSL_VERIFY) */
-#ifdef USE_SSL
-#define CMT_SSL_FORBID_METHOD "»È¤ï¤Ê¤¤SSL¥á¥½¥Ã¥É¤Î¥ê¥¹¥È(2: SSLv2, 3: SSLv3, t:TLSv1)"
-#endif
#ifdef USE_COOKIE
{"¥¯¥Ã¥¡¼¤ÎÀßÄê", params8},
#endif
@@ -466,17 +492,15 @@ struct param_section sections[] =
#ifdef COLOR
{"Color Setting", params2},
#endif /* COLOR */
- {"Other Behavior", params3},
- {"Proxy Setting", params4},
+ {"Miscellaneous Setting", params3},
{"Directory Setting", params5},
{"External Programs", params6},
+ {"Network Setting", params9},
+ {"Proxy Setting", params4},
#if defined(USE_SSL) && defined(USE_SSL_VERIFY)
{"SSL Verification Setting", params7},
#endif /* defined(USE_SSL) &&
* defined(USE_SSL_VERIFY) */
-#ifdef USE_SSL
-#define CMT_SSL_FORBID_METHOD N_("List of forbidden SSL method (2: SSLv2, 3: SSLv3, t:TLSv1)")
-#endif
#ifdef USE_COOKIE
{"Cookie Setting", params8},
#endif
@@ -484,6 +508,8 @@ struct param_section sections[] =
{NULL, NULL}
};
+static Str to_str(struct param_ptr *p);
+
static int
compare_table(struct rc_search_table *a, struct rc_search_table *b)
{
@@ -646,8 +672,8 @@ show_params(FILE * fp)
}
#endif
-static int
-str_to_bool(char *value)
+int
+str_to_bool(char *value, int old)
{
if (value == NULL)
return 1;
@@ -657,6 +683,18 @@ str_to_bool(char *value)
case 'n': /* no */
case 'u': /* undef */
return 0;
+ case 'o':
+ if (tolower(value[1]) == 'f') /* off */
+ return 0;
+ return 1; /* on */
+ case 't':
+ if (tolower(value[1]) == 'o') /* toggle */
+ return ! old;
+ return 1; /* true */
+ case '!':
+ case 'r': /* reverse */
+ case 'x': /* exchange */
+ return ! old;
}
return 1;
}
@@ -774,13 +812,16 @@ set_param(char *name, char *value)
return 0;
switch (p->type) {
case P_INT:
- *(int *) p->varptr = (p->inputtype == PI_ONOFF) ? str_to_bool(value) : atoi(value);
+ *(int *) p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(int *) p->varptr) : atoi(value);
break;
case P_SHORT:
- *(short *) p->varptr = (p->inputtype == PI_ONOFF) ? str_to_bool(value) : atoi(value);
+ *(short *) p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(short *) p->varptr) : atoi(value);
break;
case P_CHARINT:
- *(char *) p->varptr = (p->inputtype == PI_ONOFF) ? str_to_bool(value) : atoi(value);
+ *(char *) p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(char *) p->varptr) : atoi(value);
break;
case P_CHAR:
*(char *) p->varptr = value[0];
@@ -817,8 +858,6 @@ set_param(char *name, char *value)
return 1;
}
-static void sync_with_option(void);
-
int
set_param_option(char *option)
{
@@ -851,10 +890,18 @@ set_param_option(char *option)
goto option_assigned;
return 0;
option_assigned:
- sync_with_option();
return 1;
}
+char *
+get_param_option(char *name)
+{
+ struct param_ptr *p;
+
+ p = search_param(name);
+ return p ? to_str(p)->ptr : NULL;
+}
+
static void
interpret_rc(FILE * f)
{
@@ -995,7 +1042,7 @@ initMimeTypes()
UserMimeTypes[i] = loadMimeTypes(tl->ptr);
}
-static void
+void
sync_with_option(void)
{
WrapSearch = WrapDefault;
@@ -1071,7 +1118,7 @@ init_rc(char *config_file)
static char optionpanel_src1[] =
"<html><head><title>Option Setting Panel</title></head>\
-<body><center><b>Option Setting Panel</b></center><p>\n"
+<body><center><b>Option Setting Panel</b><br><b>(w3m version %s)</b></center><p>\n"
#ifdef __EMX__
"<a href=\"file:///$LIB/w3mhelperpanel.exe?mode=panel\">%s</a>\n"
#else /* not __EMX__ */
@@ -1112,7 +1159,7 @@ to_str(struct param_ptr *p)
Buffer *
load_option_panel(void)
{
- Str src = Sprintf(optionpanel_src1, CMT_HELPER);
+ Str src = Sprintf(optionpanel_src1, version, CMT_HELPER);
struct param_ptr *p;
struct sel_c *s;
int x, i;
@@ -1134,7 +1181,7 @@ load_option_panel(void)
Strcat_m_charp(src, "<input type=text name=",
p->name,
" value=\"",
- htmlquote_str( to_str(p)->ptr ),
+ html_quote( to_str(p)->ptr ),
"\">", NULL);
break;
case PI_ONOFF:
diff --git a/rcparams.h b/rcparams.h
@@ -1,76 +0,0 @@
-/* params1 */
-
-global int Tabstop init(8);
-#ifdef JP_CHARSET
-extern char DisplayCode;
-#endif /* JP_CHARSET */
-global char RenderFrame init(FALSE);
-global char TargetSelf init(FALSE);
-global int displayLink init(FALSE);
-global int UseExternalDirBuffer init(TRUE);
-#ifdef __EMX__
-global char *DirBufferCommand init("file:///$LIB/dirlist.cmd");
-#else
-global char *DirBufferCommand init("file:///$LIB/dirlist.cgi");
-#endif
-global int multicolList init(FALSE);
-
-/* params2 */
-#ifdef COLOR
-global int useColor init(TRUE);
-global int basic_color init(8); /* don't change */
-global int anchor_color init(4); /* blue */
-global int image_color init(2); /* green */
-global int form_color init(1); /* red */
-#ifdef BG_COLOR
-global int bg_color init(8); /* don't change */
-#endif /* BG_COLOR */
-global int useActiveColor init(FALSE);
-global int active_color init(6); /* cyan */
-global int useVisitedColor init(FALSE);
-global int visited_color init(5); /* magenta */
-#endif /* COLOR */
-
-/* params3 */
-
-global int PagerMax init(PAGER_MAX_LINE);
-#ifdef USE_HISTORY
-global int URLHistSize init(100);
-global int SaveURLHist init(TRUE);
-#endif /* USE_HISTORY */
-global int confirm_on_quit init(TRUE);
-global int showLineNum init(FALSE);
-global char *ftppasswd init(NULL);
-global char *UserAgent init(NULL);
-global char *AcceptLang init(NULL);
-global int WrapDefault init(FALSE);
-#ifdef USE_COOKIE
-global int use_cookie init(TRUE);
-global int accept_bad_cookie init(FALSE);
-#endif /* USE_COOKIE */
-
-/* params4 */
-
-global char *HTTP_proxy init(NULL);
-global char *GOPHER_proxy init(NULL);
-global char *FTP_proxy init(NULL);
-global int NOproxy_netaddr init(TRUE);
-global char *NO_proxy init(NULL);
-#ifdef INET6
-global int DNS_order init(0);
-#endif /* INET6 */
-
-/* params5 */
-
-global char *document_root init(NULL);
-global char *personal_document_root init(NULL);
-global char *cgi_bin init(NULL);
-
-/* params6 */
-
-global char *Editor init(DEF_EDITOR);
-global char *Mailer init(DEF_MAILER);
-global char *ExtBrowser init(DEF_EXT_BROWSER);
-global char *ExtBrowser2 init(NULL);
-global char *ExtBrowser3 init(NULL);
-global int BackgroundExtViewer init(TRUE);
diff --git a/scripts/bm2menu.pl b/scripts/bm2menu.pl
@@ -1,54 +0,0 @@
-#!/usr/bin/perl
-
-$PRE_MENU = "";
-$POST_MENU = <<EOF;
- nop "¨¡¨¡¨¡¨¡¨¡¨¡¨¡¨¡¨¡¨¡¨¡"
- func "¥Ö¥Ã¥¯¥Þ¡¼¥¯¤ËÄɲà (a)" ADD_BOOKMARK "aA"
-EOF
-
-@section = ();
-%title = ();
-%url = ();
-while(<>) {
- if (/<h2>(.*)<\/h2>/) {
- $s = &unquote($1);
- push(@section, $s);
- } elsif (/<li><a href=\"(.*)\">(.*)<\/a>/) {
- $u = &unquote($1);
- $t = &unquote($2);
- $url{$s} .= "$u\n";
- $title{$s} .= "$t\n";
- }
-}
-
-print "menu Bookmarks\n";
-print $PRE_MENU;
-foreach(@section) {
- print " popup\t\"$_\"\t\"$_\"\n";
-}
-print $POST_MENU;
-print "end\n";
-
-foreach(@section) {
- print "\n";
- print "menu \"$_\"\n";
- @ts = split("\n", $title{$_});
- @us = split("\n", $url{$_});
- while(@ts) {
- $t = shift @ts;
- $u = shift @us;
- print " func\t\"$t\"\tGOTO\t\"\"\t\"$u\"\n";
- }
- print "end\n";
-}
-
-sub unquote {
- local($_) = @_;
-
- s/\</\</g;
- s/\>/\>/g;
- s/\ / /g;
- s/\&/\&/g;
-
- return $_;
-}
diff --git a/scripts/dirlist.cgi b/scripts/dirlist.cgi
@@ -3,13 +3,27 @@
# Directory list CGI by Hironori Sakamoto (hsaka@mth.biglobe.ne.jp)
#
-$CYGWIN = 0;
+if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) {
+ $WIN32 = 1;
+ $CYGPATH = 1;
+}
+elsif ( $^O =~ /cygwin|os2/i ) {
+ $WIN32 = 1;
+ $CYGPATH = 0;
+}
+else {
+ $WIN32 = 0;
+ $CYGPATH = 0;
+}
$RC_DIR = '~/.w3m/';
$RC_DIR =~ s@^~/@$ENV{'HOME'}/@;
+if ($CYGPATH) {
+ $RC_DIR = &cygwin_pathconv("$RC_DIR");
+}
$CONFIG = "$RC_DIR/dirlist";
$CGI = $ENV{'SCRIPT_NAME'} || $0;
-$CGI = &html_quote(&form_encode("file:$CGI"));
+$CGI = "file://" . &file_encode("$CGI");
$AFMT = '<a href="%s"><nobr>%s</nobr></a>';
$NOW = time();
@@ -39,7 +53,7 @@ if ($query eq '') {
} else {
$dir = $query;
if (($dir !~ m@^/@) &&
- ($CYGWIN && $dir !~ /^[a-z]:/i)) {
+ ($WIN32 && $dir !~ /^[a-z]:/i)) {
$_ = `pwd`;
chop;
s/\r$//;
@@ -50,11 +64,17 @@ if ($query eq '') {
if ($dir !~ m@/$@) {
$dir .= '/';
}
+if ($dir =~ m@^/@ && $CYGPATH) {
+ $dir = &cygwin_pathconv("$dir");
+}
$ROOT = '';
-if ($CYGWIN) {
+if ($WIN32) {
if (($dir =~ s@^//[^/]+@@) || ($dir =~ s@^[a-z]:@@i)) {
$ROOT = $&;
}
+ if ($CYGPATH) {
+ $ROOT = &cygwin_pathconv("$ROOT");
+ }
}
if ($cgi) {
$dir = &cleanup($dir);
@@ -67,8 +87,8 @@ if ($cmd) {
&update_option($CONFIG);
}
-$qdir = &html_quote("$ROOT$dir");
-$edir = &html_quote(&form_encode("$ROOT$dir"));
+$qdir = "$ROOT" . &html_quote("$dir");
+$edir = "$ROOT" . &file_encode("$dir");
if (! opendir(DIR, "$ROOT$dir")) {
print <<EOF;
Content-Type: text/html
@@ -98,7 +118,7 @@ Content-Type: text/html
<body>
<h1>Directory list of $qdir</h1>
EOF
-&print_form($qdir, @OPT);
+&print_form($edir, @OPT);
print <<EOF;
<hr>
EOF
@@ -114,14 +134,14 @@ if ($TYPE eq $TYPE_TREE) {
<tr valign=top><td width="160">
<pre>
EOF
- $q = &html_quote("$ROOT$_");
- $e = &html_quote(&form_encode("$ROOT$_"));
+ $q = "$ROOT". &html_quote("$_");
+ $e = "$ROOT" . &file_encode("$_");
if ($dir =~ m@^$@) {
$n = "\" name=\"current";
} else {
$n = '';
}
- printf("$AFMT\n", "$q$n", "<b>$q</b>");
+ printf("$AFMT\n", "$e$n", "<b>$q</b>");
$N = 0;
$SKIPLINE = "";
@@ -163,23 +183,23 @@ sub left_dir {
local($_, $dir0, $d, $qdir, $q, $edir, $e);
$dir0 = "$dir/";
- $dir = "$ROOT$dir0";
- opendir(DIR, $dir) || return;
+ $dir = "$dir0";
+ opendir(DIR, "$ROOT$dir") || return;
foreach(sort readdir(DIR)) {
- -d "$dir$_" || next;
+ -d "$ROOT$dir$_" || next;
/^\.$/ && next;
/^\.\.$/ && next;
push(@cdirs, $_);
}
closedir(DIR);
- $qdir = &html_quote($dir);
- $edir = &html_quote(&form_encode($dir));
+ $qdir = "$ROOT" . &html_quote($dir);
+ $edir = "$ROOT" . &file_encode($dir);
while(@cdirs) {
$_ = shift @cdirs;
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
$N++;
if (!$ok && $_ eq $sdirs[0]) {
$d = $dir0 . shift @sdirs;
@@ -189,11 +209,11 @@ sub left_dir {
} else {
$n = '';
}
- printf("${pre}o-$AFMT\n", "$qdir$q$n", "<b>$q</b>");
+ printf("${pre}o-$AFMT\n", "$edir$e$n", "<b>$q</b>");
&left_dir(@cdirs ? "$pre| " : "$pre ", $d, @sdirs);
$ok = 1;
} else {
- printf("${pre}+-$AFMT\n", "$qdir$q", $q);
+ printf("${pre}+-$AFMT\n", "$edir$e", $q);
}
}
}
@@ -206,11 +226,11 @@ sub right_dir {
$atime,$mtime,$ctime,$blksize,$blocks);
local(%sizes, %ctimes, %prints);
- $dir = "$ROOT$dir/";
- opendir(DIR, $dir) || return;
+ $dir = "$dir/";
+ opendir(DIR, "$ROOT$dir") || return;
- $qdir = &html_quote($dir);
- $edir = &html_quote(&form_encode($dir));
+ $qdir = "$ROOT" . &html_quote($dir);
+ $edir = "$ROOT" . &file_encode($dir);
if ($TYPE eq $TYPE_TREE) {
print "<b>$qdir</b>\n";
}
@@ -221,7 +241,7 @@ sub right_dir {
# if ($TYPE eq $TYPE_TREE) {
# /^\.\.$/ && next;
# }
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
(($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = lstat($f)) || next;
push(@list, $_);
@@ -272,16 +292,16 @@ sub right_dir {
$n = 0;
print "<table>\n<tr valign=top>";
foreach(@list) {
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
if ($n % $nr == 0) {
print "<td>";
}
if (-d $f) {
- printf($AFMT, "$qdir$q", "$q/");
+ printf($AFMT, "$edir$e", "$q/");
} else {
- printf($AFMT, "$qdir$q", $q);
+ printf($AFMT, "$edir$e", $q);
}
$n++;
if ($n % $nr == 0) {
@@ -294,14 +314,14 @@ sub right_dir {
return;
}
foreach(@list) {
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
print $prints{$_};
if (-d $f) {
- printf($AFMT, "$qdir$q", "$q/");
+ printf($AFMT, "$edir$e", "$q/");
} else {
- printf($AFMT, "$qdir$q", $q);
+ printf($AFMT, "$edir$e", $q);
}
if (-l $f) {
print " -> ", &html_quote(readlink($f));
@@ -316,15 +336,15 @@ sub init_option {
$OPT_FORMAT = 1;
$OPT_SORT = 2;
$TYPE_TREE = 't';
- $TYPE_STARDRD = 'd';
+ $TYPE_STANDARD = 'd';
$FORMAT_SHORT = 's';
- $FORMAT_STANDRAD = 'd';
+ $FORMAT_STANDARD = 'd';
$FORMAT_LONG = 'l';
$FORMAT_COLUMN = 'c';
$SORT_NAME = 'n';
$SORT_SIZE = 's';
$SORT_TIME = 't';
- local(@opt) = ($TYPE_TREE, $FORMAT_STANDRAD, $SORT_NAME);
+ local(@opt) = ($TYPE_TREE, $FORMAT_STANDARD, $SORT_NAME);
local($_);
open(CONFIG, "< $config") || return @opt;
@@ -416,17 +436,16 @@ sub html_quote {
s/[<>&"]/$QUOTE{$&}/g;
return $_;
}
-sub form_encode {
+sub file_encode {
local($_) = @_;
- s/[\t\r\n%#&=+]/sprintf('%%%2x', unpack('c', $&))/eg;
- s/ /+/g;
+ s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg;
return $_;
}
sub form_decode {
local($_) = @_;
s/\+/ /g;
- s/%([\da-f][\da-f])/pack('c', hex($1))/egi;
+ s/%([\da-f][\da-f])/pack('C', hex($1))/egi;
return $_;
}
@@ -499,3 +518,15 @@ sub utime {
}
}
+sub cygwin_pathconv {
+ local($_) = @_;
+ local(*CYGPATH);
+
+ open(CYGPATH, '-|') or exec('cygpath', '-w', $_);
+ $_ = <CYGPATH>;
+ close(CYGPATH);
+ s/\r?\n$//;
+ s!\\!/!g;
+ s!/$!!;
+ return $_;
+}
diff --git a/scripts/dirlist.in b/scripts/dirlist.in
@@ -3,13 +3,27 @@
# Directory list CGI by Hironori Sakamoto (hsaka@mth.biglobe.ne.jp)
#
-$CYGWIN = @CYGWIN@;
+if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) {
+ $WIN32 = 1;
+ $CYGPATH = 1;
+}
+elsif ( $^O =~ /cygwin|os2/i ) {
+ $WIN32 = 1;
+ $CYGPATH = 0;
+}
+else {
+ $WIN32 = 0;
+ $CYGPATH = 0;
+}
$RC_DIR = '~/.w3m/';
$RC_DIR =~ s@^~/@$ENV{'HOME'}/@;
+if ($CYGPATH) {
+ $RC_DIR = &cygwin_pathconv("$RC_DIR");
+}
$CONFIG = "$RC_DIR/dirlist";
$CGI = $ENV{'SCRIPT_NAME'} || $0;
-$CGI = &html_quote(&form_encode("file:$CGI"));
+$CGI = "file://" . &file_encode("$CGI");
$AFMT = '<a href="%s"><nobr>%s</nobr></a>';
$NOW = time();
@@ -39,7 +53,7 @@ if ($query eq '') {
} else {
$dir = $query;
if (($dir !~ m@^/@) &&
- ($CYGWIN && $dir !~ /^[a-z]:/i)) {
+ ($WIN32 && $dir !~ /^[a-z]:/i)) {
$_ = `pwd`;
chop;
s/\r$//;
@@ -50,11 +64,17 @@ if ($query eq '') {
if ($dir !~ m@/$@) {
$dir .= '/';
}
+if ($dir =~ m@^/@ && $CYGPATH) {
+ $dir = &cygwin_pathconv("$dir");
+}
$ROOT = '';
-if ($CYGWIN) {
+if ($WIN32) {
if (($dir =~ s@^//[^/]+@@) || ($dir =~ s@^[a-z]:@@i)) {
$ROOT = $&;
}
+ if ($CYGPATH) {
+ $ROOT = &cygwin_pathconv("$ROOT");
+ }
}
if ($cgi) {
$dir = &cleanup($dir);
@@ -67,8 +87,8 @@ if ($cmd) {
&update_option($CONFIG);
}
-$qdir = &html_quote("$ROOT$dir");
-$edir = &html_quote(&form_encode("$ROOT$dir"));
+$qdir = "$ROOT" . &html_quote("$dir");
+$edir = "$ROOT" . &file_encode("$dir");
if (! opendir(DIR, "$ROOT$dir")) {
print <<EOF;
Content-Type: text/html
@@ -98,7 +118,7 @@ Content-Type: text/html
<body>
<h1>Directory list of $qdir</h1>
EOF
-&print_form($qdir, @OPT);
+&print_form($edir, @OPT);
print <<EOF;
<hr>
EOF
@@ -114,14 +134,14 @@ if ($TYPE eq $TYPE_TREE) {
<tr valign=top><td width="160">
<pre>
EOF
- $q = &html_quote("$ROOT$_");
- $e = &html_quote(&form_encode("$ROOT$_"));
+ $q = "$ROOT". &html_quote("$_");
+ $e = "$ROOT" . &file_encode("$_");
if ($dir =~ m@^$@) {
$n = "\" name=\"current";
} else {
$n = '';
}
- printf("$AFMT\n", "$q$n", "<b>$q</b>");
+ printf("$AFMT\n", "$e$n", "<b>$q</b>");
$N = 0;
$SKIPLINE = "";
@@ -163,23 +183,23 @@ sub left_dir {
local($_, $dir0, $d, $qdir, $q, $edir, $e);
$dir0 = "$dir/";
- $dir = "$ROOT$dir0";
- opendir(DIR, $dir) || return;
+ $dir = "$dir0";
+ opendir(DIR, "$ROOT$dir") || return;
foreach(sort readdir(DIR)) {
- -d "$dir$_" || next;
+ -d "$ROOT$dir$_" || next;
/^\.$/ && next;
/^\.\.$/ && next;
push(@cdirs, $_);
}
closedir(DIR);
- $qdir = &html_quote($dir);
- $edir = &html_quote(&form_encode($dir));
+ $qdir = "$ROOT" . &html_quote($dir);
+ $edir = "$ROOT" . &file_encode($dir);
while(@cdirs) {
$_ = shift @cdirs;
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
$N++;
if (!$ok && $_ eq $sdirs[0]) {
$d = $dir0 . shift @sdirs;
@@ -189,11 +209,11 @@ sub left_dir {
} else {
$n = '';
}
- printf("${pre}o-$AFMT\n", "$qdir$q$n", "<b>$q</b>");
+ printf("${pre}o-$AFMT\n", "$edir$e$n", "<b>$q</b>");
&left_dir(@cdirs ? "$pre| " : "$pre ", $d, @sdirs);
$ok = 1;
} else {
- printf("${pre}+-$AFMT\n", "$qdir$q", $q);
+ printf("${pre}+-$AFMT\n", "$edir$e", $q);
}
}
}
@@ -206,11 +226,11 @@ sub right_dir {
$atime,$mtime,$ctime,$blksize,$blocks);
local(%sizes, %ctimes, %prints);
- $dir = "$ROOT$dir/";
- opendir(DIR, $dir) || return;
+ $dir = "$dir/";
+ opendir(DIR, "$ROOT$dir") || return;
- $qdir = &html_quote($dir);
- $edir = &html_quote(&form_encode($dir));
+ $qdir = "$ROOT" . &html_quote($dir);
+ $edir = "$ROOT" . &file_encode($dir);
if ($TYPE eq $TYPE_TREE) {
print "<b>$qdir</b>\n";
}
@@ -221,7 +241,7 @@ sub right_dir {
# if ($TYPE eq $TYPE_TREE) {
# /^\.\.$/ && next;
# }
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
(($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = lstat($f)) || next;
push(@list, $_);
@@ -272,16 +292,16 @@ sub right_dir {
$n = 0;
print "<table>\n<tr valign=top>";
foreach(@list) {
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
if ($n % $nr == 0) {
print "<td>";
}
if (-d $f) {
- printf($AFMT, "$qdir$q", "$q/");
+ printf($AFMT, "$edir$e", "$q/");
} else {
- printf($AFMT, "$qdir$q", $q);
+ printf($AFMT, "$edir$e", $q);
}
$n++;
if ($n % $nr == 0) {
@@ -294,14 +314,14 @@ sub right_dir {
return;
}
foreach(@list) {
- $f = "$dir$_";
+ $f = "$ROOT$dir$_";
$q = &html_quote($_);
- $e = &html_quote(&form_encode($_));
+ $e = &file_encode($_);
print $prints{$_};
if (-d $f) {
- printf($AFMT, "$qdir$q", "$q/");
+ printf($AFMT, "$edir$e", "$q/");
} else {
- printf($AFMT, "$qdir$q", $q);
+ printf($AFMT, "$edir$e", $q);
}
if (-l $f) {
print " -> ", &html_quote(readlink($f));
@@ -316,15 +336,15 @@ sub init_option {
$OPT_FORMAT = 1;
$OPT_SORT = 2;
$TYPE_TREE = 't';
- $TYPE_STARDRD = 'd';
+ $TYPE_STANDARD = 'd';
$FORMAT_SHORT = 's';
- $FORMAT_STANDRAD = 'd';
+ $FORMAT_STANDARD = 'd';
$FORMAT_LONG = 'l';
$FORMAT_COLUMN = 'c';
$SORT_NAME = 'n';
$SORT_SIZE = 's';
$SORT_TIME = 't';
- local(@opt) = ($TYPE_TREE, $FORMAT_STANDRAD, $SORT_NAME);
+ local(@opt) = ($TYPE_TREE, $FORMAT_STANDARD, $SORT_NAME);
local($_);
open(CONFIG, "< $config") || return @opt;
@@ -416,17 +436,16 @@ sub html_quote {
s/[<>&"]/$QUOTE{$&}/g;
return $_;
}
-sub form_encode {
+sub file_encode {
local($_) = @_;
- s/[\t\r\n%#&=+]/sprintf('%%%2x', unpack('c', $&))/eg;
- s/ /+/g;
+ s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg;
return $_;
}
sub form_decode {
local($_) = @_;
s/\+/ /g;
- s/%([\da-f][\da-f])/pack('c', hex($1))/egi;
+ s/%([\da-f][\da-f])/pack('C', hex($1))/egi;
return $_;
}
@@ -499,3 +518,15 @@ sub utime {
}
}
+sub cygwin_pathconv {
+ local($_) = @_;
+ local(*CYGPATH);
+
+ open(CYGPATH, '-|') or exec('cygpath', '-w', $_);
+ $_ = <CYGPATH>;
+ close(CYGPATH);
+ s/\r?\n$//;
+ s!\\!/!g;
+ s!/$!!;
+ return $_;
+}
diff --git a/table.c b/table.c
@@ -25,32 +25,32 @@ static char *ruleB[] =
#define HORIZONTALBAR "¨¬"
#define RULE_WIDTH 2
#else /* not KANJI_SYMBOLS */
+char alt_rule[] = {
+'+', '|', '-', '+', '|', '|', '+', ' ', '-', '+', '-', ' ', '+', ' ', ' ', ' '};
#if defined(__EMX__)&&!defined(JP_CHARSET)
extern int CodePage;
static char *_rule[] =
#else
-char alt_rule[] = {
-'+', '|', '-', '+', '|', '|', '+', ' ', '-', '+', '-', ' ', '+', ' ', ' ', ' '};
static char *rule[] =
#endif
{
- "<_RULE>\200</_RULE>",
- "<_RULE>\201</_RULE>",
- "<_RULE>\202</_RULE>",
- "<_RULE>\203</_RULE>",
- "<_RULE>\204</_RULE>",
- "<_RULE>\205</_RULE>",
- "<_RULE>\206</_RULE>",
- "<_RULE>\207</_RULE>",
- "<_RULE>\210</_RULE>",
- "<_RULE>\211</_RULE>",
- "<_RULE>\212</_RULE>",
- "<_RULE>\213</_RULE>",
- "<_RULE>\214</_RULE>",
- "<_RULE>\215</_RULE>",
- "<_RULE>\216</_RULE>",
- "<_RULE>\217</_RULE>"
+ "<_RULE TYPE=0>+</_RULE>",
+ "<_RULE TYPE=1>|</_RULE>",
+ "<_RULE TYPE=2>-</_RULE>",
+ "<_RULE TYPE=3>+</_RULE>",
+ "<_RULE TYPE=4>|</_RULE>",
+ "<_RULE TYPE=5>|</_RULE>",
+ "<_RULE TYPE=6>+</_RULE>",
+ "<_RULE TYPE=7> </_RULE>",
+ "<_RULE TYPE=8>-</_RULE>",
+ "<_RULE TYPE=9>+</_RULE>",
+ "<_RULE TYPE=10>-</_RULE>",
+ "<_RULE TYPE=11> </_RULE>",
+ "<_RULE TYPE=12>+</_RULE>",
+ "<_RULE TYPE=13> </_RULE>",
+ "<_RULE TYPE=14> </_RULE>",
+ "<_RULE TYPE=15> </_RULE>"
};
#if defined(__EMX__)&&!defined(JP_CHARSET)
static char **ruleB = _rule, **rule = _rule;
@@ -64,7 +64,7 @@ static char *ruleB850[] = {
static char **ruleB = rule;
#endif /* not __EMX__ or JP_CHARSET */
-#define TN_VERTICALBAR "<_RULE>\205</_RULE>"
+#define TN_VERTICALBAR "<_RULE TYPE=5>|</_RULE>"
#define RULE_WIDTH 1
#endif /* not KANJI_SYMBOLS */
@@ -386,7 +386,7 @@ check_row(struct table *t, int row)
r = max(t->max_rowsize * 2, row + 1);
tabdata = New_N(GeneralList **, r);
tabattr = New_N(table_attr *, r);
- tabheight = New_N(short, r);
+ tabheight = NewAtom_N(short, r);
#ifdef ID_EXT
tabidvalue = New_N(Str *, r);
tridvalue = New_N(Str, r);
@@ -461,7 +461,7 @@ int visible_length_offset = 0;
int
visible_length(char *str)
{
- int len = 0;
+ int len = 0, max_len = 0;
int status = R_ST_NORMAL;
int prev_status = status;
Str tagbuf = Strnew();
@@ -508,6 +508,12 @@ visible_length(char *str)
len++;
} while ((visible_length_offset + len) % Tabstop != 0);
}
+ else if (*str == '\n' || *str == '\r') {
+ if (len > max_len) max_len = len;
+ len = 0;
+ }
+ else if (*str == '\n' || *str == '\r')
+ len = 0;
str++;
}
if (status == R_ST_AMP) {
@@ -518,7 +524,7 @@ visible_length(char *str)
len += strlen(r2);
}
}
- return len;
+ return len > max_len ? len : max_len;
}
int
@@ -1508,20 +1514,21 @@ check_table_height(struct table *t)
cell.rowspan[idx] == rowspan)
c = idx;
}
- if (c > cell.maxcell && c < MAXCELL) {
- cell.maxcell++;
- cell.row[cell.maxcell] = j;
- cell.rowspan[cell.maxcell] = rowspan;
- cell.height[cell.maxcell] = 0;
- if (cell.maxcell > k)
- bcopy(cell.index + k, cell.index + k + 1, cell.maxcell - k);
- cell.index[k] = cell.maxcell;
- }
- if (c <= cell.maxcell && c >= 0 &&
- cell.height[c] < t_dep) {
- cell.height[c] = t_dep;
- continue;
+ if (c < MAXCELL) {
+ if (c > cell.maxcell) {
+ cell.maxcell++;
+ cell.row[cell.maxcell] = j;
+ cell.rowspan[cell.maxcell] = rowspan;
+ cell.height[cell.maxcell] = 0;
+ if (cell.maxcell > k)
+ bcopy(cell.index + k, cell.index + k + 1, cell.maxcell - k);
+ cell.index[k] = cell.maxcell;
+ }
+
+ if (cell.height[c] < t_dep)
+ cell.height[c] = t_dep;
}
+ continue;
}
if (t->tabheight[j] < t_dep)
t->tabheight[j] = t_dep;
@@ -1639,33 +1646,29 @@ make_caption(struct table *t, struct html_feed_environ *h_env)
struct html_feed_environ henv;
struct readbuffer obuf;
struct environment envs[MAX_ENV_LEVEL];
- TextLineList *tl;
- Str tmp;
+ int limit;
if (t->caption->length <= 0)
return;
- if (t->total_width <= 0)
- t->total_width = h_env->limit;
-
+ if (t->total_width > 0)
+ limit = t->total_width;
+ else
+ limit = h_env->limit;
init_henv(&henv, &obuf, envs, MAX_ENV_LEVEL, newTextLineList(),
- t->total_width, h_env->envs[h_env->envc].indent);
+ limit, h_env->envs[h_env->envc].indent);
HTMLlineproc1("<center>", &henv);
HTMLlineproc0(t->caption->ptr, &henv, FALSE);
HTMLlineproc1("</center>", &henv);
- tl = henv.buf;
-
- if (tl->nitem > 0) {
- TextLineListItem *ti;
- tmp = Strnew_charp("<pre for_table>");
- for (ti = tl->first; ti != NULL; ti = ti->next) {
- Strcat(tmp, ti->ptr->line);
- Strcat_char(tmp, '\n');
- }
- Strcat_charp(tmp, "</pre>");
- HTMLlineproc1(tmp->ptr, h_env);
- }
+ if (t->total_width < henv.maxlimit)
+ t->total_width = henv.maxlimit;
+ limit = h_env->limit;
+ h_env->limit = t->total_width;
+ HTMLlineproc1("<center>", h_env);
+ HTMLlineproc0(t->caption->ptr, h_env, FALSE);
+ HTMLlineproc1("</center>", h_env);
+ h_env->limit = limit;
}
void
@@ -1674,7 +1677,7 @@ renderTable(struct table *t,
struct html_feed_environ *h_env)
{
int i, j, w, r, h;
- Str renderbuf = Strnew();
+ Str renderbuf;
short new_tabwidth[MAXCOL];
#ifdef MATRIX
int itr;
@@ -1682,6 +1685,7 @@ renderTable(struct table *t,
MAT *mat, *minv;
PERM *pivot;
#endif /* MATRIX */
+ int width;
int rulewidth;
Str vrulea, vruleb, vrulec;
#ifdef ID_EXT
@@ -1830,12 +1834,14 @@ renderTable(struct table *t,
}
/* table output */
+ width = t->total_width;
+
make_caption(t, h_env);
HTMLlineproc1("<pre for_table>", h_env);
#ifdef ID_EXT
if (t->id != NULL) {
- idtag = Sprintf("<_id id=\"%s\">", htmlquote_str((t->id)->ptr));
+ idtag = Sprintf("<_id id=\"%s\">", html_quote((t->id)->ptr));
HTMLlineproc1(idtag->ptr, h_env);
}
#endif /* ID_EXT */
@@ -1844,7 +1850,7 @@ renderTable(struct table *t,
case BORDER_THICK:
renderbuf = Strnew();
print_sep(t, -1, T_TOP, t->maxcol, renderbuf);
- push_render_image(renderbuf, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
t->total_height += 1;
break;
}
@@ -1883,7 +1889,7 @@ renderTable(struct table *t,
#ifdef ID_EXT
if (t->tridvalue[r] != NULL && h == 0) {
idtag = Sprintf("<_id id=\"%s\">",
- htmlquote_str((t->tridvalue[r])->ptr));
+ html_quote((t->tridvalue[r])->ptr));
Strcat(renderbuf, idtag);
}
#endif /* ID_EXT */
@@ -1892,7 +1898,7 @@ renderTable(struct table *t,
#ifdef ID_EXT
if (t->tabidvalue[r][i] != NULL && h == 0) {
idtag = Sprintf("<_id id=\"%s\">",
- htmlquote_str((t->tabidvalue[r][i])->ptr));
+ html_quote((t->tabidvalue[r][i])->ptr));
Strcat(renderbuf, idtag);
}
#endif /* ID_EXT */
@@ -1921,12 +1927,12 @@ renderTable(struct table *t,
t->total_height += 1;
break;
}
- push_render_image(renderbuf, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
}
if (r < t->maxrow && t->border_mode != BORDER_NONE) {
renderbuf = Strnew();
print_sep(t, r, T_MIDDLE, t->maxcol, renderbuf);
- push_render_image(renderbuf, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
}
t->total_height += t->tabheight[r];
}
@@ -1935,7 +1941,7 @@ renderTable(struct table *t,
case BORDER_THICK:
renderbuf = Strnew();
print_sep(t, t->maxrow, T_BOTTOM, t->maxcol, renderbuf);
- push_render_image(renderbuf, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
t->total_height += 1;
break;
}
@@ -1943,7 +1949,7 @@ renderTable(struct table *t,
renderbuf = Strnew(" ");
t->total_height++;
t->total_width = 1;
- push_render_image(renderbuf, t->total_width, h_env);
+ push_render_image(renderbuf, 1, t->total_width, h_env);
}
HTMLlineproc1("</pre>", h_env);
}
@@ -2244,10 +2250,10 @@ skip_space(struct table *t, char *line, struct table_linfo *linfo,
else {
if (c == '&') {
ec = getescapechar(&line);
- if (ec) {
+ if (ec >= 0) {
c = ec;
ctype = IS_CNTRL(ec) ? PC_CTRL : PC_ASCII;
- len = strlen(conv_latin1(ec));
+ len = strlen(conv_entity(ec));
wlen = line - save;
}
}
@@ -2411,6 +2417,19 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
cmd = tag->tagid;
+ if (mode->pre_mode & TBLM_IGNORE) {
+ switch (cmd) {
+ case HTML_N_STYLE:
+ mode->pre_mode &= ~TBLM_STYLE;
+ return TAG_ACTION_NONE;
+ case HTML_N_SCRIPT:
+ mode->pre_mode &= ~TBLM_SCRIPT;
+ return TAG_ACTION_NONE;
+ default:
+ return TAG_ACTION_NONE;
+ }
+ }
+
switch (cmd) {
CASE_TABLE_TAG:
if (mode->caption)
@@ -2433,17 +2452,6 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
}
}
- if (mode->pre_mode & TBLM_IGNORE) {
- switch (cmd) {
- case HTML_N_STYLE:
- mode->pre_mode &= ~TBLM_STYLE;
- case HTML_N_SCRIPT:
- mode->pre_mode &= ~TBLM_SCRIPT;
- default:
- return TAG_ACTION_NONE;
- }
- }
-
/* failsafe: a tag other than <option></option>and </select> in *
* <select> environment is regarded as the end of <select>. */
if (mode->pre_mode & TBLM_INSELECT && cmd == HTML_N_FORM) {
@@ -2720,6 +2728,7 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
case HTML_N_LISTING:
case HTML_XMP:
case HTML_N_XMP:
+ case HTML_PLAINTEXT:
feed_table_block_tag(tbl, line, mode, 0, cmd);
switch (cmd) {
case HTML_PRE:
@@ -2740,6 +2749,9 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
case HTML_N_XMP:
mode->pre_mode &= ~TBLM_XMP;
break;
+ case HTML_PLAINTEXT:
+ mode->pre_mode |= TBLM_PLAINTEXT;
+ break;
}
break;
case HTML_DL:
@@ -2793,28 +2805,12 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
tok = process_img(tag);
feed_table1(tbl, tok, mode, width);
break;
-#ifdef NEW_FORM
case HTML_FORM:
process_form(tag);
break;
case HTML_N_FORM:
process_n_form();
break;
-#else /* not NEW_FORM */
- case HTML_FORM:
- case HTML_N_FORM:
- feed_table_block_tag(tbl, "<br>", mode, 0, HTML_BR);
- if (line[1] == '/') {
- tok = Strnew_charp("</form_int ");
- Strcat_charp(tok, line + 6);
- }
- else {
- tok = Strnew_charp("<form_int ");
- Strcat_charp(tok, line + 5);
- }
- pushdata(tbl, tbl->row, tbl->col, tok->ptr);
- break;
-#endif /* not NEW_FORM */
case HTML_INPUT:
tmp = process_input(tag);
feed_table1(tbl, tmp, mode, width);
@@ -3018,15 +3014,30 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode,
else {
int ec;
q = p;
- ec = getescapechar(&p);
- r = conv_latin1(ec);
- if (r != NULL && strlen(r) == 1 &&
- ec == (unsigned char)*r) {
- Strcat_char(tmp, *r);
- }
- else {
- Strcat_char(tmp, *q);
- p = q + 1;
+ switch (ec = getescapechar(&p)) {
+ case '<':
+ Strcat_charp(tmp, "<");
+ break;
+ case '>':
+ Strcat_charp(tmp, ">");
+ break;
+ case '&':
+ Strcat_charp(tmp, "&");
+ break;
+ case '\r':
+ Strcat_char(tmp, '\n');
+ break;
+ default:
+ r = conv_entity(ec);
+ if (r != NULL && strlen(r) == 1 &&
+ ec == (unsigned char)*r) {
+ Strcat_char(tmp, *r);
+ break;
+ }
+ case -1:
+ Strcat_char(tmp, *q);
+ p = q + 1;
+ break;
}
}
}
diff --git a/table.c.0 b/table.c.0
@@ -1,2878 +0,0 @@
-/* -*- mode: c; c-basic-offset: 4; tab-width: 8; -*- */
-/* $Id$ */
-/*
- * HTML table
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#ifdef __EMX__
-#include <strings.h>
-#endif /* __EMX__ */
-
-#include "fm.h"
-#include "html.h"
-#include "parsetag.h"
-#include "Str.h"
-#include "myctype.h"
-
-#ifdef KANJI_SYMBOLS
-static char *rule[] =
-{"¨«", "¨§", "¨¨", "¨£", "¨©", "¨¢", "¨¤", "07", "¨ª", "¨¦", "¨¡", "0B", "¨¥", "0D", "0E", " "};
-static char *ruleB[] =
-{"00", "¨·", "¨¸", "¨®", "¨¹", "¨", "¨¯", "07", "¨º", "¨±", "¨¬", "0B", "¨°", "0D", "0E", " "};
-#define TN_VERTICALBAR "¨¢"
-#define HORIZONTALBAR "¨¬"
-#define RULE_WIDTH 2
-#else /* not KANJI_SYMBOLS */
-static char *rule[] =
-{
- "<_RULE TYPE=0>+</_RULE>",
- "<_RULE TYPE=1>+</_RULE>",
- "<_RULE TYPE=2>+</_RULE>",
- "<_RULE TYPE=3>+</_RULE>",
- "<_RULE TYPE=4>+</_RULE>",
- "<_RULE TYPE=5>|</_RULE>",
- "<_RULE TYPE=6>+</_RULE>",
- "<_RULE TYPE=7>07</_RULE>",
- "<_RULE TYPE=8>+</_RULE>",
- "<_RULE TYPE=9>+</_RULE>",
- "<_RULE TYPE=10>-</_RULE>",
- "<_RULE TYPE=11>0B</_RULE>",
- "<_RULE TYPE=12>+</_RULE>",
- "<_RULE TYPE=13>0D</_RULE>",
- "<_RULE TYPE=14>0E</_RULE>",
- "<_RULE TYPE=15> </_RULE>"};
-static char **ruleB = rule;
-#define TN_VERTICALBAR "<_RULE TYPE=5>|</_RULE>"
-#define HORIZONTALBAR "<_RULE TYPE=10>-</_RULE>"
-#define RULE_WIDTH 1
-#endif /* not KANJI_SYMBOLS */
-
-#define RULE(mode) (((mode)==BORDER_THICK)?ruleB:rule)
-#define TK_VERTICALBAR(mode) (RULE(mode)[5])
-
-#define BORDERWIDTH 2
-#define BORDERHEIGHT 1
-#define NOBORDERWIDTH 1
-#define NOBORDERHEIGHT 0
-
-#define HTT_X 1
-#define HTT_Y 2
-#define HTT_ALIGN 0x30
-#define HTT_LEFT 0x00
-#define HTT_CENTER 0x10
-#define HTT_RIGHT 0x20
-#define HTT_TRSET 0x40
-#ifdef NOWRAP
-#define HTT_NOWRAP 4
-#endif /* NOWRAP */
-#define TAG_IS(s,tag,len) (strncasecmp(s,tag,len)==0&&(s[len] == '>' || IS_SPACE((int)s[len])))
-
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif /* not max */
-#ifndef min
-#define min(a,b) ((a) > (b) ? (b) : (a))
-#endif /* not min */
-#ifndef abs
-#define abs(a) ((a) >= 0. ? (a) : -(a))
-#endif /* not abs */
-
-#ifdef MATRIX
-#ifndef MESCHACH
-#include "matrix.c"
-#endif /* not MESCHACH */
-#endif /* MATRIX */
-
-#ifdef MATRIX
-int correct_table_matrix(struct table *, int, int, int, double);
-void set_table_matrix(struct table *, int);
-#endif /* MATRIX */
-
-#ifdef MATRIX
-static double
-weight(int x)
-{
-
- if (x < COLS)
- return (double) x;
- else
- return COLS * (log((double) x / COLS) + 1.);
-}
-
-static double
-weight2(int a)
-{
- return (double) a / COLS * 4 + 1.;
-}
-
-#define sigma_td(a) (0.5*weight2(a)) /* <td width=...> */
-#define sigma_td_nw(a) (32*weight2(a)) /* <td ...> */
-#define sigma_table(a) (0.25*weight2(a)) /* <table width=...> */
-#define sigma_table_nw(a) (2*weight2(a)) /* <table...> */
-#else /* not MATRIX */
-#define LOG_MIN 1.0
-static double
-weight3(int x)
-{
- if (x < 0.1)
- return 0.1;
- if (x < LOG_MIN)
- return (double) x;
- else
- return LOG_MIN * (log((double) x / LOG_MIN) + 1.);
-}
-#endif /* not MATRIX */
-
-static int
-dsort_index(short e1, short *ent1, short e2, short *ent2, int base,
- char *index, int nent)
-{
- int n = nent;
- int k = 0;
-
- int e = e1 * base + e2;
- while (n > 0) {
- int nn = n / 2;
- int idx = index[k + nn];
- int ne = ent1[idx] * base + ent2[idx];
- if (ne == e) {
- k += nn;
- break;
- }
- else if (ne < e) {
- n -= nn + 1;
- k += nn + 1;
- }
- else {
- n = nn;
- }
- }
- return k;
-}
-
-static int
-fsort_index(double e, double *ent, char *index, int nent)
-{
- int n = nent;
- int k = 0;
-
- while (n > 0) {
- int nn = n / 2;
- int idx = index[k + nn];
- double ne = ent[idx];
- if (ne == e) {
- k += nn;
- break;
- }
- else if (ne > e) {
- n -= nn + 1;
- k += nn + 1;
- }
- else {
- n = nn;
- }
- }
- return k;
-}
-
-static void
-dv2sv(double *dv, short *iv, int size)
-{
- int i, k, iw;
- char *index;
- double *edv;
- double w = 0., x;
-
- index = NewAtom_N(char, size);
- edv = NewAtom_N(double, size);
- for (i = 0; i < size; i++) {
- iv[i] = ceil(dv[i]);
- edv[i] = (double) iv[i] - dv[i];
- }
-
- w = 0.;
- for (k = 0; k < size; k++) {
- x = edv[k];
- w += x;
- i = fsort_index(x, edv, index, k);
- if (k > i)
- bcopy(index + i, index + i + 1, k - i);
- index[i] = k;
- }
- iw = min((int) (w + 0.5), size);
- if (iw == 0)
- return;
- x = edv[(int) index[iw - 1]];
- for (i = 0; i < size; i++) {
- k = index[i];
- if (i >= iw && abs(edv[k] - x) > 1e-6)
- break;
- iv[k]--;
- }
-}
-
-static int
-table_colspan(struct table *t, int row, int col)
-{
- int i;
- for (i = col + 1; i <= t->maxcol && (t->tabattr[row][i] & HTT_X); i++);
- return i - col;
-}
-
-static int
-table_rowspan(struct table *t, int row, int col)
-{
- int i;
- if (!t->tabattr[row])
- return 0;
- for (i = row + 1; i <= t->maxrow && t->tabattr[i] &&
- (t->tabattr[i][col] & HTT_Y); i++);
- return i - row;
-}
-
-static int
-minimum_cellspacing(int border_mode)
-{
- switch (border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- case BORDER_NOWIN:
- return RULE_WIDTH;
- case BORDER_NONE:
- return 1;
- default:
- /* not reached */
- return 0;
- }
-}
-
-static int
-table_border_width(struct table *t)
-{
- switch (t->border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- return t->maxcol * t->cellspacing + 2 * (RULE_WIDTH + t->cellpadding);
- case BORDER_NOWIN:
- case BORDER_NONE:
- return t->maxcol * t->cellspacing;
- default:
- /* not reached */
- return 0;
- }
-}
-
-struct table *
-newTable()
-{
- struct table *t;
- int i, j;
-
- t = New(struct table);
- t->max_rowsize = MAXROW;
- t->tabdata = New_N(TextList **, MAXROW);
- t->tabattr = New_N(table_attr *, MAXROW);
- t->tabheight = NewAtom_N(short, MAXROW);
-#ifdef ID_EXT
- t->tabidvalue = New_N(Str *, MAXROW);
- t->tridvalue = New_N(Str, MAXROW);
-#endif /* ID_EXT */
-
- for (i = 0; i < MAXROW; i++) {
- t->tabdata[i] = NULL;
- t->tabattr[i] = 0;
- t->tabheight[i] = 0;
-#ifdef ID_EXT
- t->tabidvalue[i] = NULL;
- t->tridvalue[i] = NULL;
-#endif /* ID_EXT */
- }
- for (j = 0; j < MAXCOL; j++) {
- t->tabwidth[j] = 0;
- t->minimum_width[j] = 0;
- t->fixed_width[j] = 0;
- }
- t->cell.maxcell = -1;
- t->cell.icell = -1;
- t->tabcontentssize = 0;
- t->indent = 0;
- t->ntable = 0;
- t->tables_size = 0;
- t->tables = NULL;
-#ifdef MATRIX
- t->matrix = NULL;
- t->vector = NULL;
-#endif /* MATRIX */
- t->linfo.prev_ctype = PC_ASCII;
- t->linfo.prev_spaces = -1;
- t->linfo.prevchar = ' ';
- t->trattr = 0;
-
- t->status = R_ST_NORMAL;
- t->suspended_input = Strnew();
- t->caption = Strnew();
-#ifdef ID_EXT
- t->id = NULL;
-#endif
- return t;
-}
-
-static void
-check_row(struct table *t, int row)
-{
- int i, r;
- TextList ***tabdata;
- table_attr **tabattr;
- short *tabheight;
-#ifdef ID_EXT
- Str **tabidvalue;
- Str *tridvalue;
-#endif /* ID_EXT */
-
- if (row >= t->max_rowsize) {
- r = max(t->max_rowsize * 2, row + 1);
- tabdata = New_N(TextList **, r);
- tabattr = New_N(table_attr *, r);
- tabheight = New_N(short, r);
-#ifdef ID_EXT
- tabidvalue = New_N(Str *, r);
- tridvalue = New_N(Str, r);
-#endif /* ID_EXT */
- for (i = 0; i < t->max_rowsize; i++) {
- tabdata[i] = t->tabdata[i];
- tabattr[i] = t->tabattr[i];
- tabheight[i] = t->tabheight[i];
-#ifdef ID_EXT
- tabidvalue[i] = t->tabidvalue[i];
- tridvalue[i] = t->tridvalue[i];
-#endif /* ID_EXT */
- }
- for (; i < r; i++) {
- tabdata[i] = NULL;
- tabattr[i] = NULL;
- tabheight[i] = 0;
-#ifdef ID_EXT
- tabidvalue[i] = NULL;
- tridvalue[i] = NULL;
-#endif /* ID_EXT */
- }
- t->tabdata = tabdata;
- t->tabattr = tabattr;
- t->tabheight = tabheight;
-#ifdef ID_EXT
- t->tabidvalue = tabidvalue;
- t->tridvalue = tridvalue;
-#endif /* ID_EXT */
- t->max_rowsize = r;
- }
-
- if (t->tabdata[row] == NULL) {
- t->tabdata[row] = New_N(TextList *, MAXCOL);
- t->tabattr[row] = NewAtom_N(table_attr, MAXCOL);
-#ifdef ID_EXT
- t->tabidvalue[row] = New_N(Str, MAXCOL);
-#endif /* ID_EXT */
- for (i = 0; i < MAXCOL; i++) {
- t->tabdata[row][i] = NULL;
- t->tabattr[row][i] = 0;
-#ifdef ID_EXT
- t->tabidvalue[row][i] = NULL;
-#endif /* ID_EXT */
- }
- }
-}
-
-void
-pushdata(struct table *t, int row, int col, char *data)
-{
- check_row(t, row);
- if (t->tabdata[row][col] == NULL)
- t->tabdata[row][col] = newTextList();
-
- pushText(t->tabdata[row][col], data);
-}
-
-int visible_length_offset = 0;
-int
-visible_length(char *str)
-{
- int len = 0;
- int status = R_ST_NORMAL;
- int prev_status = status;
- Str tagbuf = Strnew();
- char *t, *r2;
- struct parsed_tagarg *t_arg, *tt;
- int amp_len;
-
- t = str;
- while (*str) {
- prev_status = status;
- len += next_status(*str, &status);
- if (status == R_ST_TAG0) {
- Strclear(tagbuf);
- Strcat_char(tagbuf, *str);
- }
- else if (status == R_ST_TAG || status == R_ST_DQUOTE || status == R_ST_QUOTE || status == R_ST_EQL) {
- Strcat_char(tagbuf, *str);
- }
- else if (status == R_ST_AMP) {
- if (prev_status == R_ST_NORMAL) {
- Strclear(tagbuf);
- amp_len = 0;
- }
- else {
- Strcat_char(tagbuf, *str);
- len++;
- amp_len++;
- }
- }
- else if (status == R_ST_NORMAL && prev_status == R_ST_AMP) {
- Strcat_char(tagbuf, *str);
- r2 = tagbuf->ptr;
- t = getescapecmd(&r2);
- len += strlen(t) - 1 - amp_len;
- if (*r2 != '\0') {
- str -= strlen(r2);
- }
- }
- else if (status == R_ST_NORMAL && ST_IS_REAL_TAG(prev_status)) {
- Strcat_char(tagbuf, *str);
- if (TAG_IS(tagbuf->ptr, "<img", 4)) {
- int anchor_len = 0;
- t_arg = parse_tag(tagbuf->ptr + 5);
- for (tt = t_arg; tt; tt = tt->next) {
- if (strcasecmp(tt->arg, "src") == 0 && tt->value && anchor_len == 0) {
- r2 = tt->value + strlen(tt->value) - 1;
- while (tt->value < r2 && *r2 != '/')
- r2--;
- if (*r2 == '/')
- r2++;
- while (*r2 && *r2 != '.') {
- r2++;
- anchor_len++;
- }
- anchor_len += 2;
- }
- else if (strcasecmp(tt->arg, "alt") == 0 && tt->value) {
- anchor_len = strlen(tt->value) + 1;
- break;
- }
- }
- len += anchor_len;
- }
- else if (TAG_IS(tagbuf->ptr, "<input", 6)) {
- int width = 20;
- int valuelen = 1;
- int input_type = FORM_INPUT_TEXT;
- t_arg = parse_tag(tagbuf->ptr + 7);
- for (tt = t_arg; tt; tt = tt->next) {
- if (strcasecmp(tt->arg, "type") == 0 && tt->value) {
- input_type = formtype(tt->value);
- }
- else if (strcasecmp(tt->arg, "value") == 0 && tt->value) {
- valuelen = strlen(tt->value);
- }
- else if (strcasecmp(tt->arg, "width") == 0 && tt->value) {
- width = atoi(tt->value);
- }
- }
- switch (input_type) {
- case FORM_INPUT_TEXT:
- case FORM_INPUT_FILE:
- case FORM_INPUT_PASSWORD:
- len += width + 2;
- break;
- case FORM_INPUT_SUBMIT:
- case FORM_INPUT_RESET:
- case FORM_INPUT_IMAGE:
- case FORM_INPUT_BUTTON:
- len += valuelen + 2;
- break;
- case FORM_INPUT_CHECKBOX:
- case FORM_INPUT_RADIO:
- len += 3;
- }
- }
- else if (TAG_IS(tagbuf->ptr, "<textarea", 9)) {
- int width = 20;
- t_arg = parse_tag(tagbuf->ptr + 7);
- for (tt = t_arg; tt; tt = tt->next) {
- if (strcasecmp(tt->arg, "cols") == 0 && tt->value) {
- width = atoi(tt->value);
- }
- }
- len += width + 2;
- }
- else if (TAG_IS(tagbuf->ptr, "<option", 7))
- len += 3;
- }
- else if (*str == '\t') {
- len--;
- do {
- len++;
- } while ((visible_length_offset + len) % Tabstop != 0);
- }
- str++;
- }
- if (status == R_ST_AMP) {
- r2 = tagbuf->ptr;
- t = getescapecmd(&r2);
- len += strlen(t) - 1 - amp_len;
- if (*r2 != '\0') {
- len += strlen(r2);
- }
- }
- return len;
-}
-
-int
-maximum_visible_length(char *str)
-{
- int maxlen, len;
- char *p;
-
- for (p = str; *p && *p != '\t'; p++);
-
- visible_length_offset = 0;
- maxlen = visible_length(str);
-
- if (*p == '\0')
- return maxlen;
-
- for (visible_length_offset = 1; visible_length_offset < Tabstop;
- visible_length_offset++) {
- len = visible_length(str);
- if (maxlen < len) {
- maxlen = len;
- break;
- }
- }
- return maxlen;
-}
-
-char *
-align(char *str, int width, int mode)
-{
- int i, l, l1, l2;
- Str buf = Strnew();
-
- if (str == NULL || *str == '\0') {
- for (i = 0; i < width; i++)
- Strcat_char(buf, ' ');
- return buf->ptr;
- }
- l = width - visible_length(str);
- switch (mode) {
- case ALIGN_CENTER:
- l1 = l / 2;
- l2 = l - l1;
- for (i = 0; i < l1; i++)
- Strcat_char(buf, ' ');
- Strcat_charp(buf, str);
- for (i = 0; i < l2; i++)
- Strcat_char(buf, ' ');
- return buf->ptr;
- case ALIGN_LEFT:
- Strcat_charp(buf, str);
- for (i = 0; i < l; i++)
- Strcat_char(buf, ' ');
- return buf->ptr;
- case ALIGN_RIGHT:
- for (i = 0; i < l; i++)
- Strcat_char(buf, ' ');
- Strcat_charp(buf, str);
- return buf->ptr;
- }
- return Strnew_charp(str)->ptr;
-}
-
-void
-print_item(struct table *t,
- int row, int col, int width,
- Str buf)
-{
- int alignment;
- char *p;
-
- if (t->tabdata[row])
- p = popText(t->tabdata[row][col]);
- else
- p = NULL;
-
- if (p != NULL) {
- check_row(t, row);
- alignment = ALIGN_CENTER;
- if ((t->tabattr[row][col] & HTT_ALIGN) == HTT_LEFT)
- alignment = ALIGN_LEFT;
- else if ((t->tabattr[row][col] & HTT_ALIGN) == HTT_RIGHT)
- alignment = ALIGN_RIGHT;
- else if ((t->tabattr[row][col] & HTT_ALIGN) == HTT_CENTER)
- alignment = ALIGN_CENTER;
- Strcat_charp(buf, align(p, width, alignment));
- }
- else
- Strcat_charp(buf, align(NULL, width, ALIGN_CENTER));
-}
-
-
-#define T_TOP 0
-#define T_MIDDLE 1
-#define T_BOTTOM 2
-
-void
-print_sep(struct table *t,
- int row, int type, int maxcol,
- Str buf)
-{
- int forbid;
- char **rulep;
- int i, j, k, l, m;
-
-#if defined(__EMX__)&&!defined(JP_CHARSET)
- if(CodePage==850){
- ruleB = ruleB850;
- rule = rule850;
- }
-#endif
- if (row >= 0)
- check_row(t, row);
- check_row(t, row + 1);
- if ((type == T_TOP || type == T_BOTTOM) && t->border_mode == BORDER_THICK) {
- rulep = ruleB;
- }
- else {
- rulep = rule;
- }
- forbid = 1;
- if (type == T_TOP)
- forbid |= 2;
- else if (type == T_BOTTOM)
- forbid |= 8;
- else if (t->tabattr[row + 1][0] & HTT_Y) {
- forbid |= 4;
- }
- if (t->border_mode != BORDER_NOWIN)
- Strcat_charp(buf, RULE(t->border_mode)[forbid]);
- for (i = 0; i <= maxcol; i++) {
- forbid = 10;
- if (type != T_BOTTOM && (t->tabattr[row + 1][i] & HTT_Y)) {
- if (t->tabattr[row + 1][i] & HTT_X) {
- goto do_last_sep;
- }
- else {
- for (k = row; k >= 0 && t->tabattr[k] && (t->tabattr[k][i] & HTT_Y); k--);
- m = t->tabwidth[i] + 2 * t->cellpadding;
- for (l = i + 1; l <= t->maxcol && (t->tabattr[row][l] & HTT_X); l++)
- m += t->tabwidth[l] + t->cellspacing;
- print_item(t, k, i, m, buf);
- }
- }
- else {
- for (j = 0; j < t->tabwidth[i] + 2 * t->cellpadding; j += RULE_WIDTH) {
- Strcat_charp(buf, rulep[forbid]);
- }
- }
- do_last_sep:
- if (i < maxcol) {
- forbid = 0;
- if (type == T_TOP)
- forbid |= 2;
- else if (t->tabattr[row][i + 1] & HTT_X) {
- forbid |= 2;
- }
- if (type == T_BOTTOM)
- forbid |= 8;
- else {
- if (t->tabattr[row + 1][i + 1] & HTT_X) {
- forbid |= 8;
- }
- if (t->tabattr[row + 1][i + 1] & HTT_Y) {
- forbid |= 4;
- }
- if (t->tabattr[row + 1][i] & HTT_Y) {
- forbid |= 1;
- }
- }
- if (forbid != 15) /* forbid==15 means 'no rule at all' */
- Strcat_charp(buf, rulep[forbid]);
- }
- }
- forbid = 4;
- if (type == T_TOP)
- forbid |= 2;
- if (type == T_BOTTOM)
- forbid |= 8;
- if (t->tabattr[row + 1][maxcol] & HTT_Y) {
- forbid |= 1;
- }
- if (t->border_mode != BORDER_NOWIN)
- Strcat_charp(buf, RULE(t->border_mode)[forbid]);
- Strcat_charp(buf, "<eol>");
-}
-
-static int
-get_spec_cell_width(struct table *tbl, int row, int col)
-{
- int i, w;
-
- w = tbl->tabwidth[col];
- for (i = col + 1; i <= tbl->maxcol; i++) {
- check_row(tbl, row);
- if (tbl->tabattr[row][i] & HTT_X)
- w += tbl->tabwidth[i] + tbl->cellspacing;
- else
- break;
- }
- return w;
-}
-
-void
-do_refill(struct table *tbl, int row, int col)
-{
- TextList *orgdata;
- TextListItem *l;
- struct readbuffer obuf;
- struct html_feed_environ h_env;
- struct environment envs[MAX_ENV_LEVEL];
-
- if (tbl->tabdata[row] == NULL ||
- tbl->tabdata[row][col] == NULL)
- return;
- orgdata = tbl->tabdata[row][col];
- tbl->tabdata[row][col] = newTextList();
-
- init_henv(&h_env, &obuf, envs, MAX_ENV_LEVEL, tbl->tabdata[row][col],
- tbl->tabwidth[col], 0);
- h_env.limit = get_spec_cell_width(tbl, row, col);
- for (l = orgdata->first; l != NULL; l = l->next) {
- if (TAG_IS(l->ptr, "<dummy_table", 12)) {
- struct parsed_tagarg *t_arg, *t;
- int id = -1;
- t_arg = parse_tag(l->ptr + 12);
- for (t = t_arg; t; t = t->next) {
- if (!strcasecmp(t->arg, "id") && t->value) {
- id = atoi(t->value);
- break;
- }
- }
- if (id >= 0) {
- int alignment;
- TextListItem *ti;
- save_fonteffect(&h_env, h_env.obuf);
- flushline(&h_env, &obuf, 0, 0, h_env.limit);
-
- if (RB_GET_ALIGN(h_env.obuf) == RB_CENTER)
- alignment = ALIGN_CENTER;
- else if (RB_GET_ALIGN(h_env.obuf) == RB_RIGHT)
- alignment = ALIGN_RIGHT;
- else
- alignment = ALIGN_LEFT;
-
- if (alignment == ALIGN_LEFT) {
- appendTextList(h_env.buf, tbl->tables[id].buf);
- }
- else {
- for (ti = tbl->tables[id].buf->first; ti != NULL; ti = ti->next) {
- pushText(h_env.buf, align(ti->ptr, h_env.limit, alignment));
- }
- }
- restore_fonteffect(&h_env, h_env.obuf);
- }
- }
- else
- HTMLlineproc1(l->ptr, &h_env);
- }
- flushline(&h_env, &obuf, 0, 0, h_env.limit);
-}
-
-static void
-check_cell_width(short *tabwidth, short *cellwidth,
- short *col, short *colspan, short maxcell,
- char *index, int space, int dir)
-{
- int i, j, k, bcol, ecol;
- int swidth, width;
-
- for (k = 0; k <= maxcell; k++) {
- j = index[k];
- if (cellwidth[j] <= 0)
- continue;
- bcol = col[j];
- ecol = bcol + colspan[j];
- swidth = 0;
- for (i = bcol; i < ecol; i++)
- swidth += tabwidth[i];
-
- width = cellwidth[j] - (colspan[j] - 1) * space;
- if (width > swidth) {
- int w = (width - swidth) / colspan[j];
- int r = (width - swidth) % colspan[j];
- for (i = bcol; i < ecol; i++)
- tabwidth[i] += w;
- /* dir {0: horizontal, 1: vertical} */
- if (dir == 1 && r > 0)
- r = colspan[j];
- for (i = 1; i <= r; i++)
- tabwidth[ecol - i]++;
- }
- }
-}
-
-void
-check_minimum_width(struct table *t, short *tabwidth)
-{
- int i;
- struct table_cell *cell = &t->cell;
-
- for (i = 0; i <= t->maxcol; i++) {
- if (tabwidth[i] < t->minimum_width[i])
- tabwidth[i] = t->minimum_width[i];
- }
-
- check_cell_width(tabwidth, cell->minimum_width, cell->col, cell->colspan,
- cell->maxcell, cell->index, t->cellspacing, 0);
-}
-
-void
-check_maximum_width(struct table *t)
-{
- struct table_cell *cell = &t->cell;
-#ifdef MATRIX
- int i, j, bcol, ecol;
- int swidth, width;
-
- cell->necell = 0;
- for (j = 0; j <= cell->maxcell; j++) {
- bcol = cell->col[j];
- ecol = bcol + cell->colspan[j];
- swidth = 0;
- for (i = bcol; i < ecol; i++)
- swidth += t->tabwidth[i];
-
- width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing;
- if (width > swidth) {
- cell->eindex[cell->necell] = j;
- cell->necell++;
- }
- }
-#else /* not MATRIX */
- check_cell_width(t->tabwidth, cell->width, cell->col, cell->colspan,
- cell->maxcell, cell->index, t->cellspacing, 0);
- check_minimum_width(t, t->tabwidth);
-#endif /* not MATRIX */
-}
-
-
-#ifdef MATRIX
-static int
-recalc_width(int old, int delta, double rat)
-{
- double w = rat * old;
- double ww = (double) delta;
- if (w > 0.) {
- if (ww < 0.)
- ww = 0.;
- ww += 0.2;
- }
- else {
- if (ww > 0.)
- ww = 0.;
- ww -= 1.0;
- }
- if (w > ww)
- return (int) (ww / rat);
- return old;
-}
-
-static int
-check_compressible_cell(struct table *t, MAT * minv,
- short *newwidth, short *swidth, short *cwidth,
- int totalwidth,
- int icol, int icell, double sxx, int corr)
-{
- struct table_cell *cell = &t->cell;
- int i, j, k, m, bcol, ecol;
- int delta, dmax, dmin, owidth;
- double sxy;
-
- if (sxx < 10.)
- return corr;
-
- if (icol >= 0) {
- owidth = newwidth[icol];
- delta = newwidth[icol] - t->tabwidth[icol];
- bcol = icol;
- ecol = bcol + 1;
- }
- else if (icell >= 0) {
- owidth = swidth[icell];
- delta = swidth[icell] - cwidth[icell];
- bcol = cell->col[icell];
- ecol = bcol + cell->colspan[icell];
- }
- else {
- owidth = totalwidth;
- delta = totalwidth;
- bcol = 0;
- ecol = t->maxcol + 1;
- }
-
- dmin = delta;
- dmax = 0;
- for (k = 0; k <= cell->maxcell; k++) {
- int bcol1, ecol1;
- if (dmin <= 0)
- return corr;
- j = cell->index[k];
- if (icol < 0 && j == icell)
- continue;
- bcol1 = cell->col[j];
- ecol1 = bcol1 + cell->colspan[j];
- sxy = 0.;
- for (m = bcol1; m < ecol1; m++) {
- for (i = bcol; i < ecol; i++)
- sxy += m_entry(minv, i, m);
- }
- if (fabs(delta * sxy / sxx) < 0.5)
- continue;
- if (sxy > 0.)
- dmin = recalc_width(dmin, swidth[j] - cwidth[j], sxy / sxx);
- else
- dmax = recalc_width(dmax, swidth[j] - cwidth[j], sxy / sxx);
- }
- for (m = 0; m <= t->maxcol; m++) {
- if (dmin <= 0)
- return corr;
- if (icol >= 0 && m == icol)
- continue;
- sxy = 0.;
- for (i = bcol; i < ecol; i++)
- sxy += m_entry(minv, i, m);
- if (fabs(delta * sxy / sxx) < 0.5)
- continue;
- if (sxy > 0.)
- dmin = recalc_width(dmin, newwidth[m] - t->tabwidth[m], sxy / sxx);
- else
- dmax = recalc_width(dmax, newwidth[m] - t->tabwidth[m], sxy / sxx);
- }
- if (dmax > 0 && dmin > dmax)
- dmin = dmax;
- if (dmin > 1) {
- correct_table_matrix(t, bcol, ecol - bcol, owidth - dmin, 1.);
- corr++;
- }
- return corr;
-}
-
-#define MAX_ITERATION 3
-int
-check_table_width(struct table *t, short *newwidth, MAT * minv, int itr)
-{
- int i, j, k, m, bcol, ecol;
- int corr = 0;
- struct table_cell *cell = &t->cell;
-#ifdef __GNUC__
- short orgwidth[t->maxcol + 1];
- short cwidth[cell->maxcell + 1], swidth[cell->maxcell + 1];
-#else /* __GNUC__ */
- short orgwidth[MAXCOL];
- short cwidth[MAXCELL], swidth[MAXCELL];
-#endif /* __GNUC__ */
- int twidth;
- double sxy, *Sxx, stotal;
-
- twidth = 0;
- stotal = 0.;
- for (i = 0; i <= t->maxcol; i++) {
- twidth += newwidth[i];
- stotal += m_entry(minv, i, i);
- for (m = 0; m < i; m++) {
- stotal += 2 * m_entry(minv, i, m);
- }
- }
-
- Sxx = NewAtom_N(double, cell->maxcell + 1);
- for (k = 0; k <= cell->maxcell; k++) {
- j = cell->index[k];
- bcol = cell->col[j];
- ecol = bcol + cell->colspan[j];
- swidth[j] = 0;
- for (i = bcol; i < ecol; i++)
- swidth[j] += newwidth[i];
- cwidth[j] = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing;
- Sxx[j] = 0.;
- for (i = bcol; i < ecol; i++) {
- Sxx[j] += m_entry(minv, i, i);
- for (m = bcol; m <= ecol; m++) {
- if (m < i)
- Sxx[j] += 2 * m_entry(minv, i, m);
- }
- }
- }
-
- /* compress table */
- corr = check_compressible_cell(t, minv, newwidth, swidth, cwidth, twidth,
- -1, -1, stotal, corr);
- if (itr < MAX_ITERATION && corr > 0)
- return corr;
-
- /* compress multicolumn cell */
- for (k = cell->maxcell; k >= 0; k--) {
- j = cell->index[k];
- corr = check_compressible_cell(t, minv, newwidth, swidth, cwidth, twidth,
- -1, j, Sxx[j], corr);
- if (itr < MAX_ITERATION && corr > 0)
- return corr;
- }
-
- /* compress single column cell */
- for (i = 0; i <= t->maxcol; i++) {
- corr = check_compressible_cell(t, minv, newwidth, swidth, cwidth, twidth,
- i, -1, m_entry(minv, i, i), corr);
- if (itr < MAX_ITERATION && corr > 0)
- return corr;
- }
-
-
- for (i = 0; i <= t->maxcol; i++)
- orgwidth[i] = newwidth[i];
-
- check_minimum_width(t, newwidth);
-
- for (i = 0; i <= t->maxcol; i++) {
- double sx = sqrt(m_entry(minv, i, i));
- if (sx < 0.1)
- continue;
- if (orgwidth[i] < t->minimum_width[i] &&
- newwidth[i] == t->minimum_width[i]) {
- double w = (sx > 0.5) ? 0.5 : sx * 0.2;
- sxy = 0.;
- for (m = 0; m <= t->maxcol; m++) {
- if (m == i)
- continue;
- sxy += m_entry(minv, i, m);
- }
- if (sxy <= 0.) {
- correct_table_matrix(t, i, 1, t->minimum_width[i], w);
- corr++;
- }
- }
- }
-
- for (k = 0; k <= cell->maxcell; k++) {
- int nwidth = 0, mwidth;
- double sx;
-
- j = cell->index[k];
- sx = sqrt(Sxx[j]);
- if (sx < 0.1)
- continue;
- bcol = cell->col[j];
- ecol = bcol + cell->colspan[j];
- for (i = bcol; i < ecol; i++)
- nwidth += newwidth[i];
- mwidth = cell->minimum_width[j] - (cell->colspan[j] - 1) * t->cellspacing;
- if (mwidth > swidth[j] && mwidth == nwidth) {
- double w = (sx > 0.5) ? 0.5 : sx * 0.2;
-
- sxy = 0.;
- for (i = bcol; i < ecol; i++) {
- for (m = 0; m <= t->maxcol; m++) {
- if (m >= bcol && m < ecol)
- continue;
- sxy += m_entry(minv, i, m);
- }
- }
- if (sxy <= 0.) {
- correct_table_matrix(t, bcol, cell->colspan[j], mwidth, w);
- corr++;
- }
- }
- }
-
- if (itr >= MAX_ITERATION)
- return 0;
- else
- return corr;
-}
-
-#else /* not MATRIX */
-void
-set_table_width(struct table *t, short *newwidth, int maxwidth)
-{
- int i, j, k, bcol, ecol;
- struct table_cell *cell = &t->cell;
- char *fixed;
- int swidth, fwidth, width, nvar;
- double s;
- double *dwidth;
- int try_again;
-
- fixed = NewAtom_N(char, t->maxcol + 1);
- bzero(fixed, t->maxcol + 1);
- dwidth = NewAtom_N(double, t->maxcol + 1);
-
- for (i = 0; i <= t->maxcol; i++) {
- dwidth[i] = 0.0;
- if (t->fixed_width[i] < 0) {
- t->fixed_width[i] = -t->fixed_width[i] * maxwidth / 100;
- }
- if (t->fixed_width[i] > 0) {
- newwidth[i] = t->fixed_width[i];
- fixed[i] = 1;
- }
- else
- newwidth[i] = 0;
- if (newwidth[i] < t->minimum_width[i])
- newwidth[i] = t->minimum_width[i];
- }
-
- for (k = 0; k <= cell->maxcell; k++) {
- j = cell->index[k];
- bcol = cell->col[j];
- ecol = bcol + cell->colspan[j];
-
- if (cell->fixed_width[j] < 0)
- cell->fixed_width[j] = -cell->fixed_width[j] * maxwidth / 100;
-
- swidth = 0;
- fwidth = 0;
- nvar = 0;
- for (i = bcol; i < ecol; i++) {
- if (fixed[i]) {
- fwidth += newwidth[i];
- }
- else {
- swidth += newwidth[i];
- nvar++;
- }
- }
- width = max(cell->fixed_width[j], cell->minimum_width[j])
- - (cell->colspan[j] - 1) * t->cellspacing;
- if (nvar > 0 && width > fwidth + swidth) {
- s = 0.;
- for (i = bcol; i < ecol; i++) {
- if (!fixed[i])
- s += weight3(t->tabwidth[i]);
- }
- for (i = bcol; i < ecol; i++) {
- if (!fixed[i])
- dwidth[i] = (width - fwidth) * weight3(t->tabwidth[i]) / s;
- else
- dwidth[i] = (double) newwidth[i];
- }
- dv2sv(dwidth, newwidth, cell->colspan[j]);
- if (cell->fixed_width[j] > 0) {
- for (i = bcol; i < ecol; i++)
- fixed[i] = 1;
- }
- }
- }
-
- do {
- nvar = 0;
- swidth = 0;
- fwidth = 0;
- for (i = 0; i <= t->maxcol; i++) {
- if (fixed[i]) {
- fwidth += newwidth[i];
- }
- else {
- swidth += newwidth[i];
- nvar++;
- }
- }
- width = maxwidth - t->maxcol * t->cellspacing;
- if (nvar == 0 || width <= fwidth + swidth)
- break;
-
- s = 0.;
- for (i = 0; i <= t->maxcol; i++) {
- if (!fixed[i])
- s += weight3(t->tabwidth[i]);
- }
- for (i = 0; i <= t->maxcol; i++) {
- if (!fixed[i])
- dwidth[i] = (width - fwidth) * weight3(t->tabwidth[i]) / s;
- else
- dwidth[i] = (double) newwidth[i];
- }
- dv2sv(dwidth, newwidth, t->maxcol + 1);
-
- try_again = 0;
- for (i = 0; i <= t->maxcol; i++) {
- if (!fixed[i]) {
- if (newwidth[i] > t->tabwidth[i]) {
- newwidth[i] = t->tabwidth[i];
- fixed[i] = 1;
- try_again = 1;
- }
- else if (newwidth[i] < t->minimum_width[i]) {
- newwidth[i] = t->minimum_width[i];
- fixed[i] = 1;
- try_again = 1;
- }
- }
- }
- } while (try_again);
-}
-#endif /* not MATRIX */
-
-void
-check_table_height(struct table *t)
-{
- int i, j, k;
- struct {
- short row[MAXCELL];
- short rowspan[MAXCELL];
- char index[MAXCELL];
- short maxcell;
- short height[MAXCELL];
- } cell;
- int space;
-
- cell.maxcell = -1;
-
- for (j = 0; j <= t->maxrow; j++) {
- if (!t->tabattr[j])
- continue;
- for (i = 0; i <= t->maxcol; i++) {
- int t_dep, rowspan;
- if (t->tabattr[j][i] & (HTT_X | HTT_Y))
- continue;
-
- if (t->tabdata[j][i] == NULL)
- t_dep = 0;
- else
- t_dep = t->tabdata[j][i]->nitem;
-
- rowspan = table_rowspan(t, j, i);
- if (rowspan > 1) {
- int c = cell.maxcell + 1;
- k = dsort_index(rowspan, cell.rowspan,
- j, cell.row, t->maxrow + 1,
- cell.index, c);
- if (k <= cell.maxcell) {
- int idx = cell.index[k];
- if (cell.row[idx] == j &&
- cell.rowspan[idx] == rowspan)
- c = idx;
- }
- if (c > cell.maxcell && c < MAXCELL) {
- cell.maxcell++;
- cell.row[cell.maxcell] = j;
- cell.rowspan[cell.maxcell] = rowspan;
- cell.height[cell.maxcell] = 0;
- if (cell.maxcell > k)
- bcopy(cell.index + k, cell.index + k + 1, cell.maxcell - k);
- cell.index[k] = cell.maxcell;
- }
- if (c <= cell.maxcell && c >= 0 &&
- cell.height[c] < t_dep) {
- cell.height[c] = t_dep;
- continue;
- }
- }
- if (t->tabheight[j] < t_dep)
- t->tabheight[j] = t_dep;
- }
- }
-
- switch (t->border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- case BORDER_NOWIN:
- space = 1;
- break;
- case BORDER_NONE:
- space = 0;
- }
- check_cell_width(t->tabheight, cell.height, cell.row, cell.rowspan,
- cell.maxcell, cell.index, space, 1);
-}
-
-int
-get_table_width(struct table *t, short *orgwidth, short *cellwidth,
- int check_minimum)
-{
-#ifdef __GNUC__
- short newwidth[t->maxcol + 1];
-#else /* not __GNUC__ */
- short newwidth[MAXCOL];
-#endif /* not __GNUC__ */
- int i;
- int swidth;
- struct table_cell *cell = &t->cell;
-
- for (i = 0; i <= t->maxcol; i++)
- newwidth[i] = max(orgwidth[i], 0);
-
- check_cell_width(newwidth, cellwidth, cell->col, cell->colspan,
- cell->maxcell, cell->index, t->cellspacing, 0);
- if (check_minimum)
- check_minimum_width(t, newwidth);
-
- swidth = 0;
- for (i = 0; i <= t->maxcol; i++) {
- swidth += newwidth[i];
- }
- swidth += table_border_width(t);
- return swidth;
-}
-
-#define minimum_table_width(t)\
-(get_table_width(t,t->minimum_width,t->cell.minimum_width,0))
-#define maximum_table_width(t)\
- (get_table_width(t,t->tabwidth,t->cell.width,0))
-#define fixed_table_width(t)\
- (get_table_width(t,t->fixed_width,t->cell.fixed_width,1))
-
-void
-renderCoTable(struct table *tbl)
-{
- struct readbuffer obuf;
- struct html_feed_environ h_env;
- struct environment envs[MAX_ENV_LEVEL];
- struct table *t;
- int i, j, col, row, b_width;
- int width, nwidth, indent, maxwidth;
-#ifdef __GNUC__
- short newwidth[tbl->maxcol + 1];
-#else /* not __GNUC__ */
- short newwidth[MAXCOL];
-#endif /* not __GNUC__ */
-
- for (i = 0; i <= tbl->maxcol; i++)
- newwidth[i] = tbl->tabwidth[i];
-
- for (i = 0; i < tbl->ntable; i++) {
- t = tbl->tables[i].ptr;
- col = tbl->tables[i].col;
- row = tbl->tables[i].row;
- indent = tbl->tables[i].indent;
-
- init_henv(&h_env, &obuf, envs, MAX_ENV_LEVEL, tbl->tables[i].buf,
- tbl->tabwidth[col], indent);
- nwidth = newwidth[col];
- check_row(tbl, row);
- b_width = 0;
- for (j = col + 1; j <= tbl->maxcol; j++) {
- if (tbl->tabattr[row][j] & HTT_X) {
- h_env.limit += tbl->tabwidth[j];
- nwidth += newwidth[j];
- b_width += tbl->cellspacing;
- }
- else
- break;
- }
- h_env.limit += b_width;
-#ifndef TABLE_EXPAND
- if (t->total_width == 0)
- maxwidth = h_env.limit - indent;
- else if (t->total_width > 0)
- maxwidth = t->total_width;
- else
- maxwidth = t->total_width = -t->total_width *
- get_spec_cell_width(tbl, row, col) / 100;
-#else
- maxwidth = h_env.limit - indent;
- if (t->total_width > 0) {
- double r = ((double) maxwidth) / t->total_width;
- struct table_cell *cell = &t->cell;
-
- for (j = 0; j <= t->maxcol; j++) {
- if (t->fixed_width[j] > 0)
- t->fixed_width[j] = (int) (r * t->fixed_width[j]);
- }
- for (j = 0; j <= cell->maxcell; j++) {
- if (cell->fixed_width[j] > 0)
- cell->fixed_width[j] = (int) (r * cell->fixed_width[j]);
- }
- t->total_width = maxwidth;
- }
-#endif /* TABLE_EXPAND */
- renderTable(t, maxwidth, &h_env);
- width = t->total_width - b_width + indent;
- if (width > nwidth) {
- int cell = tbl->tables[i].cell;
- if (cell < 0) {
- newwidth[col] = width;
- }
- else {
- int ecol = col + tbl->cell.colspan[cell];
- int w = (width - nwidth) / tbl->cell.colspan[cell];
- int r = (width - nwidth) % tbl->cell.colspan[cell];
- for (j = col; j < ecol; j++)
- newwidth[j] += w;
- for (j = 1; j <= r; j++)
- newwidth[ecol - j]++;
- }
- }
- t = NULL;
- }
- for (i = 0; i <= tbl->maxcol; i++)
- tbl->tabwidth[i] = newwidth[i];
-}
-
-static void
-make_caption(struct table *t, struct html_feed_environ *h_env)
-{
- struct html_feed_environ henv;
- struct readbuffer obuf;
- struct environment envs[MAX_ENV_LEVEL];
- TextList *tl;
- Str tmp;
-
- if (t->caption->length <= 0)
- return;
-
- if (t->total_width <= 0)
- t->total_width = h_env->limit;
-
- init_henv(&henv, &obuf, envs, MAX_ENV_LEVEL, newTextList(), t->total_width,
- h_env->envs[h_env->envc].indent);
- HTMLlineproc1("<center>", &henv);
- HTMLlineproc1(t->caption->ptr, &henv);
- HTMLlineproc1("</center>", &henv);
-
- tl = henv.buf;
-
- if (tl->nitem > 0) {
- TextListItem *ti;
- tmp = Strnew_charp("<pre for_table>");
- for (ti = tl->first; ti != NULL; ti = ti->next) {
- Strcat_charp(tmp, ti->ptr);
- Strcat_char(tmp, '\n');
- }
- Strcat_charp(tmp, "</pre>");
- HTMLlineproc1(tmp->ptr, h_env);
- }
-}
-
-void
-renderTable(struct table *t,
- int max_width,
- struct html_feed_environ *h_env)
-{
- int i, j, w, r, h;
- Str renderbuf = Strnew();
- short new_tabwidth[MAXCOL];
-#ifdef MATRIX
- int itr;
- VEC *newwidth;
- MAT *mat, *minv;
- PERM *pivot;
-#endif /* MATRIX */
- int maxheight = 0;
- Str vrulea, vruleb, vrulec;
-#ifdef ID_EXT
- Str idtag;
-#endif /* ID_EXT */
-
- if (t->maxcol < 0) {
- make_caption(t, h_env);
- return;
- }
-
- max_width -= table_border_width(t);
-
- if (max_width <= 0)
- max_width = 1;
-
- check_maximum_width(t);
-
-#ifdef MATRIX
- if (t->maxcol == 0) {
- if (t->tabwidth[0] > max_width)
- t->tabwidth[0] = max_width;
- if (t->total_width > 0)
- t->tabwidth[0] = max_width;
- else if (t->fixed_width[0] > 0)
- t->tabwidth[0] = t->fixed_width[0];
- if (t->tabwidth[0] < t->minimum_width[0])
- t->tabwidth[0] = t->minimum_width[0];
- }
- else {
- set_table_matrix(t, max_width);
-
- itr = 0;
- mat = m_get(t->maxcol + 1, t->maxcol + 1);
- pivot = px_get(t->maxcol + 1);
- newwidth = v_get(t->maxcol + 1);
- minv = m_get(t->maxcol + 1, t->maxcol + 1);
- do {
- m_copy(t->matrix, mat);
- LUfactor(mat, pivot);
- LUsolve(mat, pivot, t->vector, newwidth);
- dv2sv(newwidth->ve, new_tabwidth, t->maxcol + 1);
- LUinverse(mat, pivot, minv);
-#ifdef TABLE_DEBUG
- fprintf(stderr, "max_width=%d\n", max_width);
- fprintf(stderr, "minimum : ");
- for (i = 0; i <= t->maxcol; i++)
- fprintf(stderr, "%2d ", t->minimum_width[i]);
- fprintf(stderr, "\ndecided : ");
- for (i = 0; i <= t->maxcol; i++)
- fprintf(stderr, "%2d ", new_tabwidth[i]);
- fprintf(stderr, "\n");
-#endif /* TABLE_DEBUG */
- itr++;
-
- } while (check_table_width(t, new_tabwidth, minv, itr));
- v_free(newwidth);
- px_free(pivot);
- m_free(mat);
- m_free(minv);
- m_free(t->matrix);
- v_free(t->vector);
- for (i = 0; i <= t->maxcol; i++) {
- t->tabwidth[i] = new_tabwidth[i];
- }
- }
-#else /* not MATRIX */
- set_table_width(t, new_tabwidth, max_width);
- for (i = 0; i <= t->maxcol; i++) {
- t->tabwidth[i] = new_tabwidth[i];
- }
-#endif /* not MATRIX */
-
- renderCoTable(t);
- check_minimum_width(t, t->tabwidth);
-
- t->total_width = 0;
- for (i = 0; i <= t->maxcol; i++) {
- if (t->border_mode != BORDER_NONE && t->tabwidth[i] % RULE_WIDTH == 1)
- t->tabwidth[i]++;
- t->total_width += t->tabwidth[i];
- }
-
- t->total_width += table_border_width(t);
-
- for (i = 0; i <= t->maxcol; i++) {
- for (j = 0; j <= t->maxrow; j++) {
- check_row(t, j);
- if (t->tabattr[j][i] & HTT_Y)
- continue;
- do_refill(t, j, i);
- }
- }
-
- check_table_height(t);
-
- /* table output */
- make_caption(t, h_env);
-
- HTMLlineproc1("<pre for_table>", h_env);
-#ifdef ID_EXT
- if (t->id != NULL) {
- idtag = Sprintf("<_id id=\"%s\">", (t->id)->ptr);
- HTMLlineproc1(idtag->ptr, h_env);
- }
-#endif /* ID_EXT */
- switch (t->border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- renderbuf = Strnew();
- print_sep(t, -1, T_TOP, t->maxcol, renderbuf);
- HTMLlineproc1(renderbuf->ptr, h_env);
- maxheight += 1;
- break;
- }
- vruleb = Strnew();
- switch (t->border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- vrulea = Strnew();
- vrulec = Strnew();
- Strcat_charp(vrulea, TK_VERTICALBAR(t->border_mode));
- for (i = 0; i < t->cellpadding; i++) {
- Strcat_char(vrulea, ' ');
- Strcat_char(vruleb, ' ');
- Strcat_char(vrulec, ' ');
- }
- Strcat_charp(vrulec, TK_VERTICALBAR(t->border_mode));
- case BORDER_NOWIN:
-#if defined(__EMX__)&&!defined(JP_CHARSET)
- Strcat_charp(vruleb, CodePage==850?"³":TN_VERTICALBAR);
-#else
- Strcat_charp(vruleb, TN_VERTICALBAR);
-#endif
- for (i = 0; i < t->cellpadding; i++)
- Strcat_char(vruleb, ' ');
- break;
- case BORDER_NONE:
- for (i = 0; i < t->cellspacing; i++)
- Strcat_char(vruleb, ' ');
- }
-
- for (r = 0; r <= t->maxrow; r++) {
- for (h = 0; h < t->tabheight[r]; h++) {
- renderbuf = Strnew();
- if (t->border_mode == BORDER_THIN || t->border_mode == BORDER_THICK)
- Strcat(renderbuf, vrulea);
-#ifdef ID_EXT
- if (t->tridvalue[r] != NULL && h == 0) {
- idtag = Sprintf("<_id id=\"%s\">", (t->tridvalue[r])->ptr);
- Strcat(renderbuf, idtag);
- }
-#endif /* ID_EXT */
- for (i = 0; i <= t->maxcol; i++) {
- check_row(t, r);
-#ifdef ID_EXT
- if (t->tabidvalue[r][i] != NULL && h == 0) {
- idtag = Sprintf("<_id id=\"%s\">", (t->tabidvalue[r][i])->ptr);
- Strcat(renderbuf, idtag);
- }
-#endif /* ID_EXT */
- if (!(t->tabattr[r][i] & HTT_X)) {
- w = t->tabwidth[i];
- for (j = i + 1;
- j <= t->maxcol && (t->tabattr[r][j] & HTT_X);
- j++)
- w += t->tabwidth[j] + t->cellspacing;
- if (t->tabattr[r][i] & HTT_Y) {
- for (j = r - 1;
- j >= 0 && t->tabattr[j] && (t->tabattr[j][i] & HTT_Y);
- j--);
- print_item(t, j, i, w, renderbuf);
- }
- else
- print_item(t, r, i, w, renderbuf);
- }
- if (i < t->maxcol && !(t->tabattr[r][i + 1] & HTT_X))
- Strcat(renderbuf, vruleb);
- }
- switch (t->border_mode) {
- case BORDER_THIN:
- case BORDER_THICK:
- Strcat(renderbuf, vrulec);
- Strcat_charp(renderbuf, "<eol>");
- maxheight += 1;
- break;
- case BORDER_NONE:
- case BORDER_NOWIN:
- Strcat_charp(renderbuf, "<eol>");
- break;
- }
- HTMLlineproc1(renderbuf->ptr, h_env);
- }
- if (r < t->maxrow && t->border_mode != BORDER_NONE) {
- renderbuf = Strnew();
- print_sep(t, r, T_MIDDLE, t->maxcol, renderbuf);
- HTMLlineproc1(renderbuf->ptr, h_env);
- }
- maxheight += t->tabheight[r];
- }
- if (t->border_mode == BORDER_THIN || t->border_mode == BORDER_THICK) {
- renderbuf = Strnew();
- print_sep(t, t->maxrow, T_BOTTOM, t->maxcol, renderbuf);
- HTMLlineproc1(renderbuf->ptr, h_env);
- maxheight += 1;
- }
- if (maxheight == 0)
- HTMLlineproc1(" <eol>", h_env);
- HTMLlineproc1("</pre>", h_env);
-}
-
-
-struct table *
-begin_table(int border, int spacing, int padding)
-{
- struct table *t;
- int mincell = minimum_cellspacing(border);
-
- t = newTable();
- t->row = t->col = -1;
- t->maxcol = -1;
- t->maxrow = -1;
- t->border_mode = border;
- t->flag = 0;
- if (border == BORDER_NOWIN)
- t->flag |= TBL_EXPAND_OK;
- t->cellspacing = max(spacing, mincell);
- switch (border) {
- case BORDER_THIN:
- case BORDER_THICK:
- case BORDER_NOWIN:
- t->cellpadding = (t->cellspacing - mincell) / 2;
- break;
- case BORDER_NONE:
- t->cellpadding = t->cellspacing - mincell;
- }
-
- if (padding > t->cellpadding)
- t->cellpadding = padding;
-
- switch (border) {
- case BORDER_THIN:
- case BORDER_THICK:
- case BORDER_NOWIN:
- t->cellspacing = 2 * t->cellpadding + mincell;
- break;
- case BORDER_NONE:
- t->cellspacing = t->cellpadding + mincell;
- }
- return t;
-}
-
-static void
-check_minimum0(struct table *t, int min)
-{
- int i, w, ww;
- struct table_cell *cell;
-
- if (t->col < 0)
- return;
- if (t->tabwidth[t->col] < 0)
- return;
- check_row(t, t->row);
- w = table_colspan(t, t->row, t->col);
- min += t->indent;
- if (w == 1)
- ww = min;
- else {
- cell = &t->cell;
- ww = 0;
- if (cell->icell >= 0 && cell->minimum_width[cell->icell] < min)
- cell->minimum_width[cell->icell] = min;
- }
- for (i = t->col;
- i <= t->maxcol && (i == t->col || (t->tabattr[t->row][i] & HTT_X));
- i++) {
- if (t->minimum_width[i] < ww)
- t->minimum_width[i] = ww;
- }
-}
-
-static int
-setwidth0(struct table *t, struct table_mode *mode)
-{
- int w;
- int width = t->tabcontentssize;
- struct table_cell *cell = &t->cell;
-
- if (t->col < 0)
- return -1;
- if (t->tabwidth[t->col] < 0)
- return -1;
- check_row(t, t->row);
- if (t->linfo.prev_spaces > 0)
- width -= t->linfo.prev_spaces;
- w = table_colspan(t, t->row, t->col);
- if (w == 1) {
- if (t->tabwidth[t->col] < width)
- t->tabwidth[t->col] = width;
- }
- else if (cell->icell >= 0) {
- if (cell->width[cell->icell] < width)
- cell->width[cell->icell] = width;
- }
- return width;
-}
-
-static void
-setwidth(struct table *t, struct table_mode *mode)
-{
- int width = setwidth0(t, mode);
- if (width < 0)
- return;
-#ifdef NOWRAP
- if (t->tabattr[t->row][t->col] & HTT_NOWRAP)
- check_minimum0(t, width);
-#endif /* NOWRAP */
- if (mode->pre_mode & (TBLM_NOBR | TBLM_PRE | TBLM_PRE_INT) &&
- mode->nobr_offset >= 0)
- check_minimum0(t, width - mode->nobr_offset);
-}
-
-static void
-addcontentssize(struct table *t, int width)
-{
-
- if (t->col < 0)
- return;
- if (t->tabwidth[t->col] < 0)
- return;
- check_row(t, t->row);
- t->tabcontentssize += width;
-}
-
-static void
-clearcontentssize(struct table *t, struct table_mode *mode)
-{
- mode->nobr_offset = 0;
- t->linfo.prev_spaces = -1;
- t->linfo.prevchar = ' ';
- t->tabcontentssize = 0;
-}
-
-void
-check_rowcol(struct table *tbl)
-{
- if (!(tbl->flag & TBL_IN_ROW)) {
- tbl->flag |= TBL_IN_ROW;
- tbl->row++;
- if (tbl->row > tbl->maxrow)
- tbl->maxrow = tbl->row;
- tbl->col = -1;
- }
- if (tbl->row == -1)
- tbl->row = 0;
- if (tbl->col == -1)
- tbl->col = 0;
-
- for (;; tbl->row++) {
- check_row(tbl, tbl->row);
- for (; tbl->col < MAXCOL &&
- tbl->tabattr[tbl->row][tbl->col] & (HTT_X | HTT_Y);
- tbl->col++);
- if (tbl->col < MAXCOL)
- break;
- tbl->col = 0;
- }
- if (tbl->row > tbl->maxrow)
- tbl->maxrow = tbl->row;
- if (tbl->col > tbl->maxcol)
- tbl->maxcol = tbl->col;
-
- tbl->flag |= TBL_IN_COL;
-}
-
-int
-skip_space(struct table *t, char *line, struct table_linfo *linfo,
- int checkminimum)
-{
- int skip = 0, s = linfo->prev_spaces;
- Lineprop ctype = linfo->prev_ctype, prev_ctype;
- char prevchar = linfo->prevchar;
- int w = (linfo->prev_spaces == -1) ? 0 : linfo->length;
- int min = 1;
-
- if (*line == '<' && line[strlen(line) - 1] == '>') {
- if (checkminimum)
- check_minimum0(t, visible_length(line));
- return 0;
- }
-
- while (*line) {
- char c = *line, *save = line;
- int ec = '\0', len = 1, wlen = 1;
- prev_ctype = ctype;
- ctype = get_ctype(c, prev_ctype);
- if (min < w)
- min = w;
- if (ctype == PC_ASCII && IS_SPACE(c)) {
- w = 0;
- s++;
- }
- else {
- if (c == '&') {
- ec = getescapechar(&line);
- if (ec) {
- c = ec;
- if (IS_CNTRL(ec))
- ctype = PC_CTRL;
- else
- ctype = PC_ASCII;
- len = strlen(conv_latin1(ec));
- wlen = line - save;
- }
- }
- if (prevchar && is_boundary(prevchar, prev_ctype, c, ctype)) {
- w = len;
- }
- else {
- w += len;
- }
- if (s > 0) {
-#ifdef JP_CHARSET
- if (ctype == PC_KANJI1 && prev_ctype == PC_KANJI2)
- skip += s;
- else
-#endif /* JP_CHARSET */
- skip += s - 1;
- }
- s = 0;
- }
- prevchar = c;
- line = save + wlen;
- }
- if (s > 1) {
- skip += s - 1;
- linfo->prev_spaces = 1;
- }
- else {
- linfo->prev_spaces = s;
- }
- linfo->prev_ctype = ctype;
- linfo->prevchar = prevchar;
-
- if (checkminimum) {
- if (min < w)
- min = w;
- linfo->length = w;
- check_minimum0(t, min);
- }
- return skip;
-}
-
-#define TAG_ACTION_NONE 0
-#define TAG_ACTION_FEED 1
-#define TAG_ACTION_TABLE 2
-#define TAG_ACTION_N_TABLE 3
-
-static int
-feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width)
-{
- int cmd;
- char *s_line;
- struct table_cell *cell = &tbl->cell;
- struct parsed_tagarg *t_arg, *t;
- int colspan, rowspan;
- int col, prev_col;
- int i, j, k, v, v0, w, id, status;
- Str tok, tmp, anchor;
- table_attr align;
-
- s_line = line;
- cmd = gethtmlcmd(&s_line, &status);
-
- if (mode->pre_mode & TBLM_IGNORE) {
- switch (cmd) {
- case HTML_N_STYLE:
- mode->pre_mode &= ~TBLM_STYLE;
- case HTML_N_SCRIPT:
- mode->pre_mode &= ~TBLM_SCRIPT;
- default:
- return TAG_ACTION_NONE;
- }
- }
-
-#ifdef MENU_SELECT
- /* failsafe: a tag other than <option></option>and </select> in *
- * <select> environment is regarded as the end of <select>. */
- if (mode->pre_mode & TBLM_INSELECT) {
- switch (cmd) {
- case HTML_TABLE:
- case HTML_N_TABLE:
- case HTML_TR:
- case HTML_N_TR:
- case HTML_TD:
- case HTML_N_TD:
- case HTML_TH:
- case HTML_N_TH:
- case HTML_THEAD:
- case HTML_N_THEAD:
- case HTML_TBODY:
- case HTML_N_TBODY:
- case HTML_TFOOT:
- case HTML_N_TFOOT:
- case HTML_COLGROUP:
- case HTML_N_COLGROUP:
- case HTML_COL:
- mode->pre_mode &= ~TBLM_INSELECT;
- tmp = process_n_select();
- feed_table1(tbl, tmp, mode, width);
- }
- }
-#endif /* MENU_SELECT */
-
- switch (cmd) {
- case HTML_TABLE:
- return TAG_ACTION_TABLE;
- case HTML_N_TABLE:
- return TAG_ACTION_N_TABLE;
- case HTML_TR:
- if (tbl->col >= 0 && tbl->tabcontentssize > 0)
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- mode->caption = 0;
- mode->indent_level = 0;
- mode->nobr_level = 0;
- mode->mode_level = 0;
- mode->pre_mode = 0;
- tbl->col = -1;
- tbl->row++;
- tbl->flag |= TBL_IN_ROW;
- tbl->indent = 0;
- align = 0;
- t_arg = parse_tag(line + 3);
- for (t = t_arg; t; t = t->next) {
- if (!strcasecmp(t->arg, "align") && t->value) {
- if (!strcasecmp(t->value, "left"))
- align = (HTT_LEFT | HTT_TRSET);
- else if (!strcasecmp(t->value, "right"))
- align = (HTT_RIGHT | HTT_TRSET);
- else if (!strcasecmp(t->value, "center"))
- align = (HTT_CENTER | HTT_TRSET);
- }
-#ifdef ID_EXT
- if (!strcasecmp(t->arg, "id") && t->value) {
- tbl->tridvalue[tbl->row] = Strnew_charp(t->value);
- }
-#endif /* ID_EXT */
- }
- tbl->trattr = align;
- break;
- case HTML_TH:
- case HTML_TD:
- prev_col = tbl->col;
- if (tbl->col >= 0 && tbl->tabcontentssize > 0)
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- mode->caption = 0;
- mode->indent_level = 0;
- mode->nobr_level = 0;
- mode->mode_level = 0;
- mode->pre_mode = 0;
- tbl->flag |= TBL_IN_COL;
- tbl->linfo.prev_spaces = -1;
- tbl->linfo.prevchar = ' ';
- tbl->linfo.prev_ctype = PC_ASCII;
- tbl->indent = 0;
- if (tbl->row == -1) {
- /* for broken HTML... */
- tbl->row = -1;
- tbl->col = -1;
- tbl->maxrow = tbl->row;
- }
- if (tbl->col == -1) {
- if (!(tbl->flag & TBL_IN_ROW)) {
- tbl->row++;
- tbl->flag |= TBL_IN_ROW;
- }
- if (tbl->row > tbl->maxrow)
- tbl->maxrow = tbl->row;
- }
- tbl->col++;
- check_row(tbl, tbl->row);
- while (tbl->tabattr[tbl->row][tbl->col]) {
- tbl->col++;
- }
- if (tbl->col > MAXCOL - 1) {
- tbl->col = prev_col;
- return TAG_ACTION_NONE;
- }
- if (tbl->col > tbl->maxcol) {
- tbl->maxcol = tbl->col;
- }
- tbl->height = 0;
- t_arg = parse_tag(line + 3);
- colspan = rowspan = 1;
- v = 0;
- if (tbl->trattr & HTT_TRSET)
- align = (tbl->trattr & HTT_ALIGN);
- else if (cmd == HTML_TH)
- align = HTT_CENTER;
- else
- align = HTT_LEFT;
- for (t = t_arg; t; t = t->next) {
- if (!strcasecmp(t->arg, "rowspan") && t->value) {
- rowspan = atoi(t->value);
- if ((tbl->row + rowspan) >= tbl->max_rowsize)
- check_row(tbl, tbl->row + rowspan);
- }
- else if (!strcasecmp(t->arg, "colspan") && t->value) {
- colspan = atoi(t->value);
- if ((tbl->col + colspan) >= MAXCOL) {
- /* Can't expand column */
- colspan = MAXCOL - tbl->col;
- }
- }
- else if (!strcasecmp(t->arg, "align") && t->value) {
- if (!strcasecmp(t->value, "left"))
- align = HTT_LEFT;
- else if (!strcasecmp(t->value, "right"))
- align = HTT_RIGHT;
- else if (!strcasecmp(t->value, "center"))
- align = HTT_CENTER;
- }
-#ifdef NOWRAP
- else if (!strcasecmp(t->arg, "nowrap"))
- tbl->tabattr[tbl->row][tbl->col] |= HTT_NOWRAP;
-#endif /* NOWRAP */
- else if (!strcasecmp(t->arg, "width") && t->value) {
- if (IS_DIGIT(*t->value)) {
- v = atoi(t->value);
- if (v == 0)
- v = 1;
- else if (v < 0)
- v = 0;
- if (t->value[strlen(t->value) - 1] == '%') {
- v = -v;
- }
- else {
-#ifdef TABLE_EXPAND
- v = max(v / tbl->ppc, 1);
-#else /* not TABLE_EXPAND */
- v = v / PIXEL_PER_CHAR;
-#endif /* not TABLE_EXPAND */
- }
- }
- else
- continue;
-#ifdef ID_EXT
- }
- else if (!strcasecmp(t->arg, "id") && t->value) {
- tbl->tabidvalue[tbl->row][tbl->col] = Strnew_charp(t->value);
-#endif /* ID_EXT */
- }
- }
-#ifdef NOWRAP
- if (v != 0) {
- /* NOWRAP and WIDTH= conflicts each other */
- tbl->tabattr[tbl->row][tbl->col] &= ~HTT_NOWRAP;
- }
-#endif /* NOWRAP */
- tbl->tabattr[tbl->row][tbl->col] &= ~HTT_ALIGN;
- tbl->tabattr[tbl->row][tbl->col] |= align;
- if (colspan > 1) {
- col = tbl->col;
-
- cell->icell = cell->maxcell + 1;
- k = dsort_index(colspan, cell->colspan, col, cell->col, MAXCOL,
- cell->index, cell->icell);
- if (k <= cell->maxcell) {
- i = cell->index[k];
- if (cell->col[i] == col &&
- cell->colspan[i] == colspan)
- cell->icell = i;
- }
- if (cell->icell > cell->maxcell && cell->icell < MAXCELL) {
- cell->maxcell++;
- cell->col[cell->maxcell] = col;
- cell->colspan[cell->maxcell] = colspan;
- cell->width[cell->maxcell] = 0;
- cell->minimum_width[cell->maxcell] = 0;
- cell->fixed_width[cell->maxcell] = 0;
- if (cell->maxcell > k)
- bcopy(cell->index + k, cell->index + k + 1, cell->maxcell - k);
- cell->index[k] = cell->maxcell;
- }
- if (cell->icell > cell->maxcell)
- cell->icell = -1;
- }
- if (v != 0) {
- if (colspan == 1) {
- v0 = tbl->fixed_width[tbl->col];
- if (v0 == 0 || (v0 > 0 && v > v0) || (v0 < 0 && v < v0)) {
-#ifdef TABLE_DEBUG
- fprintf(stderr, "width(%d) = %d\n", tbl->col, v);
-#endif /* TABLE_DEBUG */
- tbl->fixed_width[tbl->col] = v;
- }
- }
- else if (cell->icell >= 0) {
- v0 = cell->fixed_width[cell->icell];
- if (v0 == 0 || (v0 > 0 && v > v0) || (v0 < 0 && v < v0))
- cell->fixed_width[cell->icell] = v;
- }
- }
- for (i = 0; i < rowspan; i++) {
- check_row(tbl, tbl->row + i);
- for (j = 0; j < colspan; j++) {
- tbl->tabattr[tbl->row + i][tbl->col + j] &= ~(HTT_X | HTT_Y);
- tbl->tabattr[tbl->row + i][tbl->col + j] |=
- ((i > 0) ? HTT_Y : 0) | ((j > 0) ? HTT_X : 0);
- if (tbl->col + j > tbl->maxcol) {
- tbl->maxcol = tbl->col + j;
- }
- }
- if (tbl->row + i > tbl->maxrow) {
- tbl->maxrow = tbl->row + i;
- }
- }
- break;
- case HTML_N_TR:
- setwidth(tbl, mode);
- tbl->col = -1;
- tbl->flag &= ~(TBL_IN_ROW | TBL_IN_COL);
- return TAG_ACTION_NONE;
- case HTML_N_TH:
- case HTML_N_TD:
- setwidth(tbl, mode);
- tbl->flag &= ~TBL_IN_COL;
-#ifdef TABLE_DEBUG
- {
- TextListItem *it;
- int i = tbl->col, j = tbl->row;
- fprintf(stderr, "(a) row,col: %d, %d\n", j, i);
- if (tbl->tabdata[j] && tbl->tabdata[j][i]) {
- for (it = tbl->tabdata[j][i]->first; it; it = it->next)
- fprintf(stderr, " [%s] \n", it->ptr);
- }
- }
-#endif
- return TAG_ACTION_NONE;
- case HTML_P:
- case HTML_BR:
- case HTML_DT:
- case HTML_DD:
- case HTML_CENTER:
- case HTML_N_CENTER:
- case HTML_DIV:
- case HTML_N_DIV:
- case HTML_H:
- case HTML_N_H:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- if (cmd == HTML_DD)
- addcontentssize(tbl, tbl->indent);
- break;
- case HTML_DL:
- case HTML_BLQ:
- case HTML_OL:
- case HTML_UL:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- mode->indent_level++;
- if (mode->indent_level <= MAX_INDENT_LEVEL)
- tbl->indent += INDENT_INCR;
- if (cmd == HTML_BLQ) {
- check_minimum0(tbl, 0);
- addcontentssize(tbl, tbl->indent);
- }
- break;
- case HTML_N_DL:
- case HTML_N_BLQ:
- case HTML_N_OL:
- case HTML_N_UL:
- if (mode->indent_level > 0) {
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- mode->indent_level--;
- if (mode->indent_level < MAX_INDENT_LEVEL)
- tbl->indent -= INDENT_INCR;
- }
- break;
- case HTML_LI:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- check_minimum0(tbl, 0);
- addcontentssize(tbl, tbl->indent);
- break;
- case HTML_PRE:
- case HTML_LISTING:
- case HTML_XMP:
- setwidth(tbl, mode);
- check_rowcol(tbl);
- clearcontentssize(tbl, mode);
- pushdata(tbl, tbl->row, tbl->col, line);
- mode->pre_mode |= TBLM_PRE;
- mode->mode_level++;
- break;
- case HTML_N_PRE:
- case HTML_N_LISTING:
- case HTML_N_XMP:
- setwidth(tbl, mode);
- check_rowcol(tbl);
- clearcontentssize(tbl, mode);
- pushdata(tbl, tbl->row, tbl->col, line);
- if (mode->mode_level > 0)
- mode->mode_level--;
- if (mode->mode_level == 0)
- mode->pre_mode &= ~TBLM_PRE;
- tbl->linfo.prev_spaces = 0;
- tbl->linfo.prevchar = '\0';
- tbl->linfo.prev_ctype = PC_ASCII;
- break;
- case HTML_NOBR:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- if (!(mode->pre_mode & TBLM_NOBR)) {
- mode->nobr_offset = -1;
- mode->pre_mode |= TBLM_NOBR;
- }
- mode->nobr_level++;
- break;
- case HTML_WBR:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- mode->nobr_offset = -1;
- break;
- case HTML_N_NOBR:
- if (mode->nobr_level > 0)
- mode->nobr_level--;
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- if (mode->nobr_level == 0)
- mode->pre_mode &= ~TBLM_NOBR;
- break;
- case HTML_PRE_INT:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- if (!(mode->pre_mode & TBLM_PRE_INT)) {
- mode->nobr_offset = -1;
- mode->pre_mode |= TBLM_PRE_INT;
- }
- tbl->linfo.prev_spaces = 0;
- break;
- case HTML_N_PRE_INT:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- mode->pre_mode &= ~TBLM_PRE_INT;
- break;
- case HTML_IMG:
- tok = process_img(parse_tag(line + 3));
- feed_table1(tbl, tok, mode, width);
- break;
-#ifdef NEW_FORM
- case HTML_FORM:
- process_form(parse_tag(line));
- break;
- case HTML_N_FORM:
- process_n_form();
- break;
-#else /* not NEW_FORM */
- case HTML_FORM:
- case HTML_N_FORM:
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, "<br>");
- setwidth(tbl, mode);
- clearcontentssize(tbl, mode);
- if (line[1] == '/') {
- tok = Strnew_charp("</form_int ");
- Strcat_charp(tok, line + 6);
- }
- else {
- tok = Strnew_charp("<form_int ");
- Strcat_charp(tok, line + 5);
- }
- pushdata(tbl, tbl->row, tbl->col, tok->ptr);
- break;
-#endif /* not NEW_FORM */
- case HTML_INPUT:
- tmp = process_input(parse_tag(line + 6));
- feed_table1(tbl, tmp, mode, width);
- break;
- case HTML_SELECT:
- t_arg = parse_tag(line + 7);
- tmp = process_select(t_arg);
- feed_table1(tbl, tmp, mode, width);
-#ifdef MENU_SELECT
- if (!tag_exists(t_arg, "multiple")) /* non-multiple select */
- mode->pre_mode |= TBLM_INSELECT;
-#endif /* MENU_SELECT */
- break;
- case HTML_N_SELECT:
-#ifdef MENU_SELECT
- mode->pre_mode &= ~TBLM_INSELECT;
-#endif /* MENU_SELECT */
- tmp = process_n_select();
- feed_table1(tbl, tmp, mode, width);
- break;
- case HTML_OPTION:
- tmp = process_option(parse_tag(line + 7));
- if (tmp)
- feed_table1(tbl, tmp, mode, width);
-#ifdef MENU_SELECT
- else
- feed_select(line);
-#endif /* MENU_SELECT */
- break;
- case HTML_TEXTAREA:
- w = 0;
- check_rowcol(tbl);
- if (tbl->col + 1 <= tbl->maxcol &&
- tbl->tabattr[tbl->row][tbl->col + 1] & HTT_X) {
- if (cell->icell >= 0 && cell->fixed_width[cell->icell] > 0)
- w = cell->fixed_width[cell->icell];
- }
- else {
- if (tbl->fixed_width[tbl->col] > 0)
- w = tbl->fixed_width[tbl->col];
- }
- tmp = process_textarea(parse_tag(line + 9), w);
- feed_table1(tbl, tmp, mode, width);
- mode->pre_mode |= TBLM_INTXTA;
- break;
- case HTML_N_TEXTAREA:
- mode->pre_mode &= ~TBLM_INTXTA;
- tmp = process_n_textarea();
- feed_table1(tbl, tmp, mode, width);
- break;
- case HTML_A:
- anchor = NULL;
- check_rowcol(tbl);
- t_arg = parse_tag(line + 2);
- i = 0;
- for (t = t_arg; t; t = t->next) {
- if (strcasecmp(t->arg, "href") == 0 && t->value) {
- anchor = Strnew_charp(t->value);
- }
- else if (strcasecmp(t->arg, "hseq") == 0 && t->value) {
- i = atoi(t->value);
- }
- }
- if (i == 0 && anchor) {
- Str tmp = process_anchor(line);
- pushdata(tbl, tbl->row, tbl->col, tmp->ptr);
- if (mode->pre_mode & (TBLM_PRE | TBLM_NOBR))
- addcontentssize(tbl, 1);
- else
- check_minimum0(tbl, 1);
- setwidth(tbl, mode);
- }
- else {
- pushdata(tbl, tbl->row, tbl->col, line);
- }
- break;
- case HTML_DEL:
- case HTML_N_DEL:
- case HTML_INS:
- case HTML_N_INS:
- pushdata(tbl, tbl->row, tbl->col, line);
- i = 5;
- check_minimum0(tbl, i);
- addcontentssize(tbl, i);
- setwidth(tbl, mode);
- break;
- case HTML_DUMMY_TABLE:
- id = -1;
- w = 0;
- t_arg = parse_tag(line + 12);
- for (t = t_arg; t; t = t->next) {
- if (!strcasecmp(t->arg, "id") && t->value) {
- id = atoi(t->value);
- }
- else if (!strcasecmp(t->arg, "width") && t->value) {
- w = atoi(t->value);
- }
- }
- if (id >= 0) {
- setwidth(tbl, mode);
- check_rowcol(tbl);
- pushdata(tbl, tbl->row, tbl->col, line);
- clearcontentssize(tbl, mode);
- addcontentssize(tbl, maximum_table_width(tbl->tables[id].ptr));
- check_minimum0(tbl, minimum_table_width(tbl->tables[id].ptr));
- if (w > 0)
- check_minimum0(tbl, w);
- else
- check_minimum0(tbl, fixed_table_width(tbl->tables[id].ptr));
- setwidth0(tbl, mode);
- clearcontentssize(tbl, mode);
- }
- break;
- case HTML_CAPTION:
- mode->caption = 1;
- break;
- case HTML_N_CAPTION:
- mode->caption = 0;
- break;
- case HTML_THEAD:
- case HTML_N_THEAD:
- case HTML_TBODY:
- case HTML_N_TBODY:
- case HTML_TFOOT:
- case HTML_N_TFOOT:
- case HTML_COLGROUP:
- case HTML_N_COLGROUP:
- case HTML_COL:
- break;
- case HTML_SCRIPT:
- mode->pre_mode |= TBLM_SCRIPT;
- break;
- case HTML_STYLE:
- mode->pre_mode |= TBLM_STYLE;
- break;
- default:
- /* unknown tag: put into table */
- return TAG_ACTION_FEED;
- }
- return TAG_ACTION_NONE;
-}
-
-
-int
-feed_table(struct table *tbl, char **tline, struct table_mode *mode, int width)
-{
- int i;
- char *line;
- char *p;
- Str tok, tmp;
- struct table_linfo *linfo = &tbl->linfo;
-
- if (*tline == NULL || **tline == '\0')
- return -1;
-
- tok = Strnew();
- if (tbl->suspended_input->length > 0) {
- Strcat_charp(tbl->suspended_input, *tline);
- *tline = tbl->suspended_input->ptr;
- tbl->suspended_input = Strnew();
- tbl->status = R_ST_NORMAL;
- }
- while (read_token(tok, tline, &tbl->status, mode->pre_mode & TBLM_PREMODE, 0)) {
- if (ST_IS_COMMENT(tbl->status)) {
- continue;
- }
- else if (tbl->status != R_ST_NORMAL) {
- /* line ended within tag */
- int l = tok->length;
- if (tok->ptr[l - 1] == '\n') {
- Strchop(tok);
- if (ST_IS_REAL_TAG(tbl->status))
- Strcat_char(tok, ' ');
- }
- tbl->suspended_input = Strdup(tok);
- return -1;
- }
- line = tok->ptr;
- if (mode->caption && !TAG_IS(line, "</caption", 9)) {
- Strcat(tbl->caption, tok);
- continue;
- }
- if (*line == '<') {
- int action = feed_table_tag(tbl, line, mode, width);
- if (action == TAG_ACTION_NONE)
- continue;
- else if (action == TAG_ACTION_N_TABLE)
- return 0;
- else if (action == TAG_ACTION_TABLE) {
- *tline -= tok->length;
- return 1;
- }
- }
- if (mode->pre_mode & TBLM_IGNORE)
- continue;
- if (mode->pre_mode & TBLM_INTXTA) {
- feed_textarea(line);
- continue;
- }
-#ifdef MENU_SELECT
- if (mode->pre_mode & TBLM_INSELECT) {
- feed_select(line);
- continue;
- }
-#endif /* MENU_SELECT */
- /* convert &...; if it is latin-1 character */
- if (!(*line == '<' && line[strlen(line) - 1] == '>') &&
- strchr(line, '&') != NULL) {
- tmp = Strnew();
- for (p = line; *p;) {
- char *q, *r;
- if (*p == '&') {
- if (!strncasecmp(p, "&", 5) ||
- !strncasecmp(p, ">", 4) ||
- !strncasecmp(p, "<", 4)) {
- /* do not convert */
- Strcat_char(tmp, *p);
- p++;
- }
- else {
- q = p;
- r = getescapecmd(&p);
- if (r != NULL && ((*r & 0x80) || IS_CNTRL(*r))) {
- /* latin-1 character */
- Strcat_charp(tmp, r);
- }
- else {
- Strcat_char(tmp, *q);
- p = q + 1;
- }
- }
- }
- else {
- Strcat_char(tmp, *p);
- p++;
- }
- }
- line = tmp->ptr;
- }
- if (!(mode->pre_mode & (TBLM_PRE | TBLM_PRE_INT))) {
- if (!(tbl->flag & TBL_IN_COL)) {
- linfo->prev_spaces = -1;
- linfo->prev_ctype = PC_ASCII;
- }
- if (linfo->prev_spaces != 0)
- while (IS_SPACE(*line))
- line++;
- if (*line == '\0')
- continue;
- check_rowcol(tbl);
- if (mode->pre_mode & TBLM_NOBR && mode->nobr_offset < 0)
- mode->nobr_offset = tbl->tabcontentssize;
-
- /* count of number of spaces skipped in normal mode */
- i = skip_space(tbl, line, linfo, !(mode->pre_mode & TBLM_NOBR));
- addcontentssize(tbl, visible_length(line) - i);
- setwidth(tbl, mode);
- }
- else {
- /* <pre> mode or something like it */
- check_rowcol(tbl);
- if (mode->pre_mode & TBLM_PRE_INT && mode->nobr_offset < 0)
- mode->nobr_offset = tbl->tabcontentssize;
- i = maximum_visible_length(line);
- addcontentssize(tbl, i);
- setwidth(tbl, mode);
- if (!(mode->pre_mode & TBLM_PRE_INT)) {
- p = line + strlen(line) - 1;
- if (*p == '\r' || *p == '\n')
- clearcontentssize(tbl, mode);
- }
- }
- pushdata(tbl, tbl->row, tbl->col, line);
- }
- if (ST_IS_COMMENT(tbl->status))
- return 2;
- else
- return -1;
-}
-
-void
-feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width)
-{
- char *p;
- if (!tok)
- return;
- p = tok->ptr;
- feed_table(tbl, &p, mode, width);
-}
-
-void
-pushTable(struct table *tbl, struct table *tbl1)
-{
- int col;
- int row;
-
- check_rowcol(tbl);
- col = tbl->col;
- row = tbl->row;
-
- if (tbl->ntable >= tbl->tables_size) {
- struct table_in *tmp;
- tbl->tables_size += MAX_TABLE_N;
- tmp = New_N(struct table_in, tbl->tables_size);
- if (tbl->tables)
-#ifdef __CYGWIN__
- bcopy((const char *) tbl->tables, (char *) tmp, (size_t) tbl->ntable * sizeof(struct table_in));
-#else /* not __CYGWIN__ */
- bcopy(tbl->tables, tmp, tbl->ntable * sizeof(struct table_in));
-#endif /* not __CYGWIN__ */
- tbl->tables = tmp;
- }
-
- tbl->tables[tbl->ntable].ptr = tbl1;
- tbl->tables[tbl->ntable].col = col;
- tbl->tables[tbl->ntable].row = row;
- tbl->tables[tbl->ntable].indent = tbl->indent;
- tbl->tables[tbl->ntable].buf = newTextList();
- check_row(tbl, row);
- if (col + 1 <= tbl->maxcol &&
- tbl->tabattr[row][col + 1] & HTT_X)
- tbl->tables[tbl->ntable].cell = tbl->cell.icell;
- else
- tbl->tables[tbl->ntable].cell = -1;
- tbl->ntable++;
-}
-
-#ifdef MATRIX
-int
-correct_table_matrix(struct table *t, int col, int cspan, int a, double b)
-{
- int i, j;
- int ecol = col + cspan;
- double w = 1. / (b * b);
-
- for (i = col; i < ecol; i++) {
- v_add_val(t->vector, i, w * a);
- for (j = i; j < ecol; j++) {
- m_add_val(t->matrix, i, j, w);
- m_set_val(t->matrix, j, i, m_entry(t->matrix, i, j));
- }
- }
- return i;
-}
-
-static void
-correct_table_matrix2(struct table *t, int col, int cspan, double s, double b)
-{
- int i, j;
- int ecol = col + cspan;
- int size = t->maxcol + 1;
- double w = 1. / (b * b);
- double ss;
-
- for (i = 0; i < size; i++) {
- for (j = i; j < size; j++) {
- if (i >= col && i < ecol && j >= col && j < ecol)
- ss = (1. - s) * (1. - s);
- else if ((i >= col && i < ecol) || (j >= col && j < ecol))
- ss = -(1. - s) * s;
- else
- ss = s * s;
- m_add_val(t->matrix, i, j, w * ss);
- }
- }
-}
-
-static void
-correct_table_matrix3(struct table *t, int col, char *flags, double s, double b)
-{
- int i, j;
- double ss;
- int size = t->maxcol + 1;
- double w = 1. / (b * b);
- int flg = (flags[col] == 0);
-
- for (i = 0; i < size; i++) {
- if (!((flg && flags[i] == 0) || (!flg && flags[i] != 0)))
- continue;
- for (j = i; j < size; j++) {
- if (!((flg && flags[j] == 0) || (!flg && flags[j] != 0)))
- continue;
- if (i == col && j == col)
- ss = (1. - s) * (1. - s);
- else if (i == col || j == col)
- ss = -(1. - s) * s;
- else
- ss = s * s;
- m_add_val(t->matrix, i, j, w * ss);
- }
- }
-}
-
-static void
-set_table_matrix0(struct table *t, int maxwidth)
-{
- int size = t->maxcol + 1;
- int i, j, k, bcol, ecol;
- int swidth, width, a;
- double w0, w1, w, s, b;
-#ifdef __GNUC__
- double we[size];
- char expand[size];
-#else /* not __GNUC__ */
- double we[MAXCOL];
- char expand[MAXCOL];
-#endif /* not __GNUC__ */
- struct table_cell *cell = &t->cell;
-
- w0 = 0.;
- for (i = 0; i < size; i++) {
- we[i] = weight(t->tabwidth[i]);
- w0 += we[i];
- }
- if (w0 <= 0.)
- w0 = 1.;
-
- if (cell->necell == 0) {
- for (i = 0; i < size; i++) {
- s = we[i] / w0;
- b = sigma_td_nw((int) (s * maxwidth));
- correct_table_matrix2(t, i, 1, s, b);
- }
- return;
- }
-
- bzero(expand, size);
-
- for (k = 0; k < cell->necell; k++) {
- j = cell->eindex[k];
- bcol = cell->col[j];
- ecol = bcol + cell->colspan[j];
- swidth = 0;
- for (i = bcol; i < ecol; i++) {
- swidth += t->tabwidth[i];
- expand[i]++;
- }
- width = cell->width[j] - (cell->colspan[j] - 1) * t->cellspacing;
- w = weight(width);
- w1 = 0.;
- for (i = bcol; i < ecol; i++)
- w1 += we[i];
- s = w / (w0 + w - w1);
- a = (int) (s * maxwidth);
- b = sigma_td_nw(a);
- correct_table_matrix2(t, bcol, cell->colspan[j], s, b);
- }
-
- w1 = 0.;
- for (i = 0; i < size; i++)
- if (expand[i] == 0)
- w1 += we[i];
- for (i = 0; i < size; i++) {
- if (expand[i] == 0) {
- s = we[i] / max(w1, 1.);
- b = sigma_td_nw((int) (s * maxwidth));
- }
- else {
- s = we[i] / max(w0 - w1, 1.);
- b = sigma_td_nw(maxwidth);
- }
- correct_table_matrix3(t, i, expand, s, b);
- }
-}
-
-void
-set_table_matrix(struct table *t, int width)
-{
- int size = t->maxcol + 1;
- int i, j;
- double b, s;
- int a;
- struct table_cell *cell = &t->cell;
-
- if (size < 1)
- return;
-
- t->matrix = m_get(size, size);
- t->vector = v_get(size);
- for (i = 0; i < size; i++) {
- for (j = i; j < size; j++)
- m_set_val(t->matrix, i, j, 0.);
- v_set_val(t->vector, i, 0.);
- }
-
- for (i = 0; i < size; i++) {
- if (t->fixed_width[i] > 0) {
- a = max(t->fixed_width[i], t->minimum_width[i]);
- b = sigma_td(a);
- correct_table_matrix(t, i, 1, a, b);
- }
- else if (t->fixed_width[i] < 0) {
- s = -(double) t->fixed_width[i] / 100.;
- b = sigma_td((int) (s * width));
- correct_table_matrix2(t, i, 1, s, b);
- }
- }
-
- for (j = 0; j <= cell->maxcell; j++) {
- if (cell->fixed_width[j] > 0) {
- a = max(cell->fixed_width[j], cell->minimum_width[j]);
- b = sigma_td(a);
- correct_table_matrix(t, cell->col[j],
- cell->colspan[j], a, b);
- }
- else if (cell->fixed_width[j] < 0) {
- s = -(double) cell->fixed_width[j] / 100.;
- b = sigma_td((int) (s * width));
- correct_table_matrix2(t, cell->col[j],
- cell->colspan[j], s, b);
- }
- }
-
- set_table_matrix0(t, width);
-
- if (t->total_width > 0) {
- b = sigma_table(width);
- }
- else {
- b = sigma_table_nw(width);
- }
- correct_table_matrix(t, 0, size, width, b);
-}
-#endif /* MATRIX */
diff --git a/table.h b/table.h
@@ -119,12 +119,13 @@ struct table {
#define TBLM_NOBR 2
#define TBLM_XMP 4
#define TBLM_LST 8
+#define TBLM_PLAINTEXT 16
#define TBLM_PRE_INT 32
#define TBLM_INTXTA 64
#define TBLM_INSELECT 128
-#define TBLM_PREMODE (TBLM_PRE|TBLM_INTXTA|TBLM_INSELECT|TBLM_XMP|TBLM_LST)
-#define TBLM_SPECIAL (TBLM_PRE|TBLM_PRE_INT|TBLM_XMP|TBLM_LST)
-#define TBLM_PLAIN (TBLM_XMP|TBLM_LST)
+#define TBLM_PREMODE (TBLM_PRE|TBLM_INTXTA|TBLM_INSELECT|TBLM_PLAIN)
+#define TBLM_SPECIAL (TBLM_PRE|TBLM_PRE_INT|TBLM_PLAIN)
+#define TBLM_PLAIN (TBLM_PLAINTEXT|TBLM_XMP|TBLM_LST)
#define TBLM_SCRIPT 256
#define TBLM_STYLE 512
#define TBLM_IGNORE (TBLM_SCRIPT|TBLM_STYLE)
diff --git a/terms.c b/terms.c
@@ -17,7 +17,13 @@
#include <gpm.h>
#endif /* USE_GPM */
#ifdef USE_SYSMOUSE
+#include <osreldate.h>
+#if (__FreeBSD_version >= 400017)
+#include <sys/consio.h>
+#include <sys/fbio.h>
+#else
#include <machine/console.h>
+#endif
int (*sysm_handler) (int x, int y, int nbs, int obs);
static int cwidth = 8, cheight = 16;
static int xpix, ypix, nbs, obs = 0;
@@ -185,8 +191,6 @@ static Screen *ScreenElem = NULL, **ScreenImage = NULL;
static l_prop CurrentMode = 0;
static int graph_enabled = 0;
-char DisplayCode = DISPLAY_CODE;
-
static char gcmap[96];
extern int tgetent(char *, char *);
@@ -250,7 +254,6 @@ set_tty(void)
void
ttymode_set(int mode, int imode)
{
- int er;
TerminalMode ioval;
TerminalGet(tty, &ioval);
@@ -259,9 +262,8 @@ ttymode_set(int mode, int imode)
IMODEFLAG(ioval) |= imode;
#endif /* not SGTTY */
- er = TerminalSet(tty, &ioval);
-
- if (er == -1) {
+ while (TerminalSet(tty, &ioval) == -1) {
+ if (errno == EINTR || errno == EAGAIN) continue;
printf("Error occured while set %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -270,7 +272,6 @@ ttymode_set(int mode, int imode)
void
ttymode_reset(int mode, int imode)
{
- int er;
TerminalMode ioval;
TerminalGet(tty, &ioval);
@@ -279,9 +280,8 @@ ttymode_reset(int mode, int imode)
IMODEFLAG(ioval) &= ~imode;
#endif /* not SGTTY */
- er = TerminalSet(tty, &ioval);
-
- if (er == -1) {
+ while (TerminalSet(tty, &ioval) == -1) {
+ if (errno == EINTR || errno == EAGAIN) continue;
printf("Error occured while reset %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -291,13 +291,12 @@ ttymode_reset(int mode, int imode)
void
set_cc(int spec, int val)
{
- int er;
TerminalMode ioval;
TerminalGet(tty, &ioval);
ioval.c_cc[spec] = val;
- er = TerminalSet(tty, &ioval);
- if (er == -1) {
+ while (TerminalSet(tty, &ioval) == -1) {
+ if (errno == EINTR || errno == EAGAIN) continue;
printf("Error occured: errno=%d\n", errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -340,7 +339,7 @@ reset_exit(SIGNAL_ARG)
if (mouseActive)
mouse_end();
#endif /* MOUSE */
- exit(0);
+ w3m_exit(0);
SIGNAL_RETURN;
}
@@ -427,7 +426,7 @@ getTCstr(void)
if (suc == NULL)
GETSTR(T_kl, "kl");
}
- GETSTR(T_cr, "cr"); /* carrige return */
+ GETSTR(T_cr, "cr"); /* carriage return */
GETSTR(T_ta, "ta"); /* tab */
GETSTR(T_sc, "sc"); /* save cursor */
GETSTR(T_rc, "rc"); /* restore cursor */
@@ -451,12 +450,16 @@ getTCstr(void)
GETSTR(T_op, "op"); /* set default color pair to its original
* * * * * * * value */
#ifdef CYGWIN
-/* for TERM=pcansi on MS-DOS prompt. * T_as = "\033[12m"; * T_ae =
- * "\033[10m"; * T_ac =
- * "l\001k\002m\003j\004x\005q\006n\020a\024v\025w\026u\027t\031"; */
- T_as[0] = '\0';
- T_ae[0] = '\0';
- T_ac[0] = '\0';
+/* for TERM=pcansi on MS-DOS prompt.
+ T_eA = "";
+ T_as = "\033[12m";
+ T_ae = "\033[10m";
+ T_ac = "l\001k\002m\003j\004x\005q\006n\020a\024v\025w\026u\027t\031";
+*/
+ T_eA = "";
+ T_as = "";
+ T_ae = "";
+ T_ac = "";
#endif /* CYGWIN */
LINES = COLS = 0;
@@ -539,8 +542,8 @@ setupscreen(void)
if (COLS + 1 > max_COLS) {
max_COLS = COLS + 1;
for (i = 0; i < max_LINES; i++) {
- ScreenElem[i].lineimage = New_N(char, max_COLS);
- ScreenElem[i].lineprop = New_N(l_prop, max_COLS);
+ ScreenElem[i].lineimage = NewAtom_N(char, max_COLS);
+ ScreenElem[i].lineprop = NewAtom_N(l_prop, max_COLS);
}
}
for (i = 0; i < LINES; i++) {
@@ -722,9 +725,6 @@ addch(char c)
l_prop *pr;
int dest, i;
short *dirty;
-#ifdef __EMX__
- extern int CodePage;
-#endif
if (CurColumn == COLS)
wrap();
@@ -846,7 +846,7 @@ addch(char c)
else if (c == '\n') {
wrap();
}
- else if (c == '\r') { /* Carrige return */
+ else if (c == '\r') { /* Carriage return */
CurColumn = 0;
}
else if (c == '\b' && CurColumn > 0) { /* Backspace */
@@ -1090,13 +1090,13 @@ refresh(void)
|| (!(pr[col] & S_BCOLORED) && (mode & S_BCOLORED))
#endif /* BG_COLOR */
|| (!(pr[col] & S_GRAPHICS) && (mode & S_GRAPHICS))) {
- if ((!(pr[col] & S_COLORED) && (mode & S_COLORED))
+ if ((mode & S_COLORED)
#ifdef BG_COLOR
- || (!(pr[col] & S_BCOLORED) && (mode & S_BCOLORED))
+ || (mode & S_BCOLORED)
#endif /* BG_COLOR */
)
writestr(T_op);
- if (!(pr[col] & S_GRAPHICS) && (mode & S_GRAPHICS))
+ if (mode & S_GRAPHICS)
writestr(T_ae);
writestr(T_me);
mode &= ~M_MEND;
@@ -1108,18 +1108,6 @@ refresh(void)
else if (pcol != col)
MOVE(line, col);
- if ((pr[col] & S_COLORED) && (pr[col] ^ mode) & COL_FCOLOR) {
- color = (pr[col] & COL_FCOLOR);
- mode = ((mode & ~COL_FCOLOR) | color);
- writestr(color_seq(color));
- }
-#ifdef BG_COLOR
- if ((pr[col] & S_BCOLORED) && (pr[col] ^ mode) & COL_BCOLOR) {
- bcolor = (pr[col] & COL_BCOLOR);
- mode = ((mode & ~COL_BCOLOR) | bcolor);
- writestr(bcolor_seq(bcolor));
- }
-#endif /* BG_COLOR */
if ((pr[col] & S_STANDOUT) && !(mode & S_STANDOUT)) {
writestr(T_so);
mode |= S_STANDOUT;
@@ -1132,6 +1120,18 @@ refresh(void)
writestr(T_md);
mode |= S_BOLD;
}
+ if ((pr[col] & S_COLORED) && (pr[col] ^ mode) & COL_FCOLOR) {
+ color = (pr[col] & COL_FCOLOR);
+ mode = ((mode & ~COL_FCOLOR) | color);
+ writestr(color_seq(color));
+ }
+#ifdef BG_COLOR
+ if ((pr[col] & S_BCOLORED) && (pr[col] ^ mode) & COL_BCOLOR) {
+ bcolor = (pr[col] & COL_BCOLOR);
+ mode = ((mode & ~COL_BCOLOR) | bcolor);
+ writestr(bcolor_seq(bcolor));
+ }
+#endif /* BG_COLOR */
if ((pr[col] & S_GRAPHICS) && !(mode & S_GRAPHICS)) {
if (!graph_enabled) {
graph_enabled = 1;
@@ -1561,7 +1561,12 @@ getch(void)
{
char c;
- read(tty, &c, 1);
+ while (read(tty, &c, 1) < (int)1) {
+ if (errno == EINTR || errno == EAGAIN) continue;
+ /* error happend on read(2) */
+ quitfm();
+ break; /* unreachable */
+ }
return c;
}
@@ -1610,7 +1615,7 @@ sysm_getch()
int
do_getch()
{
- if (is_xterm)
+ if (is_xterm || ! sysm_handler)
return getch();
else
return sysm_getch();
@@ -1760,6 +1765,7 @@ mouse_init()
mi.operation = MOUSE_MODE;
mi.u.mode.mode = 0;
mi.u.mode.signal = SIGUSR2;
+ sysm_handler = NULL;
if (ioctl(tty, CONS_MOUSECTL, &mi) != -1) {
signal(SIGUSR2, sysmouse);
mi.operation = MOUSE_SHOW;
diff --git a/terms.h b/terms.h
@@ -3,8 +3,6 @@
extern int LINES, COLS;
-extern char DisplayCode;
-
#define CODE_ASCII '\0'
#define CODE_EUC 'E'
#define CODE_SJIS 'S'
@@ -25,14 +23,6 @@ extern char DisplayCode;
#define STR_JIS_J "ISO-2022-JP (JIS C 6226 + '\033(H')"
#define STR_INNER_EUC "EUC-JP (internal)"
-#if defined(__EMX__)&&!defined(JP_CHARSET)
-/*
- * Following definitions are valid only for the OS/2 native console
- */
-#define CODE_850 '8' /* code page 850 */
-#define CODE_PC 'P' /* another code pages */
-#endif /* __EMX__ */
-
#define CODE_JIS(x) ((x)==CODE_JIS_n||(x)==CODE_JIS_m||(x)==CODE_JIS_N||(x)==CODE_JIS_j||(x)==CODE_JIS_J)
#endif /* not TERMS_H */
diff --git a/ucs_eucjp.h b/ucs_eucjp.h
@@ -0,0 +1,119 @@
+static entity_map ucs_eucjp_map[] =
+{
+ { 0x0152, "OE" },
+ { 0x0153, "oe" },
+ { 0x0178, "Y:" },
+ { 0x0192, "f" },
+ { 0x02C6, "^" },
+ { 0x02DC, "~" },
+ { 0x0391, "¦¡" },
+ { 0x0392, "¦¢" },
+ { 0x0393, "¦£" },
+ { 0x0394, "¦¤" },
+ { 0x0395, "¦¥" },
+ { 0x0396, "¦¦" },
+ { 0x0397, "¦§" },
+ { 0x0398, "¦¨" },
+ { 0x0399, "¦©" },
+ { 0x039A, "¦ª" },
+ { 0x039B, "¦«" },
+ { 0x039C, "¦¬" },
+ { 0x039D, "¦" },
+ { 0x039E, "¦®" },
+ { 0x039F, "¦¯" },
+ { 0x03A0, "¦°" },
+ { 0x03A1, "¦±" },
+ { 0x03A3, "¦²" },
+ { 0x03A4, "¦³" },
+ { 0x03A5, "¦´" },
+ { 0x03A6, "¦µ" },
+ { 0x03A7, "¦¶" },
+ { 0x03A8, "¦·" },
+ { 0x03A9, "¦¸" },
+ { 0x03B1, "¦Á" },
+ { 0x03B2, "¦Â" },
+ { 0x03B3, "¦Ã" },
+ { 0x03B4, "¦Ä" },
+ { 0x03B5, "¦Å" },
+ { 0x03B6, "¦Æ" },
+ { 0x03B7, "¦Ç" },
+ { 0x03B8, "¦È" },
+ { 0x03B9, "¦É" },
+ { 0x03BA, "¦Ê" },
+ { 0x03BB, "¦Ë" },
+ { 0x03BC, "¦Ì" },
+ { 0x03BD, "¦Í" },
+ { 0x03BE, "¦Î" },
+ { 0x03BF, "¦Ï" },
+ { 0x03C0, "¦Ð" },
+ { 0x03C1, "¦Ñ" },
+ { 0x03C2, "¦Ò" },
+ { 0x03C3, "¦Ò" },
+ { 0x03C4, "¦Ó" },
+ { 0x03C5, "¦Ô" },
+ { 0x03C6, "¦Õ" },
+ { 0x03C7, "¦Ö" },
+ { 0x03C8, "¦×" },
+ { 0x03C9, "¦Ø" },
+ { 0x2002, " " },
+ { 0x2003, " " },
+ { 0x2013, "¡¾" },
+ { 0x2014, "¡Ý" },
+ { 0x2018, "¡Æ" },
+ { 0x2019, "¡Ç" },
+ { 0x201A, "," },
+ { 0x201C, "¡È" },
+ { 0x201D, "¡É" },
+ { 0x201E, ",," },
+ { 0x2020, "¢÷" },
+ { 0x2021, "¢ø" },
+ { 0x2022, "¡¦" },
+ { 0x2026, "¡Ä" },
+ { 0x2030, "¢ó" },
+ { 0x2032, "¡ì" },
+ { 0x2033, "¡í" },
+ { 0x2039, "¡ã" },
+ { 0x203A, "¡ä" },
+ { 0x203E, "¡±" },
+ { 0x2044, "/" },
+ { 0x20AC, "=C=" },
+ { 0x2122, "TM" },
+ { 0x2190, "¢«" },
+ { 0x2191, "¢¬" },
+ { 0x2192, "¢ª" },
+ { 0x2193, "¢" },
+ { 0x21D2, "¢Í" },
+ { 0x21D4, "¢Î" },
+ { 0x2200, "¢Ï" },
+ { 0x2202, "¢ß" },
+ { 0x2203, "¢Ð" },
+ { 0x2205, "¦Õ" },
+ { 0x2207, "¢à" },
+ { 0x2208, "¢º" },
+ { 0x220B, "¢»" },
+ { 0x220F, "¦°" },
+ { 0x2211, "¦²" },
+ { 0x2212, "¡Ý" },
+ { 0x221A, "¢å" },
+ { 0x221D, "¢ç" },
+ { 0x221E, "¡ç" },
+ { 0x2220, "¢Ü" },
+ { 0x2227, "¢Ê" },
+ { 0x2228, "¢Ë" },
+ { 0x2229, "¢Á" },
+ { 0x222A, "¢À" },
+ { 0x222B, "¢é" },
+ { 0x2234, "¡è" },
+ { 0x223C, "¡Á" },
+ { 0x2260, "¡â" },
+ { 0x2261, "¢á" },
+ { 0x2264, "¡å" },
+ { 0x2265, "¡æ" },
+ { 0x2282, "¢¾" },
+ { 0x2283, "¢¿" },
+ { 0x2286, "¢¼" },
+ { 0x2287, "¢½" },
+ { 0x22A5, "¢Ý" },
+ { 0x25CA, "¡þ" },
+ { 0x2666, "¢¡" },
+};
diff --git a/ucs_latin1.h b/ucs_latin1.h
@@ -0,0 +1,36 @@
+static entity_map ucs_latin1_map[] =
+{
+ { 0x0152, "OE" },
+ { 0x0153, "oe" },
+ { 0x0178, "Y:" },
+ { 0x0192, "f" },
+ { 0x02C6, "^" },
+ { 0x02DC, "~" },
+ { 0x03BC, "\xB5" },
+ { 0x2002, " " },
+ { 0x2003, " " },
+ { 0x2013, "\xAD" },
+ { 0x2014, "-" },
+ { 0x2018, "`" },
+ { 0x2019, "'" },
+ { 0x201A, "\xB8" },
+ { 0x201C, "\"" },
+ { 0x201D, "\"" },
+ { 0x201E, ",," },
+ { 0x2022, "*" },
+ { 0x2030, "0/00" },
+ { 0x2032, "'" },
+ { 0x2033, "\"" },
+ { 0x2039, "<" },
+ { 0x203A, ">" },
+ { 0x2044, "/" },
+ { 0x20AC, "=C=" },
+ { 0x2122, "TM" },
+ { 0x2205, "\xF8" },
+ { 0x2212, "-" },
+ { 0x223C, "~" },
+ { 0x2260, "!=" },
+ { 0x2261, "=" },
+ { 0x2264, "<=" },
+ { 0x2265, ">=" },
+};
diff --git a/url.c b/url.c
@@ -54,7 +54,7 @@ static int
21, /* ftp */
21, /* ftpdir */
0, /* local - not defined */
- 0, /* ??? - not defined? */
+ 0, /* local-CGI - not defined? */
0, /* exec - not defined? */
119, /* nntp */
119, /* news */
@@ -71,7 +71,7 @@ struct cmdtable schemetable[] =
{"ftp", SCM_FTP},
{"local", SCM_LOCAL},
{"file", SCM_LOCAL},
- {"exec", SCM_LOCAL_CGI}, /* ??? */
+/* {"exec", SCM_EXEC}, */
{"nntp", SCM_NNTP},
{"news", SCM_NEWS},
{"mailto", SCM_MAILTO},
@@ -276,7 +276,9 @@ openSSLHandle(int sock)
#endif /* defined(USE_SSL_VERIFY) */
SSL_CTX_set_default_verify_paths(ssl_ctx);
#endif /* SSLEAY_VERSION_NUMBER >= 0x0800 */
- atexit(free_ssl_ctx);
+/*** by inu
+ atexit(free_ssl_ctx);
+*/
}
handle = SSL_new(ssl_ctx);
SSL_set_fd(handle, sock);
@@ -362,7 +364,7 @@ openSocket(char *hostname,
MySignalHandler(*trap) ();
if (fmInitialized) {
- message(Sprintf("Opening socket...\n")->ptr, 0, 0);
+ message(Sprintf("Opening socket...")->ptr, 0, 0);
refresh();
}
if (SETJMP(AbortLoading) != 0) {
@@ -452,7 +454,7 @@ openSocket(char *hostname,
hostaddr.sin_family = AF_INET;
hostaddr.sin_port = s_port;
if (fmInitialized) {
- message(Sprintf("Connecting to %s\n", hostname)->ptr, 0, 0);
+ message(Sprintf("Connecting to %s", hostname)->ptr, 0, 0);
refresh();
}
if (connect(sock, (struct sockaddr *) &hostaddr,
@@ -467,7 +469,7 @@ openSocket(char *hostname,
char **h_addr_list;
int result;
if (fmInitialized) {
- message(Sprintf("Performing hostname lookup on %s\n", hostname)->ptr, 0, 0);
+ message(Sprintf("Performing hostname lookup on %s", hostname)->ptr, 0, 0);
refresh();
}
if ((entry = gethostbyname(hostname)) == NULL) {
@@ -489,7 +491,7 @@ openSocket(char *hostname,
adr & 0xff);
#endif
if (fmInitialized) {
- message(Sprintf("Connecting to %s\n", hostname)->ptr, 0, 0);
+ message(Sprintf("Connecting to %s", hostname)->ptr, 0, 0);
refresh();
}
if ((result = connect(sock, (struct sockaddr *) &hostaddr,
@@ -557,9 +559,8 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
{
char *p, *q;
Str tmp;
-#ifdef __EMX__
- int i;
-#endif
+
+ url = url_quote(url); /* quote 0x01-0x20, 0x7F-0xFF */
p = url;
p_url->scheme = SCM_MISSING;
@@ -569,6 +570,7 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
p_url->host = NULL;
p_url->is_nocache = 0;
p_url->file = NULL;
+ p_url->real_file = NULL;
p_url->label = NULL;
if (*url == '#') { /* label only */
@@ -576,35 +578,40 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
copyParsedURL(p_url, current);
goto do_label;
}
-#ifdef __EMX__
- for (i = 17; i > 0; i -= 10)
- if (!strncmp(url, "file://localhost/", i)) {
- p_url->scheme = SCM_LOCAL;
- p += i;
- url += i;
- break;
- }
- if (*url == '/' && IS_ALPHA(url[1]) && (url[2] == ':' || url[2] == '|')) {
- ++p;
- ++url;
+#if defined( __EMX__ ) || defined( __CYGWIN__ )
+ if (!strncmp(url, "file://localhost/", 17)) {
+ p_url->scheme = SCM_LOCAL;
+ p += 17 - 1;
+ url += 17 - 1;
}
- if (IS_ALPHA(*url) && (url[1] == ':' || url[1] == '|')) {
+#endif
+#ifdef SUPPORT_DOS_DRIVE_PREFIX
+ if (IS_ALPHA(*p) && (p[1] == ':' || p[1] == '|')) {
p_url->scheme = SCM_LOCAL;
- p_url->file = p = allocStr(url, 0);
- if (p[1] == '|')
- p[1] = ':';
- }
- if (p_url->scheme == SCM_LOCAL)
goto analyze_file;
-#endif
+ }
+#endif /* SUPPORT_DOS_DRIVE_PREFIX */
/* search for scheme */
p_url->scheme = getURLScheme(&p);
if (p_url->scheme == SCM_MISSING) { /* scheme not found */
- if (current)
+ if (current) {
copyParsedURL(p_url, current);
- else
+ if (p_url->scheme == SCM_LOCAL_CGI)
+ p_url->scheme = SCM_LOCAL;
+ } else
p_url->scheme = SCM_LOCAL;
p = url;
+ if (!strncmp(p,"//",2)) {
+ /* URL begins with // */
+ /* it means that 'scheme:' is abbreviated */
+#ifdef __CYGWIN__
+ /* in CYGWIN, '//host/share' doesn't means 'http://host/share' */
+ p_url->scheme = SCM_LOCAL;
+ goto analyze_file;
+#endif /* __CYGWIN__ */
+ p += 2;
+ goto analyze_url;
+ }
goto analyze_file;
}
/* get host and port */
@@ -626,15 +633,17 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
goto analyze_file;
}
#endif
-#ifdef CYGWIN
- goto analyze_file; /* file://DRIVE/foo or *
- * file://machine/share/foo */
-#endif /* CYGWIN */
+#if defined( __CYGWIN__ ) && defined( SUPPORT_DOS_DRIVE_PREFIX )
+ if (IS_ALPHA(p[2]) && (p[3] == ':' || p[3] == '|'))
+ p += 2;
+ goto analyze_file; /* file://DRIVE/foo or
+ file://machine/share/foo */
+#endif /* __CYGWIN__ && SUPPORT_DOS_DRIVE_PREFIX */
}
p += 2; /* scheme://foo */
analyze_url:
q = p;
- while (*p && *p != ':' && *p != '/' && *p != '@') {
+ while (*p && *p != ':' && *p != '/' && *p != '@' && *p != '?') {
#ifdef INET6
if (*p == '[') { /* rfc2732 compliance */
char *p_colon = NULL;
@@ -689,6 +698,7 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
q = ++p;
goto analyze_url;
case '/': /* scheme://host/... */
+ case '?':
/* scheme://user@host/... */
/* scheme://user:pass@host/... */
p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE);
@@ -704,12 +714,29 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
}
#endif
analyze_file:
+#ifndef __CYGWIN__
if (p_url->scheme == SCM_LOCAL && p_url->user == NULL &&
p_url->host != NULL && strcmp(p_url->host, "localhost")) {
p_url->scheme = SCM_FTP; /* ftp://host/... */
if (p_url->port == 0)
p_url->port = DefaultPort[SCM_FTP];
}
+#endif
+#ifdef SUPPORT_DOS_DRIVE_PREFIX
+ if (p_url->scheme == SCM_LOCAL) {
+ q = p;
+ if (*q == '/')
+ q++;
+ if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) {
+ if (q[1] == '|') {
+ p = allocStr(q, 0);
+ p[1] = ':';
+ }
+ else
+ p = q;
+ }
+ }
+#endif
q = p;
#ifdef USE_GOPHER
@@ -812,6 +839,10 @@ copyParsedURL(ParsedURL * p, ParsedURL * q)
p->file = allocStr(q->file, 0);
else
p->file = NULL;
+ if (q->real_file)
+ p->real_file = allocStr(q->real_file, 0);
+ else
+ p->real_file = NULL;
if (q->label)
p->label = allocStr(q->label, 0);
else
@@ -850,7 +881,7 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
pu->scheme != SCM_NEWS &&
#endif /* USE_NNTP */
pu->file[0] != '/'
-#ifdef __EMX__
+#ifdef SUPPORT_DOS_DRIVE_PREFIX
&& !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0]) && pu->file[1] == ':')
#endif
) {
@@ -901,6 +932,9 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
}
#else
if (pu->scheme == SCM_LOCAL && pu->file[0] != '/' &&
+#if defined( __CYGWIN__ ) && defined( SUPPORT_DOS_DRIVE_PREFIX ) /* for 'drive:' */
+ ! (IS_ALPHA(pu->file[0]) && pu->file[1] == ':') &&
+#endif
strcmp(pu->file, "-")) {
tmp = Strnew_charp(CurrentDir);
if (Strlastchar(tmp) != '/')
@@ -928,13 +962,15 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
pu->file[0] == '/') {
pu->file = cleanupName(pu->file);
}
+ if (pu->scheme == SCM_LOCAL)
+ pu->real_file = cleanupName2(file_unquote(pu->file), FALSE);
}
}
static Str
_parsedURL2Str(ParsedURL * pu, int pass)
{
- Str tmp = Strnew();
+ Str tmp;
static char *scheme_str[] =
{
"http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "news", "mailto",
@@ -989,7 +1025,7 @@ _parsedURL2Str(ParsedURL * pu, int pass)
#ifdef USE_NNTP
pu->scheme != SCM_NEWS &&
#endif /* USE_NNTP */
-#ifdef __EMX__
+#ifdef SUPPORT_DOS_DRIVE_PREFIX
(pu->file == NULL || (pu->file[0] != '/' && pu->file[1] != ':')))
#else
(pu->file == NULL || pu->file[0] != '/'))
@@ -1043,7 +1079,7 @@ otherinfo(ParsedURL * target, ParsedURL * current, char *referer)
else
Strcat_charp(s, UserAgent);
Strcat_charp(s, "\r\n");
- Strcat_charp(s, "Accept: text/*, image/*, audio/*, application/*\r\n");
+ Strcat_charp(s, "Accept: text/*, image/*, audio/*, video/*, application/*\r\n");
Strcat_charp(s, "Accept-Encoding: gzip, compress, bzip, bzip2, deflate\r\n");
Strcat_charp(s, "Accept-Language: ");
if (AcceptLang != NULL && *AcceptLang != '\0') {
@@ -1064,7 +1100,7 @@ otherinfo(ParsedURL * target, ParsedURL * current, char *referer)
Strcat(s, Sprintf(":%d", target->port));
Strcat_charp(s, "\r\n");
}
- if (target->is_nocache) {
+ if (target->is_nocache || NoCache) {
Strcat_charp(s, "Pragma: no-cache\r\n");
Strcat_charp(s, "Cache-control: no-cache\r\n");
}
@@ -1145,15 +1181,22 @@ HTTPrequest(ParsedURL * pu, ParsedURL * current, HRequest * hr, TextList * extra
Strcat_charp(tmp, "\r\n");
}
else {
- Strcat_charp(tmp, "Content-type: application/x-www-form-urlencoded\r\n");
+ if (!override_content_type) {
+ Strcat_charp(tmp, "Content-type: application/x-www-form-urlencoded\r\n");
+ }
Strcat(tmp, Sprintf("Content-length: %ld\r\n", hr->request->length));
+ if (header_string)
+ Strcat (tmp, header_string);
Strcat_charp(tmp, "\r\n");
- Strcat_charp(tmp, hr->request->body);
+ Strcat_charp_n(tmp, hr->request->body, hr->request->length);
Strcat_charp(tmp, "\r\n");
}
}
- else
+ else {
+ if (header_string)
+ Strcat (tmp, header_string);
Strcat_charp(tmp, "\r\n");
+ }
#ifdef DEBUG
fprintf(stderr, "HTTPrequest: [ %s ]\n\n", tmp->ptr);
#endif /* DEBUG */
@@ -1183,9 +1226,9 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
URLOption * option, FormList * request, TextList * extra_header,
URLFile * ouf, unsigned char *status)
{
- Str tmp = Strnew();
- int sock;
- char *p, *q;
+ Str tmp;
+ int i, sock, scheme;
+ char *p, *q, *u;
URLFile uf;
HRequest hr;
#ifdef USE_SSL
@@ -1193,7 +1236,6 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
#endif /* USE_SSL */
#ifdef USE_NNTP
FILE *fw;
- int i;
char *r;
InputStream stream;
#endif /* USE_NNTP */
@@ -1205,14 +1247,21 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
init_stream(&uf, SCM_MISSING, NULL);
}
+ u = url;
+ scheme = getURLScheme(&u);
+ if (current == NULL && scheme == SCM_MISSING && ! ArgvIsURL)
+ u = file_to_url(url); /* force to local file */
+ else
+ u = url;
retry:
- parseURL2(url, pu, current);
+ parseURL2(u, pu, current);
if (pu->scheme == SCM_LOCAL && pu->file == NULL) {
if (pu->label != NULL) {
/* #hogege is not a label but a filename */
Str tmp2 = Strnew_charp("#");
Strcat_charp(tmp2, pu->label);
pu->file = tmp2->ptr;
+ pu->real_file = cleanupName2(file_unquote(pu->file), FALSE);
pu->label = NULL;
}
else {
@@ -1238,76 +1287,79 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
case SCM_LOCAL_CGI:
if (request && request->body) {
/* local CGI: POST */
- uf.stream = newFileStream(localcgi_post(pu->file, request, option->referer),
- (void (*)()) pclose);
+ uf.stream = newFileStream(localcgi_post(pu->real_file, request,
+ option->referer), (void (*)()) pclose);
if (uf.stream == NULL)
goto ordinary_local_file;
uf.is_cgi = TRUE;
- uf.scheme = SCM_LOCAL_CGI;
+ uf.scheme = pu->scheme = SCM_LOCAL_CGI;
}
- else if ((p = strchr(pu->file, '?')) != NULL) {
+ else if ((q = strchr(pu->file, '?')) != NULL) {
/* lodal CGI: GET */
- for (q = pu->file; *q && *q != '?'; q++)
- Strcat_char(tmp, *q);
- uf.stream = newFileStream(localcgi_get(tmp->ptr, p + 1, option->referer),
- (void (*)()) pclose);
+ p = Strnew_charp_n(pu->file, (int)(q - pu->file))->ptr;
+ pu->real_file = cleanupName2(file_unquote(p), FALSE);
+ uf.stream = newFileStream(localcgi_get(pu->real_file, q + 1,
+ option->referer), (void (*)()) pclose);
if (uf.stream == NULL) {
- pu->file = tmp->ptr;
+ pu->file = p;
goto ordinary_local_file;
}
uf.is_cgi = TRUE;
- uf.scheme = SCM_LOCAL_CGI;
+ uf.scheme = pu->scheme = SCM_LOCAL_CGI;
}
+ else if ((i = strlen(pu->file)) > 4 &&
#ifdef __EMX__
- else if (!strncmp(pu->file + strlen(pu->file) - 4, ".cmd", 4))
+ !strncmp(pu->file + i - 4, ".cmd", 4))
#else
- else if (!strncmp(pu->file + strlen(pu->file) - 4, ".cgi", 4))
+ !strncmp(pu->file + i - 4, ".cgi", 4))
#endif
{
/* lodal CGI: GET */
- uf.stream = newFileStream(localcgi_get(pu->file, "", option->referer),
- (void (*)()) pclose);
+ uf.stream = newFileStream(localcgi_get(pu->real_file, "",
+ option->referer), (void (*)()) pclose);
if (uf.stream == NULL)
goto ordinary_local_file;
uf.is_cgi = TRUE;
- uf.scheme = SCM_LOCAL_CGI;
+ uf.scheme = pu->scheme = SCM_LOCAL_CGI;
}
else {
ordinary_local_file:
- examineFile(pu->file, &uf);
+ examineFile(pu->real_file, &uf);
}
if (uf.stream == NULL) {
- if (dir_exist(pu->file)) {
+ if (dir_exist(pu->real_file)) {
add_index_file(pu, &uf);
if (uf.stream == NULL)
return uf;
}
else if (document_root != NULL) {
- Strcat_charp(tmp, document_root);
+ tmp = Strnew_charp(document_root);
if (Strlastchar(tmp) != '/' && pu->file[0] != '/')
Strcat_char(tmp, '/');
Strcat_charp(tmp, pu->file);
- tmp = Strnew_charp(cleanupName(tmp->ptr));
- if (dir_exist(tmp->ptr)) {
- pu->file = tmp->ptr;
+ p = cleanupName(tmp->ptr);
+ q = cleanupName2(file_unquote(p), FALSE);
+ if (dir_exist(q)) {
+ pu->file = p;
+ pu->real_file = q;
add_index_file(pu, &uf);
if (uf.stream == NULL) {
return uf;
}
}
else {
- examineFile(tmp->ptr, &uf);
- if (uf.stream)
- pu->file = tmp->ptr;
+ examineFile(q, &uf);
+ if (uf.stream) {
+ pu->file = p;
+ pu->real_file = q;
+ }
}
}
}
if (uf.stream == NULL && retryAsHttp && url[0] != '/') {
- char *u = url;
- int scheme = getURLScheme(&u);
if (scheme == SCM_MISSING || scheme == SCM_UNKNOWN) {
/* retry it as "http://" */
- url = Strnew_m_charp("http://", url, NULL)->ptr;
+ u = Strnew_m_charp("http://", url, NULL)->ptr;
goto retry;
}
}
@@ -1517,7 +1569,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
if (pu->file == NULL || *pu->file == '\0')
goto nntp_error;
/* first char of pu->file is '/' */
- group = Strnew_charp(pu->file + 1)->ptr;
+ group = url_unquote(Strnew_charp(pu->file + 1)->ptr);
p = strchr(group, '/');
if (p == NULL)
goto nntp_error;
@@ -1533,7 +1585,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
goto nntp_error;
fprintf(fw, "ARTICLE %s\r\n", p);
} else {
- fprintf(fw, "ARTICLE <%s>\r\n", pu->file);
+ fprintf(fw, "ARTICLE <%s>\r\n", url_unquote(pu->file));
}
fflush(fw);
tmp = StrISgets(stream);
@@ -1562,18 +1614,20 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
static void
add_index_file(ParsedURL * pu, URLFile *uf)
{
- Str tmp = Strnew_charp(pu->file);
+ char *p, *q;
if (index_file == NULL || index_file[0] == '\0') {
uf->stream = NULL;
return;
}
- Strcat_m_charp(tmp, "/", index_file, NULL);
- tmp->ptr = cleanupName(tmp->ptr);
- examineFile(tmp->ptr, uf);
+ p = Strnew_m_charp(pu->file, "/", file_quote(index_file), NULL)->ptr;
+ p = cleanupName(p);
+ q = cleanupName2(file_unquote(p), FALSE);
+ examineFile(q, uf);
if (uf->stream == NULL)
return;
- pu->file = tmp->ptr;
+ pu->file = p;
+ pu->real_file = q;
return;
}
diff --git a/version.c b/version.c
@@ -1,4 +1,4 @@
-#define CURRENT_VERSION "w3m/0.2.1"
+#define CURRENT_VERSION "w3m/0.2.1-inu-1.5"
#ifndef FM_H
char *version = CURRENT_VERSION;
diff --git a/w3m-doc/contain.wd b/w3m-doc/contain.wd
@@ -9,6 +9,6 @@ DOC.operation operation.html
DOC.configuration configuration.html
DOC.function function.html
DOC.FAQ faq.html
-DOC.developement developement.html
+DOC.development development.html
DOC.community community.html
@end
diff --git a/w3m-doc/detail.html.in b/w3m-doc/detail.html.in
@@ -21,9 +21,9 @@
<LI><A HREF="@DOC.configuration@">$B3F<o@_Dj(B</A>
<LI><A HREF="@DOC.function@">$B5!G=>\:Y(B</A>
<LI><A HREF="@DOC.FAQ@">FAQ</A>
- <LI><A HREF="@DOC.developement@">$B3+H/%I%-%e%a%s%H(B</A>
+ <LI><A HREF="@DOC.development@">$B3+H/%I%-%e%a%s%H(B</A>
<LI><A HREF="@DOC.community@">w3m $B%3%_%e%K%F%#(B</A>
- <LI><A HREF="@DOC.copyright@">Copiright</A>
+ <LI><A HREF="@DOC.copyright@">Copyright</A>
</UL>
<HR>
<A HREF="@DOC.index@">$B%H%C%W%Z%$%8$KLa$k(B</A>
diff --git a/w3m-doc/developement.html.in b/w3m-doc/developement.html.in
@@ -1,77 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-
-@include define.wd
-@include contain.wd
-
-<HEAD>
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-2022-jp">
-<TITLE>DEVELOPEMENT -$B3+H/%I%-%e%a%s%H(B-</TITLE>
-</HEAD>
-
-<BODY>
-
-<H1><A NAME="index">w3m$B3+H/%I%-%e%a%s%H(B</A></H1>
-<DIV>
-<!-- w3m$B$N3+H/$K4X$7$F$$$m$$$m$H5-$9(B -->
-</DIV>
- <UL>
- <LI><A HREF="#story">w3m$B$N3+H/$K$D$$$F(B</A>
- <LI><A HREF="#known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A>
- <LI><A HREF="#ToDo">ToDo</A>
- <LI><A HREF="#history">$BMzNr(B</A>
- <LI><A HREF="#policy">$B3+H/%]%j%7!<(B</A>
- <LI><A HREF="#tips">$B3+H/<T8~$1(BTips</A>
- </UL>
-
-<DIV>
-<A HREF="@DOC.index@">$B%H%C%W%Z%$%8$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="story">w3m$B$N3+H/$K$D$$$F(B</A></H2>
-<!-- doc-jp/STORY.html$B$+$i0zMQ(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A><H2>
-<!-- $B8=:_H=L@$7$F$$$k%P%0(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="ToDo">ToDo</A><H2>
-<!-- $B$d$i$M$P$J$i$s$3$H!?$d$m$&$+$J$!$J$3$H(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="history">$BMzNr(B</A><H2>
-<!-- w3m$B3+H/MzNr(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="policy">$B3+H/%]%j%7!<(B</A><H2>
-<!-- w3m$B$NL\;X$9$3$H!?3+H/>e$N$3$@$o$j(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<H2><A NAME="tips">$B3+H/<T8~$1(BTips</A><H2>
-<!-- w3m$B$r3+H/$9$k$&$($G$N>.5;(B -->
-<DIV>
-<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
-</DIV>
-<HR>
-
-<A HREF="@DOC.index@">$B%H%C%W%Z%$%8$KLa$k(B</A>
-
-</BODY>
-</HTML>
diff --git a/w3m-doc/development.html.in b/w3m-doc/development.html.in
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+
+@include define.wd
+@include contain.wd
+
+<HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-2022-jp">
+<TITLE>DEVELOPMENT -$B3+H/%I%-%e%a%s%H(B-</TITLE>
+</HEAD>
+
+<BODY>
+
+<H1><A NAME="index">w3m$B3+H/%I%-%e%a%s%H(B</A></H1>
+<DIV>
+<!-- w3m$B$N3+H/$K4X$7$F$$$m$$$m$H5-$9(B -->
+</DIV>
+ <UL>
+ <LI><A HREF="#story">w3m$B$N3+H/$K$D$$$F(B</A>
+ <LI><A HREF="#known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A>
+ <LI><A HREF="#ToDo">ToDo</A>
+ <LI><A HREF="#history">$BMzNr(B</A>
+ <LI><A HREF="#policy">$B3+H/%]%j%7!<(B</A>
+ <LI><A HREF="#tips">$B3+H/<T8~$1(BTips</A>
+ </UL>
+
+<DIV>
+<A HREF="@DOC.index@">$B%H%C%W%Z%$%8$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="story">w3m$B$N3+H/$K$D$$$F(B</A></H2>
+<!-- doc-jp/STORY.html$B$+$i0zMQ(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A><H2>
+<!-- $B8=:_H=L@$7$F$$$k%P%0(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="ToDo">ToDo</A><H2>
+<!-- $B$d$i$M$P$J$i$s$3$H!?$d$m$&$+$J$!$J$3$H(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="history">$BMzNr(B</A><H2>
+<!-- w3m$B3+H/MzNr(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="policy">$B3+H/%]%j%7!<(B</A><H2>
+<!-- w3m$B$NL\;X$9$3$H!?3+H/>e$N$3$@$o$j(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<H2><A NAME="tips">$B3+H/<T8~$1(BTips</A><H2>
+<!-- w3m$B$r3+H/$9$k$&$($G$N>.5;(B -->
+<DIV>
+<A HREF="#index">$B$3$N%Z!<%8$N@hF,$KLa$k(B</A>
+</DIV>
+<HR>
+
+<A HREF="@DOC.index@">$B%H%C%W%Z%$%8$KLa$k(B</A>
+
+</BODY>
+</HTML>
diff --git a/w3m-doc/index.html.in b/w3m-doc/index.html.in
@@ -86,14 +86,14 @@
<LI><A HREF="@DOC.FAQ@#faq">$B$h$/J9$+$l$k<ALd$H$=$NEz$((B</A>
<LI><A HREF="@DOC.FAQ@#tips">Tips</A>
</UL>
- <LI><A HREF="@DOC.developement@" NAME="developement">$B3+H/%I%-%e%a%s%H(B</A>
+ <LI><A HREF="@DOC.development@" NAME="development">$B3+H/%I%-%e%a%s%H(B</A>
<UL>
- <LI><A HREF="@DOC.developement@#story">w3m$B$N3+H/$K$D$$$F(B</A>
- <LI><A HREF="@DOC.developement@#known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A>
- <LI><A HREF="@DOC.developement@#ToDo">ToDo</A>
- <LI><A HREF="@DOC.developement@#history">$BMzNr(B</A>
- <LI><A HREF="@DOC.developement@#policy">$B3+H/%]%j%7!<(B</A>
- <LI><A HREF="@DOC.developement@#tips">$B3+H/<T8~$1(BTips</A>
+ <LI><A HREF="@DOC.development@#story">w3m$B$N3+H/$K$D$$$F(B</A>
+ <LI><A HREF="@DOC.development@#known_bugs">$B8=:_H=L@$7$F$$$k%P%0(B</A>
+ <LI><A HREF="@DOC.development@#ToDo">ToDo</A>
+ <LI><A HREF="@DOC.development@#history">$BMzNr(B</A>
+ <LI><A HREF="@DOC.development@#policy">$B3+H/%]%j%7!<(B</A>
+ <LI><A HREF="@DOC.development@#tips">$B3+H/<T8~$1(BTips</A>
</UL>
<LI><A HREF="@DOC.community@" NAME="community">w3m$B%3%_%e%K%F%#(B</A>
<UL>
diff --git a/w3mbookmark.c b/w3mbookmark.c
@@ -27,8 +27,8 @@ static char *bkmark_src2 = "<tr><td>New Section:</td><td><input type=text name=n
<tr><td>Title:</td><td><input type=text name=title value=\"%s\" width=60></td></tr>\n\
<tr><td><input type=submit name=submit value=\"ÅÐÏ¿\"></td>\n\
</table>\n\
-<input type=hidden name=cookie value=\"%s\">
-</form>
+<input type=hidden name=cookie value=\"%s\">\
+</form>\
</body></html>\n";
static char *default_section = "̤ʬÎà";
#else /* LANG != JA */
@@ -48,8 +48,8 @@ static char *bkmark_src2 = "<tr><td>New Section:</td><td><input type=text name=n
<tr><td>Title:</td><td><input type=text name=title value=\"%s\" width=60></td></tr>\n\
<tr><td><input type=submit name=submit value=\"ADD\"></td>\n\
</table>\n\
-<input type=hidden name=cookie value=\"%s\">
-</form>
+<input type=hidden name=cookie value=\"%s\">\
+</form>\
</body></html>\n";
static char *default_section = "Miscellaneous";
#endif /* LANG != JA */
@@ -84,6 +84,7 @@ print_bookmark_panel(char *bmark, char *url, char *title)
if ((f = fopen(bmark, "r")) != NULL) {
printf("<tr><td>Section:<td><select name=\"section\">\n");
while (tmp = Strfgets(f), tmp->length > 0) {
+ Strremovefirstspaces(tmp);
if (Strncasecmp_charp(tmp, "<h2>", 4) == 0) {
p = tmp->ptr + 4;
tmp2 = Strnew();
@@ -94,7 +95,7 @@ print_bookmark_panel(char *bmark, char *url, char *title)
}
printf("</select>\n");
}
- printf(bkmark_src2, htmlquote_str(url), htmlquote_str(title),Local_cookie);
+ printf(bkmark_src2, html_quote(url), html_quote(title),Local_cookie);
}
/* create new bookmark */
@@ -142,9 +143,9 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
/* Bookmark not added */
return FALSE;
}
- url = htmlquote_str(url);
- title = htmlquote_str(title);
- section = htmlquote_str(section);
+ url = html_quote(url);
+ title = html_quote(title);
+ section = html_quote(section);
f = fopen(bmark, "r");
if (f == NULL)
@@ -157,15 +158,19 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
break;
if (Strcasecmp(tmp, section_tmp) == 0)
section_found = 1;
- if (section_found && !bmark_added && Strcmp_charp(tmp, end_section) == 0) {
- pushText(tl, Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
- bmark_added = 1;
+ if (section_found && !bmark_added) {
+ Strremovefirstspaces(tmp);
+ if (Strcmp_charp(tmp, end_section) == 0) {
+ pushText(tl, Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
+ bmark_added = 1;
+ }
}
if (!bmark_added && Strcasecmp_charp(tmp, "</body>\n") == 0) {
pushText(tl, Sprintf("<h2>%s</h2>\n<ul>\n", section)->ptr);
pushText(tl, Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
pushText(tl, end_section);
pushText(tl, "</ul>\n");
+ bmark_added = 1;
}
pushText(tl, tmp->ptr);
}
diff --git a/w3mhelp-lynx_en.html b/w3mhelp-lynx_en.html
@@ -7,7 +7,7 @@
*******
<A HREF="http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/">
w3m</A>
- (WWW-wo-Miru) Version beta by
+ (WWW-wo-Miru) Version 0.2.1 by
<A HREF="mailto:aito@ei5sun.yz.yamagata-u.ac.jp">A.ITO</A> ********<BR>
***** Key assign table *****
</CENTER>
@@ -16,21 +16,26 @@ w3m</A>
<H3>Page/Cursor motion</H3>
<table cellpadding=0>
-<TR><TD WIDTH=100>SPC,C-v<TD>Forward page
-<TR><TD>b,ESC v<TD>Previous page
+<TR><TD WIDTH=100>SPC,C-v,+<TD>Forward page
+<TR><TD>b,ESC v,-<TD>Previous page
<TR><TD>l<TD>Cursor right
<TR><TD>h<TD>Cursor left
<TR><TD>j<TD>Cursor down
<TR><TD>k<TD>Cursor up
<TR><TD>J<TD>Roll up one line
<TR><TD>K<TD>Roll down one line
+<TR><TD>^<TD>Go to the beginning of line
+<TR><TD>$<TD>Go to the end of line
<TR><TD>><TD>Shift screen right
<TR><TD><<TD>Shift screen left
-<TR><TD>.<TD>Shift screen one column right
-<TR><TD>,<TD>Shift screen one column left
+<TR><TD>C-a<TD>Go to the first line
+<TR><TD>C-e<TD>Go to the last line
<TR><TD>G<TD>Go to the specified line
+<TR><TD>Z<TD>Move to the center line
+<TR><TD>z<TD>Move to the center column
<TR><TD>TAB,C-n,Down arrow<TD>Move to next hyperlink
-<TR><TD>ESC TAB,C-p,Up arrow<TD>Move to previous link
+<TR><TD>ESC TAB,C-p,Up arrow<TD>Move to previous hyperlink
+<TR><TD>C-g<TD>Show current page position
</table>
@@ -39,12 +44,14 @@ w3m</A>
<TR><TD WIDTH=100>RET, C-f, Right arrow<TD>Follow hyperlink
<TR><TD>d, ESC RET<TD>Save link to file
<TR><TD>u<TD>Peek link URL
+<TR><TD>i<TD>Peek image URL
<TR><TD>I<TD>View inline image
<TR><TD>ESC I<TD>Save inline image to file
<TR><TD>:<TD>Mark URL-like strings as anchors
<TR><TD>ESC :<TD>Mark Message-ID-like strings as news anchors
<TR><TD>c<TD>Peek current URL
-<TR><TD>=<TD>Display infomation about current document
+<TR><TD>=<TD>Display information about current document
+<TR><TD>C-h<TD>View history of URL
<TR><TD>F<TD>Render frame
<TR><TD>M<TD>Browse current document using external browser
(use 2M and 3M to invoke second and third browser)
@@ -64,8 +71,9 @@ w3m</A>
<table cellpadding=0>
<TR><TD WIDTH=100>B, C-b, Left arrow<TD>Back to the previous buffer
<TR><TD>\<TD>View HTML source
-<TR><TD>s, C-h<TD>Select buffer
+<TR><TD>s<TD>Select buffer
<TR><TD>E<TD>Edit buffer source
+<TR><TD>C-l, C-w<TD>Redraw screen
<TR><TD>R, C-r<TD>Reload buffer
<TR><TD>S, p<TD>Save buffer
<TR><TD>ESC s<TD>Save source
@@ -76,7 +84,7 @@ w3m</A>
<table cellpadding=0>
<TR><TD WIDTH=100>k, C-p<TD>Select previous buffer
<TR><TD>j, C-n<TD>Select next buffer
-<TR><TD>D<TD>Delect current buffer
+<TR><TD>D<TD>Delete current buffer
<TR><TD>RET<TD>Go to the selected buffer
</table>
@@ -88,23 +96,23 @@ w3m</A>
<H2>Search</H2>
<table cellpadding=0>
-<TR><TD WIDTH=100>/<TD>Search forward
-<TR><TD>?<TD>Search backward
+<TR><TD WIDTH=100>/, C-s<TD>Search forward
<TR><TD>n<TD>Search next
+<TR><TD>w<TD>Toggle wrap search mode
</table>
<H2>Mark operation</H2>
<table cellpadding=0>
<TR><TD WIDTH=100>C-SPC<TD>Set/unset mark
-<TR><TD>ESC p<TD>Go to previous mark
-<TR><TD>ESC n<TD>Go to next mark
+<TR><TD>P<TD>Go to previous mark
+<TR><TD>N<TD>Go to next mark
<TR><TD>"<TD>Mark by regular expression
</table>
<H2>Miscellany</H2>
<table cellpadding=0>
<TR><TD WIDTH=100>!<TD>Execute shell command
-<TR><TD>H<TD>Help (load this file)
+<TR><TD>H, ?<TD>Help (load this file)
<TR><TD>o<TD>Set option
<TR><TD>C-k<TD>Show cookie jar
<TR><TD>C-c<TD>Stop
diff --git a/w3mhelp-lynx_ja.html b/w3mhelp-lynx_ja.html
@@ -7,7 +7,7 @@
<CENTER>
*******
<A HREF="http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/">w3m</A>
- (WWW-wo-Miru) Version beta by
+ (WWW-wo-Miru) Version 0.2.1 by
<A HREF="mailto:aito@ei5sun.yz.yamagata-u.ac.jp">A.ITO(°ËÆ£¾´Â§)</A>
********
<BR>
@@ -18,22 +18,27 @@
<H3>¥Ú¡¼¥¸/¥«¡¼¥½¥ë°ÜÆ°</H3>
<table cellpadding=0>
-<TR><TD>SPC,C-v<TD>¼¡¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
-<TR><TD>b,ESC v<TD>Á°¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>SPC,C-v,+<TD>¼¡¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>b,ESC v,-<TD>Á°¤Î¥Ú¡¼¥¸¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>l<TD>¥«¡¼¥½¥ë¤ò±¦¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>h<TD>¥«¡¼¥½¥ë¤òº¸¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>j<TD>¥«¡¼¥½¥ë¤ò²¼¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>k<TD>¥«¡¼¥½¥ë¤ò¾å¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>J<TD>²èÌ̤ò1¹Ô¾å¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
<TR><TD>K<TD>²èÌ̤ò1¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡¥
+<TR><TD>^<TD>¹ÔƬ¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>$<TD>¹ÔËö¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>><TD>²èÌÌÁ´ÂΤò±¦¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤòº¸¤Ë¤º¤é¤¹)
<TR><TD><<TD>²èÌÌÁ´ÂΤòº¸¤Ë¤º¤é¤·¤Þ¤¹¡¥(ɽ¼¨ÆâÍƤò±¦¤Ë¤º¤é¤¹)
<TR><TD>C-a<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó¾å¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>C-e<TD>ʸ½ñ¤Î¤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>G<TD>²èÌ̲¼¤Ç¹ÔÈÖ¹æ¤òÆþÎϤ·¡¤¤½¤³¤Ç»ØÄꤷ¤¿¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
¤³¤³¤Ç $ ¤òÆþÎϤ¹¤ë¤È¡¤ºÇ½ª¹Ô¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>Z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>z<TD>¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>TAB, C-n, ²¼Ìð°õ<TD>¼¡¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>ESC TAB, C-p, ¾åÌð°õ<TD>Á°¤Î¥ê¥ó¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>C-g<TD>¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨¤·¤Þ¤¹¡¥
</table>
<H3>¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯Áàºî</H3>
@@ -41,6 +46,7 @@
<TR><TD WIDTH=100>RET, C-f, ±¦Ìð°õ<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤Îʸ½ñ¤òÆɤߤ³¤ß¤Þ¤¹¡¥
<TR><TD>d, ESC RET<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤Îʸ½ñ¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>u<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹Àè¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>i<TD>¥ê¥ó¥¯¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿²èÁü¤Ø¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>I<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤ËÂбþ¤¹¤ë²èÁü¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>ESC I<TD>¸½ºß¥«¡¼¥½¥ë¤¬¤¢¤ë¥ê¥ó¥¯¤¬»Ø¤¹²èÁü¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>:<TD>URLÉ÷¤Îʸ»úÎó¤ò¥ê¥ó¥¯¤Ë¤·¤Þ¤¹¡¥¤³¤Îµ¡Ç½¤Ï¡¤HTML¤Ç¤Ê¤¤Ê¸½ñ¤ò
@@ -48,6 +54,7 @@
<TR><TD>ESC :<TD>Message-IDÉ÷¤Îʸ»úÎó¤ò¡¤news: ¤Î¥ê¥ó¥¯¤Ë¤·¤Þ¤¹¡¥¤³¤Îµ¡Ç½¤Ï¡¤HTML¤Ç¤Ê¤¤Ê¸½ñ¤òÆɤó¤Ç¤¤¤ë¤È¤¤Ë¤â͸ú¤Ç¤¹¡¥
<TR><TD>c<TD>¸½ºß¤Îʸ½ñ¤ÎURL¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>=<TD>¸½ºß¤Îʸ½ñ¤Ë´Ø¤¹¤ë¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡¥
+<TR><TD>C-h<TD>URLÍúÎò¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>F<TD><FRAMESET>¤ò´Þ¤àʸ½ñ¤òɽ¼¨¤·¤Æ¤¤¤ë¤È¤¤Ë¡¤<FRAME>
¥¿¥°¤Î»Ø¤¹Ê£¿ô¤Îʸ½ñ¤ò1¤Ä¤Îʸ½ñ¤ËÊÑ´¹¤·¤Æɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>M<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ú¡¼¥¸¤ò¡¤³°Éô¥Ö¥é¥¦¥¶¤ò»È¤Ã¤Æɽ¼¨¤·¤Þ¤¹¡¥
@@ -68,8 +75,9 @@
<table cellpadding=0>
<TR><TD WIDTH=100>B, C-b, º¸Ìð°õ<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤òºï½ü¤·¡¤°ì¤ÄÁ°¤Î¥Ð¥Ã¥Õ¥¡¤òɽ¼¨¤·¤Þ¤¹¡¥
<TR><TD>\<TD>HTML¤Î¥½¡¼¥¹¤òɽ¼¨¤·¤Þ¤¹¡¥
-<TR><TD>s, C-h<TD>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹¡¥
+<TR><TD>s<TD>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹¡¥
<TR><TD>E<TD>¸½ºß¸«¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤¬¥í¡¼¥«¥ë¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤ò¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤Þ¤¹¡¥¥¨¥Ç¥£¥¿¤ò½ªÎ»¤·¤¿¸å¡¤¤½¤Î¥Õ¥¡¥¤¥ë¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
+<TR><TD>C-l, C-w<TD>²èÌ̤òºÆÉÁ²è¤·¤Þ¤¹¡¥
<TR><TD>R, C-r<TD>¥Ð¥Ã¥Õ¥¡¤òºÆÅÙÆɤ߹þ¤ß¤Þ¤¹¡¥
<TR><TD>S, p<TD>¥Ð¥Ã¥Õ¥¡¤Îɽ¼¨ÆâÍƤò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥
<TR><TD>ESC s<TD>HTML¤Î¥½¡¼¥¹¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ¤·¤Þ¤¹¡¥v ¤Ç¥½¡¼¥¹¤òɽ¼¨¤·¤Æ S ¤Ç
@@ -97,16 +105,16 @@
<H3>¸¡º÷</H3>
<table cellpadding=0>
-<TR><TD WIDTH=100>/<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ëËöÈø¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
-<TR><TD>?<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
+<TR><TD WIDTH=100>/,C-s<TD>¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ¤«¤é¥Õ¥¡¥¤¥ëËöÈø¤Ë¸þ¤«¤Ã¤ÆÀµµ¬É½¸½¤ò¸¡º÷¤·¤Þ¤¹¡¥
<TR><TD>n<TD>¼¡¤ò¸¡º÷¤·¤Þ¤¹¡¥
+<TR><TD>w<TD>ÀÞ¤êÊÖ¤·¸¡º÷¥â¡¼¥É¤òÀڤ괹¤¨¤Þ¤¹¡¥
</table>
<H3>¥Þ¡¼¥¯Áàºî</H3>
<table cellpadding=0>
<TR><TD WIDTH=100>C-SPC<TD>¥Þ¡¼¥¯¤òÀßÄê¡¿²ò½ü¤·¤Þ¤¹¡¥¥Þ¡¼¥¯¤Ïȿžɽ¼¨¤µ¤ì¤Þ¤¹¡¥
-<TR><TD>ESC p<TD>°ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
-<TR><TD>ESC n<TD>°ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>P<TD>°ì¤ÄÁ°¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
+<TR><TD>N<TD>°ì¤Ä¸å¤Î¥Þ¡¼¥¯¤Ë°ÜÆ°¤·¤Þ¤¹¡¥
<TR><TD>"<TD>Àµµ¬É½¸½¤Ç»ØÄꤵ¤ì¤¿Ê¸»úÎó¤òÁ´¤Æ¥Þ¡¼¥¯¤·¤Þ¤¹¡¥
</table>
diff --git a/w3mhelp-w3m_en.html b/w3mhelp-w3m_en.html
@@ -7,7 +7,7 @@
*******
<A HREF="http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/">
w3m</A>
- (WWW-wo-Miru) Version beta by
+ (WWW-wo-Miru) Version 0.2.1 by
<A HREF="mailto:aito@ei5sun.yz.yamagata-u.ac.jp">A.ITO</A> ********<BR>
***** Key assign table *****
</CENTER>
@@ -24,15 +24,19 @@ w3m</A>
<TR><TD>k,C-p<TD>Cursor up
<TR><TD>J<TD>Roll up one line
<TR><TD>K<TD>Roll down one line
+<TR><TD>^,C-a<TD>Go to the beginning of line
+<TR><TD>$,C-e<TD>Go to the end of line
<TR><TD>w<TD>Go to next word
<TR><TD>W<TD>Go to previous word
<TR><TD>><TD>Shift screen right
<TR><TD><<TD>Shift screen left
<TR><TD>.<TD>Shift screen one column right
<TR><TD>,<TD>Shift screen one column left
-<TR><TD>g<TD>Go to the first line
-<TR><TD>G<TD>Go to the last line
+<TR><TD>g,M-<<TD>Go to the first line
+<TR><TD>G,M-><TD>Go to the last line
<TR><TD>ESC g<TD>Go to specified line
+<TR><TD>Z<TD>Move to the center line
+<TR><TD>z<TD>Move to the center column
<TR><TD>TAB<TD>Move to next hyperlink
<TR><TD>C-u,ESC TAB<TD>Move to previous hyperlink
<TR><TD>[<TD>Go to the first link
@@ -44,12 +48,15 @@ w3m</A>
<TR><TD WIDTH=100>RET<TD>Follow hyperlink
<TR><TD>a, ESC RET<TD>Save link to file
<TR><TD>u<TD>Peek link URL
+<TR><TD>i<TD>Peek image URL
<TR><TD>I<TD>View inline image
<TR><TD>ESC I<TD>Save inline image to file
<TR><TD>:<TD>Mark URL-like strings as anchors
<TR><TD>ESC :<TD>Mark Message-ID-like strings as news anchors
<TR><TD>c<TD>Peek current URL
-<TR><TD>=<TD>Display infomation about current document
+<TR><TD>=<TD>Display information about current document
+<TR><TD>C-g<TD>Show current line number
+<TR><TD>C-h<TD>View history of URL
<TR><TD>F<TD>Render frame
<TR><TD>M<TD>Browse current document using external browser
(use 2M and 3M to invoke second and third browser)
@@ -71,12 +78,21 @@ w3m</A>
<TR><TD>v<TD>View HTML source
<TR><TD>s<TD>Select buffer
<TR><TD>E<TD>Edit buffer source
+<TR><TD>C-l<TD>Redraw screen
<TR><TD>R<TD>Reload buffer
<TR><TD>S<TD>Save buffer
<TR><TD>ESC s<TD>Save source
<TR><TD>ESC e<TD>Edit buffer image
</table>
+<H2>Buffer selection mode</H2>
+<table cellpadding=0>
+<TR><TD WIDTH=100>k, C-p<TD>Select previous buffer
+<TR><TD>j, C-n<TD>Select next buffer
+<TR><TD>D<TD>Delete current buffer
+<TR><TD>RET<TD>Go to the selected buffer
+</table>
+
<H2>Bookmark operation</H2>
<table cellpadding=0>
<TR><TD WIDTH=100>ESC b<TD>Load bookmark
@@ -89,6 +105,13 @@ w3m</A>
<TR><TD>?,C-r<TD>Search backward
<TR><TD>n<TD>Search next
<TR><TD>N<TD>Search previous
+<TR><TD>C-w<TD>Toggle wrap search mode
+</table>
+
+<H2>Dictionary look-up</H2>
+<table cellpadding=0>
+<TR><TD WIDTH=100>M-w<TD>Execute dictionary command (see README.dict)
+<TR><TD>M-W<TD>Execute dictionary command for word at cursor
</table>
<H2>Mark operation</H2>
diff --git a/w3mhelp-w3m_ja.html b/w3mhelp-w3m_ja.html
@@ -7,7 +7,7 @@
<CENTER>
*******
<A HREF="http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/">w3m</A>
- (WWW-wo-Miru) Version beta by
+ (WWW-wo-Miru) Version 0.2.1 by
<A HREF="mailto:aito@ei5sun.yz.yamagata-u.ac.jp">A.ITO(°ËÆ£¾´Â§)</A>
********
<BR>
@@ -26,15 +26,19 @@
<TR> <TD>k,C-p</TD> <TD>¥«¡¼¥½¥ë¤ò¾å¤Ø°ÜÆ°</TD></TR>
<TR> <TD>J</TD><TD>°ì¹Ô¾å¤Ë¥¹¥¯¥í¡¼¥ë(¿Ê¤à)</TD></TR>
<TR> <TD>K</TD><TD>°ì¹Ô²¼¤Ë¥¹¥¯¥í¡¼¥ë(Ìá¤ë)</TD></TR>
+ <TR> <TD>^,C-a</TD><TD>¹ÔƬ¤Ë°ÜÆ°</TD></TR>
+ <TR> <TD>$,C-e</TD><TD>¹ÔËö¤Ë°ÜÆ°</TD></TR>
<TR> <TD>w</TD><TD>¼¡¤Îñ¸ì¤Ë°ÜÆ°</TD></TR>
<TR> <TD>W</TD><TD>Á°¤Îñ¸ì¤Ë°ÜÆ°</TD></TR>
<TR> <TD>></TD> <TD>±¦¤Ë°ì²èÌÌʬ¥·¥Õ¥È</TD></TR>
<TR> <TD><</TD> <TD>º¸¤Ë°ì²èÌÌʬ¥·¥Õ¥È</TD></TR>
<TR> <TD>.</TD> <TD>±¦¤Ë°ìʸ»úʬ¥·¥Õ¥È</TD></TR>
<TR> <TD>,</TD> <TD>º¸¤Ë°ìʸ»úʬ¥·¥Õ¥È</TD></TR>
- <TR> <TD>g</TD> <TD>¥Ú¡¼¥¸¤ÎÀèƬ¹Ô¤Ë°ÜÆ°</TD></TR>
- <TR> <TD>G</TD> <TD>¥Ú¡¼¥¸¤ÎºÇ½ª¹Ô¤Ë°ÜÆ°</TD></TR>
+ <TR> <TD>g,M-<</TD> <TD>¥Ú¡¼¥¸¤ÎÀèƬ¹Ô¤Ë°ÜÆ°</TD></TR>
+ <TR> <TD>G,M-></TD> <TD>¥Ú¡¼¥¸¤ÎºÇ½ª¹Ô¤Ë°ÜÆ°</TD></TR>
<TR> <TD>ESC g</TD> <TD>»ØÄê¹Ô¤Ë°ÜÆ°</TD></TR>
+ <TR> <TD>Z</TD> <TD>¥«¡¼¥½¥ë¤Î¤¢¤ë°ÌÃÖ¤ò¹Ô¤ÎÃæ±û¤Ë°ÜÆ°</TD></TR>
+ <TR> <TD>z</TD> <TD>¥«¡¼¥½¥ë¤Î¤¢¤ë¹Ô¤ò²èÌ̤ÎÃæ±û¤Ë°ÜÆ°</TD></TR>
<TR> <TD>TAB</TD> <TD>¼¡¤Î¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯¤Ë°ÜÆ°</TD></TR>
<TR> <TD>C-u, ESC TAB</TD> <TD>Á°¤Î¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯¤Ë°ÜÆ°</TD></TR>
<TR> <TD>[</TD> <TD>ºÇ½é¤Î¥Ï¥¤¥Ñ¡¼¥ê¥ó¥¯¤Ë°ÜÆ°</TD></TR>
@@ -48,11 +52,14 @@
<TR> <TD>a, ESC RET</TD> <TD>¥ê¥ó¥¯Àè¤Îʸ½ñ¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ</TD></TR>
<TR> <TD>ESC I</TD> <TD>¥ê¥ó¥¯Àè¤Î²èÁü¤ò¥Õ¥¡¥¤¥ë¤ËÊݸ</TD></TR>
<TR> <TD>u</TD> <TD>¥ê¥ó¥¯ÀèURL¤Îɽ¼¨</TD></TR>
+ <TR> <TD>i</TD> <TD>¥ê¥ó¥¯¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿²èÁü¤Ø¤ÎURL¤Îɽ¼¨</TD></TR>
<TR> <TD>I</TD> <TD>¥¤¥ó¥é¥¤¥ó¥¤¥á¡¼¥¸¤Îɽ¼¨</TD></TR>
<TR> <TD>:</TD> <TD>URL¤Î¤è¤¦¤Êʸ»ú¤ò¥¢¥ó¥«¡¼¤È¤·¤Æ¥Þ¡¼¥¯</TD></TR>
<TR> <TD>ESC :</TD> <TD>Message-ID¤Î¤è¤¦¤Êʸ»ú¤ò¥¢¥ó¥«¡¼¤È¤·¤Æ¥Þ¡¼¥¯</TD></TR>
<TR> <TD>c</TD> <TD>¸½¥Ú¡¼¥¸¤ÎURL¤òɽ¼¨</TD></TR>
<TR> <TD>=</TD> <TD>¸½¥É¥¥å¥á¥ó¥È¤Î¾ðÊó¤òɽ¼¨</TD></TR>
+ <TR> <TD>C-g</TD> <TD>¥Ú¡¼¥¸Ãæ¤Ç¤Î¸½ºß°ÌÃÖ¤òɽ¼¨</TD></TR>
+ <TR> <TD>C-h</TD> <TD>URLÍúÎò¤òɽ¼¨</TD></TR>
<TR> <TD>F</TD> <TD>¥Õ¥ì¡¼¥à¤òɽ¼¨¤¹¤ë</TD></TR>
<TR> <TD>M</TD> <TD>¸½¥Ú¡¼¥¸¤ò³°Éô¥Ö¥é¥¦¥¶¤Çɽ¼¨¤¹¤ë(2M,3M¤Ç2ÈÖÌܤÈ3ÈÖÌܤΥ֥饦¥¶¤ò¸Æ¤Ó¤À¤¹)</TD></TR>
<TR> <TD>ESC M</TD> <TD>¥ê¥ó¥¯Àè¤ò³°Éô¥Ö¥é¥¦¥¶¤Çɽ¼¨¤¹¤ë(2ESC M,3ESC M¤Ç2ÈÖÌܤÈ3ÈÖÌܤΥ֥饦¥¶¤ò¸Æ¤Ó¤À¤¹)</TD></TR>
@@ -72,12 +79,22 @@
<TR> <TD>v</TD> <TD>HTML¥½¡¼¥¹¤òɽ¼¨</TD></TR>
<TR> <TD>s</TD> <TD>¥Ð¥Ã¥Õ¥¡¤òÁªÂò</TD></TR>
<TR> <TD>E</TD> <TD>¥Ð¥Ã¥Õ¥¡¤Î¥½¡¼¥¹¤òÊÔ½¸</TD></TR>
+ <TR> <TD>C-l</TD> <TD>²èÌ̤κÆÉÁ²è</TD></TR>
<TR> <TD>R</TD> <TD>¥Ð¥Ã¥Õ¥¡¤òºÆÆɤ߹þ¤ß</TD></TR>
<TR> <TD>S</TD> <TD>¥Ð¥Ã¥Õ¥¡¤òÊݸ</TD></TR>
<TR> <TD>ESC s</TD> <TD>HTML¥½¡¼¥¹¤òÊݸ</TD></TR>
<TR> <TD>ESC e</TD> <TD>¥Ð¥Ã¥Õ¥¡¤Îɽ¼¨¥¤¥á¡¼¥¸¤òÊÔ½¸</TD></TR>
</TABLE>
+<H2>¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É</H2>
+"s" ¤Ç¥Ð¥Ã¥Õ¥¡ÁªÂò¥â¡¼¥É¤ËÆþ¤Ã¤¿¤È¤¤Î¥¡¼Áàºî
+<TABLE CELLPADDING=0>
+ <TR> <TD WIDTH=100>k,C-p</TD> <TD>°ì¤Ä¾å¤Î¥Ð¥Ã¥Õ¥¡¤òÁªÂò</TD></TR>
+ <TR> <TD>j,C-n</TD> <TD>°ì¤Ä²¼¤Î¥Ð¥Ã¥Õ¥¡¤òÁªÂò</TD></TR>
+ <TR> <TD>D</TD> <TD>¸½ºßÁªÂò¤·¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤òºï½ü</TD></TR>
+ <TR> <TD>RET</TD> <TD>¸½ºßÁªÂò¤·¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¤òɽ¼¨</TD></TR>
+</TABLE>
+
<H2>¥Ö¥Ã¥¯¥Þ¡¼¥¯Áàºî</H2>
<TABLE CELLPADDING=0>
<TR> <TD WIDTH=100>ESC b</TD> <TD>¥Ö¥Ã¥¯¥Þ¡¼¥¯¤òÆɤ߹þ¤à</TD></TR>
@@ -90,6 +107,13 @@
<TR> <TD>?,C-r</TD> <TD>¸åÊý¸¡º÷</TD></TR>
<TR> <TD>n</TD> <TD>¼¡¤ò¸¡º÷</TD></TR>
<TR> <TD>N</TD> <TD>Á°¤ò¸¡º÷</TD></TR>
+ <TR> <TD>C-w</TD> <TD>ÀÞ¤êÊÖ¤·¸¡º÷¥â¡¼¥É¤ÎÀڤ괹¤¨</TD></TR>
+</TABLE>
+
+<H2>¼½ñ¸¡º÷</H2>
+<TABLE CELLPADDING=0>
+ <TR> <TD WIDTH=100>M-w</TD> <TD>ÆþÎϤ·¤¿Ã±¸ì¤ò¼½ñ¥³¥Þ¥ó¥É¤Ç¸¡º÷</TD></TR>
+ <TR> <TD>M-W</TD> <TD>¥«¡¼¥½¥ë°ÌÃÖ¤Îñ¸ì¤ò¼½ñ¥³¥Þ¥ó¥É¤Ç¸¡º÷</TD></TR>
</TABLE>
<H2>¥Þ¡¼¥¯Áàºî</H2>
diff --git a/w3mhelperpanel.c b/w3mhelperpanel.c
@@ -96,9 +96,9 @@ printMailcapPanel(char *mailcap)
continue;
Strchop(tmp);
extractMailcapEntry(tmp->ptr, &type, &viewer);
- printf("<tr valign=top><td><td>%s<td>%s<td>", htmlquote_str(type), htmlquote_str(viewer));
+ printf("<tr valign=top><td><td>%s<td>%s<td>", html_quote(type), html_quote(viewer));
printf("<input type=checkbox name=delete value=\"%s\">%s\n",
- htmlquote_str(type), MSG_DELETE);
+ html_quote(type), MSG_DELETE);
}
printf("</table><input type=submit name=submit value=\"%s\"></form></body></html>\n",
MSG_DOIT);