Skip to content

Commit 460b111

Browse files
author
Miloslav Metelka
committed
[GR-2798] Added pcre_config() internal builtin.
PullRequest: fastr/1913
2 parents 0261a08 + fcd10e6 commit 460b111

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ public BasePackage() {
687687
add(OnExit.class, OnExitNodeGen::create);
688688
add(OptionsFunctions.Options.class, OptionsFunctionsFactory.OptionsNodeGen::create);
689689
add(Order.class, OrderNodeGen::create);
690+
add(PCREConfig.class, PCREConfigNodeGen::create);
690691
add(PMatch.class, PMatchNodeGen::create);
691692
add(PMinMax.PMax.class, PMinMaxNodeGen.PMaxNodeGen::create);
692693
add(PMinMax.PMin.class, PMinMaxNodeGen.PMinNodeGen::create);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 3 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 3 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 3 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
package com.oracle.truffle.r.nodes.builtin.base;
24+
25+
import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE;
26+
import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
27+
28+
import com.oracle.truffle.api.dsl.Specialization;
29+
import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
30+
import com.oracle.truffle.r.runtime.builtins.RBuiltin;
31+
import com.oracle.truffle.r.runtime.data.RDataFactory;
32+
import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
33+
34+
@RBuiltin(name = "pcre_config", kind = INTERNAL, parameterNames = {}, behavior = PURE)
35+
public abstract class PCREConfig extends RBuiltinNode.Arg0 {
36+
37+
static {
38+
Casts.noCasts(PCREConfig.class);
39+
}
40+
41+
@Specialization
42+
protected RAbstractLogicalVector pcreConfig() {
43+
return RDataFactory.createEmptyLogicalVector();
44+
}
45+
}

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54312,6 +54312,10 @@ character(0)
5431254312
[1] "."
5431354313
[1] "."
5431454314

54315+
##com.oracle.truffle.r.test.builtins.TestBuiltin_pcre_config.testPCREConfig#
54316+
#{ is.logical(pcre_config()) }
54317+
[1] TRUE
54318+
5431554319
##com.oracle.truffle.r.test.builtins.TestBuiltin_plus_Date.testplus_Date1#
5431654320
#argv <- structure(list(e1 = structure(1, units = 'days', class = 'difftime'), e2 = structure(14579, class = 'Date')), .Names = c('e1', 'e2'));do.call('+.Date', argv)
5431754321
[1] "2009-12-02"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 3 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 3 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 3 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
package com.oracle.truffle.r.test.builtins;
24+
25+
import org.junit.Test;
26+
27+
import com.oracle.truffle.r.test.TestBase;
28+
29+
public class TestBuiltin_pcre_config extends TestBase {
30+
31+
@Test
32+
public void testPCREConfig() {
33+
// We only return empty logical vector since the result would be artificial anyway
34+
assertEval("{ is.logical(pcre_config()) }");
35+
}
36+
}

0 commit comments

Comments
 (0)