From 3ea34c667d8954ff93f70efdedee88fc82ee599d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 19 Aug 2016 20:50:58 +0200 Subject: [PATCH] pcre: new word 'version' for getting the version of the library --- extra/pcre/pcre-docs.factor | 6 +++++- extra/pcre/pcre-tests.factor | 2 +- extra/pcre/pcre.factor | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/extra/pcre/pcre-docs.factor b/extra/pcre/pcre-docs.factor index c4d0c5f4c5..32b91e272f 100644 --- a/extra/pcre/pcre-docs.factor +++ b/extra/pcre/pcre-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax sequences strings ; +USING: help.markup help.syntax math sequences strings ; IN: pcre ARTICLE: "pcre" "PCRE binding" @@ -36,4 +36,8 @@ HELP: findall } } ; +HELP: version +{ $values { "f" float } } +{ $description "Version number of the PCRE library, expressed as a float." } ; + ABOUT: "pcre" diff --git a/extra/pcre/pcre-tests.factor b/extra/pcre/pcre-tests.factor index 6582a71424..d87be91a6d 100644 --- a/extra/pcre/pcre-tests.factor +++ b/extra/pcre/pcre-tests.factor @@ -105,7 +105,7 @@ os unix? [ [ 10 ] [ PCRE_CONFIG_NEWLINE pcre-config ] unit-test ] when ! This used to work in 8.36, but might have changed in later versions. ! See: https://bugs.exim.org/show_bug.cgi?id=1875 -pcre_version " " splitting:split1 drop string>number 8.36 <= [ +version 8.36 <= [ { t t } [ "(?s)." PCRE_DOTALL has-option? "(?i)x" PCRE_CASELESS has-option? diff --git a/extra/pcre/pcre.factor b/extra/pcre/pcre.factor index e17eeaa71e..eb18f4bb79 100644 --- a/extra/pcre/pcre.factor +++ b/extra/pcre/pcre.factor @@ -1,10 +1,10 @@ -! Copyright (C) 2013 Björn Lindqvist +! Copyright (C) 2013, 2016 Björn Lindqvist ! See http://factorcode.org/license.txt for BSD license USING: accessors alien alien.accessors alien.c-types alien.data alien.enums alien.strings arrays assocs combinators fry io.encodings.string io.encodings.utf8 kernel literals math -math.bitwise pcre.ffi sequences splitting strings ; +math.bitwise math.parser pcre.ffi sequences splitting strings ; QUALIFIED: regexp IN: pcre @@ -155,3 +155,6 @@ M: regexp:regexp findall : split ( subject obj -- strings ) dupd findall [ first second ] map split-subseqs ; + +: version ( -- r ) + pcre_version " " splitting:split1 drop string>number ;