]> gitweb.factorcode.org Git - factor.git/commitdiff
pcre: new word 'version' for getting the version of the library
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 19 Aug 2016 18:50:58 +0000 (20:50 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Fri, 19 Aug 2016 18:50:58 +0000 (20:50 +0200)
extra/pcre/pcre-docs.factor
extra/pcre/pcre-tests.factor
extra/pcre/pcre.factor

index c4d0c5f4c57e992bf24a39b4d009707a50399ee5..32b91e272f11e0ae34a34010e6540277ee6a1fc1 100644 (file)
@@ -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"
index 6582a714246971664aacf5e3a354cb4cf2bcd84b..d87be91a6d2b6f1b8865cce587e6b435e477788a 100644 (file)
@@ -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)." <compiled-pcre> PCRE_DOTALL has-option?
         "(?i)x" <compiled-pcre> PCRE_CASELESS has-option?
index e17eeaa71e611b1a2ccf0aacb1c2c53f0497a78c..eb18f4bb793269306038096b02334ed94d3b93a8 100644 (file)
@@ -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 ;