Skip to content

Commit eb56a16

Browse files
committed
fetch re2 and cre2
1 parent befe7e3 commit eb56a16

2 files changed

Lines changed: 44 additions & 4 deletions

File tree

Makefile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,38 @@ compile_basics:
4141
build: fetch_externals
4242
$(PYTHON) $(EXTERNALS)/pypy/rpython/bin/rpython $(COMMON_BUILD_OPTS) $(JIT_OPTS) $(TARGET_OPTS)
4343

44-
fetch_externals: $(EXTERNALS)/pypy externals.fetched
44+
fetch_externals: $(EXTERNALS)/pypy $(EXTERNALS)/cre2 externals.fetched
4545

4646
externals.fetched:
4747
echo https://github.com/pixie-lang/external-deps/releases/download/1.0/`uname -s`-`uname -m`.tar.bz2
4848
curl -L https://github.com/pixie-lang/external-deps/releases/download/1.0/`uname -s`-`uname -m`.tar.bz2 > /tmp/externals.tar.bz2
4949
tar -jxf /tmp/externals.tar.bz2 --strip-components=2
5050
touch externals.fetched
5151

52-
53-
$(EXTERNALS)/pypy:
54-
mkdir $(EXTERNALS); \
52+
$(EXTERNALS)/pypy: $(EXTERNALS)
5553
cd $(EXTERNALS); \
5654
curl https://bitbucket.org/pypy/pypy/get/81254.tar.bz2 > pypy.tar.bz2; \
5755
mkdir pypy; \
5856
cd pypy; \
5957
tar -jxf ../pypy.tar.bz2 --strip-components=1
6058

59+
$(EXTERNALS)/re2: $(EXTERNALS)
60+
cd $(EXTERNALS) && \
61+
curl -sL https://github.com/google/re2/archive/2016-02-01.tar.gz > re2.tar.gz && \
62+
mkdir re2 && \
63+
cd re2 && \
64+
tar -jxf ../re2.tar.gz --strip-components=1
65+
66+
$(EXTERNALS)/cre2: $(EXTERNALS)/re2
67+
cd $(EXTERNALS) && \
68+
curl -sL https://github.com/marcomaggi/cre2/archive/0.1b6.tar.gz > cre2.tar.gz && \
69+
mkdir cre2 && \
70+
cd cre2 && \
71+
tar -jxf ../cre2.tar.gz --strip-components=1
72+
73+
$(EXTERNALS):
74+
mkdir $(EXTERNALS)
75+
6176
run:
6277
./pixie-vm
6378

pixie/regex.pxi

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(ns pixie.regex
2+
(:require [pixie.ffi-infer :as i]))
3+
4+
(i/with-config {:library "re2"
5+
:cxx-flags ["-lre2"]
6+
:includes ["re2.h"]}
7+
(i/defconst M_E)
8+
(i/defconst M_LOG2E)
9+
(i/defconst M_LOG10E)
10+
(i/defconst M_LN2)
11+
(i/defconst M_LN10)
12+
(i/defconst M_PI)
13+
(i/defconst M_PI_2)
14+
(i/defconst M_PI_4)
15+
(i/defconst M_1_PI)
16+
(i/defconst M_2_PI)
17+
(i/defconst M_2_SQRTPI)
18+
(i/defconst M_SQRT2)
19+
(i/defconst M_SQRT1_2)
20+
21+
(i/defcfn nan)
22+
(i/defcfn ceil)
23+
(i/defcfn floor)
24+
(i/defcfn nearbyint)
25+
(i/defcfn rint)

0 commit comments

Comments
 (0)