Changeset 12021 in project


Ignore:
Timestamp:
09/28/08 15:02:47 (12 years ago)
Author:
felix winkelmann
Message:

merged trunk rev. 11636-12020. This should be the last merge before hygienic becomes the new trunk

Location:
chicken/branches/hygienic
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/hygienic/Makefile

    r11646 r12021  
    2828        = all clean distclean spotless install uninstall confclean check \
    2929          fullcheck dist libs install-libs bootstrap
     30
    3031SRCDIR = .
    3132
  • chicken/branches/hygienic/Makefile.bsd

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/Makefile.cross-linux-mingw

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
     
    134133        cat chicken-defaults.h >>$@
    135134
    136 include $(SRCDIR)/rules.make
     135include $(SRCDIR)rules.make
  • chicken/branches/hygienic/Makefile.cygwin

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/Makefile.linux

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR ?= ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/Makefile.macosx

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/Makefile.mingw

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = .\\
    3029
    3130# platform configuration
     
    7574CUSTOM_CHICKEN_DEFAULTS=1
    7675
    77 include $(SRCDIR)/defaults.make
     76include $(SRCDIR)defaults.make
    7877
    7978# main target
     
    141140        echo #endif >>$@
    142141        echo #ifndef C_INSTALL_SHARE_HOME >>$@
    143         echo # define C_INSTALL_SHARE_HOME "$(DATADIR)" >>$@
     142        echo # define C_INSTALL_SHARE_HOME "$(IDATADIR)" >>$@
    144143        echo #endif >>$@
    145144        echo #ifndef C_INSTALL_BIN_HOME >>$@
    146         echo # define C_INSTALL_BIN_HOME "$(BINDIR)" >>$@
     145        echo # define C_INSTALL_BIN_HOME "$(IBINDIR)" >>$@
    147146        echo #endif >>$@
    148147        echo #ifndef C_INSTALL_EGG_HOME >>$@
    149         echo # define C_INSTALL_EGG_HOME "$(EGGDIR)" >>$@
     148        echo # define C_INSTALL_EGG_HOME "$(IEGGDIR)" >>$@
    150149        echo #endif >>$@
    151150        echo #ifndef C_INSTALL_LIB_HOME >>$@
    152         echo # define C_INSTALL_LIB_HOME "$(LIBDIR)" >>$@
     151        echo # define C_INSTALL_LIB_HOME "$(ILIBDIR)" >>$@
    153152        echo #endif >>$@
    154153        echo #ifndef C_INSTALL_STATIC_LIB_HOME >>$@
    155         echo # define C_INSTALL_STATIC_LIB_HOME "$(LIBDIR)" >>$@
     154        echo # define C_INSTALL_STATIC_LIB_HOME "$(ILIBDIR)" >>$@
    156155        echo #endif >>$@
    157156        echo #ifndef C_INSTALL_INCLUDE_HOME >>$@
    158         echo # define C_INSTALL_INCLUDE_HOME "$(INCDIR)" >>$@
     157        echo # define C_INSTALL_INCLUDE_HOME "$(IINCDIR)" >>$@
    159158        echo #endif >>$@
    160159        echo #ifndef C_INSTALL_MORE_LIBS >>$@
     
    192191        echo #endif >>$@
    193192        echo #ifndef C_TARGET_LIB_HOME >>$@
    194         echo # define C_TARGET_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
     193        echo # define C_TARGET_LIB_HOME "$(TARGET_PREFIX)\\lib" >>$@
    195194        echo #endif >>$@
    196195        echo #ifndef C_TARGET_RUN_LIB_HOME >>$@
    197         echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
     196        echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)\\lib" >>$@
    198197        echo #endif >>$@
    199198        echo #ifndef C_TARGET_SHARE_HOME >>$@
    200         echo # define C_TARGET_SHARE_HOME "$(TARGET_PREFIX)/share" >>$@
     199        echo # define C_TARGET_SHARE_HOME "$(TARGET_PREFIX)\\share" >>$@
    201200        echo #endif >>$@
    202201        echo #ifndef C_TARGET_INCLUDE_HOME >>$@
    203         echo # define C_TARGET_INCLUDE_HOME "$(TARGET_PREFIX)/include" >>$@
     202        echo # define C_TARGET_INCLUDE_HOME "$(TARGET_PREFIX)\\include" >>$@
    204203        echo #endif >>$@
    205204        echo #ifndef C_TARGET_STATIC_LIB_HOME >>$@
    206         echo # define C_TARGET_STATIC_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@
     205        echo # define C_TARGET_STATIC_LIB_HOME "$(TARGET_PREFIX)\\lib" >>$@
    207206        echo #endif >>$@
    208207        echo #ifndef C_BINARY_VERSION >>$@
     
    210209        echo #endif >>$@
    211210
    212 include $(SRCDIR)/rules.make
     211include $(SRCDIR)rules.make
  • chicken/branches/hygienic/Makefile.mingw-msys

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/Makefile.msvc

    r11573 r12021  
    3333# Germany
    3434
    35 PREFIX = c:/msvc-devtools
     35PREFIX = c:\\msvc-devtools
     36SRCDIR = .\\
    3637
    3738# platform configuration
  • chicken/branches/hygienic/Makefile.solaris

    r11646 r12021  
    2626
    2727
    28 SRCDIR = .
    29 VPATH  = $(SRCDIR)
     28SRCDIR = ./
    3029
    3130# platform configuration
  • chicken/branches/hygienic/NEWS

    r11646 r12021  
    3434    define-macro
    3535    define-extension
     36
     373.3.13
     38
     39- Fixes to the MinGW build.
     40
     413.3.12
     42
     43- PCRE 7.7
    3644
    37453.3.8
  • chicken/branches/hygienic/TODO

    r11989 r12021  
    22
    33* trunk merge
    4   11635 was last
     4  12020 was last
    55
    66* macros
     
    5050* setup/install
    5151** setup-download
    52 *** HTTP_PROXY
     52*** use HTTP_PROXY env. var
    5353*** handle redirects in http-fetch
    5454*** connect timeout and alternative download location
     
    7777* eggs
    7878** sassy: convert to proper module
    79 ** port javahack, fps
     79** port javahack, fmt, fps
  • chicken/branches/hygienic/compiler.scm

    r11892 r12021  
    526526  (define (walk x se dest)
    527527    (cond ((symbol? x)
    528            (when (memq x unlikely-variables)
    529              (compiler-warning
    530               'var
    531               "reference to variable `~s' possibly unintended" x) )
     528           (cond ((keyword? x) `(quote ,x))
     529                 ((memq x unlikely-variables)
     530                  (compiler-warning
     531                   'var
     532                   "reference to variable `~s' possibly unintended" x) ))
    532533           (resolve-variable x se dest))
    533534          ((not-pair? x)
  • chicken/branches/hygienic/defaults.make

    r11892 r12021  
    4040# directories
    4141
    42 SRCDIR = .
    43 VPATH  = $(SRCDIR)
    44 
    45 DESTDIR =
     42SRCDIR ?= ./
     43
     44DESTDIR ?=
     45
    4646ifeq ($(PLATFORM),mingw-msys)
    4747PREFIX ?= c:/devtools
    4848else
    4949ifeq ($(PLATFORM),mingw)
    50 PREFIX ?= c:/devtools
     50PREFIX ?= c:\\devtools
    5151else
    5252PREFIX ?= /usr/local
     
    6767
    6868ifeq ($(PLATFORM),mingw)
    69 BINDIR = $(PREFIX)\\bin
    70 LIBDIR = $(PREFIX)\\lib
    71 SHAREDIR = $(PREFIX)\\share
    72 DATADIR = $(SHAREDIR)\\chicken
    73 TOPMANDIR = $(SHAREDIR)\\man
    74 MANDIR = $(TOPMANDIR)\\man1
    75 INFODIR = $(SHAREDIR)\\info
    76 INCDIR = $(PREFIX)\\include
    77 DOCDIR = $(DATADIR)\\doc
    78 CHICKENLIBDIR = $(LIBDIR)\\chicken
    79 EGGDIR = $(CHICKENLIBDIR)\\$(BINARYVERSION)
     69IBINDIR = $(PREFIX)\\bin
     70ILIBDIR = $(PREFIX)\\lib
     71ISHAREDIR = $(PREFIX)\\share
     72IDATADIR = $(ISHAREDIR)\\chicken
     73ITOPMANDIR = $(ISHAREDIR)\\man
     74IMANDIR = $(ITOPMANDIR)\\man1
     75IINFODIR = $(ISHAREDIR)\\info
     76IINCDIR = $(PREFIX)\\include
     77IDOCDIR = $(IDATADIR)\\doc
     78ICHICKENLIBDIR = $(ILIBDIR)\\chicken
     79IEGGDIR = $(ICHICKENLIBDIR)\\$(BINARYVERSION)
    8080else
    8181IBINDIR = $(BINDIR)
     
    160160PCRE_OBJECTS_1 =
    161161else
    162 PCRE_DIR ?= $(VPATH)/pcre
    163 C_COMPILER_PCRE_OPTIONS = -DPCRE_STATIC
     162ifdef WINDOWS
     163ifneq ($(HOSTSYSTEM),mingw32)
     164PCRE_DIR ?= $(SRCDIR)pcre\\
     165else
     166endif
     167PCRE_DIR ?= $(SRCDIR)pcre/
     168else
     169PCRE_DIR ?= $(SRCDIR)pcre/
     170endif
     171C_COMPILER_PCRE_OPTIONS = -DPCRE_STATIC -DHAVE_CONFIG_H
    164172PCRE_INCLUDES = $(INCLUDES) -I$(PCRE_DIR)
    165173endif
     
    317325CHICKEN_PCRE_LIBRARY_OPTIONS =
    318326else
    319 CHICKEN_PCRE_LIBRARY_OPTIONS = -include-path $(SRCDIR)/pcre
     327CHICKEN_PCRE_LIBRARY_OPTIONS = -include-path $(SRCDIR)pcre
    320328endif
    321329
     
    395403        echo "#endif" >>$@
    396404        echo "#ifndef C_INSTALL_SHARE_HOME" >>$@
    397         echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@
     405        echo "# define C_INSTALL_SHARE_HOME \"$(IDATADIR)\"" >>$@
    398406        echo "#endif" >>$@
    399407        echo "#ifndef C_INSTALL_BIN_HOME" >>$@
    400         echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@
     408        echo "# define C_INSTALL_BIN_HOME \"$(IBINDIR)\"" >>$@
    401409        echo "#endif" >>$@
    402410        echo "#ifndef C_INSTALL_EGG_HOME" >>$@
    403         echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@
     411        echo "# define C_INSTALL_EGG_HOME \"$(IEGGDIR)\"" >>$@
    404412        echo "#endif" >>$@
    405413        echo "#ifndef C_INSTALL_LIB_HOME" >>$@
    406         echo "# define C_INSTALL_LIB_HOME \"$(LIBDIR)\"" >>$@
     414        echo "# define C_INSTALL_LIB_HOME \"$(ILIBDIR)\"" >>$@
    407415        echo "#endif" >>$@
    408416        echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@
    409         echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@
     417        echo "# define C_INSTALL_STATIC_LIB_HOME \"$(ILIBDIR)\"" >>$@
    410418        echo "#endif" >>$@
    411419        echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@
    412         echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@
     420        echo "# define C_INSTALL_INCLUDE_HOME \"$(IINCDIR)\"" >>$@
    413421        echo "#endif" >>$@
    414422        echo "#ifndef C_INSTALL_MORE_LIBS" >>$@
     
    445453        echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@
    446454        echo "#endif" >>$@
     455ifdef WINDOWS
     456        echo "#ifndef C_TARGET_LIB_HOME" >>$@
     457        echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
     458        echo "#endif" >>$@
     459        echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@
     460        echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)\\lib\"" >>$@
     461        echo "#endif" >>$@
     462        echo "#ifndef C_TARGET_SHARE_HOME" >>$@
     463        echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)\\share\"" >>$@
     464        echo "#endif" >>$@
     465        echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@
     466        echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)\\include\"" >>$@
     467        echo "#endif" >>$@
     468        echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@
     469        echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
     470        echo "#endif" >>$@
     471else
    447472        echo "#ifndef C_TARGET_LIB_HOME" >>$@
    448473        echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
     
    460485        echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
    461486        echo "#endif" >>$@
     487endif
    462488        echo "#ifndef C_CHICKEN_PROGRAM" >>$@
    463489        echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@
  • chicken/branches/hygienic/eval.scm

    r11989 r12021  
    293293
    294294      (define (compile x e h tf cntr se)
    295         (cond [(symbol? x)
     295        (cond ((keyword? x) (lambda v x))
     296              ((symbol? x)
    296297               (receive (i j) (lookup x e se)
    297298                 (cond [(not i)
     
    317318                                (lambda v (##core#inline "C_retrieve" var))] ) ) ) ]
    318319                       [(zero? i) (lambda (v) (##sys#slot (##sys#slot v 0) j))]
    319                        [else (lambda (v) (##sys#slot (##core#inline "C_u_i_list_ref" v i) j))] ) ) ]
     320                       [else (lambda (v) (##sys#slot (##core#inline "C_u_i_list_ref" v i) j))] ) ) )
    320321              [(##sys#number? x)
    321322               (case x
  • chicken/branches/hygienic/manual/Unit data-structures

    r11085 r12021  
    420420
    421421
     422==== none?
     423
     424 [procedure] (none? X)
     425
     426Ignores its argument and always returns {{#f}}. This is actually useful sometimes.
     427
     428
     429==== always?
     430
     431 [procedure] (always? X)
     432
     433Ignores its arguments and always returns {{#t}}. This is actually useful sometimes.
     434
     435
     436==== never?
     437
     438 [procedure] (never? X)
     439
     440Ignores its arguments and always returns {{#f}}. This is actually useful sometimes.
     441
     442
    422443==== constantly
    423444
     
    483504
    484505
    485 
    486506==== each
    487507
     
    559579A single value version of {{compose}} (slightly faster). {{(o)}} is equivalent
    560580to {{identity}}.
     581
     582
     583==== left-section
     584
     585 [procedure] (left-section PROC ARG0 ...)
     586
     587Returns a procedure that partially applies some of its' arguments starting from the left.
     588
     589{{PROC}} a procedure.
     590
     591{{ARG0 ...}} some prefix of the arguments for {{PROC}}.
     592
     593
     594==== right-section
     595
     596 [procedure] (right-section PROC ARG0 ...)
     597
     598Returns a procedure that partially applies some of its' arguments starting from the right.
     599
     600{{PROC}} a procedure.
     601
     602{{ARG0 ...}} some reversed suffix of the arguments for {{PROC}}.
     603
     604
    561605
    562606=== Binary searching
  • chicken/branches/hygienic/pcre/config.h

    r9133 r12021  
    1 /* config.h.  From PCRE 7.6 config.h generated from config.h.in by configure.  */
     1/* config.h.  From PCRE 7.7 config.h generated from config.h.in by configure.  */
    22
    3 #if defined(HAVE_CONFIG_H) || defined(HAVE_CHICKEN_CONFIG_H)
     3/* For HAVE_* macros */
     4#ifdef HAVE_CHICKEN_CONFIG_H
    45# include "chicken-config.h"
    56#endif
    67
    7 /* On Unix-like systems config.h.in is converted by "configure" into config.h.
    8 Some other environments also support the use of "configure". PCRE is written in
    9 Standard C, but there are a few non-standard things it can cope with, allowing
    10 it to run on SunOS4 and other "close to standard" systems.
     8/* By default, the \R escape sequence matches any Unicode line ending
     9   character or sequence of characters. If BSR_ANYCRLF is defined, this is
     10   changed so that backslash-R matches only CR, LF, or CRLF. The build- time
     11   default can be overridden by the user of PCRE at runtime. On systems that
     12   support it, "configure" can be used to override the default. */
     13/* #undef BSR_ANYCRLF */
    1114
    12 If you are going to build PCRE "by hand" on a system without "configure" you
    13 should copy the distributed config.h.generic to config.h, and then set up the
    14 macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
    15 all of your compile commands, so that config.h is included at the start of
    16 every source.
    17 
    18 Alternatively, you can avoid editing by using -D on the compiler command line
    19 to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.
    20 
    21 PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
    22 HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
    23 them both to 0; an emulation function will be used. */
    24 
    25 /* Define to 1 if you have the `memmove' function. */
    26 #ifndef HAVE_MEMMOVE
    27 /* hm... there must be a better way */
    28 # define HAVE_MEMMOVE 1
    29 #endif
    3015
    3116/* The value of LINK_SIZE determines the number of bytes used to store links
     
    8267   (ANYCRLF). */
    8368#ifndef NEWLINE
    84 #define NEWLINE '\n'
     69#define NEWLINE 10
    8570#endif
     71
     72/* PCRE uses recursive function calls to handle backtracking while matching.
     73   This can sometimes be a problem on systems that have stacks of limited
     74   size. Define NO_RECURSE to get a version that doesn't use recursion in the
     75   match() function; instead it creates its own stack by steam using
     76   pcre_recurse_malloc() to obtain memory from the heap. For more detail, see
     77   the comments and other stuff just above the match() function. On systems
     78   that support it, "configure" can be used to set this in the Makefile (use
     79   --disable-stack-for-recursion). */
     80/* #undef NO_RECURSE */
     81/* Make independent of Chicken stack - KRL */
     82#define NO_RECURSE 1
    8683
    8784/* Name of package */
     
    9592
    9693/* Define to the full name and version of this package. */
    97 #define PACKAGE_STRING "PCRE 7.6"
     94#define PACKAGE_STRING "PCRE 7.7"
    9895
    9996/* Define to the one symbol short name of this package. */
     
    10198
    10299/* Define to the version of this package. */
    103 #define PACKAGE_VERSION "7.6"
     100#define PACKAGE_VERSION "7.7"
    104101
    105102/* When calling PCRE via the POSIX interface, additional working storage is
     
    131128
    132129/* Version number of package */
    133 #define VERSION "7.6"
     130#define VERSION "7.7"
    134131
    135132/* Define to empty if `const' does not conform to ANSI C. */
  • chicken/branches/hygienic/pcre/pcre.h

    r9133 r12021  
    4343
    4444#define PCRE_MAJOR          7
    45 #define PCRE_MINOR          6
     45#define PCRE_MINOR          7
    4646#define PCRE_PRERELEASE     
    47 #define PCRE_DATE           2008-01-28
     47#define PCRE_DATE           2008-05-07
    4848
    4949/* When an application links to a PCRE DLL in Windows, the symbols that are
     
    125125#define PCRE_BSR_ANYCRLF        0x00800000
    126126#define PCRE_BSR_UNICODE        0x01000000
     127#define PCRE_JAVASCRIPT_COMPAT  0x02000000
    127128
    128129/* Exec-time and get/set-time error codes */
  • chicken/branches/hygienic/pcre/pcre_compile.c

    r9133 r12021  
    159159  "THEN";
    160160
    161 static verbitem verbs[] = {
     161static const verbitem verbs[] = {
    162162  { 6, OP_ACCEPT },
    163163  { 6, OP_COMMIT },
     
    169169};
    170170
    171 static int verbcount = sizeof(verbs)/sizeof(verbitem);
     171static const int verbcount = sizeof(verbs)/sizeof(verbitem);
    172172
    173173
     
    296296  "repeating a DEFINE group is not allowed\0"
    297297  "inconsistent NEWLINE options\0"
    298   "\\g is not followed by a braced name or an optionally braced non-zero number\0"
    299   "(?+ or (?- or (?(+ or (?(- must be followed by a non-zero number\0"
     298  "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number\0"
     299  "a numbered reference must not be zero\0"
    300300  "(*VERB) with an argument is not supported\0"
    301301  /* 60 */
     
    303303  "number is too big\0"
    304304  "subpattern name expected\0"
    305   "digit expected after (?+";
     305  "digit expected after (?+\0"
     306  "] is an invalid data character in JavaScript compatibility mode";
    306307
    307308
     
    532533    break;
    533534
    534     /* \g must be followed by a number, either plain or braced. If positive, it
    535     is an absolute backreference. If negative, it is a relative backreference.
    536     This is a Perl 5.10 feature. Perl 5.10 also supports \g{name} as a
    537     reference to a named group. This is part of Perl's movement towards a
    538     unified syntax for back references. As this is synonymous with \k{name}, we
    539     fudge it up by pretending it really was \k. */
     535    /* \g must be followed by one of a number of specific things:
     536
     537    (1) A number, either plain or braced. If positive, it is an absolute
     538    backreference. If negative, it is a relative backreference. This is a Perl
     539    5.10 feature.
     540
     541    (2) Perl 5.10 also supports \g{name} as a reference to a named group. This
     542    is part of Perl's movement towards a unified syntax for back references. As
     543    this is synonymous with \k{name}, we fudge it up by pretending it really
     544    was \k.
     545
     546    (3) For Oniguruma compatibility we also support \g followed by a name or a
     547    number either in angle brackets or in single quotes. However, these are
     548    (possibly recursive) subroutine calls, _not_ backreferences. Just return
     549    the -ESC_g code (cf \k). */
    540550
    541551    case 'g':
     552    if (ptr[1] == '<' || ptr[1] == '\'')
     553      {
     554      c = -ESC_g;
     555      break;
     556      }
     557
     558    /* Handle the Perl-compatible cases */
     559
    542560    if (ptr[1] == '{')
    543561      {
     
    566584      c = c * 10 + *(++ptr) - '0';
    567585
    568     if (c < 0)
     586    if (c < 0)   /* Integer overflow */
    569587      {
    570588      *errorcodeptr = ERR61;
     
    572590      }
    573591
    574     if (c == 0 || (braced && *(++ptr) != '}'))
     592    if (braced && *(++ptr) != '}')
    575593      {
    576594      *errorcodeptr = ERR57;
     595      break;
     596      }
     597
     598    if (c == 0)
     599      {
     600      *errorcodeptr = ERR58;
    577601      break;
    578602      }
     
    612636      while ((digitab[ptr[1]] & ctype_digit) != 0)
    613637        c = c * 10 + *(++ptr) - '0';
    614       if (c < 0)
     638      if (c < 0)    /* Integer overflow */
    615639        {
    616640        *errorcodeptr = ERR61;
     
    953977Arguments:
    954978  ptr          current position in the pattern
    955   count        current count of capturing parens so far encountered
     979  cd           compile background data
    956980  name         name to seek, or NULL if seeking a numbered subpattern
    957981  lorn         name length, or subpattern number if name is NULL
     
    962986
    963987static int
    964 find_parens(const uschar *ptr, int count, const uschar *name, int lorn,
     988find_parens(const uschar *ptr, compile_data *cd, const uschar *name, int lorn,
    965989  BOOL xmode)
    966990{
    967991const uschar *thisname;
     992int count = cd->bracount;
    968993
    969994for (; *ptr != 0; ptr++)
     
    9851010    }
    9861011
    987   /* Skip over character classes */
     1012  /* Skip over character classes; this logic must be similar to the way they
     1013  are handled for real. If the first character is '^', skip it. Also, if the
     1014  first few characters (either before or after ^) are \Q\E or \E we skip them
     1015  too. This makes for compatibility with Perl. */
    9881016
    9891017  if (*ptr == '[')
    9901018    {
     1019    BOOL negate_class = FALSE;
     1020    for (;;)
     1021      {
     1022      int c = *(++ptr);
     1023      if (c == '\\')
     1024        {
     1025        if (ptr[1] == 'E') ptr++;
     1026          else if (strncmp((const char *)ptr+1, "Q\\E", 3) == 0) ptr += 3;
     1027            else break;
     1028        }
     1029      else if (!negate_class && c == '^')
     1030        negate_class = TRUE;
     1031      else break;
     1032      }
     1033
     1034    /* If the next character is ']', it is a data character that must be
     1035    skipped, except in JavaScript compatibility mode. */
     1036
     1037    if (ptr[1] == ']' && (cd->external_options & PCRE_JAVASCRIPT_COMPAT) == 0)
     1038      ptr++;
     1039
    9911040    while (*(++ptr) != ']')
    9921041      {
     
    12531302    case OP_WORDCHAR:
    12541303    case OP_ANY:
     1304    case OP_ALLANY:
    12551305    branchlength++;
    12561306    cc++;
     
    15451595  /* Groups with zero repeats can of course be empty; skip them. */
    15461596
    1547   if (c == OP_BRAZERO || c == OP_BRAMINZERO)
     1597  if (c == OP_BRAZERO || c == OP_BRAMINZERO || c == OP_SKIPZERO)
    15481598    {
    15491599    code += _pcre_OP_lengths[c];
     
    16311681    case OP_WORDCHAR:
    16321682    case OP_ANY:
     1683    case OP_ALLANY:
    16331684    case OP_ANYBYTE:
    16341685    case OP_CHAR:
     
    18251876repetition simply by copying (because the recursion is allowed to refer to
    18261877earlier groups that are outside the current group). However, when a group is
    1827 optional (i.e. the minimum quantifier is zero), OP_BRAZERO is inserted before
    1828 it, after it has been compiled. This means that any OP_RECURSE items within it
    1829 that refer to the group itself or any contained groups have to have their
    1830 offsets adjusted. That one of the jobs of this function. Before it is called,
    1831 the partially compiled regex must be temporarily terminated with OP_END.
     1878optional (i.e. the minimum quantifier is zero), OP_BRAZERO or OP_SKIPZERO is
     1879inserted before it, after it has been compiled. This means that any OP_RECURSE
     1880items within it that refer to the group itself or any contained groups have to
     1881have their offsets adjusted. That one of the jobs of this function. Before it
     1882is called, the partially compiled regex must be temporarily terminated with
     1883OP_END.
    18321884
    18331885This function has been extended with the possibility of forward references for
     
    21142166
    21152167  case OP_NOT:
    2116   if (next < 0) return FALSE;  /* Not a character */
    21172168  if (item == next) return TRUE;
    21182169  if ((options & PCRE_CASELESS) == 0) return FALSE;
     
    26172668    zeroreqbyte = reqbyte;
    26182669    previous = code;
    2619     *code++ = OP_ANY;
     2670    *code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;
    26202671    break;
    26212672
     
    26322683    but those above are are explicitly listed afterwards. A flag byte tells
    26332684    whether the bitmap is present, and whether this is a negated class or not.
    2634     */
     2685
     2686    In JavaScript compatibility mode, an isolated ']' causes an error. In
     2687    default (Perl) mode, it is treated as a data character. */
     2688
     2689    case ']':
     2690    if ((cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
     2691      {
     2692      *errorcodeptr = ERR64;
     2693      goto FAILED;
     2694      }
     2695    goto NORMAL_CHAR;
    26352696
    26362697    case '[':
     
    26642725        negate_class = TRUE;
    26652726      else break;
     2727      }
     2728
     2729    /* Empty classes are allowed in JavaScript compatibility mode. Otherwise,
     2730    an initial ']' is taken as a data character -- the code below handles
     2731    that. In JS mode, [] must always fail, so generate OP_FAIL, whereas
     2732    [^] must match any character, so generate OP_ALLANY. */
     2733
     2734    if (c ==']' && (cd->external_options & PCRE_JAVASCRIPT_COMPAT) != 0)
     2735      {
     2736      *code++ = negate_class? OP_ALLANY : OP_FAIL;
     2737      if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
     2738      zerofirstbyte = firstbyte;
     2739      break;
    26662740      }
    26672741
     
    38213895      if (repeat_min == 0)
    38223896        {
    3823         /* If the maximum is also zero, we just omit the group from the output
    3824         altogether. */
    3825 
    3826         if (repeat_max == 0)
    3827           {
    3828           code = previous;
    3829           goto END_REPEAT;
    3830           }
    3831 
    3832         /* If the maximum is 1 or unlimited, we just have to stick in the
    3833         BRAZERO and do no more at this point. However, we do need to adjust
    3834         any OP_RECURSE calls inside the group that refer to the group itself or
    3835         any internal or forward referenced group, because the offset is from
    3836         the start of the whole regex. Temporarily terminate the pattern while
    3837         doing this. */
    3838 
    3839         if (repeat_max <= 1)
     3897        /* If the maximum is also zero, we used to just omit the group from the
     3898        output altogether, like this:
     3899
     3900        ** if (repeat_max == 0)
     3901        **   {
     3902        **   code = previous;
     3903        **   goto END_REPEAT;
     3904        **   }
     3905
     3906        However, that fails when a group is referenced as a subroutine from
     3907        elsewhere in the pattern, so now we stick in OP_SKIPZERO in front of it
     3908        so that it is skipped on execution. As we don't have a list of which
     3909        groups are referenced, we cannot do this selectively.
     3910
     3911        If the maximum is 1 or unlimited, we just have to stick in the BRAZERO
     3912        and do no more at this point. However, we do need to adjust any
     3913        OP_RECURSE calls inside the group that refer to the group itself or any
     3914        internal or forward referenced group, because the offset is from the
     3915        start of the whole regex. Temporarily terminate the pattern while doing
     3916        this. */
     3917
     3918        if (repeat_max <= 1)    /* Covers 0, 1, and unlimited */
    38403919          {
    38413920          *code = OP_END;
     
    38433922          memmove(previous+1, previous, len);
    38443923          code++;
     3924          if (repeat_max == 0)
     3925            {
     3926            *previous++ = OP_SKIPZERO;
     3927            goto END_REPEAT;
     3928            }
    38453929          *previous++ = OP_BRAZERO + repeat_type;
    38463930          }
     
    40374121      }
    40384122
     4123    /* If previous is OP_FAIL, it was generated by an empty class [] in
     4124    JavaScript mode. The other ways in which OP_FAIL can be generated, that is
     4125    by (*FAIL) or (?!) set previous to NULL, which gives a "nothing to repeat"
     4126    error above. We can just ignore the repeat in JS case. */
     4127
     4128    else if (*previous == OP_FAIL) goto END_REPEAT;
     4129
    40394130    /* Else there's some kind of shambles */
    40404131
     
    43234414        /* Search the pattern for a forward reference */
    43244415
    4325         else if ((i = find_parens(ptr, cd->bracount, name, namelen,
     4416        else if ((i = find_parens(ptr, cd, name, namelen,
    43264417                        (options & PCRE_EXTENDED) != 0)) > 0)
    43274418          {
     
    45694660        through from the Perl recursion syntax (?&name). We also come here from
    45704661        the Perl \k<name> or \k'name' back reference syntax and the \k{name}
    4571         .NET syntax. */
     4662        .NET syntax, and the Oniguruma \g<...> and \g'...' subroutine syntax. */
    45724663
    45734664        NAMED_REF_OR_RECURSE:
     
    46204711            }
    46214712          else if ((recno =                /* Forward back reference */
    4622                     find_parens(ptr, cd->bracount, name, namelen,
     4713                    find_parens(ptr, cd, name, namelen,
    46234714                      (options & PCRE_EXTENDED) != 0)) <= 0)
    46244715            {
     
    46474738          {
    46484739          const uschar *called;
     4740          terminator = ')';
     4741
     4742          /* Come here from the \g<...> and \g'...' code (Oniguruma
     4743          compatibility). However, the syntax has been checked to ensure that
     4744          the ... are a (signed) number, so that neither ERR63 nor ERR29 will
     4745          be called on this path, nor with the jump to OTHER_CHAR_AFTER_QUERY
     4746          ever be taken. */
     4747
     4748          HANDLE_NUMERICAL_RECURSION:
    46494749
    46504750          if ((refsign = *ptr) == '+')
     
    46684768            recno = recno * 10 + *ptr++ - '0';
    46694769
    4670           if (*ptr != ')')
     4770          if (*ptr != terminator)
    46714771            {
    46724772            *errorcodeptr = ERR29;
     
    47214821            if (called == NULL)
    47224822              {
    4723               if (find_parens(ptr, cd->bracount, NULL, recno,
    4724                    (options & PCRE_EXTENDED) != 0) < 0)
     4823              if (find_parens(ptr, cd, NULL, recno,
     4824                    (options & PCRE_EXTENDED) != 0) < 0)
    47254825                {
    47264826                *errorcodeptr = ERR15;
     
    50925192      zeroreqbyte = reqbyte;
    50935193
     5194      /* \g<name> or \g'name' is a subroutine call by name and \g<n> or \g'n'
     5195      is a subroutine call by number (Oniguruma syntax). In fact, the value
     5196      -ESC_g is returned only for these cases. So we don't need to check for <
     5197      or ' if the value is -ESC_g. For the Perl syntax \g{n} the value is
     5198      -ESC_REF+n, and for the Perl syntax \g{name} the result is -ESC_k (as
     5199      that is a synonym for a named back reference). */
     5200
     5201      if (-c == ESC_g)
     5202        {
     5203        const uschar *p;
     5204        save_hwm = cd->hwm;   /* Normally this is set when '(' is read */
     5205        terminator = (*(++ptr) == '<')? '>' : '\'';
     5206
     5207        /* These two statements stop the compiler for warning about possibly
     5208        unset variables caused by the jump to HANDLE_NUMERICAL_RECURSION. In
     5209        fact, because we actually check for a number below, the paths that
     5210        would actually be in error are never taken. */
     5211
     5212        skipbytes = 0;
     5213        reset_bracount = FALSE;
     5214
     5215        /* Test for a name */
     5216
     5217        if (ptr[1] != '+' && ptr[1] != '-')
     5218          {
     5219          BOOL isnumber = TRUE;
     5220          for (p = ptr + 1; *p != 0 && *p != terminator; p++)
     5221            {
     5222            if ((cd->ctypes[*p] & ctype_digit) == 0) isnumber = FALSE;
     5223            if ((cd->ctypes[*p] & ctype_word) == 0) break;
     5224            }
     5225          if (*p != terminator)
     5226            {
     5227            *errorcodeptr = ERR57;
     5228            break;
     5229            }
     5230          if (isnumber)
     5231            {
     5232            ptr++;
     5233            goto HANDLE_NUMERICAL_RECURSION;
     5234            }
     5235          is_recurse = TRUE;
     5236          goto NAMED_REF_OR_RECURSE;
     5237          }
     5238
     5239        /* Test a signed number in angle brackets or quotes. */
     5240
     5241        p = ptr + 2;
     5242        while ((digitab[*p] & ctype_digit) != 0) p++;
     5243        if (*p != terminator)
     5244          {
     5245          *errorcodeptr = ERR57;
     5246          break;
     5247          }
     5248        ptr++;
     5249        goto HANDLE_NUMERICAL_RECURSION;
     5250        }
     5251
    50945252      /* \k<name> or \k'name' is a back reference by name (Perl syntax).
    50955253      We also support \k{name} (.NET syntax) */
     
    55985756     }
    55995757
    5600    /* .* is not anchored unless DOTALL is set and it isn't in brackets that
    5601    are or may be referenced. */
     5758   /* .* is not anchored unless DOTALL is set (which generates OP_ALLANY) and
     5759   it isn't in brackets that are or may be referenced. */
    56025760
    56035761   else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR ||
    5604              op == OP_TYPEPOSSTAR) &&
    5605             (*options & PCRE_DOTALL) != 0)
     5762             op == OP_TYPEPOSSTAR))
    56065763     {
    5607      if (scode[1] != OP_ANY || (bracket_map & backref_map) != 0) return FALSE;
     5764     if (scode[1] != OP_ALLANY || (bracket_map & backref_map) != 0)
     5765       return FALSE;
    56085766     }
    56095767
  • chicken/branches/hygienic/pcre/pcre_dfa_exec.c

    r9133 r12021  
    8585that follow must also be modified. */
    8686
    87 static uschar coptable[] = {
     87static const uschar coptable[] = {
    8888  0,                             /* End                                    */
    8989  0, 0, 0, 0, 0,                 /* \A, \G, \K, \B, \b                     */
    9090  0, 0, 0, 0, 0, 0,              /* \D, \d, \S, \s, \W, \w                 */
    91   0, 0,                          /* Any, Anybyte                           */
     91  0, 0, 0,                       /* Any, AllAny, Anybyte                   */
    9292  0, 0, 0,                       /* NOTPROP, PROP, EXTUNI                  */
    9393  0, 0, 0, 0, 0,                 /* \R, \H, \h, \V, \v                     */
     
    133133  0, 0,                          /* BRAZERO, BRAMINZERO                    */
    134134  0, 0, 0, 0,                    /* PRUNE, SKIP, THEN, COMMIT              */
    135   0, 0                           /* FAIL, ACCEPT                           */
     135  0, 0, 0                        /* FAIL, ACCEPT, SKIPZERO                 */
    136136};
    137137
     
    139139and \w */
    140140
    141 static uschar toptable1[] = {
     141static const uschar toptable1[] = {
    142142  0, 0, 0, 0, 0, 0,
    143143  ctype_digit, ctype_digit,
    144144  ctype_space, ctype_space,
    145145  ctype_word,  ctype_word,
    146   0                               /* OP_ANY */
     146  0, 0                            /* OP_ANY, OP_ALLANY */
    147147};
    148148
    149 static uschar toptable2[] = {
     149static const uschar toptable2[] = {
    150150  0, 0, 0, 0, 0, 0,
    151151  ctype_digit, 0,
    152152  ctype_space, 0,
    153153  ctype_word,  0,
    154   1                               /* OP_ANY */
     154  1, 1                            /* OP_ANY, OP_ALLANY */
    155155};
    156156
     
    224224  recursing         regex recursive call level
    225225
    226 Returns:            > 0 =>
    227                     = 0 =>
     226Returns:            > 0 => number of match offset pairs placed in offsets
     227                    = 0 => offsets overflowed; longest matches are present
    228228                     -1 => failed to match
    229229                   < -1 => some kind of unexpected problem
     
    695695
    696696      /*-----------------------------------------------------------------*/
     697      case OP_SKIPZERO:
     698      code += 1 + GET(code, 2);
     699      while (*code == OP_ALT) code += GET(code, 1);
     700      ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
     701      break;
     702
     703      /*-----------------------------------------------------------------*/
    697704      case OP_CIRC:
    698705      if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||
     
    733740      /*-----------------------------------------------------------------*/
    734741      case OP_ANY:
    735       if (clen > 0 && ((ims & PCRE_DOTALL) != 0 || !IS_NEWLINE(ptr)))
     742      if (clen > 0 && !IS_NEWLINE(ptr))
     743        { ADD_NEW(state_offset + 1, 0); }
     744      break;
     745
     746      /*-----------------------------------------------------------------*/
     747      case OP_ALLANY:
     748      if (clen > 0)
    736749        { ADD_NEW(state_offset + 1, 0); }
    737750      break;
     
    853866      /* These opcodes likewise inspect the subject character, but have an
    854867      argument that is not a data character. It is one of these opcodes:
    855       OP_ANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE, OP_WORDCHAR,
    856       OP_NOT_WORDCHAR. The value is loaded into d. */
     868      OP_ANY, OP_ALLANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE,
     869      OP_WORDCHAR, OP_NOT_WORDCHAR. The value is loaded into d. */
    857870
    858871      case OP_TYPEPLUS:
     
    865878        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
    866879            (c < 256 &&
    867               (d != OP_ANY ||
    868                (ims & PCRE_DOTALL) != 0 ||
    869                !IS_NEWLINE(ptr)
    870               ) &&
     880              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
    871881              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
    872882          {
     
    891901        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
    892902            (c < 256 &&
    893               (d != OP_ANY ||
    894                (ims & PCRE_DOTALL) != 0 ||
    895                !IS_NEWLINE(ptr)
    896               ) &&
     903              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
    897904              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
    898905          {
     
    916923        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
    917924            (c < 256 &&
    918               (d != OP_ANY ||
    919                (ims & PCRE_DOTALL) != 0 ||
    920                !IS_NEWLINE(ptr)
    921               ) &&
     925              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
    922926              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
    923927          {
     
    939943        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
    940944            (c < 256 &&
    941               (d != OP_ANY ||
    942                (ims & PCRE_DOTALL) != 0 ||
    943                !IS_NEWLINE(ptr)
    944               ) &&
     945              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
    945946              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
    946947          {
     
    963964        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
    964965            (c < 256 &&
    965               (d != OP_ANY ||
    966                (ims & PCRE_DOTALL) != 0 ||
    967                !IS_NEWLINE(ptr)
    968               ) &&
     966              (d != OP_ANY || !IS_NEWLINE(ptr)) &&
    969967              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
    970968          {
     
    21632161/* ========================================================================== */
    21642162      /* These are the opcodes for fancy brackets of various kinds. We have
    2165       to use recursion in order to handle them. */
     2163      to use recursion in order to handle them. The "always failing" assersion
     2164      (?!) is optimised when compiling to OP_FAIL, so we have to support that,
     2165      though the other "backtracking verbs" are not supported. */
     2166
     2167      case OP_FAIL:
     2168      break;
    21662169
    21672170      case OP_ASSERT:
  • chicken/branches/hygienic/pcre/pcre_exec.c

    r9133 r12021  
    11491149    break;
    11501150
    1151     /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
    1152     that it may occur zero times. It may repeat infinitely, or not at all -
    1153     i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
    1154     repeat limits are compiled as a number of copies, with the optional ones
    1155     preceded by BRAZERO or BRAMINZERO. */
     1151    /* BRAZERO, BRAMINZERO and SKIPZERO occur just before a bracket group,
     1152    indicating that it may occur zero times. It may repeat infinitely, or not
     1153    at all - i.e. it could be ()* or ()? or even (){0} in the pattern. Brackets
     1154    with fixed upper repeat limits are compiled as a number of copies, with the
     1155    optional ones preceded by BRAZERO or BRAMINZERO. */
    11561156
    11571157    case OP_BRAZERO:
     
    11721172      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
    11731173      ecode++;
     1174      }
     1175    break;
     1176
     1177    case OP_SKIPZERO:
     1178      {
     1179      next = ecode+1;
     1180      do next += GET(next,1); while (*next == OP_ALT);
     1181      ecode = next + 1 + LINK_SIZE;
    11741182      }
    11751183    break;
     
    14221430
    14231431    case OP_ANY:
    1424     if ((ims & PCRE_DOTALL) == 0)
    1425       {
    1426       if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
    1427       }
     1432    if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
     1433    /* Fall through */
     1434
     1435    case OP_ALLANY:
    14281436    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
    1429     if (utf8)
    1430       while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
     1437    if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    14311438    ecode++;
    14321439    break;
     
    17241731      {
    17251732      offset = GET2(ecode, 1) << 1;               /* Doubled ref number */
    1726       ecode += 3;                                 /* Advance past item */
    1727 
    1728       /* If the reference is unset, set the length to be longer than the amount
    1729       of subject left; this ensures that every attempt at a match fails. We
    1730       can't just fail here, because of the possibility of quantifiers with zero
    1731       minima. */
    1732 
    1733       length = (offset >= offset_top || md->offset_vector[offset] < 0)?
    1734         md->end_subject - eptr + 1 :
    1735         md->offset_vector[offset+1] - md->offset_vector[offset];
     1733      ecode += 3;
     1734
     1735      /* If the reference is unset, there are two possibilities:
     1736
     1737      (a) In the default, Perl-compatible state, set the length to be longer
     1738      than the amount of subject left; this ensures that every attempt at a
     1739      match fails. We can't just fail here, because of the possibility of
     1740      quantifiers with zero minima.
     1741
     1742      (b) If the JavaScript compatibility flag is set, set the length to zero
     1743      so that the back reference matches an empty string.
     1744
     1745      Otherwise, set the length to the length of what was matched by the
     1746      referenced subpattern. */
     1747
     1748      if (offset >= offset_top || md->offset_vector[offset] < 0)
     1749        length = (md->jscript_compat)? 0 : md->end_subject - eptr + 1;
     1750      else
     1751        length = md->offset_vector[offset+1] - md->offset_vector[offset];
    17361752
    17371753      /* Set up for repetition, or handle the non-repeated case */
     
    29362952        for (i = 1; i <= min; i++)
    29372953          {
    2938           if (eptr >= md->end_subject ||
    2939                ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))
     2954          if (eptr >= md->end_subject || IS_NEWLINE(eptr))
    29402955            RRETURN(MATCH_NOMATCH);
     2956          eptr++;
     2957          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
     2958          }
     2959        break;
     2960
     2961        case OP_ALLANY:
     2962        for (i = 1; i <= min; i++)
     2963          {
     2964          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
    29412965          eptr++;
    29422966          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
     
    31523176        {
    31533177        case OP_ANY:
    3154         if ((ims & PCRE_DOTALL) == 0)
    3155           {
    3156           for (i = 1; i <= min; i++)
    3157             {
    3158             if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
    3159             eptr++;
    3160             }
    3161           }
    3162         else eptr += min;
     3178        for (i = 1; i <= min; i++)
     3179          {
     3180          if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
     3181          eptr++;
     3182          }
     3183        break;
     3184
     3185        case OP_ALLANY:
     3186        eptr += min;
    31633187        break;
    31643188
     
    34173441          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
    34183442          if (fi >= max || eptr >= md->end_subject ||
    3419                (ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&
    3420                 IS_NEWLINE(eptr)))
     3443               (ctype == OP_ANY && IS_NEWLINE(eptr)))
    34213444            RRETURN(MATCH_NOMATCH);
    34223445
     
    34243447          switch(ctype)
    34253448            {
    3426             case OP_ANY:        /* This is the DOTALL case */
    3427             break;
    3428 
     3449            case OP_ANY:        /* This is the non-NL case */
     3450            case OP_ALLANY:
    34293451            case OP_ANYBYTE:
    34303452            break;
     
    35783600          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
    35793601          if (fi >= max || eptr >= md->end_subject ||
    3580                ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))
     3602               (ctype == OP_ANY && IS_NEWLINE(eptr)))
    35813603            RRETURN(MATCH_NOMATCH);
    35823604
     
    35843606          switch(ctype)
    35853607            {
    3586             case OP_ANY:   /* This is the DOTALL case */
    3587             break;
    3588 
     3608            case OP_ANY:     /* This is the non-NL case */
     3609            case OP_ALLANY:
    35893610            case OP_ANYBYTE:
    35903611            break;
     
    38403861          if (max < INT_MAX)
    38413862            {
    3842             if ((ims & PCRE_DOTALL) == 0)
     3863            for (i = min; i < max; i++)
    38433864              {
    3844               for (i = min; i < max; i++)
    3845                 {
    3846                 if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
    3847                 eptr++;
    3848                 while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    3849                 }
     3865              if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
     3866              eptr++;
     3867              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    38503868              }
    3851             else
     3869            }
     3870
     3871          /* Handle unlimited UTF-8 repeat */
     3872
     3873          else
     3874            {
     3875            for (i = min; i < max; i++)
    38523876              {
    3853               for (i = min; i < max; i++)
    3854                 {
    3855                 if (eptr >= md->end_subject) break;
    3856                 eptr++;
    3857                 while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    3858                 }
     3877              if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
     3878              eptr++;
     3879              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    38593880              }
    38603881            }
    3861 
    3862           /* Handle unlimited UTF-8 repeat */
    3863 
    3864           else
    3865             {
    3866             if ((ims & PCRE_DOTALL) == 0)
     3882          break;
     3883
     3884          case OP_ALLANY:
     3885          if (max < INT_MAX)
     3886            {
     3887            for (i = min; i < max; i++)
    38673888              {
    3868               for (i = min; i < max; i++)
    3869                 {
    3870                 if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
    3871                 eptr++;
    3872                 while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    3873                 }
     3889              if (eptr >= md->end_subject) break;
     3890              eptr++;
     3891              while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
    38743892              }
    3875             else
    3876               {
    3877               eptr = md->end_subject;
    3878               }
    3879             }
     3893            }
     3894          else eptr = md->end_subject;   /* Unlimited UTF-8 repeat */
    38803895          break;
    38813896
     
    40654080          {
    40664081          case OP_ANY:
    4067           if ((ims & PCRE_DOTALL) == 0)
    4068             {
    4069             for (i = min; i < max; i++)
    4070               {
    4071               if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
    4072               eptr++;
    4073               }
    4074             break;
    4075             }
    4076           /* For DOTALL case, fall through and treat as \C */
    4077 
     4082          for (i = min; i < max; i++)
     4083            {
     4084            if (eptr >= md->end_subject || IS_NEWLINE(eptr)) break;
     4085            eptr++;
     4086            }
     4087          break;
     4088
     4089          case OP_ALLANY:
    40784090          case OP_ANYBYTE:
    40794091          c = max - min;
     
    44514463md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
    44524464utf8 = md->utf8 = (re->options & PCRE_UTF8) != 0;
     4465md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
    44534466
    44544467md->notbol = (options & PCRE_NOTBOL) != 0;
  • chicken/branches/hygienic/pcre/pcre_internal.h

    r9133 r12021  
    6666#define DPRINTF(p) /* Nothing */
    6767#endif
    68 
    69 
    70 /* Get the definitions provided by running "configure" */
    71 
    72 #include "config.h"
    7368
    7469
     
    520515   PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
    521516   PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
    522    PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
     517   PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
     518   PCRE_JAVASCRIPT_COMPAT)
    523519
    524520#define PUBLIC_EXEC_OPTIONS \
     
    610606their negation. Also, they must appear in the same order as in the opcode
    611607definitions below, up to ESC_z. There's a dummy for OP_ANY because it
    612 corresponds to "." rather than an escape sequence. The final one must be
    613 ESC_REF as subsequent values are used for backreferences (\1, \2, \3, etc).
    614 There are two tests in the code for an escape greater than ESC_b and less than
    615 ESC_Z to detect the types that may be repeated. These are the types that
    616 consume characters. If any new escapes are put in between that don't consume a
    617 character, that code will have to change. */
     608corresponds to "." rather than an escape sequence, and another for OP_ALLANY
     609(which is used for [^] in JavaScript compatibility mode).
     610
     611The final escape must be ESC_REF as subsequent values are used for
     612backreferences (\1, \2, \3, etc). There are two tests in the code for an escape
     613greater than ESC_b and less than ESC_Z to detect the types that may be
     614repeated. These are the types that consume characters. If any new escapes are
     615put in between that don't consume a character, that code will have to change.
     616*/
    618617
    619618enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
    620        ESC_W, ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H, ESC_h,
    621        ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };
     619       ESC_W, ESC_w, ESC_dum1, ESC_dum2, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H,
     620       ESC_h, ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k,
     621       ESC_REF };
    622622
    623623
     
    645645  OP_NOT_WORDCHAR,       /* 10 \W */
    646646  OP_WORDCHAR,           /* 11 \w */
    647   OP_ANY,            /* 12 Match any character */
    648   OP_ANYBYTE,        /* 13 Match any byte (\C); different to OP_ANY for UTF-8 */
    649   OP_NOTPROP,        /* 14 \P (not Unicode property) */
    650   OP_PROP,           /* 15 \p (Unicode property) */
    651   OP_ANYNL,          /* 16 \R (any newline sequence) */
    652   OP_NOT_HSPACE,     /* 17 \H (not horizontal whitespace) */
    653   OP_HSPACE,         /* 18 \h (horizontal whitespace) */
    654   OP_NOT_VSPACE,     /* 19 \V (not vertical whitespace) */
    655   OP_VSPACE,         /* 20 \v (vertical whitespace) */
    656   OP_EXTUNI,         /* 21 \X (extended Unicode sequence */
    657   OP_EODN,           /* 22 End of data or \n at end of data: \Z. */
    658   OP_EOD,            /* 23 End of data: \z */
    659 
    660   OP_OPT,            /* 24 Set runtime options */
    661   OP_CIRC,           /* 25 Start of line - varies with multiline switch */
    662   OP_DOLL,           /* 26 End of line - varies with multiline switch */
    663   OP_CHAR,           /* 27 Match one character, casefully */
    664   OP_CHARNC,         /* 28 Match one character, caselessly */
    665   OP_NOT,            /* 29 Match one character, not the following one */
    666 
    667   OP_STAR,           /* 30 The maximizing and minimizing versions of */
    668   OP_MINSTAR,        /* 31 these six opcodes must come in pairs, with */
    669   OP_PLUS,           /* 32 the minimizing one second. */
    670   OP_MINPLUS,        /* 33 This first set applies to single characters.*/
    671   OP_QUERY,          /* 34 */
    672   OP_MINQUERY,       /* 35 */
    673 
    674   OP_UPTO,           /* 36 From 0 to n matches */
    675   OP_MINUPTO,        /* 37 */
    676   OP_EXACT,          /* 38 Exactly n matches */
    677 
    678   OP_POSSTAR,        /* 39 Possessified star */
    679   OP_POSPLUS,        /* 40 Possessified plus */
    680   OP_POSQUERY,       /* 41 Posesssified query */
    681   OP_POSUPTO,        /* 42 Possessified upto */
    682 
    683   OP_NOTSTAR,        /* 43 The maximizing and minimizing versions of */
    684   OP_NOTMINSTAR,     /* 44 these six opcodes must come in pairs, with */
    685   OP_NOTPLUS,        /* 45 the minimizing one second. They must be in */
    686   OP_NOTMINPLUS,     /* 46 exactly the same order as those above. */
    687   OP_NOTQUERY,       /* 47 This set applies to "not" single characters. */
    688   OP_NOTMINQUERY,    /* 48 */
    689 
    690   OP_NOTUPTO,        /* 49 From 0 to n matches */
    691   OP_NOTMINUPTO,     /* 50 */
    692   OP_NOTEXACT,       /* 51 Exactly n matches */
    693 
    694   OP_NOTPOSSTAR,     /* 52 Possessified versions */
    695   OP_NOTPOSPLUS,     /* 53 */
    696   OP_NOTPOSQUERY,    /* 54 */
    697   OP_NOTPOSUPTO,     /* 55 */
    698 
    699   OP_TYPESTAR,       /* 56 The maximizing and minimizing versions of */
    700   OP_TYPEMINSTAR,    /* 57 these six opcodes must come in pairs, with */
    701   OP_TYPEPLUS,       /* 58 the minimizing one second. These codes must */
    702   OP_TYPEMINPLUS,    /* 59 be in exactly the same order as those above. */
    703   OP_TYPEQUERY,      /* 60 This set applies to character types such as \d */
    704   OP_TYPEMINQUERY,   /* 61 */
    705 
    706   OP_TYPEUPTO,       /* 62 From 0 to n matches */
    707   OP_TYPEMINUPTO,    /* 63 */
    708   OP_TYPEEXACT,      /* 64 Exactly n matches */
    709 
    710   OP_TYPEPOSSTAR,    /* 65 Possessified versions */
    711   OP_TYPEPOSPLUS,    /* 66 */
    712   OP_TYPEPOSQUERY,   /* 67 */
    713   OP_TYPEPOSUPTO,    /* 68 */
    714 
    715   OP_CRSTAR,         /* 69 The maximizing and minimizing versions of */
    716   OP_CRMINSTAR,      /* 70 all these opcodes must come in pairs, with */
    717   OP_CRPLUS,         /* 71 the minimizing one second. These codes must */
    718   OP_CRMINPLUS,      /* 72 be in exactly the same order as those above. */
    719   OP_CRQUERY,        /* 73 These are for character classes and back refs */
    720   OP_CRMINQUERY,     /* 74 */
    721   OP_CRRANGE,        /* 75 These are different to the three sets above. */
    722   OP_CRMINRANGE,     /* 76 */
    723 
    724   OP_CLASS,          /* 77 Match a character class, chars < 256 only */
    725   OP_NCLASS,         /* 78 Same, but the bitmap was created from a negative
     647  OP_ANY,            /* 12 Match any character (subject to DOTALL) */
     648  OP_ALLANY,         /* 13 Match any character (not subject to DOTALL) */
     649  OP_ANYBYTE,        /* 14 Match any byte (\C); different to OP_ANY for UTF-8 */
     650  OP_NOTPROP,        /* 15 \P (not Unicode property) */
     651  OP_PROP,           /* 16 \p (Unicode property) */
     652  OP_ANYNL,          /* 17 \R (any newline sequence) */
     653  OP_NOT_HSPACE,     /* 18 \H (not horizontal whitespace) */
     654  OP_HSPACE,         /* 19 \h (horizontal whitespace) */
     655  OP_NOT_VSPACE,     /* 20 \V (not vertical whitespace) */
     656  OP_VSPACE,         /* 21 \v (vertical whitespace) */
     657  OP_EXTUNI,         /* 22 \X (extended Unicode sequence */
     658  OP_EODN,           /* 23 End of data or \n at end of data: \Z. */
     659  OP_EOD,            /* 24 End of data: \z */
     660
     661  OP_OPT,            /* 25 Set runtime options */
     662  OP_CIRC,           /* 26 Start of line - varies with multiline switch */
     663  OP_DOLL,           /* 27 End of line - varies with multiline switch */
     664  OP_CHAR,           /* 28 Match one character, casefully */
     665  OP_CHARNC,         /* 29 Match one character, caselessly */
     666  OP_NOT,            /* 30 Match one character, not the following one */
     667
     668  OP_STAR,           /* 31 The maximizing and minimizing versions of */
     669  OP_MINSTAR,        /* 32 these six opcodes must come in pairs, with */
     670  OP_PLUS,           /* 33 the minimizing one second. */
     671  OP_MINPLUS,        /* 34 This first set applies to single characters.*/
     672  OP_QUERY,          /* 35 */
     673  OP_MINQUERY,       /* 36 */
     674
     675  OP_UPTO,           /* 37 From 0 to n matches */
     676  OP_MINUPTO,        /* 38 */
     677  OP_EXACT,          /* 39 Exactly n matches */
     678
     679  OP_POSSTAR,        /* 40 Possessified star */
     680  OP_POSPLUS,        /* 41 Possessified plus */
     681  OP_POSQUERY,       /* 42 Posesssified query */
     682  OP_POSUPTO,        /* 43 Possessified upto */
     683
     684  OP_NOTSTAR,        /* 44 The maximizing and minimizing versions of */
     685  OP_NOTMINSTAR,     /* 45 these six opcodes must come in pairs, with */
     686  OP_NOTPLUS,        /* 46 the minimizing one second. They must be in */
     687  OP_NOTMINPLUS,     /* 47 exactly the same order as those above. */
     688  OP_NOTQUERY,       /* 48 This set applies to "not" single characters. */
     689  OP_NOTMINQUERY,    /* 49 */
     690
     691  OP_NOTUPTO,        /* 50 From 0 to n matches */
     692  OP_NOTMINUPTO,     /* 51 */
     693  OP_NOTEXACT,       /* 52 Exactly n matches */
     694
     695  OP_NOTPOSSTAR,     /* 53 Possessified versions */
     696  OP_NOTPOSPLUS,     /* 54 */
     697  OP_NOTPOSQUERY,    /* 55 */
     698  OP_NOTPOSUPTO,     /* 56 */
     699
     700  OP_TYPESTAR,       /* 57 The maximizing and minimizing versions of */
     701  OP_TYPEMINSTAR,    /* 58 these six opcodes must come in pairs, with */
     702  OP_TYPEPLUS,       /* 59 the minimizing one second. These codes must */
     703  OP_TYPEMINPLUS,    /* 60 be in exactly the same order as those above. */
     704  OP_TYPEQUERY,      /* 61 This set applies to character types such as \d */
     705  OP_TYPEMINQUERY,   /* 62 */
     706
     707  OP_TYPEUPTO,       /* 63 From 0 to n matches */
     708  OP_TYPEMINUPTO,    /* 64 */
     709  OP_TYPEEXACT,      /* 65 Exactly n matches */
     710
     711  OP_TYPEPOSSTAR,    /* 66 Possessified versions */
     712  OP_TYPEPOSPLUS,    /* 67 */
     713  OP_TYPEPOSQUERY,   /* 68 */
     714  OP_TYPEPOSUPTO,    /* 69 */
     715
     716  OP_CRSTAR,         /* 70 The maximizing and minimizing versions of */
     717  OP_CRMINSTAR,      /* 71 all these opcodes must come in pairs, with */
     718  OP_CRPLUS,         /* 72 the minimizing one second. These codes must */
     719  OP_CRMINPLUS,      /* 73 be in exactly the same order as those above. */
     720  OP_CRQUERY,        /* 74 These are for character classes and back refs */
     721  OP_CRMINQUERY,     /* 75 */
     722  OP_CRRANGE,        /* 76 These are different to the three sets above. */
     723  OP_CRMINRANGE,     /* 77 */
     724
     725  OP_CLASS,          /* 78 Match a character class, chars < 256 only */
     726  OP_NCLASS,         /* 79 Same, but the bitmap was created from a negative
    726727                           class - the difference is relevant only when a UTF-8
    727728                           character > 255 is encountered. */
    728729
    729   OP_XCLASS,         /* 79 Extended class for handling UTF-8 chars within the
     730  OP_XCLASS,         /* 80 Extended class for handling UTF-8 chars within the
    730731                           class. This does both positive and negative. */
    731732
    732   OP_REF,            /* 80 Match a back reference */
    733   OP_RECURSE,        /* 81 Match a numbered subpattern (possibly recursive) */
    734   OP_CALLOUT,        /* 82 Call out to external function if provided */
    735 
    736   OP_ALT,            /* 83 Start of alternation */
    737   OP_KET,            /* 84 End of group that doesn't have an unbounded repeat */
    738   OP_KETRMAX,        /* 85 These two must remain together and in this */
    739   OP_KETRMIN,        /* 86 order. They are for groups the repeat for ever. */
     733  OP_REF,            /* 81 Match a back reference */
     734  OP_RECURSE,        /* 82 Match a numbered subpattern (possibly recursive) */
     735  OP_CALLOUT,        /* 83 Call out to external function if provided */
     736
     737  OP_ALT,            /* 84 Start of alternation */
     738  OP_KET,            /* 85 End of group that doesn't have an unbounded repeat */
     739  OP_KETRMAX,        /* 86 These two must remain together and in this */
     740  OP_KETRMIN,        /* 87 order. They are for groups the repeat for ever. */
    740741
    741742  /* The assertions must come before BRA, CBRA, ONCE, and COND.*/
    742743
    743   OP_ASSERT,         /* 87 Positive lookahead */
    744   OP_ASSERT_NOT,     /* 88 Negative lookahead */
    745   OP_ASSERTBACK,     /* 89 Positive lookbehind */
    746   OP_ASSERTBACK_NOT, /* 90 Negative lookbehind */
    747   OP_REVERSE,        /* 91 Move pointer back - used in lookbehind assertions */
     744  OP_ASSERT,         /* 88 Positive lookahead */
     745  OP_ASSERT_NOT,     /* 89 Negative lookahead */
     746  OP_ASSERTBACK,     /* 90 Positive lookbehind */
     747  OP_ASSERTBACK_NOT, /* 91 Negative lookbehind */
     748  OP_REVERSE,        /* 92 Move pointer back - used in lookbehind assertions */
    748749
    749750  /* ONCE, BRA, CBRA, and COND must come after the assertions, with ONCE first,
    750751  as there's a test for >= ONCE for a subpattern that isn't an assertion. */
    751752
    752   OP_ONCE,           /* 92 Atomic group */
    753   OP_BRA,            /* 93 Start of non-capturing bracket */
    754   OP_CBRA,           /* 94 Start of capturing bracket */
    755   OP_COND,           /* 95 Conditional group */
     753  OP_ONCE,           /* 93 Atomic group */
     754  OP_BRA,            /* 94 Start of non-capturing bracket */
     755  OP_CBRA,           /* 95 Start of capturing bracket */
     756  OP_COND,           /* 96 Conditional group */
    756757
    757758  /* These three must follow the previous three, in the same order. There's a
    758759  check for >= SBRA to distinguish the two sets. */
    759760
    760   OP_SBRA,           /* 96 Start of non-capturing bracket, check empty  */
    761   OP_SCBRA,          /* 97 Start of capturing bracket, check empty */
    762   OP_SCOND,          /* 98 Conditional group, check empty */
    763 
    764   OP_CREF,           /* 99 Used to hold a capture number as condition */
    765   OP_RREF,           /* 100 Used to hold a recursion number as condition */
    766   OP_DEF,            /* 101 The DEFINE condition */
    767 
    768   OP_BRAZERO,        /* 102 These two must remain together and in this */
    769   OP_BRAMINZERO,     /* 103 order. */
     761  OP_SBRA,           /* 97 Start of non-capturing bracket, check empty  */
     762  OP_SCBRA,          /* 98 Start of capturing bracket, check empty */
     763  OP_SCOND,          /* 99 Conditional group, check empty */
     764
     765  OP_CREF,           /* 100 Used to hold a capture number as condition */
     766  OP_RREF,           /* 101 Used to hold a recursion number as condition */
     767  OP_DEF,            /* 102 The DEFINE condition */
     768
     769  OP_BRAZERO,        /* 103 These two must remain together and in this */
     770  OP_BRAMINZERO,     /* 104 order. */
    770771
    771772  /* These are backtracking control verbs */
    772773
    773   OP_PRUNE,          /* 104 */
    774   OP_SKIP,           /* 105 */
    775   OP_THEN,           /* 106 */
    776   OP_COMMIT,         /* 107 */
     774  OP_PRUNE,          /* 105 */
     775  OP_SKIP,           /* 106 */
     776  OP_THEN,           /* 107 */
     777  OP_COMMIT,         /* 108 */
    777778
    778779  /* These are forced failure and success verbs */
    779780
    780   OP_FAIL,           /* 108 */
    781   OP_ACCEPT          /* 109 */
     781  OP_FAIL,           /* 109 */
     782  OP_ACCEPT,         /* 110 */
     783
     784  /* This is used to skip a subpattern with a {0} quantifier */
     785
     786  OP_SKIPZERO        /* 111 */
    782787};
    783788
     
    788793#define OP_NAME_LIST \
    789794  "End", "\\A", "\\G", "\\K", "\\B", "\\b", "\\D", "\\d",         \
    790   "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte",                   \
     795  "\\S", "\\s", "\\W", "\\w", "Any", "AllAny", "Anybyte",         \
    791796  "notprop", "prop", "\\R", "\\H", "\\h", "\\V", "\\v",           \
    792797  "extuni",  "\\Z", "\\z",                                        \
     
    804809  "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
    805810  "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
    806   "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT"
     811  "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \
     812  "Skip zero"
    807813
    808814
     
    820826  1, 1, 1, 1, 1,                 /* \A, \G, \K, \B, \b                     */ \
    821827  1, 1, 1, 1, 1, 1,              /* \D, \d, \S, \s, \W, \w                 */ \
    822   1, 1,                          /* Any, Anybyte                           */ \
     828  1, 1, 1,                       /* Any, AllAny, Anybyte                   */ \
    823829  3, 3, 1,                       /* NOTPROP, PROP, EXTUNI                  */ \
    824830  1, 1, 1, 1, 1,                 /* \R, \H, \h, \V, \v                     */ \
     
    869875  1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
    870876  1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \
    871   1, 1                           /* FAIL, ACCEPT                           */
     877  1, 1, 1                        /* FAIL, ACCEPT, SKIPZERO                 */
    872878
    873879
     
    885891       ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
    886892       ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
    887        ERR60, ERR61, ERR62, ERR63 };
     893       ERR60, ERR61, ERR62, ERR63, ERR64 };
    888894
    889895/* The real format of the start of the pcre block; the index of names and the
     
    10101016  BOOL   noteol;                /* NOTEOL flag */
    10111017  BOOL   utf8;                  /* UTF8 flag */
     1018  BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */
    10121019  BOOL   endonly;               /* Dollar not before final \n */
    10131020  BOOL   notempty;              /* Empty string match not wanted */
  • chicken/branches/hygienic/pcre/pcre_study.c

    r9133 r12021  
    218218      break;
    219219
     220      /* SKIPZERO skips the bracket. */
     221
     222      case OP_SKIPZERO:
     223      do tcode += GET(tcode,1); while (*tcode == OP_ALT);
     224      tcode += 1 + LINK_SIZE;
     225      break;
     226
    220227      /* Single-char * or ? sets the bit and tries the next item */
    221228
     
    342349        {
    343350        case OP_ANY:
     351        case OP_ALLANY:
    344352        return SSB_FAIL;
    345353
  • chicken/branches/hygienic/pcre/ucpinternal.h

    r6175 r12021  
    1818#define f0_scriptmask   0xff000000  /* Mask for script field */
    1919#define f0_scriptshift          24  /* Shift for script value */
    20 #define f0_rangeflag    0x00f00000  /* Flag for a range item */
     20#define f0_rangeflag    0x00800000  /* Flag for a range item */
    2121#define f0_charmask     0x001fffff  /* Mask for code point value */
    2222
  • chicken/branches/hygienic/rules.make

    r11978 r12021  
    2525# POSSIBILITY OF SUCH DAMAGE.
    2626
     27VPATH=$(SRCDIR):$(SRCDIR)pcre
    2728
    2829# object files
     
    5152ifeq ($(USE_HOST_PCRE),)
    5253PCRE_OBJECTS_1 ?= \
    53        pcre/pcre_compile \
    54        pcre/pcre_config \
    55        pcre/pcre_dfa_exec \
    56        pcre/pcre_exec \
    57        pcre/pcre_fullinfo \
    58        pcre/pcre_get \
    59        pcre/pcre_globals \
    60        pcre/pcre_info \
    61        pcre/pcre_maketables \
    62        pcre/pcre_newline \
    63        pcre/pcre_ord2utf8 \
    64        pcre/pcre_refcount \
    65        pcre/pcre_study \
    66        pcre/pcre_tables \
    67        pcre/pcre_try_flipped \
    68        pcre/pcre_ucp_searchfuncs \
    69        pcre/pcre_valid_utf8 \
    70        pcre/pcre_version \
    71        pcre/pcre_xclass \
    72        pcre/pcre_chartables
     54       $(PCRE_DIR)pcre_compile \
     55       $(PCRE_DIR)pcre_config \
     56       $(PCRE_DIR)pcre_dfa_exec \
     57       $(PCRE_DIR)pcre_exec \
     58       $(PCRE_DIR)pcre_fullinfo \
     59       $(PCRE_DIR)pcre_get \
     60       $(PCRE_DIR)pcre_globals \
     61       $(PCRE_DIR)pcre_info \
     62       $(PCRE_DIR)pcre_maketables \
     63       $(PCRE_DIR)pcre_newline \
     64       $(PCRE_DIR)pcre_ord2utf8 \
     65       $(PCRE_DIR)pcre_refcount \
     66       $(PCRE_DIR)pcre_study \
     67       $(PCRE_DIR)pcre_tables \
     68       $(PCRE_DIR)pcre_try_flipped \
     69       $(PCRE_DIR)pcre_ucp_searchfuncs \
     70       $(PCRE_DIR)pcre_valid_utf8 \
     71       $(PCRE_DIR)pcre_version \
     72       $(PCRE_DIR)pcre_xclass \
     73       $(PCRE_DIR)pcre_chartables
    7374PCRE_SHARED_OBJECTS = $(PCRE_OBJECTS_1:=$(O))
    7475PCRE_STATIC_OBJECTS = $(PCRE_OBJECTS_1:=-static$(O))
     
    596597# pcre objects
    597598
    598 $(PCRE_DIR)/pcre_compile$(O): $(PCRE_DIR)/pcre_compile.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    599         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    600           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    601           $(C_COMPILER_PCRE_OPTIONS)
    602 $(PCRE_DIR)/pcre_config$(O): $(PCRE_DIR)/pcre_config.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    603         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    604           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    605           $(C_COMPILER_PCRE_OPTIONS)
    606 $(PCRE_DIR)/pcre_dfa_exec$(O): $(PCRE_DIR)/pcre_dfa_exec.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    607         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    608           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    609           $(C_COMPILER_PCRE_OPTIONS)
    610 $(PCRE_DIR)/pcre_exec$(O): $(PCRE_DIR)/pcre_exec.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    611         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    612           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    613           $(C_COMPILER_PCRE_OPTIONS)
    614 $(PCRE_DIR)/pcre_fullinfo$(O): $(PCRE_DIR)/pcre_fullinfo.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    615         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    616           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    617           $(C_COMPILER_PCRE_OPTIONS)
    618 $(PCRE_DIR)/pcre_get$(O): $(PCRE_DIR)/pcre_get.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    619         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    620           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    621           $(C_COMPILER_PCRE_OPTIONS)
    622 $(PCRE_DIR)/pcre_globals$(O): $(PCRE_DIR)/pcre_globals.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    623         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    624           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    625           $(C_COMPILER_PCRE_OPTIONS)
    626 $(PCRE_DIR)/pcre_info$(O): $(PCRE_DIR)/pcre_info.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    627         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    628           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    629           $(C_COMPILER_PCRE_OPTIONS)
    630 $(PCRE_DIR)/pcre_maketables$(O): $(PCRE_DIR)/pcre_maketables.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    631         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    632           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    633           $(C_COMPILER_PCRE_OPTIONS)
    634 $(PCRE_DIR)/pcre_newline$(O): $(PCRE_DIR)/pcre_newline.c $(PCRE_DIR)/pcre_internal.h $(PCRE_DIR)/config.h $(CHICKEN_CONFIG_H) $(PCRE_DIR)/pcre.h $(PCRE_DIR)/ucp.h
    635         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    636           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    637           $(C_COMPILER_PCRE_OPTIONS)
    638 pcre/pcre_ord2utf8$(O): pcre/pcre_ord2utf8.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    639         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    640           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    641           $(C_COMPILER_PCRE_OPTIONS)
    642 pcre/pcre_refcount$(O): pcre/pcre_refcount.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    643         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    644           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    645           $(C_COMPILER_PCRE_OPTIONS)
    646 pcre/pcre_study$(O): pcre/pcre_study.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    647         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    648           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    649           $(C_COMPILER_PCRE_OPTIONS)
    650 pcre/pcre_tables$(O): pcre/pcre_tables.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    651         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    652           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    653           $(C_COMPILER_PCRE_OPTIONS)
    654 pcre/pcre_try_flipped$(O): pcre/pcre_try_flipped.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    655         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    656           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    657           $(C_COMPILER_PCRE_OPTIONS)
    658 pcre/pcre_ucp_searchfuncs$(O): pcre/pcre_ucp_searchfuncs.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h pcre/ucptable.h pcre/ucpinternal.h
    659         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    660           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    661           $(C_COMPILER_PCRE_OPTIONS)
    662 pcre/pcre_valid_utf8$(O): pcre/pcre_valid_utf8.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    663         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    664           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    665           $(C_COMPILER_PCRE_OPTIONS)
    666 pcre/pcre_version$(O): pcre/pcre_version.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    667         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    668           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    669           $(C_COMPILER_PCRE_OPTIONS)
    670 pcre/pcre_xclass$(O): pcre/pcre_xclass.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    671         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    672           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    673           $(C_COMPILER_PCRE_OPTIONS)
    674 pcre/pcre_chartables$(O): pcre/pcre_chartables.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H)
     599$(PCRE_DIR)pcre_compile$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     600        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     601          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     602          $(C_COMPILER_PCRE_OPTIONS)
     603$(PCRE_DIR)pcre_config$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     604        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     605          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     606          $(C_COMPILER_PCRE_OPTIONS)
     607$(PCRE_DIR)pcre_dfa_exec$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     608        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     609          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     610          $(C_COMPILER_PCRE_OPTIONS)
     611$(PCRE_DIR)pcre_exec$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     612        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     613          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     614          $(C_COMPILER_PCRE_OPTIONS)
     615$(PCRE_DIR)pcre_fullinfo$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     616        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     617          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     618          $(C_COMPILER_PCRE_OPTIONS)
     619$(PCRE_DIR)pcre_get$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     620        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     621          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     622          $(C_COMPILER_PCRE_OPTIONS)
     623$(PCRE_DIR)pcre_globals$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     624        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     625          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     626          $(C_COMPILER_PCRE_OPTIONS)
     627$(PCRE_DIR)pcre_info$(O): pcre_info.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     628        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     629          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     630          $(C_COMPILER_PCRE_OPTIONS)
     631$(PCRE_DIR)pcre_maketables$(O): pcre_maketables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     632        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     633          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     634          $(C_COMPILER_PCRE_OPTIONS)
     635$(PCRE_DIR)pcre_newline$(O): pcre_newline.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     636        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     637          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     638          $(C_COMPILER_PCRE_OPTIONS)
     639$(PCRE_DIR)pcre_ord2utf8$(O): pcre_ord2utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     640        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     641          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     642          $(C_COMPILER_PCRE_OPTIONS)
     643$(PCRE_DIR)pcre_refcount$(O): pcre_refcount.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     644        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     645          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     646          $(C_COMPILER_PCRE_OPTIONS)
     647$(PCRE_DIR)pcre_study$(O): pcre_study.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     648        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     649          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     650          $(C_COMPILER_PCRE_OPTIONS)
     651$(PCRE_DIR)pcre_tables$(O): pcre_tables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     652        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     653          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     654          $(C_COMPILER_PCRE_OPTIONS)
     655$(PCRE_DIR)pcre_try_flipped$(O): pcre_try_flipped.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     656        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     657          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     658          $(C_COMPILER_PCRE_OPTIONS)
     659$(PCRE_DIR)pcre_ucp_searchfuncs$(O): pcre_ucp_searchfuncs.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h ucptable.h ucpinternal.h
     660        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     661          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     662          $(C_COMPILER_PCRE_OPTIONS)
     663$(PCRE_DIR)pcre_valid_utf8$(O): pcre_valid_utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     664        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     665          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     666          $(C_COMPILER_PCRE_OPTIONS)
     667$(PCRE_DIR)pcre_version$(O): pcre_version.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     668        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     669          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     670          $(C_COMPILER_PCRE_OPTIONS)
     671$(PCRE_DIR)pcre_xclass$(O): pcre_xclass.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     672        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     673          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     674          $(C_COMPILER_PCRE_OPTIONS)
     675$(PCRE_DIR)pcre_chartables$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H)
    675676        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    676677          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     
    679680# static pcre objects
    680681
    681 pcre/pcre_compile-static$(O): pcre/pcre_compile.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    682         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    683           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    684           $(C_COMPILER_PCRE_OPTIONS)
    685 pcre/pcre_config-static$(O): pcre/pcre_config.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    686         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    687           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    688           $(C_COMPILER_PCRE_OPTIONS)
    689 pcre/pcre_dfa_exec-static$(O): pcre/pcre_dfa_exec.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    690         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    691           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    692           $(C_COMPILER_PCRE_OPTIONS)
    693 pcre/pcre_exec-static$(O): pcre/pcre_exec.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    694         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    695           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    696           $(C_COMPILER_PCRE_OPTIONS)
    697 pcre/pcre_fullinfo-static$(O): pcre/pcre_fullinfo.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    698         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    699           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    700           $(C_COMPILER_PCRE_OPTIONS)
    701 pcre/pcre_get-static$(O): pcre/pcre_get.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    702         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    703           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    704           $(C_COMPILER_PCRE_OPTIONS)
    705 pcre/pcre_globals-static$(O): pcre/pcre_globals.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    706         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    707           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    708           $(C_COMPILER_PCRE_OPTIONS)
    709 pcre/pcre_info-static$(O): pcre/pcre_info.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    710         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    711           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    712           $(C_COMPILER_PCRE_OPTIONS)
    713 pcre/pcre_maketables-static$(O): pcre/pcre_maketables.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    714         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    715           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    716           $(C_COMPILER_PCRE_OPTIONS)
    717 pcre/pcre_newline-static$(O): pcre/pcre_newline.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    718         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    719           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    720           $(C_COMPILER_PCRE_OPTIONS)
    721 pcre/pcre_ord2utf8-static$(O): pcre/pcre_ord2utf8.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    722         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    723           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    724           $(C_COMPILER_PCRE_OPTIONS)
    725 pcre/pcre_refcount-static$(O): pcre/pcre_refcount.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    726         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    727           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    728           $(C_COMPILER_PCRE_OPTIONS)
    729 pcre/pcre_study-static$(O): pcre/pcre_study.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    730         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    731           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    732           $(C_COMPILER_PCRE_OPTIONS)
    733 pcre/pcre_tables-static$(O): pcre/pcre_tables.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    734         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    735           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    736           $(C_COMPILER_PCRE_OPTIONS)
    737 pcre/pcre_try_flipped-static$(O): pcre/pcre_try_flipped.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    738         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    739           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    740           $(C_COMPILER_PCRE_OPTIONS)
    741 pcre/pcre_ucp_searchfuncs-static$(O): pcre/pcre_ucp_searchfuncs.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h pcre/ucptable.h pcre/ucpinternal.h
    742         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    743           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    744           $(C_COMPILER_PCRE_OPTIONS)
    745 pcre/pcre_valid_utf8-static$(O): pcre/pcre_valid_utf8.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    746         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    747           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    748           $(C_COMPILER_PCRE_OPTIONS)
    749 pcre/pcre_version-static$(O): pcre/pcre_version.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    750         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    751           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    752           $(C_COMPILER_PCRE_OPTIONS)
    753 pcre/pcre_xclass-static$(O): pcre/pcre_xclass.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H) pcre/pcre.h pcre/ucp.h
    754         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    755           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    756           $(C_COMPILER_PCRE_OPTIONS)
    757 pcre/pcre_chartables-static$(O): pcre/pcre_chartables.c pcre/pcre_internal.h pcre/config.h $(CHICKEN_CONFIG_H)
     682$(PCRE_DIR)pcre_compile-static$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     683        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     684          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     685          $(C_COMPILER_PCRE_OPTIONS)
     686$(PCRE_DIR)pcre_config-static$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     687        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     688          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     689          $(C_COMPILER_PCRE_OPTIONS)
     690$(PCRE_DIR)pcre_dfa_exec-static$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     691        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     692          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     693          $(C_COMPILER_PCRE_OPTIONS)
     694$(PCRE_DIR)pcre_exec-static$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     695        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     696          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     697          $(C_COMPILER_PCRE_OPTIONS)
     698$(PCRE_DIR)pcre_fullinfo-static$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     699        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     700          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     701          $(C_COMPILER_PCRE_OPTIONS)
     702$(PCRE_DIR)pcre_get-static$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     703        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     704          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     705          $(C_COMPILER_PCRE_OPTIONS)
     706$(PCRE_DIR)pcre_globals-static$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     707        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     708          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     709          $(C_COMPILER_PCRE_OPTIONS)
     710$(PCRE_DIR)pcre_info-static$(O): pcre_info.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     711        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     712          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     713          $(C_COMPILER_PCRE_OPTIONS)
     714$(PCRE_DIR)pcre_maketables-static$(O): pcre_maketables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     715        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     716          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     717          $(C_COMPILER_PCRE_OPTIONS)
     718$(PCRE_DIR)pcre_newline-static$(O): pcre_newline.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     719        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     720          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     721          $(C_COMPILER_PCRE_OPTIONS)
     722$(PCRE_DIR)pcre_ord2utf8-static$(O): pcre_ord2utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     723        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     724          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     725          $(C_COMPILER_PCRE_OPTIONS)
     726$(PCRE_DIR)pcre_refcount-static$(O): pcre_refcount.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     727        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     728          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     729          $(C_COMPILER_PCRE_OPTIONS)
     730$(PCRE_DIR)pcre_study-static$(O): pcre_study.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     731        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     732          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     733          $(C_COMPILER_PCRE_OPTIONS)
     734$(PCRE_DIR)pcre_tables-static$(O): pcre_tables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     735        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     736          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     737          $(C_COMPILER_PCRE_OPTIONS)
     738$(PCRE_DIR)pcre_try_flipped-static$(O): pcre_try_flipped.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     739        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     740          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     741          $(C_COMPILER_PCRE_OPTIONS)
     742$(PCRE_DIR)pcre_ucp_searchfuncs-static$(O): pcre_ucp_searchfuncs.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h ucptable.h ucpinternal.h
     743        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     744          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     745          $(C_COMPILER_PCRE_OPTIONS)
     746$(PCRE_DIR)pcre_valid_utf8-static$(O): pcre_valid_utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     747        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     748          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     749          $(C_COMPILER_PCRE_OPTIONS)
     750$(PCRE_DIR)pcre_version-static$(O): pcre_version.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     751        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     752          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     753          $(C_COMPILER_PCRE_OPTIONS)
     754$(PCRE_DIR)pcre_xclass-static$(O): pcre_xclass.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
     755        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
     756          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     757          $(C_COMPILER_PCRE_OPTIONS)
     758$(PCRE_DIR)pcre_chartables-static$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H)
    758759        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    759760          $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
     
    763764
    764765ifneq ($(HACKED_APPLY),)
    765 $(APPLY_HACK_OBJECT): apply-hack.$(ARCH).s
     766$(APPLY_HACK_OBJECT): $(SRCDIR)apply-hack.$(ARCH).s
    766767        $(ASSEMBLER) $(ASSEMBLER_OPTIONS) $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
    767768endif
     
    930931endif
    931932ifneq ($(POSTINSTALL_STATIC_LIBRARY),true)
     933ifdef WINDOWS
     934        $(POSTINSTALL_STATIC_LIBRARY) $(POSTINSTALL_STATIC_LIBRARY_FLAGS) \
     935          $(ILIBDIR)\\libchicken$(A)
     936        $(POSTINSTALL_STATIC_LIBRARY) $(POSTINSTALL_STATIC_LIBRARY_FLAGS) \
     937          $(ILIBDIR)\\libuchicken$(A)
     938else
    932939        $(POSTINSTALL_STATIC_LIBRARY) $(POSTINSTALL_STATIC_LIBRARY_FLAGS) \
    933940          $(ILIBDIR)/libchicken$(A)
     
    935942          $(ILIBDIR)/libuchicken$(A)
    936943endif
    937         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken.h $(DESTDIR)$(IINCDIR)
     944endif
     945        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.h $(DESTDIR)$(IINCDIR)
    938946        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(CHICKEN_CONFIG_H) $(DESTDIR)$(IINCDIR)
    939947ifndef STATICBUILD
     
    976984          $(CHICKEN_INSTALL_PROGRAM)$(EXE) $(CHICKEN_UNINSTALL_PROGRAM)$(EXE) \
    977985          $(CHICKEN_STATUS_PROGRAM)$(EXE)
    978         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) NEEDS_RELINKING=no RUNTIME_LINKER_PATH=$(LIBDIR) install
     986        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) NEEDS_RELINKING=no RUNTIME_LINKER_PATH=$(LIBDIR) install
    979987        $(MAKE_WRITABLE_COMMAND) $(CHICKEN_PROGRAM)$(EXE) $(CSI_PROGRAM)$(EXE) \
    980988          $(CSC_PROGRAM)$(EXE) $(CHICKEN_PROFILE_PROGRAM)$(EXE)
     
    10411049endif
    10421050endif
    1043         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken.1 $(DESTDIR)$(IMANDIR)
    1044         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/csi.1 $(DESTDIR)$(IMANDIR)
    1045         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/csc.1 $(DESTDIR)$(IMANDIR)
    1046         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-install.1 $(DESTDIR)$(IMANDIR)
    1047         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-uninstall.1 $(DESTDIR)$(IMANDIR)
    1048         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-status.1 $(DESTDIR)$(IMANDIR)
    1049         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-profile.1 $(DESTDIR)$(IMANDIR)
    1050         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-bug.1 $(DESTDIR)$(IMANDIR)
     1051        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.1 $(DESTDIR)$(IMANDIR)
     1052        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)csi.1 $(DESTDIR)$(IMANDIR)
     1053        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)csc.1 $(DESTDIR)$(IMANDIR)
     1054        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-install.1 $(DESTDIR)$(IMANDIR)
     1055        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-uninstall.1 $(DESTDIR)$(IMANDIR)
     1056        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-status.1 $(DESTDIR)$(IMANDIR)
     1057        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-profile.1 $(DESTDIR)$(IMANDIR)
     1058        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-bug.1 $(DESTDIR)$(IMANDIR)
    10511059        $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) $(DESTDIR)$(IDOCDIR)/html
    1052         -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/html/* $(DESTDIR)$(IDOCDIR)/html
    1053         -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken.pdf $(DESTDIR)$(IDOCDIR)
    1054         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/README $(DESTDIR)$(IDOCDIR)
    1055         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/LICENSE $(DESTDIR)$(IDOCDIR)
    1056         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/chicken-more-macros.scm $(DESTDIR)$(IDATADIR)
     1060        -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)html/* $(DESTDIR)$(IDOCDIR)/html
     1061        -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken.pdf $(DESTDIR)$(IDOCDIR)
     1062        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)README $(DESTDIR)$(IDOCDIR)
     1063        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)LICENSE $(DESTDIR)$(IDOCDIR)
     1064        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)chicken-more-macros.scm $(DESTDIR)$(IDATADIR)
    10571065        -$(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) chicken.info $(DESTDIR)$(IINFODIR)
    10581066        $(INSTALLINFO_PROGRAM) $(INSTALLINFO_PROGRAM_OPTIONS) --infodir=$(DESTDIR)$(IINFODIR) chicken.info
    10591067ifdef WINDOWS
    1060         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) $(SRCDIR)/csibatch.bat $(DESTDIR)$(IBINDIR)
     1068        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) $(SRCDIR)csibatch.bat $(DESTDIR)$(IBINDIR)
    10611069endif
    10621070endif
     
    10711079
    10721080install-setup-files:
    1073         $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)/setup.defaults $(DESTDIR)$(IEGGDIR)
     1081        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_FILE_OPTIONS) $(SRCDIR)setup.defaults $(DESTDIR)$(IEGGDIR)
    10741082        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) setup-api.so $(DESTDIR)$(IEGGDIR)
    10751083        $(INSTALL_PROGRAM) $(INSTALL_PROGRAM_EXECUTABLE_OPTIONS) setup-download.so $(DESTDIR)$(IEGGDIR)
     
    11131121.SUFFIXES: .scm
    11141122
    1115 library.c: library.scm version.scm banner.scm
    1116         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1117 eval.c: eval.scm
    1118         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1119 expand.c: expand.scm synrules.scm
     1123library.c: $(SRCDIR)library.scm $(SRCDIR)version.scm $(SRCDIR)banner.scm
     1124        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1125eval.c: $(SRCDIR)eval.scm
     1126        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1127expand.c: $(SRCDIR)expand.scm $(SRCDIR)synrules.scm
    11201128        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1121 data-structures.c: data-structures.scm private-namespace.scm
    1122         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend private-namespace.scm
    1123 ports.c: ports.scm private-namespace.scm
    1124         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend private-namespace.scm
    1125 files.c: files.scm private-namespace.scm
    1126         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend private-namespace.scm
    1127 extras.c: extras.scm private-namespace.scm
    1128         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend private-namespace.scm
    1129 lolevel.c: lolevel.scm
    1130         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1131 tcp.c: tcp.scm
    1132         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1133 srfi-1.c: srfi-1.scm
    1134         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1135 srfi-4.c: srfi-4.scm
    1136         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1137 srfi-13.c: srfi-13.scm
    1138         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1139 srfi-14.c: srfi-14.scm
    1140         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1141 srfi-18.c: srfi-18.scm
    1142         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1143 srfi-69.c: srfi-69.scm private-namespace.scm
    1144         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend private-namespace.scm
    1145 utils.c: utils.scm
    1146         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1147 posixunix.c: posixunix.scm
    1148         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1149 posixwin.c: posixwin.scm
    1150         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1151 regex.c: regex.scm
     1129data-structures.c: $(SRCDIR)data-structures.scm $(SRCDIR)private-namespace.scm
     1130        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1131ports.c: $(SRCDIR)ports.scm $(SRCDIR)private-namespace.scm
     1132        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1133files.c: $(SRCDIR)files.scm $(SRCDIR)private-namespace.scm
     1134        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1135extras.c: $(SRCDIR)extras.scm $(SRCDIR)private-namespace.scm
     1136        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1137lolevel.c: $(SRCDIR)lolevel.scm
     1138        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1139tcp.c: $(SRCDIR)tcp.scm
     1140        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1141srfi-1.c: $(SRCDIR)srfi-1.scm
     1142        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1143srfi-4.c: $(SRCDIR)srfi-4.scm
     1144        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1145srfi-13.c: $(SRCDIR)srfi-13.scm
     1146        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1147srfi-14.c: $(SRCDIR)srfi-14.scm
     1148        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1149srfi-18.c: $(SRCDIR)srfi-18.scm
     1150        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1151srfi-69.c: $(SRCDIR)srfi-69.scm $(SRCDIR)private-namespace.scm
     1152        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1153utils.c: $(SRCDIR)utils.scm
     1154        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1155posixunix.c: $(SRCDIR)posixunix.scm
     1156        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1157posixwin.c: $(SRCDIR)posixwin.scm
     1158        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1159regex.c: $(SRCDIR)regex.scm
    11521160        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) -output-file $@
    1153 scheduler.c: scheduler.scm
    1154         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1155 profiler.c: profiler.scm
    1156         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1157 stub.c: stub.scm
    1158         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1159 
    1160 ulibrary.c: library.scm version.scm banner.scm unsafe-declarations.scm
     1161scheduler.c: $(SRCDIR)scheduler.scm
     1162        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1163profiler.c: $(SRCDIR)profiler.scm
     1164        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1165stub.c: $(SRCDIR)stub.scm
     1166        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     1167
     1168ulibrary.c: $(SRCDIR)library.scm $(SRCDIR)version.scm $(SRCDIR)banner.scm $(SRCDIR)unsafe-declarations.scm
    11611169        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1162 ueval.c: eval.scm unsafe-declarations.scm
     1170ueval.c: $(SRCDIR)eval.scm $(SRCDIR)unsafe-declarations.scm
    11631171        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1164 udata-structures.c: data-structures.scm private-namespace.scm unsafe-declarations.scm
    1165         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend private-namespace.scm
    1166 uports.c: ports.scm private-namespace.scm unsafe-declarations.scm
     1172udata-structures.c: $(SRCDIR)data-structures.scm $(SRCDIR)private-namespace.scm $(SRCDIR)unsafe-declarations.scm
     1173        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1174uports.c: $(SRCDIR)ports.scm $(SRCDIR)private-namespace.scm $(SRCDIR)unsafe-declarations.scm
    11671175        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1168 ufiles.c: files.scm private-namespace.scm unsafe-declarations.scm
     1176ufiles.c: $(SRCDIR)files.scm $(SRCDIR)private-namespace.scm $(SRCDIR)unsafe-declarations.scm
    11691177        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1170 uextras.c: extras.scm private-namespace.scm unsafe-declarations.scm
    1171         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend private-namespace.scm
    1172 ulolevel.c: lolevel.scm unsafe-declarations.scm
     1178uextras.c: $(SRCDIR)extras.scm $(SRCDIR)private-namespace.scm $(SRCDIR)unsafe-declarations.scm
     1179        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1180ulolevel.c: $(SRCDIR)lolevel.scm $(SRCDIR)unsafe-declarations.scm
    11731181        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1174 utcp.c: tcp.scm unsafe-declarations.scm
     1182utcp.c: $(SRCDIR)tcp.scm $(SRCDIR)unsafe-declarations.scm
    11751183        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1176 usrfi-1.c: srfi-1.scm unsafe-declarations.scm
     1184usrfi-1.c: $(SRCDIR)srfi-1.scm $(SRCDIR)unsafe-declarations.scm
    11771185        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1178 usrfi-4.c: srfi-4.scm unsafe-declarations.scm
     1186usrfi-4.c: $(SRCDIR)srfi-4.scm $(SRCDIR)unsafe-declarations.scm
    11791187        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1180 usrfi-13.c: srfi-13.scm unsafe-declarations.scm
     1188usrfi-13.c: $(SRCDIR)srfi-13.scm $(SRCDIR)unsafe-declarations.scm
    11811189        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1182 usrfi-14.c: srfi-14.scm unsafe-declarations.scm
     1190usrfi-14.c: $(SRCDIR)srfi-14.scm $(SRCDIR)unsafe-declarations.scm
    11831191        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1184 usrfi-18.c: srfi-18.scm unsafe-declarations.scm
     1192usrfi-18.c: $(SRCDIR)srfi-18.scm $(SRCDIR)unsafe-declarations.scm
    11851193        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1186 usrfi-69.c: srfi-69.scm private-namespace.scm unsafe-declarations.scm
    1187         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend private-namespace.scm
    1188 uutils.c: utils.scm
     1194usrfi-69.c: $(SRCDIR)srfi-69.scm $(SRCDIR)private-namespace.scm $(SRCDIR)unsafe-declarations.scm
     1195        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1196uutils.c: $(SRCDIR)utils.scm
    11891197        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1190 uposixunix.c: posixunix.scm unsafe-declarations.scm
     1198uposixunix.c: $(SRCDIR)posixunix.scm $(SRCDIR)unsafe-declarations.scm
    11911199        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1192 uposixwin.c: posixwin.scm unsafe-declarations.scm
     1200uposixwin.c: $(SRCDIR)posixwin.scm $(SRCDIR)unsafe-declarations.scm
    11931201        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1194 uregex.c: regex.scm unsafe-declarations.scm
     1202uregex.c: $(SRCDIR)regex.scm $(SRCDIR)unsafe-declarations.scm
    11951203        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    11961204
    1197 chicken.import.c: chicken.import.scm
    1198         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1199 lolevel.import.c: lolevel.import.scm
    1200         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1201 srfi-1.import.c: srfi-1.import.scm
    1202         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1203 srfi-4.import.c: srfi-4.import.scm
    1204         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1205 data-structures.import.c: data-structures.import.scm
    1206         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1207 ports.import.c: ports.import.scm
    1208         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1209 files.import.c: files.import.scm
    1210         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1211 posix.import.c: posix.import.scm
    1212         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1213 srfi-13.import.c: srfi-13.import.scm
    1214         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1215 srfi-69.import.c: srfi-69.import.scm
    1216         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1217 extras.import.c: extras.import.scm
    1218         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1219 regex.import.c: regex.import.scm
    1220         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1221 srfi-14.import.c: srfi-14.import.scm
    1222         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1223 tcp.import.c: tcp.import.scm
    1224         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1225 foreign.import.c: foreign.import.scm
    1226         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1227 scheme.import.c: scheme.import.scm
    1228         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1229 csi.import.c: csi.import.scm
    1230         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1231 srfi-18.import.c: srfi-18.import.scm
    1232         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1233 utils.import.c: utils.import.scm
    1234         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1235 setup-api.import.c: setup-api.import.scm setup-api.scm
    1236         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1237 setup-download.import.c: setup-download.import.scm setup-download.scm
    1238         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1239 setup-utils.import.c: setup-utils.import.scm setup-utils.scm
    1240         $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    1241 
    1242 chicken.c: chicken.scm chicken-more-macros.scm chicken-ffi-macros.scm private-namespace.scm
     1205chicken.import.c: $(SRCDIR)chicken.import.scm
     1206        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1207lolevel.import.c: $(SRCDIR)lolevel.import.scm
     1208        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1209srfi-1.import.c: $(SRCDIR)srfi-1.import.scm
     1210        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1211srfi-4.import.c: $(SRCDIR)srfi-4.import.scm
     1212        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1213data-structures.import.c: $(SRCDIR)data-structures.import.scm
     1214        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1215ports.import.c: $(SRCDIR)ports.import.scm
     1216        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1217files.import.c: $(SRCDIR)files.import.scm
     1218        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1219posix.import.c: $(SRCDIR)posix.import.scm
     1220        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1221srfi-13.import.c: $(SRCDIR)srfi-13.import.scm
     1222        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1223srfi-69.import.c: $(SRCDIR)srfi-69.import.scm
     1224        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1225extras.import.c: $(SRCDIR)extras.import.scm
     1226        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1227regex.import.c: $(SRCDIR)regex.import.scm
     1228        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1229srfi-14.import.c: $(SRCDIR)srfi-14.import.scm
     1230        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1231tcp.import.c: $(SRCDIR)tcp.import.scm
     1232        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1233foreign.import.c: $(SRCDIR)foreign.import.scm
     1234        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1235scheme.import.c: $(SRCDIR)scheme.import.scm
     1236        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1237csi.import.c: $(SRCDIR)csi.import.scm
     1238        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1239srfi-18.import.c: $(SRCDIR)srfi-18.import.scm
     1240        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1241utils.import.c: $(SRCDIR)utils.import.scm
     1242        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1243setup-api.import.c: $(SRCDIR)setup-api.import.scm $(SRCDIR)setup-api.scm
     1244        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1245setup-download.import.c: $(SRCDIR)setup-download.import.scm $(SRCDIR)setup-download.scm
     1246        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1247setup-utils.import.c: $(SRCDIR)setup-utils.import.scm $(SRCDIR)setup-utils.scm
     1248        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1249
     1250chicken.c: $(SRCDIR)chicken.scm $(SRCDIR)chicken-more-macros.scm $(SRCDIR)chicken-ffi-macros.scm $(SRCDIR)private-namespace.scm
    12431251        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1244 support.c: support.scm banner.scm private-namespace.scm
     1252support.c: $(SRCDIR)support.scm $(SRCDIR)banner.scm $(SRCDIR)private-namespace.scm
    12451253        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1246 compiler.c: compiler.scm private-namespace.scm
     1254compiler.c: $(SRCDIR)compiler.scm $(SRCDIR)private-namespace.scm
    12471255        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1248 optimizer.c: optimizer.scm private-namespace.scm
     1256optimizer.c: $(SRCDIR)optimizer.scm $(SRCDIR)private-namespace.scm
    12491257        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1250 batch-driver.c: batch-driver.scm private-namespace.scm
     1258batch-driver.c: $(SRCDIR)batch-driver.scm $(SRCDIR)private-namespace.scm
    12511259        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1252 c-platform.c: c-platform.scm private-namespace.scm
     1260c-platform.c: $(SRCDIR)c-platform.scm $(SRCDIR)private-namespace.scm
    12531261        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    1254 c-backend.c: c-backend.scm private-namespace.scm
     1262c-backend.c: $(SRCDIR)c-backend.scm $(SRCDIR)private-namespace.scm
    12551263        $(CHICKEN) $< $(CHICKEN_COMPILER_OPTIONS) -output-file $@
    12561264
    1257 csi.c: csi.scm banner.scm chicken-more-macros.scm private-namespace.scm
    1258         $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@ -extend private-namespace.scm
    1259 chicken-profile.c: chicken-profile.scm
     1265csi.c: $(SRCDIR)csi.scm $(SRCDIR)banner.scm $(SRCDIR)chicken-more-macros.scm $(SRCDIR)private-namespace.scm
     1266        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@ -extend $(SRCDIR)private-namespace.scm
     1267chicken-profile.c: $(SRCDIR)chicken-profile.scm
    12601268        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    1261 chicken-install.c: chicken-install.scm setup-download.c setup-utils.c
     1269chicken-install.c: $(SRCDIR)chicken-install.scm setup-download.c setup-utils.c
    12621270        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    1263 chicken-uninstall.c: chicken-uninstall.scm setup-utils.c
     1271chicken-uninstall.c: $(SRCDIR)chicken-uninstall.scm setup-utils.c
    12641272        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    1265 chicken-status.c: chicken-status.scm setup-utils.c
     1273chicken-status.c: $(SRCDIR)chicken-status.scm setup-utils.c
    12661274        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    1267 csc.c: csc.scm
     1275csc.c: $(SRCDIR)csc.scm
    12681276        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    1269 chicken-bug.c: chicken-bug.scm
     1277chicken-bug.c: $(SRCDIR)chicken-bug.scm
    12701278        $(CHICKEN) $< $(CHICKEN_PROGRAM_OPTIONS) -output-file $@
    12711279
    1272 setup-api.c: setup-api.scm setup-utils.c
     1280setup-api.c: $(SRCDIR)setup-api.scm setup-utils.c
    12731281        $(CHICKEN) $< $(CHICKEN_DYNAMIC_OPTIONS) -emit-import-library setup-api -output-file $@
    1274 setup-download.c: setup-download.scm setup-utils.c
     1282setup-download.c: $(SRCDIR)setup-download.scm setup-utils.c
    12751283        $(CHICKEN) $< $(CHICKEN_DYNAMIC_OPTIONS) -emit-import-library setup-download -output-file $@
    1276 setup-utils.c: setup-utils.scm
     1284setup-utils.c: $(SRCDIR)setup-utils.scm
    12771285        $(CHICKEN) $< $(CHICKEN_DYNAMIC_OPTIONS) -emit-import-library setup-utils -output-file $@
    12781286
     
    12921300
    12931301dist: distfiles
    1294         $(CSI) -s scripts/makedist.scm
     1302        $(CSI) -s $(SRCDIR)scripts/makedist.scm
    12951303
    12961304# cleaning up
     
    12991307
    13001308ifeq ($(PLATFORM),mingw)
    1301 CLEAN_PCRE = pcre\*$(O)
     1309CLEAN_PCRE = $(PCRE_DIR)*$(O)
    13021310CLEAN_MINGW_LIBS = libchickengui.a libchickengui.dll libchickengui.dll.a
    13031311else
    1304 CLEAN_PCRE = pcre/*$(O)
     1312CLEAN_PCRE = $(PCRE_DIR)*$(O)
    13051313CLEAN_MINGW_LIBS =
    13061314endif
     
    13461354compiler-check:
    13471355        @echo "======================================== packing ..."
    1348         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) dist
     1356        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) dist
    13491357        $(REMOVE_COMMAND $(REMOVE_COMMAND_RECURSIVE_OPTIONS) tests/chicken-*
    13501358        tar -C tests -xzf `ls -t chicken-*.tar.gz | head -1`
    13511359        @echo "======================================== building stage 1 ..."
    1352         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
     1360        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
    13531361        touch tests/chicken-*/*.scm
    13541362        @echo "======================================== building stage 2 ..."
    1355         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
     1363        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
    13561364        cat tests/chicken-*/*.c >tests/stage2.out
    13571365        @echo "======================================== building stage 3 ..."
    1358         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
     1366        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) STATICBUILD=1 -C tests/chicken-* confclean all
    13591367        cat tests/chicken-*/*.c >tests/stage3.out
    13601368        diff tests/stage2.out tests/stage3.out >tests/stages.diff
     
    13671375
    13681376bootstrap:
    1369         gzip -d -c $(SRCDIR)/bootstrap.tar.gz | tar xvf -
     1377        gzip -d -c $(SRCDIR)bootstrap.tar.gz | tar xvf -
    13701378        touch *.c
    1371         $(MAKE) -f $(SRCDIR)/Makefile.$(PLATFORM) STATICBUILD=1 DEBUGBUILD=1 \
     1379        $(MAKE) -f $(SRCDIR)Makefile.$(PLATFORM) STATICBUILD=1 DEBUGBUILD=1 \
    13721380          chicken$(EXE)
    13731381        cp chicken$(EXE) chicken-boot$(EXE)
    13741382        touch *.scm
    13751383
    1376 bootstrap.tar.gz: posixunix.c posixwin.c $(IMPORT_LIBRARIES:=.import.c)
    1377         tar cfz bootstrap.tar.gz library.c eval.c data-structures.c ports.c files.c extras.c lolevel.c utils.c tcp.c \
     1384$(SRCDIR)bootstrap.tar.gz: distfiles
     1385        tar cfz $@ library.c eval.c data-structures.c ports.c files.c extras.c lolevel.c utils.c tcp.c \
    13781386          srfi-1.c srfi-4.c srfi-13.c srfi-14.c srfi-18.c srfi-69.c posixunix.c posixwin.c regex.c \
    13791387          scheduler.c profiler.c stub.c expand.c $(COMPILER_OBJECTS_1:=.c)
  • chicken/branches/hygienic/runtime.c

    r11973 r12021  
    207207# define FORWARDING_BIT_SHIFT          63
    208208# define UWORD_FORMAT_STRING           "0x%lx"
     209# define UWORD_COUNT_FORMAT_STRING     "%ld"
    209210#else
    210211# define ALIGNMENT_HOLE_MARKER         ((C_word)0xfffffffe)
    211212# define FORWARDING_BIT_SHIFT          31
    212213# define UWORD_FORMAT_STRING           "0x%x"
     214# define UWORD_COUNT_FORMAT_STRING     "%d"
    213215#endif
    214216
     
    13041306C_word arg_val(C_char *arg)
    13051307{
    1306   int len;
    1307   if (!arg)
    1308       panic(C_text("required argument missing to runtime option"));
    1309   len = C_strlen(arg);
    1310 
    1311   if(len < 1) panic(C_text("illegal runtime-option argument"));
    1312 
    1313   switch(arg[ len - 1 ]) {
    1314   case 'k':
    1315   case 'K':
    1316     return atol(arg) * 1024;
    1317 
    1318   case 'm':
    1319   case 'M':
    1320     return atol(arg) * 1024 * 1024;
    1321 
    1322   case 'g':
    1323   case 'G':
    1324     return atol(arg) * 1024 * 1024 * 1024;
    1325 
    1326   default:
    1327     return atol(arg);
    1328   }
     1308      int len;
     1309     
     1310      if (arg == NULL) panic(C_text("illegal runtime-option argument"));
     1311     
     1312      len = C_strlen(arg);
     1313     
     1314      if(len < 1) panic(C_text("illegal runtime-option argument"));
     1315     
     1316      switch(arg[ len - 1 ]) {
     1317      case 'k':
     1318      case 'K':
     1319          return atol(arg) * 1024;
     1320         
     1321      case 'm':
     1322      case 'M':
     1323          return atol(arg) * 1024 * 1024;
     1324         
     1325      case 'g':
     1326      case 'G':
     1327          return atol(arg) * 1024 * 1024 * 1024;
     1328         
     1329      default:
     1330          return atol(arg);
     1331      }
    13291332}
    13301333
     
    32053208
    32063209  if(debug_mode)
    3207     C_printf(C_text("[debug] resizing heap dynamically from " UWORD_FORMAT_STRING " to " UWORD_FORMAT_STRING " bytes...\n"),
    3208            (C_uword)heap_size, size);
     3210    C_printf(C_text("[debug] resizing heap dynamically from " UWORD_COUNT_FORMAT_STRING "k to " UWORD_COUNT_FORMAT_STRING "k ...\n"),
     3211             (C_uword)heap_size / 1000, size / 1000);
    32093212
    32103213  if(gc_report_flag) {
     
    77767779    default: barf(C_BAD_ARGUMENT_TYPE_ERROR, "number->string", C_fix(radix));
    77777780    }
     7781  }
     7782  else if(!C_immediatep(num) && C_block_header(num) == C_FLONUM_TAG) {
     7783    f = C_flonum_magnitude(num);
     7784
     7785    if(C_fits_in_unsigned_int_p(num) == C_SCHEME_TRUE) {
     7786      switch(radix) {
     7787      case 2:
     7788        p = to_binary((unsigned int)f);
     7789        goto fini;
     7790
     7791      case 8:
     7792        C_sprintf(p = buffer, "%o", (unsigned int)f);
     7793        goto fini;
     7794
     7795      case 16:
     7796        C_sprintf(p = buffer, "%x", (unsigned int)f);
     7797        goto fini;
     7798      }
     7799    }
     7800
     7801#if defined(__CYGWIN__) || defined(__MINGW32__)
     7802    if(C_isnan(f)) {
     7803      C_strcpy(p = buffer, "+nan.0");
     7804      goto fini;
     7805    }
     7806    else if(C_isinf(f)) {
     7807      C_sprintf(p = buffer, "%cinf.0", f > 0 ? '+' : '-');
     7808      goto fini;
     7809    }
     7810#endif
     7811
     7812#ifdef HAVE_GCVT
     7813    C_gcvt(f, flonum_print_precision, buffer);
     7814#else
     7815    C_sprintf(buffer, C_text("%.*g"), flonum_print_precision, f);
     7816#endif
     7817
     7818    if((p = C_strpbrk(buffer, C_text(".eE"))) == NULL) {
     7819      if(*buffer == 'i' || *buffer == 'n') { /* inf or nan */
     7820        C_memmove(buffer + 1, buffer, C_strlen(buffer) + 1);
     7821        *buffer = '+';
     7822      }
     7823      else if(buffer[ 1 ] != 'i') C_strcat(buffer, C_text(".0")); /* negative infinity? */
     7824    }
     7825
     7826    p = buffer;
     7827  }
     7828  else
     7829    barf(C_BAD_ARGUMENT_TYPE_ERROR, "number->string", num);
    77787830
    77797831  fini:
     
    77887840    radix = C_string(&a, radix, p);
    77897841    C_kontinue(k, radix);
    7790   }
    7791 
    7792   if(!C_immediatep(num) && C_block_header(num) == C_FLONUM_TAG) {
    7793     f = C_flonum_magnitude(num);
    7794 
    7795     if(C_fits_in_unsigned_int_p(num) == C_SCHEME_TRUE) {
    7796       switch(radix) {
    7797       case 2:
    7798         p = to_binary((unsigned int)f);
    7799         goto fini;
    7800 
    7801       case 8:
    7802         C_sprintf(p = buffer, "%o", (unsigned int)f);
    7803         goto fini;
    7804 
    7805       case 16:
    7806         C_sprintf(p = buffer, "%x", (unsigned int)f);
    7807         goto fini;
    7808       }
    7809     }
    7810 
    7811 #if defined(__CYGWIN__) || defined(__MINGW32__)
    7812     if(C_isnan(f)) {
    7813       C_strcpy(p = buffer, "+nan.0");
    7814       goto fini;
    7815     }
    7816     else if(C_isinf(f)) {
    7817       C_sprintf(p = buffer, "%cinf.0", f > 0 ? '+' : '-');
    7818       goto fini;
    7819     }
    7820 #endif
    7821 
    7822 #ifdef HAVE_GCVT
    7823     C_gcvt(f, flonum_print_precision, buffer);
    7824 #else
    7825     C_sprintf(buffer, C_text("%.*g"), flonum_print_precision, f);
    7826 #endif
    7827 
    7828     if((p = C_strpbrk(buffer, C_text(".eE"))) == NULL) {
    7829       if(*buffer == 'i' || *buffer == 'n') { /* inf or nan */
    7830         C_memmove(buffer + 1, buffer, C_strlen(buffer) + 1);
    7831         *buffer = '+';
    7832       }
    7833       else if(buffer[ 1 ] != 'i') C_strcat(buffer, C_text(".0")); /* negative infinity? */
    7834     }
    7835 
    7836     p = buffer;
    7837     goto fini;
    7838   }
    7839 
    7840   barf(C_BAD_ARGUMENT_TYPE_ERROR, "number->string", num);
    78417842}
    78427843
  • chicken/branches/hygienic/scheduler.scm

    r10712 r12021  
    3636        ##sys#remove-from-ready-queue ##sys#unblock-threads-for-i/o ##sys#force-primordial
    3737        ##sys#fdset-input-set ##sys#fdset-output-set ##sys#fdset-clear
    38         ##sys#fdset-select-timeout ##sys#fdset-restore
     38        ##sys#fdset-select-timeout ##sys#fdset-restore ##sys#remove-from-timeout-list
    3939        ##sys#clear-i/o-state-for-thread!)
    4040  (foreign-declare #<<EOF
     
    218218(define ##sys#timeout-list '())
    219219
     220(define (##sys#remove-from-timeout-list t)
     221  (let loop ((l ##sys#timeout-list) (prev #f))
     222    (if (null? l)
     223        l
     224        (let ((h (##sys#slot l 0))
     225              (r (##sys#slot l 1)))
     226          (if (eq? (##sys#slot h 1) t)
     227              (if prev
     228                  (set-cdr! prev r)
     229                  (set! ##sys#timeout-list r))
     230              (loop r l))))))
     231
    220232(define (##sys#thread-block-for-timeout! t tm)
    221233  (dbg t " blocks for " tm)
     
    247259  (##sys#setislot t 11 #f)
    248260  (##sys#setislot t 8 '())
     261  (##sys#remove-from-timeout-list t)
    249262  (let ([rs (##sys#slot t 12)])
    250263    (unless (null? rs)
     
    413426
    414427;;; Get list of all threads that are ready or waiting for timeout or waiting for I/O:
    415 
    416 (define (##sys#all-threads)
    417   (append ##sys#ready-queue-head
    418           (apply append (map cdr ##sys#fd-list))
    419           (map cdr ##sys#timeout-list)))
     428;
     429; (contributed by Joerg Wittenberger)
     430
     431(define (##sys#all-threads #!optional
     432                           (cns (lambda (queue arg val init)
     433                                  (cons val init)))
     434                           (init '()))
     435  (let loop ((l ##sys#ready-queue-head) (i init))
     436    (if (pair? l)
     437        (loop (cdr l) (cns 'ready #f (car l) i))
     438        (let loop ((l ##sys#fd-list) (i i))
     439          (if (pair? l)
     440              (loop (cdr l)
     441                    (let ((fd (caar l)))
     442                      (let loop ((l (cdar l)))
     443                        (if (null? l) i
     444                            (cns 'i/o fd (car l) (loop (cdr l)))))))
     445              (let loop ((l ##sys#timeout-list) (i i))
     446                (if (pair? l)
     447                    (loop (cdr l) (cns 'timeout (caar l) (cdar l) i))
     448                    i)))))))
    420449
    421450
     
    444473(define (##sys#thread-unblock! t)
    445474  (when (eq? 'blocked (##sys#slot t 3))
    446     (set! ##sys#timeout-list (##sys#delq t ##sys#timeout-list))
     475    (##sys#remove-from-timeout-list t)
    447476    (set! ##sys#fd-list
    448477      (let loop ([fdl ##sys#fd-list])
  • chicken/branches/hygienic/srfi-69.scm

    r10952 r12021  
    99;
    1010;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
    11 ;     disclaimer. 
     11;     disclaimer.
    1212;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
    13 ;     disclaimer in the documentation and/or other materials provided with the distribution. 
     13;     disclaimer in the documentation and/or other materials provided with the distribution.
    1414;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
    15 ;     products derived from this software without specific prior written permission. 
     15;     products derived from this software without specific prior written permission.
    1616;
    1717; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
     
    4949(declare
    5050  (hide
    51     unbound-value-thunk
    5251    %object-uid-hash %eq?-hash %eqv?-hash %equal?-hash
    5352    %hash-table-copy %hash-table-ref %hash-table-update! %hash-table-merge!
    5453    %hash-table-for-each %hash-table-fold
     54    %hash-table-rehash! %hash-table-check-resize!
     55    %hash-table-update!/default
    5556    hash-table-canonical-length hash-table-rehash) )
    5657
     
    5859
    5960(register-feature! 'srfi-69)
    60 
    61 
    62 ;;; Unbound Value:
    63 
    64 (define-inline ($unbound-value)
    65   (##sys#slot '##sys#arbitrary-unbound-symbol 0))
    66 
    67 (define unbound-value-thunk (lambda () ($unbound-value)))
    68 
    69 (define-inline ($unbound? ?val)
    70   (eq? ($unbound-value) ?val) )
    7161
    7262
     
    306296(define (%equal?-hash obj)
    307297
    308   ; Recurse into some portion of the vector's slots 
     298  ; Recurse into some portion of the vector's slots
    309299  (define (vector-hash obj seed depth start)
    310300    (let ([len (##sys#size obj)])
     
    589579    (thunk) ) )
    590580
     581;; %hash-table-rehash!:
     582
     583(define (%hash-table-rehash! vec1 vec2 hash)
     584  (let ([len1 (##sys#size vec1)]
     585        [len2 (##sys#size vec2)] )
     586    (do ([i 0 (fx+ i 1)])
     587        [(fx>= i len1)]
     588      (let loop ([bucket (##sys#slot vec1 i)])
     589        (unless (null? bucket)
     590          (let* ([pare (##sys#slot bucket 0)]
     591                 [key (##sys#slot pare 0)]
     592                 [hshidx (hash key len2)] )
     593            (##sys#setslot vec2 hshidx
     594                           (cons (cons key (##sys#slot pare 1)) (##sys#slot vec2 hshidx)))
     595            (loop (##sys#slot bucket 1)) ) ) ) ) ) )
     596
     597;; %hash-table-resize!:
     598
     599(define (%hash-table-resize! ht vec len)
     600  (let* ([deslen (fxmin hash-table-max-length (fx* len hash-table-new-length-factor))]
     601         [newlen (hash-table-canonical-length hash-table-prime-lengths deslen)]
     602         [vec2 (make-vector newlen '())] )
     603    (%hash-table-rehash! vec vec2 (##sys#slot ht 4))
     604    (##sys#setslot ht 1 vec2) ) )
     605
     606;; %hash-table-check-resize!:
     607
     608#; ;UNUSED
     609(define %hash-table-check-resize!
     610       ; Note that these are standard integrations!
     611  (let ([floor floor]
     612        [inexact->exact inexact->exact]
     613        [* *] )
     614    (lambda (ht newsiz)
     615      (let ([vec (##sys#slot ht 1)]
     616            [min-load (##sys#slot ht 5)]
     617            [max-load (##sys#slot ht 6)] )
     618        (let ([len (##sys#size vec)] )
     619          (let ([min-load-len (inexact->exact (floor (* len min-load)))]
     620                [max-load-len (inexact->exact (floor (* len max-load)))] )
     621            (if (and (fx< len hash-table-max-length)
     622                     (fx<= min-load-len newsiz) (fx<= newsiz max-load-len))
     623                (%hash-table-resize! ht vec len) ) ) ) ) ) ) )
     624
     625(define-inline (%hash-table-check-resize! ht newsiz)
     626  (let ([vec (##sys#slot ht 1)]
     627        [min-load (##sys#slot ht 5)]
     628        [max-load (##sys#slot ht 6)] )
     629    (let ([len (##sys#size vec)] )
     630      (let ([min-load-len (inexact->exact (floor (* len min-load)))]
     631            [max-load-len (inexact->exact (floor (* len max-load)))] )
     632        (if (and (fx< len hash-table-max-length)
     633                 (fx<= min-load-len newsiz) (fx<= newsiz max-load-len))
     634          (%hash-table-resize! ht vec len) ) ) ) ) )
     635
    591636;; hash-table-copy:
    592637
     
    623668;; Modified for ht props min & max load.
    624669
    625 (define (hash-table-rehash vec1 vec2 hash)
    626   (let ([len1 (##sys#size vec1)]
    627         [len2 (##sys#size vec2)] )
    628     (do ([i 0 (fx+ i 1)])
    629         [(fx>= i len1)]
    630       (let loop ([bucket (##sys#slot vec1 i)])
    631         (unless (null? bucket)
    632           (let* ([pare (##sys#slot bucket 0)]
    633                  [key (##sys#slot pare 0)]
    634                  [hshidx (hash key len2)] )
    635             (##sys#setslot vec2 hshidx
    636                            (cons (cons key (##sys#slot pare 1))
    637                                  (##sys#slot vec2 hshidx)))
    638             (loop (##sys#slot bucket 1)) ) ) ) ) ) )
    639 
    640 (define %hash-table-update!
    641   (let ([core-eq? eq?]
    642         [floor floor] )
    643     (lambda (ht key func thunk)
    644       (let ([hash (##sys#slot ht 4)]
    645             [test (##sys#slot ht 3)]
    646             [newsiz (fx+ (##sys#slot ht 2) 1)]
    647             [min-load (##sys#slot ht 5)]
    648             [max-load (##sys#slot ht 6)] )
    649         (let re-enter ()
    650           (let* ([vec (##sys#slot ht 1)]
    651                  [len (##sys#size vec)] )
    652             (let ([min-load-len (inexact->exact (floor (* len min-load)))]
    653                   [max-load-len (inexact->exact (floor (* len max-load)))]
    654                   [hshidx (hash key len)] )
    655               ; Need to resize table?
    656               (if (and (fx< len hash-table-max-length)
    657                        (fx<= min-load-len newsiz) (fx<= newsiz max-load-len))
    658                   ; then resize the table:
    659                   (let ([vec2 (make-vector
    660                                (hash-table-canonical-length
    661                                 hash-table-prime-lengths
    662                                 (fxmin hash-table-max-length
    663                                        (fx* len hash-table-new-length-factor)))
    664                                '())])
    665                     (hash-table-rehash vec vec2 hash)
    666                     (##sys#setslot ht 1 vec2)
    667                     (re-enter) )
    668                   ; else update the table:
    669                   (let ([bucket0 (##sys#slot vec hshidx)])
    670                     (if (eq? core-eq? test)
    671                         ; Fast path (eq? is rewritten by the compiler):
    672                         (let loop ([bucket bucket0])
    673                           (cond [(null? bucket)
    674                                  (let ([val (func (thunk))])
    675                                    (##sys#setslot vec hshidx (cons (cons key val) bucket0))
    676                                    (##sys#setislot ht 2 newsiz)
    677                                    val) ]
    678                                 [else
    679                                  (let ([pare (##sys#slot bucket 0)])
    680                                    (if (eq? key (##sys#slot pare 0))
    681                                        (let ([val (func (##sys#slot pare 1))])
    682                                          (##sys#setslot pare 1 val)
    683                                          val)
    684                                        (loop (##sys#slot bucket 1)) ) ) ] ) )
    685                         ; Slow path
    686                         (let loop ([bucket bucket0])
    687                           (cond [(null? bucket)
    688                                  (let ([val (func (thunk))])
    689                                    (##sys#setslot vec hshidx (cons (cons key val) bucket0))
    690                                    (##sys#setislot ht 2 newsiz)
    691                                    val) ]
    692                                 [else
    693                                  (let ([pare (##sys#slot bucket 0)])
    694                                    (if (test key (##sys#slot pare 0))
    695                                        (let ([val (func (##sys#slot pare 1))])
    696                                          (##sys#setslot pare 1 val)
    697                                          val)
    698                                        (loop (##sys#slot bucket 1)) ) ) ] ) ) ) ) ) ) ) ) ) ) ) )
    699 
    700 (define (hash-table-update!
    701          ht key
    702          #!optional (func identity)
    703                     (thunk
    704                      (let ([thunk (##sys#slot ht 9)])
    705                        (or thunk
    706                            (lambda ()
    707                              (##sys#signal-hook #:access-error
    708                               'hash-table-update!
    709                               "hash-table does not contain key" key ht))))))
    710   (##sys#check-structure ht 'hash-table 'hash-table-update!)
    711   (##sys#check-closure func 'hash-table-update!)
    712   (##sys#check-closure thunk 'hash-table-update!)
    713   (%hash-table-update! ht key func thunk) )
     670(define hash-table-update!
     671  (let ([core-eq? eq?] )
     672    (lambda (ht key
     673             #!optional (func identity)
     674                        (thunk
     675                         (let ([thunk (##sys#slot ht 9)])
     676                           (or thunk
     677                               (lambda ()
     678                                 (##sys#signal-hook #:access-error
     679                                  'hash-table-update!
     680                                  "hash-table does not contain key" key ht))))))
     681      (##sys#check-structure ht 'hash-table 'hash-table-update!)
     682      (##sys#check-closure func 'hash-table-update!)
     683      (##sys#check-closure thunk 'hash-table-update!)
     684      (let ([newsiz (fx+ (##sys#slot ht 2) 1)] )
     685        (%hash-table-check-resize! ht newsiz)
     686        (let ([hash (##sys#slot ht 4)]
     687              [test (##sys#slot ht 3)]
     688              [vec (##sys#slot ht 1)] )
     689          (let* ([len (##sys#size vec)]
     690                 [hshidx (hash key len)]
     691                 [bucket0 (##sys#slot vec hshidx)] )
     692            (if (eq? core-eq? test)
     693                ; Fast path (eq? is rewritten by the compiler):
     694                (let loop ([bucket bucket0])
     695                  (if (null? bucket)
     696                      (let ([val (func (thunk))])
     697                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     698                        (##sys#setislot ht 2 newsiz)
     699                        val )
     700                      (let ([pare (##sys#slot bucket 0)])
     701                         (if (eq? key (##sys#slot pare 0))
     702                             (let ([val (func (##sys#slot pare 1))])
     703                               (##sys#setslot pare 1 val)
     704                               val)
     705                             (loop (##sys#slot bucket 1)) ) ) ) )
     706                ; Slow path
     707                (let loop ([bucket bucket0])
     708                  (if (null? bucket)
     709                      (let ([val (func (thunk))])
     710                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     711                        (##sys#setislot ht 2 newsiz)
     712                        val )
     713                      (let ([pare (##sys#slot bucket 0)])
     714                         (if (test key (##sys#slot pare 0))
     715                             (let ([val (func (##sys#slot pare 1))])
     716                               (##sys#setslot pare 1 val)
     717                               val )
     718                             (loop (##sys#slot bucket 1)) ) ) ) ) ) ) ) ) ) ) )
     719
     720(define %hash-table-update!/default
     721  (let ([core-eq? eq?] )
     722    (lambda (ht key func def)
     723      (let ([newsiz (fx+ (##sys#slot ht 2) 1)] )
     724        (%hash-table-check-resize! ht newsiz)
     725        (let ([hash (##sys#slot ht 4)]
     726              [test (##sys#slot ht 3)]
     727              [vec (##sys#slot ht 1)] )
     728          (let* ([len (##sys#size vec)]
     729                 [hshidx (hash key len)]
     730                 [bucket0 (##sys#slot vec hshidx)] )
     731            (if (eq? core-eq? test)
     732                ; Fast path (eq? is rewritten by the compiler):
     733                (let loop ([bucket bucket0])
     734                  (if (null? bucket)
     735                      (let ([val (func def)])
     736                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     737                        (##sys#setislot ht 2 newsiz)
     738                        val )
     739                      (let ([pare (##sys#slot bucket 0)])
     740                         (if (eq? key (##sys#slot pare 0))
     741                             (let ([val (func (##sys#slot pare 1))])
     742                               (##sys#setslot pare 1 val)
     743                               val)
     744                             (loop (##sys#slot bucket 1)) ) ) ) )
     745                ; Slow path
     746                (let loop ([bucket bucket0])
     747                  (if (null? bucket)
     748                      (let ([val (func def)])
     749                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     750                        (##sys#setislot ht 2 newsiz)
     751                        val )
     752                      (let ([pare (##sys#slot bucket 0)])
     753                         (if (test key (##sys#slot pare 0))
     754                             (let ([val (func (##sys#slot pare 1))])
     755                               (##sys#setslot pare 1 val)
     756                               val )
     757                             (loop (##sys#slot bucket 1)) ) ) ) ) ) ) ) ) ) ) )
    714758
    715759(define (hash-table-update!/default ht key func def)
    716760  (##sys#check-structure ht 'hash-table 'hash-table-update!/default)
    717761  (##sys#check-closure func 'hash-table-update!/default)
    718   (%hash-table-update! ht key func (lambda () def)) )
    719 
    720 (define (hash-table-set! ht key val)
    721   (##sys#check-structure ht 'hash-table 'hash-table-set!)
    722   (let ([thunk (lambda _ val)])
    723     (%hash-table-update! ht key thunk thunk) )
    724   (void) )
     762  (%hash-table-update!/default ht key func def) )
     763
     764(define hash-table-set!
     765  (let ([core-eq? eq?] )
     766    (lambda (ht key val)
     767      (##sys#check-structure ht 'hash-table 'hash-table-set!)
     768      (let ([newsiz (fx+ (##sys#slot ht 2) 1)] )
     769        (%hash-table-check-resize! ht newsiz)
     770        (let ([hash (##sys#slot ht 4)]
     771              [test (##sys#slot ht 3)]
     772              [vec (##sys#slot ht 1)] )
     773          (let* ([len (##sys#size vec)]
     774                 [hshidx (hash key len)]
     775                 [bucket0 (##sys#slot vec hshidx)] )
     776            (if (eq? core-eq? test)
     777                ; Fast path (eq? is rewritten by the compiler):
     778                (let loop ([bucket bucket0])
     779                  (if (null? bucket)
     780                      (begin
     781                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     782                        (##sys#setislot ht 2 newsiz) )
     783                      (let ([pare (##sys#slot bucket 0)])
     784                         (if (eq? key (##sys#slot pare 0))
     785                             (##sys#setslot pare 1 val)
     786                             (loop (##sys#slot bucket 1)) ) ) ) )
     787                ; Slow path
     788                (let loop ([bucket bucket0])
     789                  (if (null? bucket)
     790                      (begin
     791                        (##sys#setslot vec hshidx (cons (cons key val) bucket0))
     792                        (##sys#setislot ht 2 newsiz) )
     793                      (let ([pare (##sys#slot bucket 0)])
     794                         (if (test key (##sys#slot pare 0))
     795                             (##sys#setslot pare 1 val)
     796                             (loop (##sys#slot bucket 1)) ) ) ) ) )
     797            (void) ) ) ) ) ) )
    725798
    726799;; Hash-Table Reference:
    727800
    728 (define %hash-table-ref
     801(define hash-table-ref
     802  (getter-with-setter
     803    (let ([core-eq? eq?])
     804      (lambda (ht key #!optional (def (lambda ()
     805                                        (##sys#signal-hook #:access-error
     806                                         'hash-table-ref
     807                                         "hash-table does not contain key" key ht))))
     808        (##sys#check-structure ht 'hash-table 'hash-table-ref)
     809        (##sys#check-closure def 'hash-table-ref)
     810        (let  ([vec (##sys#slot ht 1)]
     811               [test (##sys#slot ht 3)] )
     812          (let* ([hash (##sys#slot ht 4)]
     813                 [hshidx (hash key (##sys#size vec))] )
     814            (if (eq? core-eq? test)
     815                ; Fast path (eq? is rewritten by the compiler):
     816                (let loop ([bucket (##sys#slot vec hshidx)])
     817                  (if (null? bucket)
     818                      (def)
     819                      (let ([pare (##sys#slot bucket 0)])
     820                        (if (eq? key (##sys#slot pare 0))
     821                            (##sys#slot pare 1)
     822                            (loop (##sys#slot bucket 1)) ) ) ) )
     823                ; Slow path
     824                (let loop ([bucket (##sys#slot vec hshidx)])
     825                  (if (null? bucket)
     826                      (def)
     827                      (let ([pare (##sys#slot bucket 0)])
     828                        (if (test key (##sys#slot pare 0))
     829                            (##sys#slot pare 1)
     830                            (loop (##sys#slot bucket 1)) ) ) ) ) ) ) ) ) )
     831   hash-table-set!) )
     832
     833(define hash-table-ref/default
    729834  (let ([core-eq? eq?])
    730835    (lambda (ht key def)
    731        (let  ([vec (##sys#slot ht 1)]
    732               [test (##sys#slot ht 3)] )
    733          (let* ([hash (##sys#slot ht 4)]
    734                 [hshidx (hash key (##sys#size vec))] )
     836      (##sys#check-structure ht 'hash-table 'hash-table-ref/default)
     837      (let  ([vec (##sys#slot ht 1)]
     838             [test (##sys#slot ht 3)] )
     839        (let* ([hash (##sys#slot ht 4)]
     840               [hshidx (hash key (##sys#size vec))] )
    735841           (if (eq? core-eq? test)
    736842               ; Fast path (eq? is rewritten by the compiler):
    737843               (let loop ([bucket (##sys#slot vec hshidx)])
    738844                 (if (null? bucket)
    739                      (def)
     845                     def
    740846                     (let ([pare (##sys#slot bucket 0)])
    741847                       (if (eq? key (##sys#slot pare 0))
     
    745851               (let loop ([bucket (##sys#slot vec hshidx)])
    746852                 (if (null? bucket)
    747                      (def)
     853                     def
    748854                     (let ([pare (##sys#slot bucket 0)])
    749855                       (if (test key (##sys#slot pare 0))
     
    751857                           (loop (##sys#slot bucket 1)) ) ) ) ) ) ) ) ) ) )
    752858
    753 (define hash-table-ref
    754   (getter-with-setter
    755    (lambda (ht key #!optional (def (lambda ()
    756                                      (##sys#signal-hook #:access-error
    757                                       'hash-table-ref
    758                                       "hash-table does not contain key" key ht))))
    759      (##sys#check-structure ht 'hash-table 'hash-table-ref)
    760      (##sys#check-closure def 'hash-table-ref)
    761      (%hash-table-ref ht key def) )
    762    hash-table-set!))
    763 
    764 (define (hash-table-ref/default ht key default)
    765   (##sys#check-structure ht 'hash-table 'hash-table-ref/default)
    766   (%hash-table-ref ht key (lambda () default)) )
    767 
    768 (define (hash-table-exists? ht key)
    769   (##sys#check-structure ht 'hash-table 'hash-table-exists?)
    770   (not ($unbound? (%hash-table-ref ht key unbound-value-thunk))) )
     859(define hash-table-exists?
     860  (let ([core-eq? eq?])
     861    (lambda (ht key)
     862      (##sys#check-structure ht 'hash-table 'hash-table-exists?)
     863      (let  ([vec (##sys#slot ht 1)]
     864             [test (##sys#slot ht 3)] )
     865        (let* ([hash (##sys#slot ht 4)]
     866               [hshidx (hash key (##sys#size vec))] )
     867          (if (eq? core-eq? test)
     868               ; Fast path (eq? is rewritten by the compiler):
     869               (let loop ([bucket (##sys#slot vec hshidx)])
     870                 (and (not (null? bucket))
     871                      (let ([pare (##sys#slot bucket 0)])
     872                        (or (eq? key (##sys#slot pare 0))
     873                            (loop (##sys#slot bucket 1)) ) ) ) )
     874               ; Slow path
     875               (let loop ([bucket (##sys#slot vec hshidx)])
     876                 (and (not (null? bucket))
     877                      (let ([pare (##sys#slot bucket 0)])
     878                        (or (test key (##sys#slot pare 0))
     879                            (loop (##sys#slot bucket 1)) ) ) ) ) ) ) ) ) ) )
    771880
    772881;; hash-table-delete!:
     
    777886      (##sys#check-structure ht 'hash-table 'hash-table-delete!)
    778887      (let* ([vec (##sys#slot ht 1)]
    779              [len (##sys#size vec)] )
    780         (let* ([hash (##sys#slot ht 4)]
    781                [hshidx (hash key len)] )
    782           (let ([test (##sys#slot ht 3)]
    783                 [newsiz (fx- (##sys#slot ht 2) 1)]
    784                 [bucket0 (##sys#slot vec hshidx)] )
    785             (if (eq? core-eq? test)
    786                 ; Fast path (eq? is rewritten by the compiler):
    787                 (let loop ([prev #f] [bucket bucket0])
    788                   (and (not (null? bucket))
    789                        (let ([pare (##sys#slot bucket 0)]
    790                              [nxt (##sys#slot bucket 1)])
    791                         (if (eq? key (##sys#slot pare 0))
    792                              (begin
    793                                (if prev
    794                                    (##sys#setslot prev 1 nxt)
    795                                    (##sys#setslot vec hshidx nxt) )
    796                                (##sys#setislot ht 2 newsiz)
    797                                #t )
    798                              (loop bucket nxt) ) ) ) )
    799                 ; Slow path
    800                 (let loop ([prev #f] [bucket bucket0])
    801                   (and (not (null? bucket))
    802                        (let ([pare (##sys#slot bucket 0)]
    803                              [nxt (##sys#slot bucket 1)])
    804                         (if (test key (##sys#slot pare 0))
    805                              (begin
    806                                (if prev
    807                                    (##sys#setslot prev 1 nxt)
    808                                    (##sys#setslot vec hshidx nxt) )
    809                                (##sys#setislot ht 2 newsiz)
    810                                #t )
    811                              (loop bucket nxt) ) ) ) ) ) ) ) ) ) ) )
     888             [len (##sys#size vec)]
     889             [hash (##sys#slot ht 4)]
     890             [hshidx (hash key len)] )
     891        (let ([test (##sys#slot ht 3)]
     892              [newsiz (fx- (##sys#slot ht 2) 1)]
     893              [bucket0 (##sys#slot vec hshidx)] )
     894          (if (eq? core-eq? test)
     895              ; Fast path (eq? is rewritten by the compiler):
     896              (let loop ([prev #f] [bucket bucket0])
     897                (and (not (null? bucket))
     898                     (let ([pare (##sys#slot bucket 0)]
     899                           [nxt (##sys#slot bucket 1)])
     900                      (if (eq? key (##sys#slot pare 0))
     901                           (begin
     902                             (if prev
     903                                 (##sys#setslot prev 1 nxt)
     904                                 (##sys#setslot vec hshidx nxt) )
     905                             (##sys#setislot ht 2 newsiz)
     906                             #t )
     907                           (loop bucket nxt) ) ) ) )
     908              ; Slow path
     909              (let loop ([prev #f] [bucket bucket0])
     910                (and (not (null? bucket))
     911                     (let ([pare (##sys#slot bucket 0)]
     912                           [nxt (##sys#slot bucket 1)])
     913                      (if (test key (##sys#slot pare 0))
     914                           (begin
     915                             (if prev
     916                                 (##sys#setslot prev 1 nxt)
     917                                 (##sys#setslot vec hshidx nxt) )
     918                             (##sys#setislot ht 2 newsiz)
     919                             #t )
     920                           (loop bucket nxt) ) ) ) ) ) ) ) ) ) )
    812921
    813922;; hash-table-remove!:
     
    851960          [(null? lst)]
    852961        (let ([b (##sys#slot lst 0)])
    853           (%hash-table-update! ht1 (##sys#slot b 0)
    854                                    identity (lambda () (##sys#slot b 1))) ) ) ) ) )
     962          (%hash-table-update!/default ht1 (##sys#slot b 0) identity (##sys#slot b 1)) ) ) ) ) )
    855963
    856964(define (hash-table-merge! ht1 ht2)
     
    887995      (let ([ht (apply make-hash-table rest)])
    888996        (for-each (lambda (x)
    889                     (%hash-table-update! ht (##sys#slot x 0)
    890                                             identity (lambda () (##sys#slot x 1))) )
     997                    (%hash-table-update!/default  ht (##sys#slot x 0) identity (##sys#slot x 1)) )
    891998                  alist)
    892999        ht ) ) ) )
Note: See TracChangeset for help on using the changeset viewer.