diff --git a/extra/pcre/pcre.factor b/extra/pcre/pcre.factor index 25707a07aa..bfd16ce835 100644 --- a/extra/pcre/pcre.factor +++ b/extra/pcre/pcre.factor @@ -33,13 +33,24 @@ ERROR: pcre-error value ; utf8-start-byte? [ nip ] [ next-utf8-char ] if ] [ 2drop f ] if* ; -: pcre-config ( what -- value ) - [ { long } [ pcre_config ] with-out-parameters ] keep +: check-bad-option ( err value what -- value ) rot 0 = [ drop ] [ bad-option ] if ; +: pcre-config ( what -- value ) + [ + dup { + PCRE_CONFIG_MATCH_LIMIT + PCRE_CONFIG_MATCH_LIMIT_RECURSION + } member? [ + { long } [ pcre_config ] with-out-parameters + ] [ + { int } [ pcre_config ] with-out-parameters + ] if + ] keep check-bad-option ; + : pcre-fullinfo ( pcre extra what -- obj ) [ { int } [ pcre_fullinfo ] with-out-parameters ] keep - rot 0 = [ drop ] [ bad-option ] if ; + check-bad-option ; : pcre-substring-list ( subject match-array count -- alien ) { void* } [ pcre_get_substring_list drop ] with-out-parameters ;