Changeset 13010 in project for chicken


Ignore:
Timestamp:
01/15/09 08:34:40 (11 years ago)
Author:
Ivan Raikov
Message:

Replaced PCRE with irregex in the release 3 branch.

Location:
chicken/branches/chicken-3
Files:
1 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/chicken-3/Makefile.linux

    r11964 r13010  
    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/branches/chicken-3/NEWS

    r12627 r13010  
     13.4.7
     2
     3- Replaced PCRE regex engine with Alex Shinn's "irregex" regular
     4  expression package
     5
     63.4.6
     7
     8- Fixed bug in number->string in base 2. [reported by Kevin Beranek]
     9
    1103.4.5
    211
  • chicken/branches/chicken-3/README

    r12959 r13010  
    33  (c)2000-2008 Felix L. Winkelmann
    44
    5   version 3.4.6
     5  version 3.4.7
    66
    77
  • chicken/branches/chicken-3/buildversion

    r12959 r13010  
    1 3.4.6
     13.4.7
  • chicken/branches/chicken-3/defaults.make

    r12627 r13010  
    149149# options
    150150
    151 ifneq ($(USE_HOST_PCRE),)
    152 LIBRARIES += -lpcre
    153 PCRE_INCLUDES =
    154 C_COMPILER_PCRE_OPTIONS =
    155 PCRE_OBJECTS_1 =
    156 else
    157 # commented out this block, as it makes NO sense whatsoever
    158 ifneq ($(SRCDIR),$(SRCDIR))
    159 ifdef WINDOWS
    160 ifneq ($(HOSTSYSTEM),mingw32)
    161 PCRE_DIR ?= $(SRCDIR)pcre
    162 else
    163 endif
    164 PCRE_DIR ?= $(SRCDIR)pcre/
    165 else
    166 PCRE_DIR ?= $(SRCDIR)pcre/
    167 endif
    168 endif
    169 # end of commented out nonsense
    170 PCRE_DIR ?= $(SRCDIR)pcre
    171 C_COMPILER_PCRE_OPTIONS = -DPCRE_STATIC -DHAVE_CONFIG_H
    172 PCRE_INCLUDES = $(INCLUDES) -I$(PCRE_DIR)
    173 endif
    174151ifndef NOPTABLES
    175152C_COMPILER_PTABLES_OPTIONS ?= -DC_ENABLE_PTABLES
     
    294271CHICKEN_UNSAFE_OPTIONS = -unsafe -no-lambda-info
    295272
    296 ifneq ($(USE_HOST_PCRE),)
    297 CHICKEN_PCRE_LIBRARY_OPTIONS =
    298 else
    299 CHICKEN_PCRE_LIBRARY_OPTIONS = -include-path $(SRCDIR)pcre
    300 endif
    301 
    302273# targets
    303274
     
    344315buildsvnrevision:
    345316        sh $(SRCDIR)/svnrevision.sh
    346 ifeq ($(USE_HOST_PCRE),)
    347         $(MAKEDIR_COMMAND) $(MAKEDIR_COMMAND_OPTIONS) pcre
    348 endif
     317
    349318
    350319# generic part of chicken-config.h
  • chicken/branches/chicken-3/files.scm

    r11227 r13010  
    186186        [string-append string-append])
    187187    (let* ([drv (if ##sys#windows-platform "([A-Za-z]:)?" "")]
    188            [patt (make-anchored-pattern (string-append drv "[\\/\\\\].*"))]
     188           [patt (string-append drv "[\\/\\\\].*")]
    189189           [rx (regexp patt)] )
    190190      (lambda (pn)
  • chicken/branches/chicken-3/manual/The User's Manual

    r12959 r13010  
    33== The User's Manual
    44
    5 This is the user's manual for the Chicken Scheme compiler, version 3.4.6
     5This is the user's manual for the Chicken Scheme compiler, version 3.4.7
    66
    77; [[Getting started]] : What is CHICKEN and how do I use it?
  • chicken/branches/chicken-3/manual/Unit regex

    r10513 r13010  
    44== Unit regex
    55
    6 This 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:
     6This library unit provides support for regular expressions. The
     7regular expression package used is {{irregex}} written by Alex
     8Shinn. See [[http://synthcode.com/scheme/irregex/]] for information
     9about the particular regexp flavor and extensions provided by this
     10library.
     11
     12To test that {{irregex}} support has been built into Chicken properly,
     13try:
    1214
    1315<enscript highlight=scheme>
    1416(require 'regex)
    15 (feature? 'pcre) => #t
     17(feature? 'irregex) => #t
    1618</enscript>
    1719
     
    119121or {{#f}} otherwise.
    120122
    121 
    122 === regexp-optimize
    123 
    124  [procedure] (regexp-optimize RX)
    125  
    126 Perform available optimizations for the precompiled regular expression {{RX}}.
    127 Returns {{#t}} when optimization performed, and {{#f}} otherwise.
    128 
    129 
    130123=== string-match
    131124=== string-match-positions
     
    243236
    244237
    245 === make-anchored-pattern
    246 
    247  [procedure] (make-anchored-pattern REGEXP [WITHOUT-BOL [WITHOUT-EOL]])
    248 
    249 Makes an anchored pattern from {{REGEXP}} (a string or a precompiled regular
    250 expression) and returns the updated pattern. When {{WITHOUT-BOL}} is {{#t}} the
    251 beginning-of-line anchor is not added. When {{WITHOUT-EOL}} is {{#t}} the
    252 end-of-line anchor is not added.
    253 
    254 The {{WITHOUT-BOL}} and {WITHOUT-EOL}} arguments are ignored for a precompiled regular
    255 expression.
    256 
    257 
    258238Previous: [[Unit match]]
    259239
  • chicken/branches/chicken-3/posixunix.scm

    r12626 r13010  
    475475    (no-procedure-checks-for-usual-bindings)
    476476    (bound-to-procedure
    477      string-match glob->regexp regexp make-anchored-pattern
     477     string-match glob->regexp regexp
    478478     ##sys#thread-yield! ##sys#make-string
    479479     ##sys#make-port ##sys#file-info ##sys#update-errno ##sys#fudge ##sys#make-c-string ##sys#check-port
     
    21032103(define glob
    21042104  (let ([regexp regexp]
    2105         [make-anchored-pattern make-anchored-pattern]
    21062105        [string-match string-match]
    21072106        [glob->regexp glob->regexp]
     
    21162115              (let-values ([(dir fil ext) (decompose-pathname path)])
    21172116                (let* ([fnpatt (glob->regexp (make-pathname #f (or fil "*") ext))]
    2118                        [patt (make-anchored-pattern fnpatt)]
    2119                        [rx (regexp patt)])
     2117                       [rx (regexp fnpatt)])
    21202118                  (let loop ([fns (directory (or dir ".") #t)])
    21212119                    (cond [(null? fns) (conc-loop (cdr paths))]
  • chicken/branches/chicken-3/posixwin.scm

    r11243 r13010  
    17721772(define glob
    17731773  (let ([regexp regexp]
    1774         [make-anchored-pattern make-anchored-pattern]
    17751774        [string-match string-match]
    17761775        [glob->regexp glob->regexp]
     
    17851784              (let-values ([(dir fil ext) (decompose-pathname path)])
    17861785                (let* ([fnpatt (glob->regexp (make-pathname #f (or fil "*") ext))]
    1787                        [patt (make-anchored-pattern fnpatt)]
    1788                        [rx (regexp patt)])
     1786                       [rx (regexp fnpatt)])
    17891787                  (let loop ([fns (directory (or dir ".") #t)])
    17901788                    (cond [(null? fns) (conc-loop (cdr paths))]
  • chicken/branches/chicken-3/regex.scm

    r11258 r13010  
    3636  (disable-warning var)
    3737  (bound-to-procedure
    38     ;; Forward reference
    39     regex-chardef-table? make-anchored-pattern
    4038    ;; Imports
    4139    get-output-string open-output-string
     
    5149    ##sys#write-char-0 )
    5250  (export
    53     regex-chardef-table? regex-chardef-table
    54     regexp? regexp regexp*
    55     regexp-optimize
    56     make-anchored-pattern
     51   regexp? regexp
    5752    string-match string-match-positions string-search string-search-positions
    5853    string-split-fields string-substitute string-substitute*
    5954    glob? glob->regexp
    60     grep
    61     regexp-escape ) )
     55    grep regexp-escape
     56
     57    irregex string->irregex sre->irregex irregex? irregex-match-data?
     58    irregex-new-matches irregex-reset-matches!
     59    irregex-match-start irregex-match-end irregex-match-substring
     60    irregex-match-num-submatches
     61    irregex-search irregex-search/matches irregex-match irregex-match-string
     62    irregex-replace irregex-replace/all
     63    irregex-dfa irregex-dfa/search irregex-dfa/extract
     64    irregex-nfa irregex-flags irregex-submatches irregex-lengths irregex-names
     65
     66    ) )
    6267
    6368(cond-expand
     
    8792    (define-macro (##sys#check-byte-vector . _) '(##core#undefined)) ) ]
    8893 [else
    89   (define (##sys#check-chardef-table x loc)
    90     (unless (regex-chardef-table? x)
    91       (##sys#error loc "invalid character definition tables structure" x) ) )
    9294  (declare
    9395    (bound-to-procedure
     
    9597      ##sys#check-string ##sys#check-list ##sys#check-exact ##sys#check-vector
    9698      ##sys#check-structure ##sys#check-symbol ##sys#check-blob ##sys#check-integer )
    97     (export
    98       ##sys#check-chardef-table )
    9999    (emit-exports "regex.exports") ) ] )
    100100
    101101
    102 ;;;
    103 
    104 #>#include "pcre.h"<#
    105 
    106 
    107 ;;;
    108 
    109 (register-feature! 'regex 'pcre)
    110 
    111 
    112 ;;; From unit lolevel:
    113 
    114 (define-inline (%tag-pointer ptr tag)
    115   (let ([tp (##sys#make-tagged-pointer tag)])
    116     (##core#inline "C_copy_pointer" ptr tp)
    117     tp ) )
    118 
    119 (define-inline (%tagged-pointer? x tag)
    120   (and (##core#inline "C_blockp" x)
    121        (##core#inline "C_taggedpointerp" x)
    122        (eq? tag (##sys#slot x 1)) ) )
    123 
    124 
    125 ;;; PCRE Types:
    126 
    127 (define-foreign-type pcre (c-pointer "pcre"))
    128 (define-foreign-type nonnull-pcre (nonnull-c-pointer "pcre"))
    129 
    130 (define-foreign-type pcre_extra (c-pointer "pcre_extra"))
    131 (define-foreign-type nonnull-pcre_extra (nonnull-c-pointer "pcre_extra"))
    132 
    133 (define-foreign-variable PCRE_CASELESS unsigned-integer)
    134 (define-foreign-variable PCRE_EXTENDED unsigned-integer)
    135 (define-foreign-variable PCRE_UTF8 unsigned-integer)
    136 
    137 ;FIXME the use of 'define-foreign-enum' causes unused global variable warning!
    138 
    139 (define-foreign-enum (pcre-option unsigned-integer)
    140   (caseless             PCRE_CASELESS)
    141   (multiline            PCRE_MULTILINE)
    142   (dotall               PCRE_DOTALL)
    143   (extended             PCRE_EXTENDED)
    144   (anchored             PCRE_ANCHORED)
    145   (dollar-endonly       PCRE_DOLLAR_ENDONLY)
    146   (extra                PCRE_EXTRA)
    147   (notbol               PCRE_NOTBOL)
    148   (noteol               PCRE_NOTEOL)
    149   (ungreedy             PCRE_UNGREEDY)
    150   (notempty             PCRE_NOTEMPTY)
    151   (utf8                 PCRE_UTF8)
    152   (no-auto-capture      PCRE_NO_AUTO_CAPTURE)
    153   (no-utf8-check        PCRE_NO_UTF8_CHECK)
    154   (auto-callout         PCRE_AUTO_CALLOUT)
    155   (partial              PCRE_PARTIAL)
    156   (dfa-shortest         PCRE_DFA_SHORTEST)
    157   (dfa-restart          PCRE_DFA_RESTART)
    158   (firstline            PCRE_FIRSTLINE)
    159   (dupnames             PCRE_DUPNAMES)
    160   (newline-cr           PCRE_NEWLINE_CR)
    161   (newline-lf           PCRE_NEWLINE_LF)
    162   (newline-crlf         PCRE_NEWLINE_CRLF)
    163   (newline-any          PCRE_NEWLINE_ANY)
    164   (newline-anycrlf      PCRE_NEWLINE_ANYCRLF)
    165   (bsr-anycrlf          PCRE_BSR_ANYCRLF)
    166   (bsr-unicode          PCRE_BSR_UNICODE) )
    167 
    168 
    169 ;;; The regexp structure primitives:
    170 
    171 (define re-finalizer
    172   (foreign-lambda void "pcre_free" c-pointer) )
    173 
    174 (define-inline (%make-regexp code)
    175   (set-finalizer! code re-finalizer)
    176   (##sys#make-structure 'regexp code #f 0) )
    177 
    178 (define-inline (%regexp? x)
    179   (##sys#structure? x 'regexp) )
    180 
    181 (define-inline (%regexp-code rx)
    182   (##sys#slot rx 1) )
    183 
    184 (define-inline (%regexp-extra rx)
    185   (##sys#slot rx 2) )
    186 
    187 (define-inline (%regexp-options rx)
    188   (##sys#slot rx 3) )
    189 
    190 (define-inline (%regexp-extra-set! rx extra)
    191   (when extra (set-finalizer! extra re-finalizer))
    192   (##sys#setslot rx 2 extra) )
    193 
    194 (define-inline (%regexp-options-set! rx options)
    195   (##sys#setslot rx 3 options) )
    196 
    197 
    198 ;;; Character Definition Tables:
    199 
    200 ;; The minimum necessary to handle chardef table parameters.
    201 
    202 ;;
    203 
    204 (define (regex-chardef-table? x)
    205   (%tagged-pointer? x 'chardef-table) )
    206 
    207 ;; Get a character definitions tables structure for the current locale.
    208 
    209 (define regex-chardef-table
    210   (let ([re-maketables
    211           (foreign-lambda* (c-pointer unsigned-char) ()
    212             "return (pcre_maketables ());")]
    213         [re-make-chardef-table-type
    214           (lambda (tables)
    215             (%tag-pointer tables 'chardef-table) ) ] )
    216     (lambda (#!optional tables)
    217       ; Using this to type tag a ref is a bit of a hack but beats
    218       ; having another public variable.
    219       (if tables
    220           ; then existing reference so just tag it
    221           (if (##sys#pointer? tables)
    222               (re-make-chardef-table-type tables)
    223               (##sys#signal-hook #:type-error 'regex-chardef-table
    224                "bad argument type - not a pointer" tables) )
    225           ; else make a new chardef tables
    226           (let ([tables (re-maketables)])
    227             (if tables
    228                 (let ([tables (re-make-chardef-table-type tables)])
    229                   (set-finalizer! tables re-finalizer)
    230                   tables )
    231                 (##sys#error-hook 6 'regex-chardef-table) ) ) ) ) ) )
    232 
    233 
    234 ;;; Regexp record:
    235 
    236 (define (regexp? x)
    237   (%regexp? x) )
    238 
    239 
    240 ;;; PCRE errors:
    241 
    242 #>
    243 static const char *C_regex_error;
    244 static int C_regex_error_offset;
    245 <#
    246 
    247 (define-foreign-variable C_regex_error c-string)
    248 (define-foreign-variable C_regex_error_offset int)
    249 
    250 (define re-error
    251   (let ([string-append string-append])
    252     (lambda (loc msg . args)
    253       (apply ##sys#error loc (string-append msg " - " C_regex_error) args) ) ) )
    254 
    255 ;;; Compile regular expression:
    256 
    257 ;FIXME nonnull-unsigned-c-string causes problems - converted string is too long!
    258 
    259 (define re-compile
    260   (foreign-lambda* pcre ((nonnull-c-string patt) (unsigned-integer options) ((const (c-pointer unsigned-char)) tables))
    261     "return(pcre_compile(patt, options, &C_regex_error, &C_regex_error_offset, tables));") )
    262 
    263 (define (re-checked-compile pattern options tables loc)
    264   (##sys#check-string pattern loc)
    265   (or (re-compile pattern options #f)
    266       (re-error loc "cannot compile regular expression" pattern C_regex_error_offset) ) )
    267 
    268 ;; Compile with subset of options and no tables
    269 
    270 (define (regexp pattern . options)
    271   (let ([options->integer
    272           (lambda ()
    273             (if (null? options)
    274                 0
    275                 (+ (if (car options) PCRE_CASELESS 0)
    276                    (let ((options (cdr options)))
    277                      (if (null? options)
    278                          0
    279                          (+ (if (car options) PCRE_EXTENDED 0)
    280                             (let ((options (cdr options)))
    281                               (if (and (pair? options) (car options)) PCRE_UTF8 0 ) ) ) ) ) ) ) )])
    282     (%make-regexp (re-checked-compile pattern (options->integer) #f 'regexp)) ) )
    283 
    284 ;; Compile with full options and tables available
    285 
    286 (define (regexp* pattern . args)
    287   (let-optionals args ([options '()] [tables #f])
    288     (##sys#check-string pattern 'regexp*)
    289     (##sys#check-list options 'regexp*)
    290     (when tables (##sys#check-chardef-table tables 'regexp*))
    291     (%make-regexp (re-checked-compile pattern (pcre-option->number options) tables 'regexp*)) ) )
    292 
    293 
    294 ;;; Optimize compiled regular expression:
    295 
    296 ;; Invoke optimizer
    297 
    298 (define re-study
    299   (foreign-lambda* pcre_extra (((const nonnull-pcre) code))
    300     "return(pcre_study(code, 0, &C_regex_error));"))
    301 
    302 ;; Optimize compiled regular expression
    303 ;; Returns whether optimization performed
    304 
    305 (define (regexp-optimize rx)
    306   (##sys#check-structure rx 'regexp 'regexp-optimize)
    307   (let ([extra (re-study (%regexp-code rx))])
    308     (cond [C_regex_error
    309             (re-error 'regexp-optimize "cannot optimize regular expression" rx)]
    310           [extra
    311             (%regexp-extra-set! rx extra)
    312             #t]
    313           [else
    314             #f] ) ) )
    315 
    316 
    317 ;;; Captured results vector:
    318 
    319 ;; Match positions vector (PCRE ovector)
    320 
    321 #>
    322 #define OVECTOR_LENGTH_MULTIPLE 3
    323 #define STATIC_OVECTOR_LEN 256
    324 static int C_regex_ovector[OVECTOR_LENGTH_MULTIPLE * STATIC_OVECTOR_LEN];
    325 <#
    326 
    327 ;;
    328 
    329 (define ovector-start-ref
    330   (foreign-lambda* int ((int i))
    331     "return(C_regex_ovector[i * 2]);") )
    332 
    333 (define ovector-end-ref
    334   (foreign-lambda* int ((int i))
    335     "return(C_regex_ovector[(i * 2) + 1]);") )
    336 
    337 
    338 ;;; Gather matched result strings or positions:
    339 
    340 (define (gather-result-positions result)
    341   (let ([mc (car result)]
    342         [cc (cadr result)])
    343     (and (fx> mc 0)
    344          (let loop ([i 0])
    345            (cond [(fx>= i cc)
    346                    '()]
    347                  [(fx>= i mc)
    348                    (cons #f (loop (fx+ i 1)))]
    349                  [else
    350                   (let ([start (ovector-start-ref i)])
    351                     (cons (and (fx>= start 0)
    352                                (list start (ovector-end-ref i)))
    353                           (loop (fx+ i 1)) ) ) ] ) ) ) ) )
    354 
    355 (define gather-results
    356   (let ([substring substring])
    357     (lambda (str result)
    358       (let ([ps (gather-result-positions result)])
    359         (and ps
    360              (##sys#map (lambda (poss) (and poss (apply substring str poss))) ps) ) ) ) ) )
    361 
    362 
    363 ;;; Common match string with compile regular expression:
    364 
    365 (define re-match
    366   (foreign-lambda* int (((const nonnull-pcre) code) ((const pcre_extra) extra)
    367                         (nonnull-scheme-pointer str) (int start) (int range)
    368                         (unsigned-integer options))
    369     "return(pcre_exec(code, extra, str, start + range, start, options, C_regex_ovector, STATIC_OVECTOR_LEN * OVECTOR_LENGTH_MULTIPLE));") )
    370 
    371 (define re-match-capture-count
    372   (foreign-lambda* int (((const nonnull-pcre) code) ((const pcre_extra) extra))
    373     "int cc;"
    374     "pcre_fullinfo(code, extra, PCRE_INFO_CAPTURECOUNT, &cc);"
    375     "return(cc + 1);") )
    376 
    377 (define (perform-match rgxp str si ri loc)
    378   (let* ([extra #f]
    379          [options 0]
    380          [rx
    381           (cond [(string? rgxp)
    382                   (re-checked-compile rgxp 0 #f loc)]
    383                 [(%regexp? rgxp)
    384                   (set! extra (%regexp-extra rgxp))
    385                   (set! options (%regexp-options rgxp))
    386                   (%regexp-code rgxp)]
    387                 [else
    388                   (##sys#signal-hook #:type-error
    389                                      loc
    390                                      "bad argument type - not a string or compiled regular expression"
    391                                      rgxp)] )]
    392          [cc (re-match-capture-count rx extra)]
    393          [mc (re-match rx extra str si ri options)])
    394     (when (string? rgxp) (re-finalizer rx))
    395     (list mc cc) ) )
    396 
    397 
    398 ;;; Match string with regular expression:
    399 
    400 ;; Note that start is a BYTE offset
    401 
    402 (define string-match)
    403 (define string-match-positions)
    404 (let ()
    405 
    406   (define (prepare-match rgxp str start loc)
    407     (##sys#check-string str loc)
    408     (let ([si (if (pair? start) (car start) 0)])
    409       (##sys#check-exact si loc)
    410       (perform-match (if (string? rgxp)
    411                          (make-anchored-pattern rgxp (fx< 0 si))
    412                          rgxp)
    413                      str si (fx- (##sys#size str) si)
    414                      loc) ) )
    415 
    416   (set! string-match
    417     (lambda (rgxp str . start)
    418       (gather-results str (prepare-match rgxp str start 'string-match)) ) )
    419 
    420   (set! string-match-positions
    421     (lambda (rgxp str . start)
    422       (gather-result-positions (prepare-match rgxp str start 'string-match-positions)) ) ) )
    423 
    424 
    425 ;;; Search string with regular expression:
    426 
    427 ;; Note that start & range are BYTE offsets
    428 
    429 
    430 (define string-search)
    431 (define string-search-positions)
    432 (let ()
    433 
    434   (define (prepare-search rgxp str start-and-range loc)
    435     (##sys#check-string str loc)
    436     (let* ([range (and (pair? start-and-range) (cdr start-and-range)) ]
    437            [si (if range (car start-and-range) 0)]
    438            [ri (if (pair? range) (car range) (fx- (##sys#size str) si))] )
    439       (##sys#check-exact si loc)
    440       (##sys#check-exact ri loc)
    441       (perform-match rgxp str si ri loc) ) )
    442 
    443   (set! string-search
    444     (lambda (rgxp str . start-and-range)
    445       (gather-results str (prepare-search rgxp str start-and-range 'string-search)) ) )
    446 
    447   (set! string-search-positions
    448     (lambda (rgxp str . start-and-range)
    449       (gather-result-positions (prepare-search rgxp str start-and-range 'string-search-positions)) ) ) )
     102(register-feature! 'regex 'irregex)
     103
     104(include "irregex.scm")
     105
     106(define-record regexp x)
     107
     108(define (regexp pat #!optional caseless extended utf8)
     109  (make-regexp
     110   (apply
     111    irregex
     112    pat
     113    (let ((opts '()))
     114      (when caseless (set! opts (cons 'i opts)))
     115      (when extended (set! opts (cons 'x opts)))
     116      (when utf8 (set! opts (cons 'utf8 opts)))
     117      opts))) )
     118
     119(define (unregexp x)
     120  (cond ((regexp? x) (regexp-x x))
     121        ((irregex? x) x)
     122        (else (irregex x))))
     123
     124(define (string-match rx str)
     125  (let ((rx (unregexp rx)))
     126    (and-let* ((m (irregex-match rx str)))
     127      (let loop ((i (irregex-match-num-submatches m))
     128                 (res '()))
     129        (if (fx<= i 0)
     130            (cons str res)
     131            (loop (fx- i 1) (cons (irregex-match-substring m i) res)))))))
     132
     133(define (string-match-positions rx str)
     134  (let ((rx (unregexp rx)))
     135    (and-let* ((m (irregex-match rx str)))
     136      (let loop ((i (irregex-match-num-submatches m))
     137                 (res '()))
     138        (if (fx<= i 0)
     139            (cons (list 0 (string-length str)) res)
     140            (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
     141                                        (irregex-match-end-index m i))
     142                                  res)))))))
     143
     144(define (string-search rx str #!optional (start 0) (range (string-length str)))
     145  (let ((rx (unregexp rx)))
     146    (and-let* ((m (irregex-search rx str start (fx+ start range))))
     147      (let loop ((i (irregex-match-num-submatches m))
     148                 (res '()))
     149        (if (fx< i 0)
     150            res
     151            (loop (fx- i 1) (cons (irregex-match-substring m i) res)))))))
     152
     153(define (string-search-positions rx str #!optional (start 0) (range (string-length str)))
     154  (let ((rx (unregexp rx)))
     155    (and-let* ((m (irregex-search rx str start (fx+ start range))))
     156      (let loop ((i (irregex-match-num-submatches m))
     157                 (res '()))
     158        (if (fx< i 0)
     159            res
     160            (loop (fx- i 1) (cons (list (irregex-match-start-index m i)
     161                                        (irregex-match-end-index m i))
     162                                  res)))))))
     163
    450164
    451165
     
    503217      (let* ([which (if (pair? flag) (car flag) 1)]
    504218             [substlen (##sys#size subst)]
     219             (strlen (##sys#size string))
    505220             [substlen-1 (fx- substlen 1)]
    506221             [result '()]
     
    525240                      (loop start index+1) ) ) ) ) )
    526241        (let loop ([index 0] [count 1])
    527           (let ([matches (string-search-positions regex string index)])
     242          (let ((matches (and (fx< index strlen)
     243                              (string-search-positions regex string index))))
    528244            (cond [matches
    529245                   (let* ([range (car matches)]
     
    590306                       #\[
    591307                       (let loop2 ((rest rest))
    592                          (match rest
    593                            [(#\] . more)        (cons #\] (loop more))]
    594                            [(#\- c . more)      `(#\- ,c ,@(loop2 more))]
    595                            [(c1 #\- c2 . more)  `(,c1 #\- ,c2 ,@(loop2 more))]
    596                            [(c . more)          (cons c (loop2 more))]
    597                            [()
    598                             (error 'glob->regexp "unexpected end of character class" s)] ) ) ) ]
     308                         (if (pair? rest)
     309                             (cond ((char=? #\] (car rest))
     310                                    (cons #\] (loop (cdr rest))))
     311                                   ((and (char=? #\- (car rest)) (pair? (cdr rest)))
     312                                    `(#\- ,(cadr rest) ,@(loop2 (cddr rest))))
     313                                   ((and (pair? (cdr rest)) (pair? (cddr rest))
     314                                         (char=? #\- (cadr rest)) )
     315                                    `(,(car rest) #\- ,(caddr rest)
     316                                      ,@(loop2 (cdddr rest))))
     317                                   ((pair? rest)
     318                                    (cons (car rest) (loop2 (cdr rest))))
     319                                   ((null? rest)
     320                                    (error 'glob->regexp "unexpected end of character class" s))))))]
    599321                     [(or (char-alphabetic? c) (char-numeric? c)) (cons c (loop rest))]
    600322                     [else `(#\\ ,c ,@(loop rest))] ) ) ) ) ) ) ) )
     
    626348      (let ([out (open-output-string)]
    627349            [len (##sys#size str)] )
    628         (let loop ([i 0])
    629           (cond [(fx>= i len) (get-output-string out)]
     350        (let loop ([i 0])
     351          (cond [(fx>= i len) (get-output-string out)]
    630352                [(memq (##core#inline "C_subchar" str i)
    631353                       '(#\. #\\ #\? #\* #\+ #\^ #\$ #\( #\) #\[ #\] #\| #\{ #\}))
     
    636358                 (##sys#write-char-0 (##core#inline "C_subchar" str i) out)
    637359                 (loop (fx+ i 1)) ] ) ) ) ) ) )
    638 
    639 
    640 ;;; Anchored pattern:
    641 
    642 (define make-anchored-pattern
    643   (let ([string-append string-append])
    644     (lambda (rgxp . args)
    645       (let-optionals args ([nos #f] [noe #f])
    646         (cond [(string? rgxp)
    647                 (string-append (if nos "" "^") rgxp (if noe "" "$"))]
    648               [else
    649                 (##sys#check-structure rgxp 'regexp 'make-anchored-pattern)
    650                 (when (or nos noe)
    651                   (warning 'make-anchored-pattern
    652                            "cannot select partial anchor for compiled regular expression") )
    653                 (%regexp-options-set! rgxp
    654                                       (bitwise-ior (%regexp-options regexp)
    655                                                    (pcre-option->number 'anchored)))
    656                 rgxp] ) ) ) ) )
  • chicken/branches/chicken-3/rules.make

    r12094 r13010  
    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 \
     
    138112          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    139113regex$(O): regex.c chicken.h $(CHICKEN_CONFIG_H)
    140         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    141           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    142           $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     114        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     115          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
     116          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    143117scheduler$(O): scheduler.c chicken.h $(CHICKEN_CONFIG_H)
    144118        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    223197          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    224198uregex$(O): uregex.c chicken.h $(CHICKEN_CONFIG_H)
    225         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    226           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    227           $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     199        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     200          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
     201          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    228202usrfi-1$(O): usrfi-1.c chicken.h $(CHICKEN_CONFIG_H)
    229         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
     203        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
    230204          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) \
    231205          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
     
    313287          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    314288regex-static$(O): regex.c chicken.h $(CHICKEN_CONFIG_H)
    315         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(PCRE_INCLUDES) \
    316           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
    317           $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     289        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) \
     290          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
     291          $(C_COMPILER_BUILD_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    318292scheduler-static$(O): scheduler.c chicken.h $(CHICKEN_CONFIG_H)
    319293        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    399373uregex-static$(O): uregex.c chicken.h $(CHICKEN_CONFIG_H)
    400374        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
    401           $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $(PCRE_INCLUDES) \
    402           $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $(C_COMPILER_PCRE_OPTIONS) $< $(C_COMPILER_OUTPUT)
     375          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) \
     376          $(C_COMPILER_BUILD_UNSAFE_RUNTIME_OPTIONS) $< $(C_COMPILER_OUTPUT)
    403377usrfi-1-static$(O): usrfi-1.c chicken.h $(CHICKEN_CONFIG_H)
    404378        $(C_COMPILER) $(C_COMPILER_OPTIONS) $(C_COMPILER_PTABLES_OPTIONS) $(INCLUDES) \
     
    489463          $(C_COMPILER_COMPILE_OPTION) $(C_COMPILER_OPTIMIZATION_OPTIONS) $< $(C_COMPILER_OUTPUT)
    490464
    491 # pcre objects
    492 
    493 $(PCRE_DIR)pcre_compile$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    494         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    495           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    496           $(C_COMPILER_PCRE_OPTIONS)
    497 $(PCRE_DIR)pcre_config$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    498         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    499           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    500           $(C_COMPILER_PCRE_OPTIONS)
    501 $(PCRE_DIR)pcre_dfa_exec$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    502         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    503           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    504           $(C_COMPILER_PCRE_OPTIONS)
    505 $(PCRE_DIR)pcre_exec$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    506         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    507           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    508           $(C_COMPILER_PCRE_OPTIONS)
    509 $(PCRE_DIR)pcre_fullinfo$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    510         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    511           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    512           $(C_COMPILER_PCRE_OPTIONS)
    513 $(PCRE_DIR)pcre_get$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    514         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    515           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    516           $(C_COMPILER_PCRE_OPTIONS)
    517 $(PCRE_DIR)pcre_globals$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    518         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    519           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    520           $(C_COMPILER_PCRE_OPTIONS)
    521 $(PCRE_DIR)pcre_info$(O): pcre_info.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    522         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    523           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    524           $(C_COMPILER_PCRE_OPTIONS)
    525 $(PCRE_DIR)pcre_maketables$(O): pcre_maketables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    526         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    527           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    528           $(C_COMPILER_PCRE_OPTIONS)
    529 $(PCRE_DIR)pcre_newline$(O): pcre_newline.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    530         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    531           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    532           $(C_COMPILER_PCRE_OPTIONS)
    533 $(PCRE_DIR)pcre_ord2utf8$(O): pcre_ord2utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    534         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    535           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    536           $(C_COMPILER_PCRE_OPTIONS)
    537 $(PCRE_DIR)pcre_refcount$(O): pcre_refcount.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    538         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    539           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    540           $(C_COMPILER_PCRE_OPTIONS)
    541 $(PCRE_DIR)pcre_study$(O): pcre_study.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    542         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    543           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    544           $(C_COMPILER_PCRE_OPTIONS)
    545 $(PCRE_DIR)pcre_tables$(O): pcre_tables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    546         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    547           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    548           $(C_COMPILER_PCRE_OPTIONS)
    549 $(PCRE_DIR)pcre_try_flipped$(O): pcre_try_flipped.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    550         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    551           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    552           $(C_COMPILER_PCRE_OPTIONS)
    553 $(PCRE_DIR)pcre_ucd$(O): pcre_ucd.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    554         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    555           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    556           $(C_COMPILER_PCRE_OPTIONS)
    557 $(PCRE_DIR)pcre_valid_utf8$(O): pcre_valid_utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    558         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    559           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    560           $(C_COMPILER_PCRE_OPTIONS)
    561 $(PCRE_DIR)pcre_version$(O): pcre_version.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    562         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    563           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    564           $(C_COMPILER_PCRE_OPTIONS)
    565 $(PCRE_DIR)pcre_xclass$(O): pcre_xclass.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    566         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    567           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    568           $(C_COMPILER_PCRE_OPTIONS)
    569 $(PCRE_DIR)pcre_chartables$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H)
    570         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    571           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    572           $(C_COMPILER_PCRE_OPTIONS)
    573 
    574 # static pcre objects
    575 
    576 $(PCRE_DIR)pcre_compile-static$(O): pcre_compile.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    577         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    578           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    579           $(C_COMPILER_PCRE_OPTIONS)
    580 $(PCRE_DIR)pcre_config-static$(O): pcre_config.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    581         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    582           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    583           $(C_COMPILER_PCRE_OPTIONS)
    584 $(PCRE_DIR)pcre_dfa_exec-static$(O): pcre_dfa_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    585         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    586           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    587           $(C_COMPILER_PCRE_OPTIONS)
    588 $(PCRE_DIR)pcre_exec-static$(O): pcre_exec.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    589         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    590           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    591           $(C_COMPILER_PCRE_OPTIONS)
    592 $(PCRE_DIR)pcre_fullinfo-static$(O): pcre_fullinfo.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    593         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    594           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    595           $(C_COMPILER_PCRE_OPTIONS)
    596 $(PCRE_DIR)pcre_get-static$(O): pcre_get.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    597         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    598           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    599           $(C_COMPILER_PCRE_OPTIONS)
    600 $(PCRE_DIR)pcre_globals-static$(O): pcre_globals.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    601         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    602           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    603           $(C_COMPILER_PCRE_OPTIONS)
    604 $(PCRE_DIR)pcre_info-static$(O): pcre_info.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    605         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    606           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    607           $(C_COMPILER_PCRE_OPTIONS)
    608 $(PCRE_DIR)pcre_maketables-static$(O): pcre_maketables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    609         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    610           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    611           $(C_COMPILER_PCRE_OPTIONS)
    612 $(PCRE_DIR)pcre_newline-static$(O): pcre_newline.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    613         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    614           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    615           $(C_COMPILER_PCRE_OPTIONS)
    616 $(PCRE_DIR)pcre_ord2utf8-static$(O): pcre_ord2utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    617         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    618           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    619           $(C_COMPILER_PCRE_OPTIONS)
    620 $(PCRE_DIR)pcre_refcount-static$(O): pcre_refcount.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    621         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    622           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    623           $(C_COMPILER_PCRE_OPTIONS)
    624 $(PCRE_DIR)pcre_study-static$(O): pcre_study.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    625         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    626           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    627           $(C_COMPILER_PCRE_OPTIONS)
    628 $(PCRE_DIR)pcre_tables-static$(O): pcre_tables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    629         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    630           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    631           $(C_COMPILER_PCRE_OPTIONS)
    632 $(PCRE_DIR)pcre_try_flipped-static$(O): pcre_try_flipped.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    633         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    634           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    635           $(C_COMPILER_PCRE_OPTIONS)
    636 $(PCRE_DIR)pcre_ucd-static$(O): pcre_ucd.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    637         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    638           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    639           $(C_COMPILER_PCRE_OPTIONS)
    640 $(PCRE_DIR)pcre_valid_utf8-static$(O): pcre_valid_utf8.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    641         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    642           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    643           $(C_COMPILER_PCRE_OPTIONS)
    644 $(PCRE_DIR)pcre_version-static$(O): pcre_version.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    645         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    646           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    647           $(C_COMPILER_PCRE_OPTIONS)
    648 $(PCRE_DIR)pcre_xclass-static$(O): pcre_xclass.c pcre_internal.h config.h $(CHICKEN_CONFIG_H) pcre.h ucp.h
    649         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    650           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    651           $(C_COMPILER_PCRE_OPTIONS)
    652 $(PCRE_DIR)pcre_chartables-static$(O): pcre_chartables.c pcre_internal.h config.h $(CHICKEN_CONFIG_H)
    653         $(C_COMPILER) $(C_COMPILER_OPTIONS) $(PCRE_INCLUDES) $(C_COMPILER_COMPILE_OPTION) \
    654           $(C_COMPILER_OPTIMIZATION_OPTIONS) $(C_COMPILER_SHARED_OPTIONS) $< $(C_COMPILER_OUTPUT) \
    655           $(C_COMPILER_PCRE_OPTIONS)
    656465
    657466# assembler objects
     
    692501libs: $(TARGETLIBS)
    693502
    694 libchicken$(SO)$(SONAME_VERSION): $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     503libchicken$(SO)$(SONAME_VERSION): $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    695504        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKEN_SO_LINKER_OPTIONS) \
    696505          $(LINKER_OUTPUT) $^ $(LIBCHICKEN_SO_LIBRARIES)
     
    700509
    701510
    702 libuchicken$(SO)$(SONAME_VERSION): $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     511libuchicken$(SO)$(SONAME_VERSION): $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    703512        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBUCHICKEN_SO_LINKER_OPTIONS) \
    704513          $(LINKER_OUTPUT) $^ $(LIBUCHICKEN_SO_LIBRARIES)
     
    707516endif
    708517
    709 cygchicken-0.dll: $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     518cygchicken-0.dll: $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    710519        gcc -shared -o $(LIBCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
    711520            -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
     
    714523            -Wl,--out-implib=libchicken.dll.a -Wl,--export-all-symbols \
    715524            -Wl,--enable-auto-import \
    716             -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
     525            -Wl,--whole-archive $(LIBCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
    717526            -Wl,--no-whole-archive $(LIBCHICKEN_SO_LIBRARIES)
    718527
    719 cyguchicken-0.dll: $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
     528cyguchicken-0.dll: $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT)
    720529        gcc -shared -o $(LIBUCHICKEN_SO_FILE) -Wl,--dll -Wl,--add-stdcall-alias \
    721530            -Wl,--enable-stdcall-fixup -Wl,--warn-unresolved-symbols \
     
    724533            -Wl,--out-implib=libuchicken.dll.a -Wl,--export-all-symbols \
    725534            -Wl,--enable-auto-import \
    726             -Wl,--whole-archive $(LIBUCHICKEN_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
     535            -Wl,--whole-archive $(LIBUCHICKEN_SHARED_OBJECTS) $(APPLY_HACK_OBJECT) \
    727536            -Wl,--no-whole-archive $(LIBUCHICKEN_SO_LIBRARIES)
    728537
    729538
    730 libchickengui$(SO): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_SHARED_OBJECTS) $(PCRE_SHARED_OBJECTS)
     539libchickengui$(SO): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_SHARED_OBJECTS)
    731540        $(LINKER) $(LINKER_OPTIONS) $(LINKER_LINK_SHARED_LIBRARY_OPTIONS) $(LIBCHICKENGUI_SO_LINKER_OPTIONS) \
    732541        $(LINKER_OUTPUT) $^ $(LIBCHICKENGUI_SO_LIBRARIES)
    733542
    734 libchicken$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKEN_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     543libchicken$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKEN_STATIC_OBJECTS)
    735544        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    736545
    737 libuchicken$(A): $(APPLY_HACK_OBJECT) $(LIBUCHICKEN_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     546libuchicken$(A): $(APPLY_HACK_OBJECT) $(LIBUCHICKEN_STATIC_OBJECTS)
    738547        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    739548
    740 libchickengui$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_STATIC_OBJECTS) $(PCRE_STATIC_OBJECTS)
     549libchickengui$(A): $(APPLY_HACK_OBJECT) $(LIBCHICKENGUI_STATIC_OBJECTS)
    741550        $(LIBRARIAN) $(LIBRARIAN_OPTIONS) $(LIBRARIAN_OUTPUT) $^
    742551
     
    977786        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    978787regex.c: $(SRCDIR)regex.scm
    979         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) -output-file $@
     788        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
    980789scheduler.c: $(SRCDIR)scheduler.scm
    981790        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
     
    1022831        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1023832uregex.c: $(SRCDIR)regex.scm
    1024         $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_PCRE_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
     833        $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) $(CHICKEN_UNSAFE_OPTIONS) -output-file $@
    1025834
    1026835chicken.c: $(SRCDIR)chicken.scm $(SRCDIR)chicken-more-macros.scm $(SRCDIR)chicken-ffi-macros.scm $(SRCDIR)private-namespace.scm
     
    1069878
    1070879ifeq ($(PLATFORM),mingw)
    1071 CLEAN_PCRE = $(PCRE_DIR)*$(O)
    1072880CLEAN_MINGW_LIBS = libchickengui.a libchickengui.dll libchickengui.dll.a
    1073881else
    1074 CLEAN_PCRE = $(PCRE_DIR)*$(O)
    1075882CLEAN_MINGW_LIBS =
    1076883endif
     
    1084891          $(PROGRAM_IMPORT_LIBRARIES) $(LIBCHICKEN_IMPORT_LIBRARY) $(LIBUCHICKEN_IMPORT_LIBRARY) \
    1085892          $(LIBCHICKENGUI_IMPORT_LIBRARY)  $(MSVC_CHICKEN_EXPORT_FILES) \
    1086           chicken.info $(CLEAN_PCRE) $(CLEAN_MINGW_LIBS) $(CLEAN_MANIFESTS)
     893          chicken.info $(CLEAN_MINGW_LIBS) $(CLEAN_MANIFESTS)
    1087894confclean:
    1088895        -$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) chicken-config.h chicken-defaults.h buildsvnrevision
  • chicken/branches/chicken-3/version.scm

    r12959 r13010  
    1 (define-constant +build-version+ "3.4.6")
     1(define-constant +build-version+ "3.4.7")
Note: See TracChangeset for help on using the changeset viewer.