Changeset 12920 in project for chicken/trunk


Ignore:
Timestamp:
12/30/08 14:53:41 (12 years ago)
Author:
felix winkelmann
Message:

irregex merge; -ignore-repository disables dloading; extension-version fix for chicken-install (reported by Peter Bex); compiler export/blockmode fix; updated bootstrapping tarball

Location:
chicken/trunk
Files:
1 deleted
28 edited
4 copied

Legend:

Unmodified
Added
Removed
  • chicken/trunk/Makefile.linux

    r12301 r12920  
    9797        echo "#define C_HACKED_APPLY" >>$@
    9898endif
    99 ifneq ($(USE_HOST_PCRE),)
    100         echo "#define C_USE_HOST_PCRE" >>$@
    101 endif
    10299        cat chicken-defaults.h >>$@
    103100
  • chicken/trunk/NEWS

    r12609 r12920  
     14.0.0x5
     2
     3- replaced PCRE regex engine with Alex Shinn's "irregex" regular expression
     4  package
     5- removed `-extension' option
     6- removed `-static-extensions' csc option and added `-static-extension NAME'
     7
    184.0.0x3
    29
  • chicken/trunk/README

    r12797 r12920  
    33  (c)2000-2008 Felix L. Winkelmann
    44
    5   version 4.0.0x4
     5  version 4.0.0x5
    66
    77
     
    161161          <http://chicken.wiki.br/cross-compilation>.
    162162
    163         USE_HOST_PCRE=
    164           The PCRE library is included with the CHICKEN
    165           distribution to remove external dependencies and to avoid
    166           incompatibilities with any previously installed version. If
    167           you want to link with an installed libpcre, set this
    168           variable to a non-empty value. Only use this feature if you
    169           know what you are doing.
    170 
    171163        SRCDIR=
    172164          Specifies that CHICKEN should be built outside of its source
  • chicken/trunk/TODO

    r12838 r12920  
    11TODO for trunk                                                          -*- Outline -*-
    22
    3 
    4 * bugs
    53
    64** compiler
     
    2321*** extended lambda-lists refer to `optional' and `let-optionals[*]'
    2422    this will break, when these macros are renamed on import
    25 *** slow
    26     compiling dynamic.scm with profile-hacked expand:
    27 
    28     procedure                       calls  seconds  average  percent
    29     ----------------------------------------------------------------
    30     ##sys#expand                     4659    0.276    0.000  100.000
    31     ##sys#expand-0                   5574    0.228    0.000   82.608
    32     lookup                          15878    0.144    0.000   52.173
    33     ##sys#check-syntax               3328    0.128    0.000   46.376
    34     body1099                         3328    0.080    0.000   28.985
    35     ##sys#canonicalize-body           462    0.044    0.000   15.942
    36     ##sys#alias-global-hook          2388    0.024    0.000    8.695
    37     def-culprit1101                   683    0.020    0.000    7.246
    38     def-se1102                        683    0.016    0.000    5.797
    39     macro-alias                       958    0.012    0.000    4.347
    40     macro?                            248    0.008    0.000    2.898
    41     body187                           403    0.004    0.000    1.449
    42     ##sys#strip-syntax                403    0.004    0.000    1.449
    43     def-alias190                      401    0.004    0.000    1.449
    44     def-se189                         400    0.004    0.000    1.449
    45     ##sys#extended-lambda-list?       672    0.000    0.000    0.000
    46     ##sys#register-export             229    0.000    0.000    0.000
    47     ##sys#extend-macro-environment     60    0.000    0.000    0.000
    48     ##sys#macro-subset                  2    0.000    0.000    0.000
    49     process-command-line                1    0.000    0.000    0.000
    50 
    51     wrapped into a module exporting `*':
    52 
    53     procedure                        calls  seconds  average  percent
    54     -----------------------------------------------------------------
    55     ##sys#expand-0                    5357    0.564    0.000  100.000
    56     ##sys#expand                      4440    0.556    0.000   98.581
    57     lookup                           15232    0.432    0.000   76.595
    58     ##sys#check-syntax                3105    0.236    0.000   41.843
    59     ##sys#canonicalize-body            462    0.220    0.000   39.007
    60     body1099                          3105    0.176    0.000   31.205
    61     ##sys#alias-global-hook           1463    0.140    0.000   24.822
    62     ##sys#register-undefined          1009    0.052    0.000    9.219
    63     macro-alias                        963    0.052    0.000    9.219
    64     ##sys#module-rename               1715    0.048    0.000    8.510
    65     def-culprit1101                    685    0.044    0.000    7.801
    66     module-undefined-list             1239    0.040    0.000    7.092
    67     ##sys#register-export              229    0.028    0.000    4.964
    68     def-se1102                         685    0.024    0.000    4.255
    69     ##sys#expand-import                  1    0.024    0.024    4.255
    70     module-name                       1488    0.016    0.000    2.836
    71     macro?                             248    0.016    0.000    2.836
    72     ##sys#strip-syntax                 407    0.012    0.000    2.127
    73     body187                            407    0.008    0.000    1.418
    74     def-alias190                       405    0.008    0.000    1.418
    75     def-se189                          404    0.008    0.000    1.418
    76     set-module-exist-list!             229    0.008    0.000    1.418
    77     ##sys#finalize-module                1    0.008    0.008    1.418
    78     ##sys#extended-lambda-list?        672    0.004    0.000    0.709
    79     module-export-list                 231    0.004    0.000    0.709
    80     check-for-redef                    229    0.004    0.000    0.709
    81     ##sys#mark-imported-symbols          3    0.004    0.001    0.709
    82     merge-se                             1    0.004    0.004    0.709
    83     set-module-undefined-list!         304    0.000    0.000    0.000
    84     module-defined-list                231    0.000    0.000    0.000
    85     module-exist-list                  230    0.000    0.000    0.000
    86     set-module-defined-list!           229    0.000    0.000    0.000
    87     ##sys#extend-macro-environment      60    0.000    0.000    0.000
    88     ##sys#find-module                    4    0.000    0.000    0.000
    89     swap1473                             4    0.000    0.000    0.000
    90     %make-module                         3    0.000    0.000    0.000
    91     make-module                          3    0.000    0.000    0.000
    92     ##sys#macro-subset                   2    0.000    0.000    0.000
    93     module-vexports                      2    0.000    0.000    0.000
    94     module-sexports                      2    0.000    0.000    0.000
    95     ##sys#register-primitive-module      2    0.000    0.000    0.000
    96     body3068                             1    0.000    0.000    0.000
    97     set-module-vexports!                 1    0.000    0.000    0.000
    98     set-module-sexports!                 1    0.000    0.000    0.000
    99     ##sys#register-module                1    0.000    0.000    0.000
    100     process-command-line                 1    0.000    0.000    0.000
    101     module-import-forms                  1    0.000    0.000    0.000
    102     module-indirect-exports              1    0.000    0.000    0.000
    103     def-sexports3071                     1    0.000    0.000    0.000
    104     def-vexports3070                     1    0.000    0.000    0.000
    105     set-module-import-forms!             1    0.000    0.000    0.000
    106     module-defined-syntax-list           1    0.000    0.000    0.000
    107 
    108     compiling match-test.scm, with matchable.scm and test.scm included:
    109 
    110     procedure                       calls  seconds  average  percent
    111     ----------------------------------------------------------------
    112     ##sys#expand-0                  27576    2.896    0.000  100.000
    113     ##sys#expand                    20616    2.504    0.000   86.464
    114     lookup                          96736    1.916    0.000   66.160
    115     ##sys#canonicalize-body          3203    1.188    0.000   41.022
    116     ##sys#check-syntax              15942    0.680    0.000   23.480
    117     macro-alias                     12350    0.404    0.000   13.950
    118     body1099                        15942    0.384    0.000   13.259
    119     ##sys#process-syntax-rules        115    0.208    0.001    7.182
    120     ##sys#alias-global-hook          7950    0.088    0.000    3.038
    121     def-culprit1101                   861    0.048    0.000    1.657
    122     ##sys#strip-syntax                933    0.036    0.000    1.243
    123     def-alias190                      931    0.036    0.000    1.243
    124     def-se189                         930    0.036    0.000    1.243
    125     def-se1102                        861    0.028    0.000    0.966
    126     body187                           933    0.008    0.000    0.276
    127     ##sys#extended-lambda-list?       581    0.000    0.000    0.000
    128     ##sys#extend-macro-environment     93    0.000    0.000    0.000
    129     ##sys#register-syntax-export       33    0.000    0.000    0.000
    130     macro?                             16    0.000    0.000    0.000
    131     ##sys#register-export              11    0.000    0.000    0.000
    132     ##sys#macro-subset                  2    0.000    0.000    0.000
    133     process-command-line                1    0.000    0.000    0.000
    13423
    13524** modules
     
    14635
    14736** build
     37*** fix mingw build, quickly
    14838*** compiling chicken-install/-uninstall must use invalid or disabled existing repository
    14939    otherwise we use stale import libraries
     
    15646* tasks
    15747
     48** documentation
     49*** update NEWS
     50
    15851** branches
    159 *** test irregular branch, merge if performance is acceptable
    16052*** try to improve performance in lazy-gensyms
    16153
     
    213105    .SECONDARY help?
    214106
     107** "weak" gc roots (as suggested by Alejo)
     108
    215109* tests
    216110
     
    219113*** fully compiled ec-tests
    220114** 3-stage bootstrap with compiler-output comparison
    221 ** install numbers egg into temporary repo and run tests
    222115
    223116
  • chicken/trunk/batch-driver.scm

    r12896 r12920  
    214214      (set! standalone-executable #f))
    215215    (when (memq 'ignore-repository options)
     216      (set! ##sys#dload-disabled #t)
    216217      (repository-path #f))
    217218    (set! debugging-chicken
     
    466467               (display-line-number-database) )
    467468
    468              (when (and block-compilation unit-name)
    469                (compiler-warning
    470                 'usage
    471                 "compilation of library unit `~a' in block-mode - globals may not be accessible outside this unit"
    472                 unit-name) )
    473 
    474469             (when (and unit-name dynamic)
    475470               (compiler-warning 'usage "library unit `~a' compiled in dynamic mode" unit-name) )
  • chicken/trunk/buildversion

    r12797 r12920  
    1 4.0.0x4
     14.0.0x5
  • chicken/trunk/chicken-install.scm

    r12844 r12920  
    122122          ((extension-information x) =>
    123123           (lambda (info)
    124              (and-let* ((a (assq 'version info)))
    125                (->string (cadr a)))))
     124             (let ((a (assq 'version info)))
     125               (if a
     126                   (->string (cadr a))
     127                   "1.0.0"))))
    126128          (else #f)))
    127129
     
    299301    (let* ((files (glob (make-pathname (repository-path) "*.import.*")))
    300302           (tmpdir (create-temporary-directory))
    301            (dbfile (make-pathname tmpdir +module-db+)))
     303           (dbfile (make-pathname tmpdir +module-db+))
     304           (rx (regexp ".*/([^/]+)\\.import\\.(scm|so)")))
    302305      (fluid-let ((##sys#warnings-enabled #f))
    303306        (for-each
    304307         (lambda (f)
    305            (let ((m (string-match ".*/([^/]+)\\.import\\.(scm|so)" f)))
     308           (let ((m (string-match rx f)))
    306309             (eval `(import ,(string->symbol (cadr m))))))
    307310         files))
     
    356359  (define (main args)
    357360    (let ((defaults (load-defaults))
    358           (update #f))
     361          (update #f)
     362          (rx "([^:]+):(.+)"))
    359363      (let loop ((args args) (eggs '()))
    360364        (cond ((null? args)
     
    456460                             *eggs+dirs*))
    457461                          (loop (cdr args) (cons egg eggs))))
    458                        ((string-match "([^:]+):(.+)" arg) =>
     462                       ((string-match rx arg) =>
    459463                        (lambda (m)
    460464                          (loop (cdr args) (alist-cons (cadr m) (caddr m) eggs))))
  • chicken/trunk/compiler.scm

    r12813 r12920  
    14131413              (set! block-compilation #t)
    14141414              (for-each hide-variable syms))))
    1415        ((export)
     1415       ((export)
     1416        (set! block-compilation #t)
    14161417        (let ((syms (stripa (cdr spec))))
    14171418          (for-each export-variable syms)))
     
    18541855            ((and (eq? '##core#variable (node-class val))
    18551856                  (eq? var (first (node-parameters val))) ) )
    1856             ((or block-compilation
    1857                  (memq var env)
     1857            ((or (memq var env)
    18581858                 (variable-mark var '##compiler#constant)
    18591859                 (not (variable-visible? var)))
     
    20732073                              (not assigned)
    20742074                              (not (get db name 'assigned))
    2075                               (or block-compilation (not (get db name 'global))) ) )
     2075                              (or (not (variable-visible? name))
     2076                                  (not (get db name 'global))) ) )
    20762077                 (quick-put! plist 'replacable name)
    20772078                 (put! db name 'replacing #t) ) ) ) )
  • chicken/trunk/defaults.make

    r12813 r12920  
    156156# options
    157157
    158 ifneq ($(USE_HOST_PCRE),)
    159 LIBRARIES += -lpcre
    160 PCRE_INCLUDES =
    161 C_COMPILER_PCRE_OPTIONS =
    162 PCRE_OBJECTS_1 =
    163 else
    164 ifdef WINDOWS
    165 ifneq ($(HOSTSYSTEM),mingw32)
    166 PCRE_DIR ?= $(SRCDIR)pcre\\
    167 else
    168 endif
    169 PCRE_DIR ?= $(SRCDIR)pcre/
    170 else
    171 PCRE_DIR ?= $(SRCDIR)pcre/
    172 endif
    173 C_COMPILER_PCRE_OPTIONS = -DPCRE_STATIC -DHAVE_CONFIG_H
    174 PCRE_INCLUDES = $(INCLUDES) -I$(PCRE_DIR)
    175 endif
    176158ifndef NOPTABLES
    177159C_COMPILER_PTABLES_OPTIONS ?= -DC_ENABLE_PTABLES
     
    324306CHICKEN_IMPORT_LIBRARY_OPTIONS = $(CHICKEN_DYNAMIC_OPTIONS)
    325307
    326 ifneq ($(USE_HOST_PCRE),)
    327 CHICKEN_PCRE_LIBRARY_OPTIONS =
    328 else
    329 CHICKEN_PCRE_LIBRARY_OPTIONS = -include-path $(SRCDIR)pcre
    330 endif
    331 
    332308# targets
    333309
     
    341317CHICKEN_BUG_PROGRAM = $(PROGRAM_PREFIX)chicken-bug$(PROGRAM_SUFFIX)
    342318IMPORT_LIBRARIES = chicken lolevel srfi-1 srfi-4 data-structures ports files posix srfi-13 srfi-69 extras \
    343         regex srfi-14 tcp foreign compiler scheme srfi-18 utils csi
     319        regex srfi-14 tcp foreign compiler scheme srfi-18 utils csi irregex
    344320IMPORT_LIBRARIES += setup-api setup-download
    345321
     
    381357buildsvnrevision:
    382358        sh $(SRCDIR)/svnrevision.sh
    383 ifeq ($(USE_HOST_PCRE),)
    384         $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) pcre
    385 endif
    386359
    387360# generic part of chicken-config.h
  • chicken/trunk/distribution/manifest

    r12840 r12920  
    174174optimizer.scm
    175175regex.scm
     176irregex.scm
    176177posixunix.scm
    177178posixwin.scm
     
    221222tests/loopy-loop.scm
    222223tests/r5rs_pitfalls.scm
     224tests/test-irregex.scm
     225tests/re-tests.txt
    223226tweaks.scm
    224227utils.scm
    225 pcre/AUTHORS
    226 pcre/config.h
    227 pcre/COPYING
    228 pcre/dftables.c
    229 pcre/LICENCE
    230 pcre/NON-UNIX-USE
    231 pcre/pcre_chartables.c
    232 pcre/pcre_compile.c
    233 pcre/pcre_config.c
    234 pcre/pcre_dfa_exec.c
    235 pcre/pcre_exec.c
    236 pcre/pcre_fullinfo.c
    237 pcre/pcre_get.c
    238 pcre/pcre_globals.c
    239 pcre/pcre_info.c
    240 pcre/pcre_internal.h
    241 pcre/pcre_maketables.c
    242 pcre/pcre_newline.c
    243 pcre/pcre_ord2utf8.c
    244 pcre/pcre_refcount.c
    245 pcre/pcre_study.c
    246 pcre/pcre_tables.c
    247 pcre/pcre_try_flipped.c
    248 pcre/pcre_ucd.c
    249 pcre/pcre_ucp_findchar.c
    250 pcre/pcre_valid_utf8.c
    251 pcre/pcre_version.c
    252 pcre/pcre_xclass.c
    253 pcre/pcre.h
    254 pcre/ucp.h
    255228apply-hack.x86.s
    256229apply-hack.x86-64.s
     
    307280extras.import.scm
    308281regex.import.scm
     282irregex.import.scm
    309283srfi-14.import.scm
    310284tcp.import.scm
     
    320294extras.import.c
    321295regex.import.c
     296irregex.import.c
    322297srfi-14.import.c
    323298tcp.import.c
  • chicken/trunk/eval.scm

    r12819 r12920  
    863863(define ##sys#current-source-filename #f)
    864864(define ##sys#current-load-path "")
     865(define ##sys#dload-disabled #f)
    865866
    866867(define-foreign-variable _dlerror c-string "C_dlerror")
     
    914915                   [else
    915916                    (let ([fname2 (##sys#string-append input ##sys#load-dynamic-extension)])
    916                       (if (and (##sys#fudge 24) (##sys#file-info fname2)) ; dload?
     917                      (if (and (not ##sys#dload-disabled)
     918                               (##sys#fudge 24) ; dload?
     919                               (##sys#file-info fname2))
    917920                          fname2
    918921                          (let ([fname3 (##sys#string-append input source-file-extension)])
     
    10981101        (define (check path)
    10991102          (let ([p0 (string-append path "/" p)])
    1100             (and (or (and rp (##sys#fudge 24) ; dload?
     1103            (and (or (and rp
     1104                          (not ##sys#dload-disabled)
     1105                          (##sys#fudge 24) ; dload?
    11011106                          (file-exists? (##sys#string-append p0 ##sys#load-dynamic-extension)))
    11021107                     (file-exists? (##sys#string-append p0 source-file-extension)) )
  • chicken/trunk/files.scm

    r11646 r12920  
    172172        [string-append string-append])
    173173    (let* ([drv (if ##sys#windows-platform "([A-Za-z]:)?" "")]
    174            [patt (make-anchored-pattern (string-append drv "[\\/\\\\].*"))]
     174           [patt (string-append drv "[\\/\\\\].*")]
    175175           [rx (regexp patt)] )
    176176      (lambda (pn)
  • chicken/trunk/henrietta.scm

    r12789 r12920  
    5252      (remove-directory tmpdir)))
    5353
    54   (define (test-file? path)
    55     (string-match "(\\./)?tests(/.*)?" path))
     54  (define test-file?
     55    (let ((rx (regexp "(\\./)?tests(/.*)?")))
     56      (lambda (path) (string-match rx path))))
    5657
    5758  (define (retrieve name version)
     
    8586      (print "\n#!eof") ) )
    8687
     88  (define query-string-rx (regexp "[^?]+\\?(.+)"))
     89  (define query-arg-rx (regexp "^&?(\\w+)=([^&]+)"))
     90
    8791  (define (service)
    8892    (let ((qs (getenv "QUERY_STRING"))
     
    9296      (unless qs
    9397        (error "no QUERY_STRING set"))
    94       (let ((m (string-match "[^?]+\\?(.+)" qs))
     98      (let ((m (string-match query-string-rx qs))
    9599            (egg #f)
    96100            (version #f))
    97101        (let loop ((qs (if m (cadr m) qs)))
    98           (let* ((m (string-search-positions "^&?(\\w+)=([^&]+)" qs))
     102          (let* ((m (string-search-positions query-arg-rx qs))
    99103                 (ms (and m (apply substring qs (cadr m))))
    100104                 (rest (and m (substring qs (cadar m)))))
  • chicken/trunk/library.scm

    r12700 r12920  
    32493249                   (if (##sys#fudge 32) " gchooks" "")
    32503250                   (if (##sys#fudge 35) " applyhook" "")
    3251                    (if (##sys#fudge 37) " hostpcre" "")
    32523251                   (if (##sys#fudge 39) " cross" "") ) ) )
    32533252        (string-append
  • chicken/trunk/manual/Acknowledgements

    r12819 r12920  
    4343and Houman Zolfaghari for bug-fixes, tips and suggestions.
    4444
    45 CHICKEN uses the PCRE regular expression package ([[http://www.pcre.org]]),
    46 which is written by Philip Hazel.
     45CHICKEN uses the "irregex" regular expression package written by Alex Shinn.
    4746
    4847Special thanks to Brandon van Every for contributing the (now defunct)
  • chicken/trunk/manual/The User's Manual

    r12797 r12920  
    33== The User's Manual
    44
    5 This is the user's manual for the Chicken Scheme compiler, version 4.0.0x4
     5This is the user's manual for the Chicken Scheme compiler, version 4.0.0x5
    66
    77; [[Overview]] : What is Chicken?
  • chicken/trunk/manual/Unit regex

    r10872 r12920  
    55
    66This library unit provides support for regular expressions. The regular
    7 expression package used is {{PCRE}} (''Perl Compatible Regular Expressions'')
    8 written by Philip Hazel. See [[http://www.pcre.org]] for information about
    9 the particular regexp flavor and extensions provided by this library.
    10 
    11 To test that PCRE support has been built into Chicken properly, try:
    12 
    13 <enscript highlight=scheme>
    14 (require 'regex)
    15 (test-feature? 'pcre) => t
    16 </enscript>
     7expression package used is {{irregex}}
     8written by Alex Shinn. Irregex supports most Perl-extensions and is
     9written completely in Scheme.
     10
     11This library unit exposes two APIs: the one listed below and the
     12original irregex API. To use the latter, import from the {{irregex}} module.
    1713
    1814
  • chicken/trunk/posixunix.scm

    r12644 r12920  
    482482    (no-procedure-checks-for-usual-bindings)
    483483    (bound-to-procedure
    484      string-match glob->regexp regexp make-anchored-pattern
     484     string-match glob->regexp regexp
    485485     ##sys#thread-yield! ##sys#make-string
    486486     ##sys#make-port ##sys#file-info ##sys#update-errno ##sys#fudge ##sys#make-c-string ##sys#check-port
     
    20922092(define glob
    20932093  (let ([regexp regexp]
    2094         [make-anchored-pattern make-anchored-pattern]
    20952094        [string-match string-match]
    20962095        [glob->regexp glob->regexp]
     
    21042103            (let ([path (car paths)])
    21052104              (let-values ([(dir fil ext) (decompose-pathname path)])
    2106                 (let* ([fnpatt (glob->regexp (make-pathname #f (or fil "*") ext))]
    2107                        [patt (make-anchored-pattern fnpatt)]
     2105                (let* ([patt (glob->regexp (make-pathname #f (or fil "*") ext))]
    21082106                       [rx (regexp patt)])
    21092107                  (let loop ([fns (directory (or dir ".") #t)])
  • chicken/trunk/posixwin.scm

    r12644 r12920  
    17681768(define glob
    17691769  (let ([regexp regexp]
    1770         [make-anchored-pattern make-anchored-pattern]
    17711770        [string-match string-match]
    17721771        [glob->regexp glob->regexp]
     
    17801779            (let ([path (car paths)])
    17811780              (let-values ([(dir fil ext) (decompose-pathname path)])
    1782                 (let* ([fnpatt (glob->regexp (make-pathname #f (or fil "*") ext))]
    1783                        [patt (make-anchored-pattern fnpatt)]
     1781                (let* ([patt (glob->regexp (make-pathname #f (or fil "*") ext))]
    17841782                       [rx (regexp patt)])
    17851783                  (let loop ([fns (directory (or dir ".") #t)])
  • chicken/trunk/regex.import.scm

    r10788 r12920  
    3030   glob?
    3131   grep
    32    make-anchored-pattern
    3332   regex-chardef-table
    3433   regex-chardef-table?
  • chicken/trunk/regex.scm

    r11258 r12920  
    1 ;;;; regex.scm - Unit for using the PCRE regex package
     1;;;; regex.scm
    22;
    33; Copyright (c) 2000-2007, Felix L. Winkelmann
     
    3333  (usual-integrations)
    3434  (disable-interrupts)
    35   (generic) ; PCRE options use lotsa bits
    36   (disable-warning var)
    37   (bound-to-procedure
    38     ;; Forward reference
    39     regex-chardef-table? make-anchored-pattern
    40     ;; Imports
    41     get-output-string open-output-string
    42     string->list list->string string-length string-ref substring make-string string-append
    43     reverse list-ref
    44     char=? char-alphabetic? char-numeric? char->integer
    45     set-finalizer!
    46     ##sys#pointer?
    47     ##sys#slot ##sys#setslot ##sys#size
    48     ##sys#make-structure ##sys#structure?
    49     ##sys#error ##sys#signal-hook
    50     ##sys#substring ##sys#fragments->string ##sys#make-c-string ##sys#string-append
    51     ##sys#write-char-0 )
     35;  (disable-warning var)
    5236  (export
    53     regex-chardef-table? regex-chardef-table
    54     regexp? regexp regexp*
    55     regexp-optimize
    56     make-anchored-pattern
     37    regexp? regexp
    5738    string-match string-match-positions string-search string-search-positions
    5839    string-split-fields string-substitute string-substitute*
    5940    glob? glob->regexp
    6041    grep
    61     regexp-escape ) )
     42    regexp-escape
     43
     44    irregex string->irregex sre->irregex irregex? irregex-match-data?
     45    irregex-new-matches irregex-reset-matches!
     46    irregex-match-start irregex-match-end irregex-match-substring
     47    irregex-match-num-submatches
     48    irregex-search irregex-search/matches irregex-match irregex-match-string
     49    irregex-replace irregex-replace/all
     50    irregex-dfa irregex-dfa/search irregex-dfa/extract
     51    irregex-nfa irregex-flags irregex-submatches irregex-lengths irregex-names
     52    ))
    6253
    6354(cond-expand
     
    7061(include "unsafe-declarations.scm")
    7162
    72 (cond-expand
    73  ((not unsafe)
    74   (define (##sys#check-chardef-table x loc)
    75     (unless (regex-chardef-table? x)
    76       (##sys#error loc "invalid character definition tables structure" x) ) )
    77   (declare
    78     (bound-to-procedure
    79       ;; Imports
    80       ##sys#check-string ##sys#check-list ##sys#check-exact ##sys#check-vector
    81       ##sys#check-structure ##sys#check-symbol ##sys#check-blob ##sys#check-integer )
    82     (export
    83       ##sys#check-chardef-table )))
    84  (else))
    85 
    86 
    87 ;;;
    88 
    89 #>#include "pcre.h"<#
    90 
    91 
    92 ;;;
    93 
    94 (register-feature! 'regex 'pcre)
    95 
    96 
    97 ;;; From unit lolevel:
    98 
    99 (define-inline (%tag-pointer ptr tag)
    100   (let ([tp (##sys#make-tagged-pointer tag)])
    101     (##core#inline "C_copy_pointer" ptr tp)
    102     tp ) )
    103 
    104 (define-inline (%tagged-pointer? x tag)
    105   (and (##core#inline "C_blockp" x)
    106        (##core#inline "C_taggedpointerp" x)
    107        (eq? tag (##sys#slot x 1)) ) )
    108 
    109 
    110 ;;; PCRE Types:
    111 
    112 (define-foreign-type pcre (c-pointer "pcre"))
    113 (define-foreign-type nonnull-pcre (nonnull-c-pointer "pcre"))
    114 
    115 (define-foreign-type pcre_extra (c-pointer "pcre_extra"))
    116 (define-foreign-type nonnull-pcre_extra (nonnull-c-pointer "pcre_extra"))
    117 
    118 (define-foreign-variable PCRE_CASELESS unsigned-integer)
    119 (define-foreign-variable PCRE_EXTENDED unsigned-integer)
    120 (define-foreign-variable PCRE_UTF8 unsigned-integer)
    121 (define-foreign-variable PCRE_MULTILINE unsigned-integer)
    122 (define-foreign-variable PCRE_DOTALL unsigned-integer)
    123 (define-foreign-variable PCRE_ANCHORED unsigned-integer)
    124 (define-foreign-variable PCRE_DOLLAR_ENDONLY unsigned-integer)
    125 (define-foreign-variable PCRE_EXTRA unsigned-integer)
    126 (define-foreign-variable PCRE_NOTBOL unsigned-integer)
    127 (define-foreign-variable PCRE_NOTEOL unsigned-integer)
    128 (define-foreign-variable PCRE_UNGREEDY unsigned-integer)
    129 (define-foreign-variable PCRE_NOTEMPTY unsigned-integer)
    130 (define-foreign-variable PCRE_NO_AUTO_CAPTURE unsigned-integer)
    131 (define-foreign-variable PCRE_NO_UTF8_CHECK unsigned-integer)
    132 (define-foreign-variable PCRE_AUTO_CALLOUT unsigned-integer)
    133 (define-foreign-variable PCRE_PARTIAL unsigned-integer)
    134 (define-foreign-variable PCRE_DFA_SHORTEST unsigned-integer)
    135 (define-foreign-variable PCRE_DFA_RESTART unsigned-integer)
    136 (define-foreign-variable PCRE_FIRSTLINE unsigned-integer)
    137 (define-foreign-variable PCRE_DUPNAMES unsigned-integer)
    138 (define-foreign-variable PCRE_NEWLINE_CR unsigned-integer)
    139 (define-foreign-variable PCRE_NEWLINE_LF unsigned-integer)
    140 (define-foreign-variable PCRE_NEWLINE_CRLF unsigned-integer)
    141 (define-foreign-variable PCRE_NEWLINE_ANY unsigned-integer)
    142 (define-foreign-variable PCRE_NEWLINE_ANYCRLF unsigned-integer)
    143 (define-foreign-variable PCRE_BSR_ANYCRLF unsigned-integer)
    144 (define-foreign-variable PCRE_BSR_UNICODE unsigned-integer)
    145 
    146 (declare (hide pcre-option->number))
    147 
    148 (define (pcre-option->number opt)
    149   (case opt
    150     ((caseless)             PCRE_CASELESS)
    151     ((multiline)            PCRE_MULTILINE)
    152     ((dotall)               PCRE_DOTALL)
    153     ((extended)             PCRE_EXTENDED)
    154     ((anchored)             PCRE_ANCHORED)
    155     ((dollar-endonly)       PCRE_DOLLAR_ENDONLY)
    156     ((extra)                PCRE_EXTRA)
    157     ((notbol)               PCRE_NOTBOL)
    158     ((noteol)               PCRE_NOTEOL)
    159     ((ungreedy)             PCRE_UNGREEDY)
    160     ((notempty)             PCRE_NOTEMPTY)
    161     ((utf8)                 PCRE_UTF8)
    162     ((no-auto-capture)      PCRE_NO_AUTO_CAPTURE)
    163     ((no-utf8-check)        PCRE_NO_UTF8_CHECK)
    164     ((auto-callout)         PCRE_AUTO_CALLOUT)
    165     ((partial)              PCRE_PARTIAL)
    166     ((dfa-shortest)         PCRE_DFA_SHORTEST)
    167     ((dfa-restart)          PCRE_DFA_RESTART)
    168     ((firstline)            PCRE_FIRSTLINE)
    169     ((dupnames)             PCRE_DUPNAMES)
    170     ((newline-cr)           PCRE_NEWLINE_CR)
    171     ((newline-lf)           PCRE_NEWLINE_LF)
    172     ((newline-crlf)         PCRE_NEWLINE_CRLF)
    173     ((newline-any)          PCRE_NEWLINE_ANY)
    174     ((newline-anycrlf)      PCRE_NEWLINE_ANYCRLF)
    175     ((bsr-anycrlf)          PCRE_BSR_ANYCRLF)
    176     ((bsr-unicode)          PCRE_BSR_UNICODE)
    177     (else                   0) ) )
    178 
    179 (declare (hide pcre-options->number))
    180 
    181 (define (pcre-options->number opts)
    182   (let loop ([opts opts] [opt 0])
    183     (if (null? opts)
    184         opt
    185         (loop (cdr opts) (+ opt (pcre-option->number (car opts)))) ) ) )
    186 
    187 ;;; The regexp structure primitives:
    188 
    189 (define re-finalizer
    190   (foreign-lambda void "pcre_free" c-pointer) )
    191 
    192 (define-inline (%make-regexp code)
    193   (set-finalizer! code re-finalizer)
    194   (##sys#make-structure 'regexp code #f 0) )
    195 
    196 (define-inline (%regexp? x)
    197   (##sys#structure? x 'regexp) )
    198 
    199 (define-inline (%regexp-code rx)
    200   (##sys#slot rx 1) )
    201 
    202 (define-inline (%regexp-extra rx)
    203   (##sys#slot rx 2) )
    204 
    205 (define-inline (%regexp-options rx)
    206   (##sys#slot rx 3) )
    207 
    208 (define-inline (%regexp-extra-set! rx extra)
    209   (when extra (set-finalizer! extra re-finalizer))
    210   (##sys#setslot rx 2 extra) )
    211 
    212 (define-inline (%regexp-options-set! rx options)
    213   (##sys#setslot rx 3 options) )
    214 
    215 
    216 ;;; Character Definition Tables:
    217 
    218 ;; The minimum necessary to handle chardef table parameters.
    219 
    220 ;;
    221 
    222 (define (regex-chardef-table? x)
    223   (%tagged-pointer? x 'chardef-table) )
    224 
    225 ;; Get a character definitions tables structure for the current locale.
    226 
    227 (define regex-chardef-table
    228   (let ([re-maketables
    229           (foreign-lambda* (c-pointer unsigned-char) ()
    230             "return (pcre_maketables ());")]
    231         [re-make-chardef-table-type
    232           (lambda (tables)
    233             (%tag-pointer tables 'chardef-table) ) ] )
    234     (lambda (#!optional tables)
    235       ; Using this to type tag a ref is a bit of a hack but beats
    236       ; having another public variable.
    237       (if tables
    238           ; then existing reference so just tag it
    239           (if (##sys#pointer? tables)
    240               (re-make-chardef-table-type tables)
    241               (##sys#signal-hook #:type-error 'regex-chardef-table
    242                "bad argument type - not a pointer" tables) )
    243           ; else make a new chardef tables
    244           (let ([tables (re-maketables)])
    245             (if tables
    246                 (let ([tables (re-make-chardef-table-type tables)])
    247                   (set-finalizer! tables re-finalizer)
    248                   tables )
    249                 (##sys#error-hook 6 'regex-chardef-table) ) ) ) ) ) )
    250 
    251 
    252 ;;; Regexp record:
    253 
    254 (define (regexp? x)
    255   (%regexp? x) )
    256 
    257 
    258 ;;; PCRE errors:
    259 
    260 #>
    261 static const char *C_regex_error;
    262 static int C_regex_error_offset;
    263 <#
    264 
    265 (define-foreign-variable C_regex_error c-string)
    266 (define-foreign-variable C_regex_error_offset int)
    267 
    268 (define re-error
    269   (let ([string-append string-append])
    270     (lambda (loc msg . args)
    271       (apply ##sys#error loc (string-append msg " - " C_regex_error) args) ) ) )
    272 
    273 ;;; Compile regular expression:
    274 
    275 ;FIXME nonnull-unsigned-c-string causes problems - converted string is too long!
    276 
    277 (define re-compile
    278   (foreign-lambda* pcre ((nonnull-c-string patt) (unsigned-integer options) ((const (c-pointer unsigned-char)) tables))
    279     "return(pcre_compile(patt, options, &C_regex_error, &C_regex_error_offset, tables));") )
    280 
    281 (define (re-checked-compile pattern options tables loc)
    282   (##sys#check-string pattern loc)
    283   (or (re-compile pattern options #f)
    284       (re-error loc "cannot compile regular expression" pattern C_regex_error_offset) ) )
    285 
    286 ;; Compile with subset of options and no tables
    287 
    288 (define regexp
    289   (let ([optspatt '(caseless extended utf8)])
    290     (lambda (pattern . options)
    291       (let ([options->integer
    292               (lambda ()
    293                 (pcre-options->number (map (lambda (i o) (if i o 'zero)) options optspatt)))])
    294         (%make-regexp (re-checked-compile pattern (options->integer) #f 'regexp)) ) ) ) )
    295 
    296 ;; Compile with full options and tables available
    297 
    298 (define (regexp* pattern . args)
    299   (let-optionals args ([options '()] [tables #f])
    300     (##sys#check-string pattern 'regexp*)
    301     (##sys#check-list options 'regexp*)
    302     (when tables (##sys#check-chardef-table tables 'regexp*))
    303     (%make-regexp (re-checked-compile pattern (pcre-options->number options) tables 'regexp*)) ) )
    304 
    305 
    306 ;;; Optimize compiled regular expression:
    307 
    308 ;; Invoke optimizer
    309 
    310 (define re-study
    311   (foreign-lambda* pcre_extra (((const nonnull-pcre) code))
    312     "return(pcre_study(code, 0, &C_regex_error));"))
    313 
    314 ;; Optimize compiled regular expression
    315 ;; Returns whether optimization performed
    316 
    317 (define (regexp-optimize rx)
    318   (##sys#check-structure rx 'regexp 'regexp-optimize)
    319   (let ([extra (re-study (%regexp-code rx))])
    320     (cond [C_regex_error
    321             (re-error 'regexp-optimize "cannot optimize regular expression" rx)]
    322           [extra
    323             (%regexp-extra-set! rx extra)
    324             #t]
    325           [else
    326             #f] ) ) )
    327 
    328 
    329 ;;; Captured results vector:
    330 
    331 ;; Match positions vector (PCRE ovector)
    332 
    333 #>
    334 #define OVECTOR_LENGTH_MULTIPLE 3
    335 #define STATIC_OVECTOR_LEN 256
    336 static int C_regex_ovector[OVECTOR_LENGTH_MULTIPLE * STATIC_OVECTOR_LEN];
    337 <#
    338 
    339 ;;
    340 
    341 (define ovector-start-ref
    342   (foreign-lambda* int ((int i))
    343     "return(C_regex_ovector[i * 2]);") )
    344 
    345 (define ovector-end-ref
    346   (foreign-lambda* int ((int i))
    347     "return(C_regex_ovector[(i * 2) + 1]);") )
    348 
    349 
    350 ;;; Gather matched result strings or positions:
    351 
    352 (define (gather-result-positions result)
    353   (let ([mc (car result)]
    354         [cc (cadr result)])
    355     (and (fx> mc 0)
    356          (let loop ([i 0])
    357            (cond [(fx>= i cc)
    358                    '()]
    359                  [(fx>= i mc)
    360                    (cons #f (loop (fx+ i 1)))]
    361                  [else
    362                   (let ([start (ovector-start-ref i)])
    363                     (cons (and (fx>= start 0)
    364                                (list start (ovector-end-ref i)))
    365                           (loop (fx+ i 1)) ) ) ] ) ) ) ) )
    366 
    367 (define gather-results
    368   (let ([substring substring])
    369     (lambda (str result)
    370       (let ([ps (gather-result-positions result)])
    371         (and ps
    372              (##sys#map (lambda (poss) (and poss (apply substring str poss))) ps) ) ) ) ) )
    373 
    374 
    375 ;;; Common match string with compile regular expression:
    376 
    377 (define re-match
    378   (foreign-lambda* int (((const nonnull-pcre) code) ((const pcre_extra) extra)
    379                         (nonnull-scheme-pointer str) (int start) (int range)
    380                         (unsigned-integer options))
    381     "return(pcre_exec(code, extra, str, start + range, start, options, C_regex_ovector, STATIC_OVECTOR_LEN * OVECTOR_LENGTH_MULTIPLE));") )
    382 
    383 (define re-match-capture-count
    384   (foreign-lambda* int (((const nonnull-pcre) code) ((const pcre_extra) extra))
    385     "int cc;"
    386     "pcre_fullinfo(code, extra, PCRE_INFO_CAPTURECOUNT, &cc);"
    387     "return(cc + 1);") )
    388 
    389 (define (perform-match rgxp str si ri loc)
    390   (let* ([extra #f]
    391          [options 0]
    392          [rx
    393           (cond [(string? rgxp)
    394                   (re-checked-compile rgxp 0 #f loc)]
    395                 [(%regexp? rgxp)
    396                   (set! extra (%regexp-extra rgxp))
    397                   (set! options (%regexp-options rgxp))
    398                   (%regexp-code rgxp)]
    399                 [else
    400                   (##sys#signal-hook #:type-error
    401                                      loc
    402                                      "bad argument type - not a string or compiled regular expression"
    403                                      rgxp)] )]
    404          [cc (re-match-capture-count rx extra)]
    405          [mc (re-match rx extra str si ri options)])
    406     (when (string? rgxp) (re-finalizer rx))
    407     (list mc cc) ) )
    408 
    409 
    410 ;;; Match string with regular expression:
    411 
    412 ;; Note that start is a BYTE offset
    413 
    414 (define string-match)
    415 (define string-match-positions)
    416 (let ()
    417 
    418   (define (prepare-match rgxp str start loc)
    419     (##sys#check-string str loc)
    420     (let ([si (if (pair? start) (car start) 0)])
    421       (##sys#check-exact si loc)
    422       (perform-match (if (string? rgxp)
    423                          (make-anchored-pattern rgxp (fx< 0 si))
    424                          rgxp)
    425                      str si (fx- (##sys#size str) si)
    426                      loc) ) )
    427 
    428   (set! string-match
    429     (lambda (rgxp str . start)
    430       (gather-results str (prepare-match rgxp str start 'string-match)) ) )
    431 
    432   (set! string-match-positions
    433     (lambda (rgxp str . start)
    434       (gather-result-positions (prepare-match rgxp str start 'string-match-positions)) ) ) )
    435 
    436 
    437 ;;; Search string with regular expression:
    438 
    439 ;; Note that start & range are BYTE offsets
    440 
    441 
    442 (define string-search)
    443 (define string-search-positions)
    444 (let ()
    445 
    446   (define (prepare-search rgxp str start-and-range loc)
    447     (##sys#check-string str loc)
    448     (let* ([range (and (pair? start-and-range) (cdr start-and-range)) ]
    449            [si (if range (car start-and-range) 0)]
    450            [ri (if (pair? range) (car range) (fx- (##sys#size str) si))] )
    451       (##sys#check-exact si loc)
    452       (##sys#check-exact ri loc)
    453       (perform-match rgxp str si ri loc) ) )
    454 
    455   (set! string-search
    456     (lambda (rgxp str . start-and-range)
    457       (gather-results str (prepare-search rgxp str start-and-range 'string-search)) ) )
    458 
    459   (set! string-search-positions
    460     (lambda (rgxp str . start-and-range)
    461       (gather-result-positions (prepare-search rgxp str start-and-range 'string-search-positions)) ) ) )
     63(register-feature! 'regex 'irregex)
     64
     65(include "irregex.scm")
     66
     67(define-record regexp x)
     68
     69(define (regexp pat #!optional caseless extended utf8)
     70  (make-regexp
     71   (apply
     72    irregex
     73    pat
     74    (let ((opts '()))
     75      (when caseless (set! opts (cons 'i opts)))
     76      (when extended (set! opts (cons 'x opts)))
     77      (when utf8 (set! opts (cons 'utf8 opts)))
     78      opts))) )
     79
     80(define (unregexp x)
     81  (cond ((regexp? x) (regexp-x x))
     82        ((irregex? x) x)
     83        (else (irregex x))))
     84
     85(define (string-match rx str)
     86  (let ((rx (unregexp rx)))
     87    (and-let* ((m (irregex-match rx str)))
     88      (let loop ((i (irregex-match-num-submatches m))
     89                 (res '()))
     90        (if (fx<= i 0)
     91            (cons str res)
     92            (loop (fx- i 1) (cons (irregex-match-substring m i) res)))))))
     93
     94(define (string-match-positions rx str)
     95  (let ((rx (unregexp rx)))
     96    (and-let* ((m (irregex-match rx str)))
     97      (let loop ((i (irregex-match-num-submatches m))
     98                 (res '()))
     99        (if (fx<= i 0)
     100            (cons (list 0 (string-length str)) res)
     101            (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
     102                                        (irregex-match-end-index m i))
     103                                  res)))))))
     104
     105(define (string-search rx str #!optional (start 0) (range (string-length str)))
     106  (let ((rx (unregexp rx)))
     107    (and-let* ((m (irregex-search rx str start (fx+ start range))))
     108      (let loop ((i (irregex-match-num-submatches m))
     109                 (res '()))
     110        (if (fx< i 0)
     111            res
     112            (loop (fx- i 1) (cons (irregex-match-substring m i) res)))))))
     113
     114(define (string-search-positions rx str #!optional (start 0) (range (string-length str)))
     115  (let ((rx (unregexp rx)))
     116    (and-let* ((m (irregex-search rx str start (fx+ start range))))
     117      (let loop ((i (irregex-match-num-submatches m))
     118                 (res '()))
     119        (if (fx< i 0)
     120            res
     121            (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
     122                                        (irregex-match-end-index m i))
     123                                  res)))))))
     124
    462125
    463126
     
    515178      (let* ([which (if (pair? flag) (car flag) 1)]
    516179             [substlen (##sys#size subst)]
     180             (strlen (##sys#size string))
    517181             [substlen-1 (fx- substlen 1)]
    518182             [result '()]
     
    537201                      (loop start index+1) ) ) ) ) )
    538202        (let loop ([index 0] [count 1])
    539           (let ([matches (string-search-positions regex string index)])
     203          (let ((matches (and (fx< index strlen)
     204                              (string-search-positions regex string index))))
    540205            (cond [matches
    541206                   (let* ([range (car matches)]
     
    644309      (let ([out (open-output-string)]
    645310            [len (##sys#size str)] )
    646         (let loop ([i 0])
    647           (cond [(fx>= i len) (get-output-string out)]
     311        (let loop ([i 0])
     312          (cond [(fx>= i len) (get-output-string out)]
    648313                [(memq (##core#inline "C_subchar" str i)
    649314                       '(#\. #\\ #\? #\* #\+ #\^ #\$ #\( #\) #\[ #\] #\| #\{ #\}))
     
    654319                 (##sys#write-char-0 (##core#inline "C_subchar" str i) out)
    655320                 (loop (fx+ i 1)) ] ) ) ) ) ) )
    656 
    657 
    658 ;;; Anchored pattern:
    659 
    660 (define make-anchored-pattern
    661   (let ([string-append string-append])
    662     (lambda (rgxp . args)
    663       (let-optionals args ([nos #f] [noe #f])
    664         (cond [(string? rgxp)
    665                 (string-append (if nos "" "^") rgxp (if noe "" "$"))]
    666               [else
    667                 (##sys#check-structure rgxp 'regexp 'make-anchored-pattern)
    668                 (when (or nos noe)
    669                   (warning 'make-anchored-pattern
    670                            "cannot select partial anchor for compiled regular expression") )
    671                 (%regexp-options-set! rgxp
    672                                       (+ (%regexp-options regexp) (pcre-option->number 'anchored)))
    673                 rgxp] ) ) ) ) )
  • chicken/trunk/rules.make

    r12852 r12920  
    2525# POSSIBILITY OF SUCH DAMAGE.
    2626
    27 VPATH=$(SRCDIR):$(SRCDIR)pcre
     27VPATH=$(SRCDIR)
    2828
    2929# object files
     
    5050LIBCHICKENGUI_STATIC_OBJECTS = $(LIBCHICKENGUI_OBJECTS_1:=-static$(O))
    5151
    52 ifeq ($(USE_HOST_PCRE),)
    53 PCRE_OBJECTS_1 ?= \
    54        $(PCRE_DIR)pcre_chartables \
    55        $(PCRE_DIR)pcre_compile \
    56        $(PCRE_DIR)pcre_config \
    57        $(PCRE_DIR)pcre_dfa_exec \
    58        $(PCRE_DIR)pcre_exec \
    59        $(PCRE_DIR)pcre_fullinfo \
    60        $(PCRE_DIR)pcre_get \
    61        $(PCRE_DIR)pcre_globals \
    62        $(PCRE_DIR)pcre_info \
    63        $(PCRE_DIR)pcre_maketables \
    64        $(PCRE_DIR)pcre_newline \
    65        $(PCRE_DIR)pcre_ord2utf8 \
    66        $(PCRE_DIR)pcre_refcount \
    67        $(PCRE_DIR)pcre_study \
    68        $(PCRE_DIR)pcre_tables \
    69        $(PCRE_DIR)pcre_try_flipped \
    70        $(PCRE_DIR)pcre_ucd \
    71        $(PCRE_DIR)pcre_valid_utf8 \
    72        $(PCRE_DIR)pcre_version \
    73        $(PCRE_DIR)pcre_xclass
    74 PCRE_SHARED_OBJECTS = $(PCRE_OBJECTS_1:=$(O))
    75 PCRE_STATIC_OBJECTS = $(PCRE_OBJECTS_1:=-static$(O))
    76 endif
    77 
    7852COMPILER_OBJECTS_1 = \
    7953       chicken batch-driver compiler optimizer support \
     
    143117          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    144118regex$(O): regex.c chicken.h $(CHICKEN_CONFIG_H)
    145         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    146           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    147           $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     119        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     120          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
     121          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    148122scheduler$(O): scheduler.c chicken.h $(CHICKEN_CONFIG_H)
    149123        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    228202          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    229203uregex$(O): uregex.c chicken.h $(CHICKEN_CONFIG_H)
    230         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    231           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    232           $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     204        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     205          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
     206          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    233207usrfi-1$(O): usrfi-1.c chicken.h $(CHICKEN_CONFIG_H)
    234         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
     208        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
    235209          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    236210          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
     
    336310          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    337311regex-static$(O): regex.c chicken.h $(CHICKEN_CONFIG_H)
    338         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    339           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
    340           $(C_COMPILER_STATIC_OPTIONS) \
    341           $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     312        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     313          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
     314          $(C_COMPILER_STATIC_OPTIONS) \
     315          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    342316scheduler-static$(O): scheduler.c chicken.h $(CHICKEN_CONFIG_H)
    343317        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    443417uregex-static$(O): uregex.c chicken.h $(CHICKEN_CONFIG_H)
    444418        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
    445           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(PCRE_INCLUDES) \
    446           $(C_COMPILER_STATIC_OPTIONS) \
    447           $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     419          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
     420          $(C_COMPILER_STATIC_OPTIONS) \
     421          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    448422usrfi-1-static$(O): usrfi-1.c chicken.h $(CHICKEN_CONFIG_H)
    449423        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    542516          $(HOST_C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(HOST_C_COMPILER_OUTPUT)
    543517regex.import$(O): regex.import.c chicken.h $(CHICKEN_CONFIG_H)
     518        $(HOST_C_COMPILER) $(HOST_C_COMPILER_OPTIONS) $(HOST_C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) -DC_SHARED \
     519          $(HOST_C_COMPILER_COMPILE_OPTION) $(HOST_C_COMPILER_OPTIMIZATION_OPTIONS) $(HOST_C_COMPILER_SHARED_OPTIONS) \
     520          $(HOST_C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(HOST_C_COMPILER_OUTPUT)
     521irregex.import$(O): irregex.import.c chicken.h $(CHICKEN_CONFIG_H)
    544522        $(HOST_C_COMPILER) $(HOST_C_COMPILER_OPTIONS) $(HOST_C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) -DC_SHARED \
    545523          $(HOST_C_COMPILER_COMPILE_OPTION) $(HOST_C_COMPILER_OPTIMIZATION_OPTIONS) $(HOST_C_COMPILER_SHARED_OPTIONS) \
     
    650628          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT)
    651629
    652 # pcre objects
    653 
    654 $(PCRE_DIR)pcre_compile$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h 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_DIR)pcre_config$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.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_DIR)pcre_dfa_exec$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h 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_DIR)pcre_exec$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h 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_DIR)pcre_fullinfo$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h 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_DIR)pcre_get$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    675         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    676           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    677           $(C_COMPILER_PCRE_OPTIONS)
    678 $(PCRE_DIR)pcre_globals$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    679         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    680           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    681           $(C_COMPILER_PCRE_OPTIONS)
    682 $(PCRE_DIR)pcre_info$(O): pcre_info.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_maketables$(O): pcre_maketables.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_newline$(O): pcre_newline.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_ord2utf8$(O): pcre_ord2utf8.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_refcount$(O): pcre_refcount.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_study$(O): pcre_study.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_tables$(O): pcre_tables.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_try_flipped$(O): pcre_try_flipped.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_ucd$(O): pcre_ucd.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_valid_utf8$(O): pcre_valid_utf8.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_version$(O): pcre_version.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_xclass$(O): pcre_xclass.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_chartables$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_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 
    735 # static pcre objects
    736 
    737 $(PCRE_DIR)pcre_compile-static$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    738         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    739           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    740           $(C_COMPILER_STATIC_OPTIONS) \
    741           $(C_COMPILER_PCRE_OPTIONS)
    742 $(PCRE_DIR)pcre_config-static$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    743         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    744           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    745           $(C_COMPILER_STATIC_OPTIONS) \
    746           $(C_COMPILER_PCRE_OPTIONS)
    747 $(PCRE_DIR)pcre_dfa_exec-static$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    748         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    749           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    750           $(C_COMPILER_STATIC_OPTIONS) \
    751           $(C_COMPILER_PCRE_OPTIONS)
    752 $(PCRE_DIR)pcre_exec-static$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    753         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    754           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    755           $(C_COMPILER_STATIC_OPTIONS) \
    756           $(C_COMPILER_PCRE_OPTIONS)
    757 $(PCRE_DIR)pcre_fullinfo-static$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    758         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    759           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    760           $(C_COMPILER_STATIC_OPTIONS) \
    761           $(C_COMPILER_PCRE_OPTIONS)
    762 $(PCRE_DIR)pcre_get-static$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    763         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    764           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    765           $(C_COMPILER_STATIC_OPTIONS) \
    766           $(C_COMPILER_PCRE_OPTIONS)
    767 $(PCRE_DIR)pcre_globals-static$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    768         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    769           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    770           $(C_COMPILER_STATIC_OPTIONS) \
    771           $(C_COMPILER_PCRE_OPTIONS)
    772 $(PCRE_DIR)pcre_info-static$(O): pcre_info.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    773         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    774           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    775           $(C_COMPILER_STATIC_OPTIONS) \
    776           $(C_COMPILER_PCRE_OPTIONS)
    777 $(PCRE_DIR)pcre_maketables-static$(O): pcre_maketables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    778         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    779           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    780           $(C_COMPILER_STATIC_OPTIONS) \
    781           $(C_COMPILER_PCRE_OPTIONS)
    782 $(PCRE_DIR)pcre_newline-static$(O): pcre_newline.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    783         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    784           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    785           $(C_COMPILER_STATIC_OPTIONS) \
    786           $(C_COMPILER_PCRE_OPTIONS)
    787 $(PCRE_DIR)pcre_ord2utf8-static$(O): pcre_ord2utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    788         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    789           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    790           $(C_COMPILER_STATIC_OPTIONS) \
    791           $(C_COMPILER_PCRE_OPTIONS)
    792 $(PCRE_DIR)pcre_refcount-static$(O): pcre_refcount.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    793         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    794           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    795           $(C_COMPILER_STATIC_OPTIONS) \
    796           $(C_COMPILER_PCRE_OPTIONS)
    797 $(PCRE_DIR)pcre_study-static$(O): pcre_study.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    798         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    799           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    800           $(C_COMPILER_STATIC_OPTIONS) \
    801           $(C_COMPILER_PCRE_OPTIONS)
    802 $(PCRE_DIR)pcre_tables-static$(O): pcre_tables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    803         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    804           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    805           $(C_COMPILER_STATIC_OPTIONS) \
    806           $(C_COMPILER_PCRE_OPTIONS)
    807 $(PCRE_DIR)pcre_try_flipped-static$(O): pcre_try_flipped.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    808         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    809           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    810           $(C_COMPILER_STATIC_OPTIONS) \
    811           $(C_COMPILER_PCRE_OPTIONS)
    812 $(PCRE_DIR)pcre_ucd-static$(O): pcre_ucd.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    813         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    814           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    815           $(C_COMPILER_STATIC_OPTIONS) \
    816           $(C_COMPILER_PCRE_OPTIONS)
    817 $(PCRE_DIR)pcre_valid_utf8-static$(O): pcre_valid_utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    818         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    819           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    820           $(C_COMPILER_STATIC_OPTIONS) \
    821           $(C_COMPILER_PCRE_OPTIONS)
    822 $(PCRE_DIR)pcre_version-static$(O): pcre_version.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    823         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    824           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    825           $(C_COMPILER_STATIC_OPTIONS) \
    826           $(C_COMPILER_PCRE_OPTIONS)
    827 $(PCRE_DIR)pcre_xclass-static$(O): pcre_xclass.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    828         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    829           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    830           $(C_COMPILER_STATIC_OPTIONS) \
    831           $(C_COMPILER_PCRE_OPTIONS)
    832 $(PCRE_DIR)pcre_chartables-static$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H)
    833         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    834           $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    835           $(C_COMPILER_STATIC_OPTIONS) \
    836           $(C_COMPILER_PCRE_OPTIONS)
    837 
    838630# assembler objects
    839631
     
    881673libs: $(TARGETLIBS)
    882674
    883 libchicken$(SO)$(SONAME_VERSION): $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     675libchicken$(SO)$(SONAME_VERSION): $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    884676        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_LINKER_OPTIONS) \
    885677          $(LINKER_OUTPUT) $^ $(LIBCHICKEN_SO_LIBRARIES)
     
    889681
    890682
    891 libuchicken$(SO)$(SONAME_VERSION): $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     683libuchicken$(SO)$(SONAME_VERSION): $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    892684        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBUCHICKEN_SO_LINKER_OPTIONS) \
    893685          $(LINKER_OUTPUT) $^ $(LIBUCHICKEN_SO_LIBRARIES)
     
    896688endif
    897689
    898 cygchicken-0.dll: $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     690cygchicken-0.dll: $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    899691        gcc -shared -o $(LIBCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
    900692            -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
     
    903695            -Wl,--out-implib=libchicken.dll.a -Wl,--export-all-symbols \
    904696            -Wl,--enable-auto-import \
    905             -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
     697            -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
    906698            -Wl,--no-whole-archive $(LIBCHICKEN_SO_LIBRARIES)
    907699
    908 cyguchicken-0.dll: $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     700cyguchicken-0.dll: $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    909701        gcc -shared -o $(LIBUCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
    910702            -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
     
    913705            -Wl,--out-implib=libuchicken.dll.a -Wl,--export-all-symbols \
    914706            -Wl,--enable-auto-import \
    915             -Wl,--whole-archive $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
     707            -Wl,--whole-archive $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
    916708            -Wl,--no-whole-archive $(LIBUCHICKEN_SO_LIBRARIES)
    917709
    918710
    919 libchickengui$(SO): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS)
     711libchickengui$(SO): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_SHARED_OBJECTS)
    920712        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKENGUI_SO_LINKER_OPTIONS) \
    921713        $(LINKER_OUTPUT) $^ $(LIBCHICKENGUI_SO_LIBRARIES)
    922714
    923 libchicken$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKEN_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     715libchicken$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKEN_STATIC_OBJECTS)
    924716        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    925717
    926 libuchicken$(A): $(APPLY_HACK_OBJECT) $(LIBUCHICKEN_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     718libuchicken$(A): $(APPLY_HACK_OBJECT) $(LIBUCHICKEN_STATIC_OBJECTS)
    927719        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    928720
    929 libchickengui$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     721libchickengui$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_STATIC_OBJECTS)
    930722        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    931723
     
    1107899        $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) $(DESTDIR)$(IEGGDIR)/extras.import.so
    1108900        $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) $(DESTDIR)$(IEGGDIR)/regex.import.so
     901        $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) $(DESTDIR)$(IEGGDIR)/irregex.import.so
    1109902        $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) $(DESTDIR)$(IEGGDIR)/srfi-14.import.so
    1110903        $(POSTINSTALL_PROGRAM) $(POSTINSTALL_PROGRAM_FLAGS) $(DESTDIR)$(IEGGDIR)/tcp.import.so
     
    12471040posixwin.c: $(SRCDIR)posixwin.scm
    12481041        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    1249 regex.c: $(SRCDIR)regex.scm
    1250         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) -output-file $@
     1042regex.c: $(SRCDIR)regex.scm $(SRCDIR)irregex.scm
     1043        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    12511044scheduler.c: $(SRCDIR)scheduler.scm
    12521045        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     
    12901083uposixwin.c: $(SRCDIR)posixwin.scm $(SRCDIR)unsafe-declarations.scm
    12911084        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1292 uregex.c: $(SRCDIR)regex.scm $(SRCDIR)unsafe-declarations.scm
    1293         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
     1085uregex.c: $(SRCDIR)regex.scm $(SRCDIR)irregex.scm $(SRCDIR)unsafe-declarations.scm
     1086        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    12941087
    12951088chicken.import.c: $(SRCDIR)chicken.import.scm
     
    13161109        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    13171110regex.import.c: $(SRCDIR)regex.import.scm
     1111        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
     1112irregex.import.c: $(SRCDIR)irregex.import.scm
    13181113        $(CHICKEN) $< $(CHICKEN_IMPORT_LIBRARY_OPTIONS) -output-file $@
    13191114srfi-14.import.c: $(SRCDIR)srfi-14.import.scm
     
    14001195
    14011196ifeq ($(PLATFORM),mingw)
    1402 CLEAN_PCRE = $(PCRE_DIR)*$(O)
    14031197CLEAN_MINGW_LIBS = libchickengui.a libchickengui.dll libchickengui.dll.a
    14041198else
    1405 CLEAN_PCRE = $(PCRE_DIR)*$(O)
    14061199CLEAN_MINGW_LIBS =
    14071200endif
     
    14151208          libchicken$(A) libuchicken$(A) libchickengui$(A) libchicken$(SO) $(PROGRAM_IMPORT_LIBRARIES) \
    14161209          $(IMPORT_LIBRARIES:=.import.so) $(LIBCHICKEN_IMPORT_LIBRARY) $(LIBUCHICKEN_IMPORT_LIBRARY) $(LIBCHICKENGUI_IMPORT_LIBRARY)  \
    1417           $(MSVC_CHICKEN_EXPORT_FILES) chicken.info $(CLEAN_PCRE) $(CLEAN_MINGW_LIBS) \
     1210          $(MSVC_CHICKEN_EXPORT_FILES) chicken.info $(CLEAN_MINGW_LIBS) \
    14181211          $(CLEAN_MANIFESTS)
    14191212
  • chicken/trunk/runtime.c

    r12869 r12920  
    42254225    return C_mk_bool(debug_mode);
    42264226
    4227   case C_fix(37):
    4228 #ifdef C_USE_HOST_PCRE
    4229     return C_SCHEME_TRUE;
    4230 #else
    4231     return C_SCHEME_FALSE;
    4232 #endif
     4227    /* 37 */
    42334228
    42344229  case C_fix(38):
  • chicken/trunk/scripts/setversion

    r10531 r12920  
    1010
    1111(define files '("README" "manual/The User's Manual"))
     12
     13(define-syntax rx
     14  (syntax-rules ()
     15    ((_ r) (force (delay (regexp r))))))
    1216
    1317(define (patch which rx subst)
     
    3135
    3236(define (parse-version v)
    33   (string-match "(\\d+)\\.(\\d+)\\.(\\d+)(.*)" v) )
     37  (string-match (rx "(\\d+)\\.(\\d+)\\.(\\d+)(.*)") v) )
    3438
    3539(define (main args)
     
    5054  (system* "cat version.scm")
    5155  (let ([vstr (sprintf "version ~A" buildversion)])
    52     (for-each (cut patch <> "version [0-9][-.0-9a-zA-Z]+" vstr) files) )
     56    (for-each (cut patch <> (rx "version [0-9][-.0-9a-zA-Z]+") vstr) files) )
    5357  (with-output-to-file "DONE" (cut print "- version is " buildversion))
    5458  0)
  • chicken/trunk/tests/runtests.sh

    r12838 r12920  
    8686$compile path-tests.scm && ./a.out
    8787
     88echo "======================================== regular expression tests ..."
     89$interpret -bnq test-irregex.scm
     90
    8891echo "======================================== r4rstest ..."
    8992$interpret -e '(set! ##sys#procedure->string (constantly "#<procedure>"))' \
  • chicken/trunk/tests/test.scm

    r10656 r12920  
    8787      (lambda () (handle-exceptions ex *fail-token* expr)) *fail-token* eq?) )
    8888    ((_ expr) (test-error 'expr expr))))
     89
     90(define-syntax test-assert
     91  (syntax-rules ()
     92    ((_ name expr) (run-equal name (lambda () (if expr #t #f)) #t eq?))))
     93
     94(define-syntax test-group
     95  (syntax-rules ()
     96    ((_ name body ...)
     97     (begin
     98       (print "\n" name ":\n")
     99       body ...))))
  • chicken/trunk/version.scm

    r12797 r12920  
    1 (define-constant +build-version+ "4.0.0x4")
     1(define-constant +build-version+ "4.0.0x5")
Note: See TracChangeset for help on using the changeset viewer.